migration_id
stringclasses
994 values
ver1_file_path
stringlengths
25
222
ver2_file_path
stringlengths
28
222
ver1_tree_path
stringlengths
1
111
ver2_tree_path
stringlengths
1
105
ver1_signature
stringlengths
5
3.53k
ver2_signature
stringlengths
5
3.53k
method_ver1
stringlengths
8
336k
method_ver2
stringlengths
8
171k
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addProfileSpecificGlobalAttributes__(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset)
addProfileSpecificGlobalAttributes__(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset)
protected abstract void addProfileSpecificGlobalAttributes(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset) throws OwsExceptionReport;
protected abstract void addProfileSpecificGlobalAttributes(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset) throws EncodingException;
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
getNetcdfFileWriter__(File netcdfFile)
getNetcdfFileWriter__(File netcdfFile)
protected NetcdfFileWriter getNetcdfFileWriter(File netcdfFile) throws CodedException { return getNetcdfFileWriter(netcdfFile, NetcdfHelper.getInstance().getNetcdfVersion()); }
protected NetcdfFileWriter getNetcdfFileWriter(File netcdfFile) throws IOException { return getNetcdfFileWriter(netcdfFile, getNetcdfHelper().getNetcdfVersion()); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
getNetcdfFileWriter__(File netcdfFile, Version version)
getNetcdfFileWriter__(File netcdfFile, Version version)
protected NetcdfFileWriter getNetcdfFileWriter(File netcdfFile, Version version) throws CodedException { try { return NetcdfFileWriter.createNew(version, netcdfFile.getAbsolutePath(), new Nc4ForceTimeChunkingStategy( NetcdfHelper.getInstance().getChunkSizeTime())); } catch (IOException e) { throw new NoApplicableCodeException().causedBy(e).withMessage("Error creating netCDF temp file."); } }
protected NetcdfFileWriter getNetcdfFileWriter(File netcdfFile, Version version) throws IOException { return NetcdfFileWriter.createNew(version, netcdfFile.getAbsolutePath(), new Nc4ForceTimeChunkingStategy( getNetcdfHelper().getChunkSizeTime())); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
encodeSensorDataToNetcdf__(File netcdfFile, AbstractSensorDataset sensorDataset, Version version)
encodeSensorDataToNetcdf__(File netcdfFile, AbstractSensorDataset sensorDataset, Version version)
protected void encodeSensorDataToNetcdf(File netcdfFile, AbstractSensorDataset sensorDataset, Version version) throws OwsExceptionReport { String sensor = sensorDataset.getSensorIdentifier(); sensorDataset.getSensor().setSensorDescription( getProcedureDescription(sensor, sensorDataset.getProcedureDescription())); NetcdfFileWriter writer = getNetcdfFileWriter(netcdfFile, version); // set fill on, doesn't seem to have any effect though writer.setFill(true); Map<Variable, Array> variableArrayMap = Maps.newHashMap(); int numTimes = sensorDataset.getTimes().size(); // FIXME shouldn't assume that all subsensors are heights (or rename // subsensors if they are) int numHeightDepth = sensorDataset.getSubSensors().size() > 0 ? sensorDataset.getSubSensors().size() : 1; // global attributes addGlobaleAttributes(writer, sensorDataset); // add appropriate dims for feature type List<Dimension> noDims = Lists.newArrayList(); List<Dimension> timeDims = Lists.newArrayList(); List<Dimension> latLngDims = Lists.newArrayList(); List<Dimension> latDims = Lists.newArrayList(); List<Dimension> lngDims = Lists.newArrayList(); List<Dimension> zDims = Lists.newArrayList(); List<Dimension> obsPropDims = Lists.newArrayList(); // REQUIRED for NetCDF-3 // add Dimensions // dTime = writer.addDimension(null, CFStandardNames.TIME.getName(), // numTimes); Dimension dTime = writer.addUnlimitedDimension(getVariableDimensionCaseName(CFStandardNames.TIME.getName())); dTime.setLength(numTimes); timeDims.add(dTime); if (!(sensorDataset instanceof StaticLocationDataset)) { zDims.add(dTime); } obsPropDims.add(dTime); // set up lat/lng dimensions // FIXME do not set time dimension for static location dataset // if ((sensorDataset instanceof StaticLocationDataset)) { // latLngDims.add(dTime); // } // set up z dimensions String dimensionName = ""; if (useHeight()) { dimensionName = getVariableDimensionCaseName(CFStandardNames.HEIGHT.getName()); } else { dimensionName = getVariableDimensionCaseName(CFStandardNames.DEPTH.getName()); } // profile/timeSeriesProfile Dimension dZ = writer.addDimension(null, dimensionName, numHeightDepth); if (sensorDataset instanceof StaticLocationDataset) { // nothing to do } else { // trajectory zDims.add(dTime); } zDims.add(dZ); obsPropDims.add(dZ); variableArrayMap.putAll(getNetcdfProfileSpecificVariablesArrays(writer, sensorDataset)); // time var Variable vTime = addVariableTime(writer, timeDims); if (numTimes > 1 && writer.getVersion().isNetdf4format()) { vTime.addAttribute(new Attribute(CDM.CHUNK_SIZE, NetcdfHelper.getInstance().getChunkSizeTime())); } ArrayDouble timeArray = new ArrayDouble(getDimShapes(timeDims)); initArrayWithFillValue(timeArray, NetcdfHelper.getInstance().getFillValue()); Array latArray = getLatitudeArray(sensorDataset); Array lonArray = getLongitudeArray(sensorDataset); // add lat/long dimensions long latSize = 1; if (latArray != null) { latSize = latArray.getSize(); } Dimension dLat = writer.addDimension(null, getVariableDimensionCaseName(CFStandardNames.LATITUDE.getName()), (int) latSize); latDims.add(dLat); long lonSize = 1; if (lonArray != null) { lonSize = lonArray.getSize(); } Dimension dLon = writer.addDimension(null, getVariableDimensionCaseName(CFStandardNames.LONGITUDE.getName()), (int) lonSize); lngDims.add(dLon); // lat/lon var Variable vLat = null; Variable vLon = null; if (latLngDims.size() > 0) { vLat = addVariableLatitude(writer, latLngDims); vLon = addVariableLongitude(writer, latLngDims); } else { vLat = addVariableLatitude(writer, latDims); vLon = addVariableLongitude(writer, lngDims); } // height/depth var Variable vHeightDepth = null; if (useHeight()) { vHeightDepth = addVariableHeight(writer, zDims); } else { vHeightDepth = addVariableDepth(writer, zDims); } String coordinateString = Joiner.on(' ').join( Lists.newArrayList(vTime.getFullName(), vLat.getFullName(), vLon.getFullName(), vHeightDepth.getFullName())); Map<OmObservableProperty, Variable> obsPropVarMap = Maps.newHashMap(); Map<Variable, Array> varDataArrayMap = Maps.newHashMap(); for (OmObservableProperty obsProp : sensorDataset.getPhenomena()) { // obs prop var Variable vObsProp = addVariableForObservedProperty(writer, obsProp, obsPropDims, coordinateString); obsPropVarMap.put(obsProp, vObsProp); // init obs prop data array Array obsPropArray = getArray(obsPropDims); initArrayWithFillValue(obsPropArray, NetcdfHelper.getInstance().getFillValue()); varDataArrayMap.put(vObsProp, obsPropArray); } // populate heights array for profile Array heightDephtArray = null; if (zDims.size() == 1 && hasDimension(zDims, dZ) && !sensorDataset.getSubSensors().isEmpty()) { heightDephtArray = initHeightDephtArray(zDims); Double consistentBinHeight = populateHeightDepthArray(sensorDataset, heightDephtArray, vHeightDepth); String verticalResolution = null; if (consistentBinHeight == null) { verticalResolution = ACDDConstants.POINT; } else if (consistentBinHeight != NetcdfHelper.getInstance().getFillValue()) { verticalResolution = consistentBinHeight + " " + CFConstants.UNITS_METERS + " " + ACDDConstants.BINNED; } if (verticalResolution != null) { writer.addGroupAttribute(null, new Attribute(ACDDConstants.GEOSPATIAL_VERTICAL_RESOLUTION, verticalResolution)); } } // iterate through sensorDataset, set values int timeCounter = 0; for (Time time : sensorDataset.getTimes()) { // set time value Index timeIndex = timeArray.getIndex(); int timeIndexCounter = 0; // if (hasDimension(timeDims, dFeatureTypeInstance)) { // timeIndex.setDim(timeIndexCounter++, 0); // } if (hasDimension(timeDims, dTime)) { timeIndex.setDim(timeIndexCounter++, timeCounter++); } timeArray.set(timeIndex, getTimeValue(time)); // data values Map<OmObservableProperty, Map<SubSensor, Value<?>>> obsPropMap = sensorDataset.getDataValues().get(time); for (OmObservableProperty obsProp : obsPropMap.keySet()) { Variable variable = obsPropVarMap.get(obsProp); Array array = varDataArrayMap.get(variable); for (Entry<SubSensor, Value<?>> subSensorEntry : obsPropMap.get(obsProp).entrySet()) { SubSensor subSensor = subSensorEntry.getKey(); Value<?> value = subSensorEntry.getValue(); Object valObj = value.getValue(); if (!(valObj instanceof Double)) { throw new NoApplicableCodeException().withMessage("Value class " + valObj.getClass().getCanonicalName() + " not supported"); } Index index = array.getIndex(); int obsPropDimCounter = 0; for (Dimension dim : obsPropDims) { // if (dim.equals(dFeatureTypeInstance)){ // feature type instance index // index.setDim(obsPropDimCounter++, 0); // } else if (dim.equals(dTime)){ if (dim.equals(dTime)) { // time index dim index.setDim(obsPropDimCounter++, timeCounter - 1); } else if (dim.equals(dZ) && dim.getLength() > 1) { // height/depth index dim index.setDim(obsPropDimCounter++, sensorDataset.getSubSensors().indexOf(subSensor)); } } if (array instanceof ArrayFloat) { ((ArrayFloat) array).set(index, Float.parseFloat(Double.toString(((Double) valObj).doubleValue()))); } else { ((ArrayDouble) array).set(index, ((Double) valObj).doubleValue()); } } } } // create the empty netCDF with dims/vars/attributes defined variableArrayMap.put(vTime, timeArray); if (latArray != null) { variableArrayMap.put(vLat, latArray); } if (lonArray != null) { variableArrayMap.put(vLon, lonArray); } if (heightDephtArray != null) { variableArrayMap.put(vHeightDepth, heightDephtArray); } variableArrayMap.putAll(varDataArrayMap); // create the empty netCDF with dims/vars/attributes defined writeToFile(writer, variableArrayMap); try { writer.close(); } catch (IOException e) { throw new NoApplicableCodeException().causedBy(e).withMessage( "Error closign netCDF data for sensor " + sensorDataset.getSensorIdentifier()); } }
protected void encodeSensorDataToNetcdf(File netcdfFile, AbstractSensorDataset sensorDataset, Version version) throws EncodingException, IOException { String sensor = sensorDataset.getSensorIdentifier(); sensorDataset.getSensor().setSensorDescription( getProcedureDescription(sensor, sensorDataset.getProcedureDescription())); NetcdfFileWriter writer = getNetcdfFileWriter(netcdfFile, version); // set fill on, doesn't seem to have any effect though writer.setFill(true); Map<Variable, Array> variableArrayMap = Maps.newHashMap(); int numTimes = sensorDataset.getTimes().size(); // FIXME shouldn't assume that all subsensors are heights (or rename // subsensors if they are) int numHeightDepth = sensorDataset.getSubSensors().size() > 0 ? sensorDataset.getSubSensors().size() : 1; // global attributes addGlobaleAttributes(writer, sensorDataset); // add appropriate dims for feature type List<Dimension> timeDims = Lists.newArrayList(); List<Dimension> latLngDims = Lists.newArrayList(); List<Dimension> latDims = Lists.newArrayList(); List<Dimension> lngDims = Lists.newArrayList(); List<Dimension> zDims = Lists.newArrayList(); List<Dimension> obsPropDims = Lists.newArrayList(); // REQUIRED for NetCDF-3 // add Dimensions // dTime = writer.addDimension(null, CFStandardNames.TIME.getName(), // numTimes); Dimension dTime = writer.addUnlimitedDimension(getVariableDimensionCaseName(CFStandardNames.TIME.getName())); dTime.setLength(numTimes); timeDims.add(dTime); if (!(sensorDataset instanceof StaticLocationDataset)) { zDims.add(dTime); } obsPropDims.add(dTime); // set up lat/lng dimensions // FIXME do not set time dimension for static location dataset // if ((sensorDataset instanceof StaticLocationDataset)) { // latLngDims.add(dTime); // } // set up z dimensions String dimensionName; if (useHeight()) { dimensionName = getVariableDimensionCaseName(CFStandardNames.HEIGHT.getName()); } else { dimensionName = getVariableDimensionCaseName(CFStandardNames.DEPTH.getName()); } // profile/timeSeriesProfile Dimension dZ = writer.addDimension(null, dimensionName, numHeightDepth); if (!(sensorDataset instanceof StaticLocationDataset)) { // trajectory zDims.add(dTime); } zDims.add(dZ); obsPropDims.add(dZ); variableArrayMap.putAll(getNetcdfProfileSpecificVariablesArrays(writer, sensorDataset)); // time var Variable vTime = addVariableTime(writer, timeDims); if (numTimes > 1 && writer.getVersion().isNetdf4format()) { vTime.addAttribute(new Attribute(CDM.CHUNK_SIZES, getNetcdfHelper().getChunkSizeTime())); } ArrayDouble timeArray = new ArrayDouble(getDimShapes(timeDims)); initArrayWithFillValue(timeArray, getNetcdfHelper().getFillValue()); Array latArray = getLatitudeArray(sensorDataset); Array lonArray = getLongitudeArray(sensorDataset); // add lat/long dimensions long latSize = 1; if (latArray != null) { latSize = latArray.getSize(); } Dimension dLat = writer.addDimension(null, getVariableDimensionCaseName(CFStandardNames.LATITUDE.getName()), (int) latSize); latDims.add(dLat); long lonSize = 1; if (lonArray != null) { lonSize = lonArray.getSize(); } Dimension dLon = writer.addDimension(null, getVariableDimensionCaseName(CFStandardNames.LONGITUDE.getName()), (int) lonSize); lngDims.add(dLon); // lat/lon var Variable vLat; Variable vLon; if (latLngDims.size() > 0) { vLat = addVariableLatitude(writer, latLngDims); vLon = addVariableLongitude(writer, latLngDims); } else { vLat = addVariableLatitude(writer, latDims); vLon = addVariableLongitude(writer, lngDims); } // height/depth var Variable vHeightDepth; if (useHeight()) { vHeightDepth = addVariableHeight(writer, zDims); } else { vHeightDepth = addVariableDepth(writer, zDims); } String coordinateString = Joiner.on(' ').join( Lists.newArrayList(vTime.getFullName(), vLat.getFullName(), vLon.getFullName(), vHeightDepth.getFullName())); Map<OmObservableProperty, Variable> obsPropVarMap = Maps.newHashMap(); Map<Variable, Array> varDataArrayMap = Maps.newHashMap(); for (OmObservableProperty obsProp : sensorDataset.getPhenomena()) { // obs prop var Variable vObsProp = addVariableForObservedProperty(writer, obsProp, obsPropDims, coordinateString); obsPropVarMap.put(obsProp, vObsProp); // init obs prop data array Array obsPropArray = getArray(obsPropDims); initArrayWithFillValue(obsPropArray, getNetcdfHelper().getFillValue()); varDataArrayMap.put(vObsProp, obsPropArray); } // populate heights array for profile Array heightDephtArray = null; if (zDims.size() == 1 && hasDimension(zDims, dZ) && !sensorDataset.getSubSensors().isEmpty()) { heightDephtArray = initHeightDephtArray(zDims); Double consistentBinHeight = populateHeightDepthArray(sensorDataset, heightDephtArray, vHeightDepth); String verticalResolution = null; if (consistentBinHeight == null) { verticalResolution = ACDDConstants.POINT; } else if (consistentBinHeight != getNetcdfHelper().getFillValue()) { verticalResolution = consistentBinHeight + " " + CFConstants.UNITS_METERS + " " + ACDDConstants.BINNED; } if (verticalResolution != null) { writer.addGroupAttribute(null, new Attribute(ACDDConstants.GEOSPATIAL_VERTICAL_RESOLUTION, verticalResolution)); } } // iterate through sensorDataset, set values int timeCounter = 0; for (Time time : sensorDataset.getTimes()) { // set time value Index timeIndex = timeArray.getIndex(); int timeIndexCounter = 0; // if (hasDimension(timeDims, dFeatureTypeInstance)) { // timeIndex.setDim(timeIndexCounter++, 0); // } if (hasDimension(timeDims, dTime)) { timeIndex.setDim(timeIndexCounter++, timeCounter++); } timeArray.set(timeIndex, getTimeValue(time)); // data values Map<OmObservableProperty, Map<SubSensor, Value<?>>> obsPropMap = sensorDataset.getDataValues().get(time); for (Entry<OmObservableProperty, Map<SubSensor, Value<?>>> entry : obsPropMap.entrySet()) { OmObservableProperty obsProp = entry.getKey(); Variable variable = obsPropVarMap.get(obsProp); Array array = varDataArrayMap.get(variable); for (Entry<SubSensor, Value<?>> subSensorEntry : obsPropMap.get(obsProp).entrySet()) { SubSensor subSensor = subSensorEntry.getKey(); Value<?> value = subSensorEntry.getValue(); Object valObj = value.getValue(); if (!(valObj instanceof Double)) { throw new EncodingException("Value class %s not supported", valObj.getClass().getCanonicalName()); } Index index = array.getIndex(); int obsPropDimCounter = 0; for (Dimension dim : obsPropDims) { // if (dim.equals(dFeatureTypeInstance)){ // feature type instance index // index.setDim(obsPropDimCounter++, 0); // } else if (dim.equals(dTime)){ if (dim.equals(dTime)) { // time index dim index.setDim(obsPropDimCounter++, timeCounter - 1); } else if (dim.equals(dZ) && dim.getLength() > 1) { // height/depth index dim index.setDim(obsPropDimCounter++, sensorDataset.getSubSensors().indexOf(subSensor)); } } if (array instanceof ArrayFloat) { ((ArrayFloat) array).set(index, Float.parseFloat(Double.toString((Double) valObj))); } else { ((ArrayDouble) array).set(index, (Double) valObj); } } } } // create the empty netCDF with dims/vars/attributes defined variableArrayMap.put(vTime, timeArray); if (latArray != null) { variableArrayMap.put(vLat, latArray); } if (lonArray != null) { variableArrayMap.put(vLon, lonArray); } if (heightDephtArray != null) { variableArrayMap.put(vHeightDepth, heightDephtArray); } variableArrayMap.putAll(varDataArrayMap); // create the empty netCDF with dims/vars/attributes defined writeToFile(writer, variableArrayMap); writer.close(); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addGlobaleAttributes__(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset)
addGlobaleAttributes__(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset)
protected void addGlobaleAttributes(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset) throws OwsExceptionReport { // convetion addConventions(writer); // metadata conventions addMetadataConventions(writer); // feature type addFeatureType(writer, sensorDataset); // CDM data type addCdmDataType(writer, sensorDataset); // NODC template version addNodcTemplateVersion(writer, sensorDataset); // standardName vocabulary addStandardNameVocabulary(writer, sensorDataset); // platform addPlatform(writer, sensorDataset); // instrument addInstrument(writer, sensorDataset); // title addTitle(writer, sensorDataset); // summary addSummary(writer, sensorDataset); // date created addCreateDate(writer); // license addLicense(writer, sensorDataset); // id addId(writer, sensorDataset); // uuid addUUID(writer, sensorDataset); // keywords vocabulary addKeywordsVocabulary(writer); // keywords addKeywords(writer, sensorDataset); // operator -> contributor addContributor(writer, sensorDataset); // publisher addPublisher(writer, sensorDataset); // geospatial extent addGeospatialAttributes(writer, sensorDataset); // geospatial_vertical_min/max/units/resolution/positive addGeospatialVerticalAttributes(writer, sensorDataset); // time coverage addTimeCoverageAttributes(writer, sensorDataset); // additional global attributes addProfileSpecificGlobalAttributes(writer, sensorDataset); }
protected void addGlobaleAttributes(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset) throws EncodingException { // convetion addConventions(writer); // metadata conventions addMetadataConventions(writer); // feature type addFeatureType(writer, sensorDataset); // CDM data type addCdmDataType(writer, sensorDataset); // NODC template version addNodcTemplateVersion(writer, sensorDataset); // standardName vocabulary addStandardNameVocabulary(writer, sensorDataset); // platform addPlatform(writer, sensorDataset); // instrument addInstrument(writer, sensorDataset); // title addTitle(writer, sensorDataset); // summary addSummary(writer, sensorDataset); // date created addCreateDate(writer); // license addLicense(writer, sensorDataset); // id addId(writer, sensorDataset); // uuid addUUID(writer, sensorDataset); // keywords vocabulary addKeywordsVocabulary(writer); // keywords addKeywords(writer, sensorDataset); // operator -> contributor addContributor(writer, sensorDataset); // publisher addPublisher(writer, sensorDataset); // geospatial extent addGeospatialAttributes(writer, sensorDataset); // geospatial_vertical_min/max/units/resolution/positive addGeospatialVerticalAttributes(writer, sensorDataset); // time coverage addTimeCoverageAttributes(writer, sensorDataset); // additional global attributes addProfileSpecificGlobalAttributes(writer, sensorDataset); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addNodcTemplateVersion__(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset)
addNodcTemplateVersion__(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset)
protected CDMNode addNodcTemplateVersion(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset) throws CodedException { return writer.addGroupAttribute(null, new Attribute(NODCConstants.NODC_TEMPLATE_VERSION, getNodcTemplateVersion(sensorDataset.getFeatureType()))); }
protected CDMNode addNodcTemplateVersion(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset) throws EncodingException { return writer.addGroupAttribute(null, new Attribute(NODCConstants.NODC_TEMPLATE_VERSION, getNodcTemplateVersion(sensorDataset.getFeatureType()))); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addId__(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset)
addId__(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset)
protected CDMNode addId(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset) throws OwsExceptionReport { return writer.addGroupAttribute(null, new Attribute(ACDDConstants.ID, sensorDataset.getSensorIdentifier())); }
protected CDMNode addId(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset) throws EncodingException { return writer.addGroupAttribute(null, new Attribute(ACDDConstants.ID, sensorDataset.getSensorIdentifier())); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addUUID__(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset)
addUUID__(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset)
protected CDMNode addUUID(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset) { return writer.addGroupAttribute(null, new Attribute(NODCConstants.UUID, UUID.randomUUID().toString())); }
protected CDMNode addUUID(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset) { return writer.addGroupAttribute(null, new Attribute(NODCConstants.UUID, UUID.randomUUID().toString())); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addGeospatialAttributes__(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset)
addGeospatialAttributes__(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset)
protected void addGeospatialAttributes(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset) throws CodedException { // FIXME when trajectories are implemented, bbox should be calculated in // AbstractSensorDataset during construction if (sensorDataset instanceof StaticLocationDataset) { StaticLocationDataset LocationDataset = (StaticLocationDataset) sensorDataset; writer.addGroupAttribute(null, new Attribute(ACDDConstants.GEOSPATIAL_LAT_MIN, LocationDataset.getLat())); writer.addGroupAttribute(null, new Attribute(ACDDConstants.GEOSPATIAL_LAT_MAX, LocationDataset.getLat())); writer.addGroupAttribute(null, new Attribute(ACDDConstants.GEOSPATIAL_LAT_UNITS, CFConstants.UNITS_DEGREES_NORTH)); writer.addGroupAttribute(null, new Attribute(ACDDConstants.GEOSPATIAL_LON_MIN, LocationDataset.getLng())); writer.addGroupAttribute(null, new Attribute(ACDDConstants.GEOSPATIAL_LON_MAX, LocationDataset.getLng())); writer.addGroupAttribute(null, new Attribute(ACDDConstants.GEOSPATIAL_LON_UNITS, CFConstants.UNITS_DEGREES_EAST)); } else { throw new NoApplicableCodeException().withMessage("Trajectory encoding is not supported (bbox)"); } }
protected void addGeospatialAttributes(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset) throws EncodingException { // FIXME when trajectories are implemented, bbox should be calculated in // AbstractSensorDataset during construction if (sensorDataset instanceof StaticLocationDataset) { StaticLocationDataset LocationDataset = (StaticLocationDataset) sensorDataset; writer.addGroupAttribute(null, new Attribute(ACDDConstants.GEOSPATIAL_LAT_MIN, LocationDataset.getLat())); writer.addGroupAttribute(null, new Attribute(ACDDConstants.GEOSPATIAL_LAT_MAX, LocationDataset.getLat())); writer.addGroupAttribute(null, new Attribute(ACDDConstants.GEOSPATIAL_LAT_UNITS, CFConstants.UNITS_DEGREES_NORTH)); writer.addGroupAttribute(null, new Attribute(ACDDConstants.GEOSPATIAL_LON_MIN, LocationDataset.getLng())); writer.addGroupAttribute(null, new Attribute(ACDDConstants.GEOSPATIAL_LON_MAX, LocationDataset.getLng())); writer.addGroupAttribute(null, new Attribute(ACDDConstants.GEOSPATIAL_LON_UNITS, CFConstants.UNITS_DEGREES_EAST)); } else { throw new EncodingException("Trajectory encoding is not supported (bbox)"); } }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addTimeCoverageAttributes__(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset)
addTimeCoverageAttributes__(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset)
protected void addTimeCoverageAttributes(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset) throws CodedException { List<Time> times = Lists.newArrayList(sensorDataset.getTimes()); Collections.sort(times); DateTime firstTime = getDateTime(times.get(0)); DateTime lastTime = getDateTime(times.get(times.size() - 1)); // temporal extent writer.addGroupAttribute(null, new Attribute(ACDDConstants.TIME_COVERAGE_START, firstTime.toString())); writer.addGroupAttribute(null, new Attribute(ACDDConstants.TIME_COVERAGE_END, lastTime.toString())); }
protected void addTimeCoverageAttributes(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset) throws EncodingException { List<Time> times = Lists.newArrayList(sensorDataset.getTimes()); Collections.sort(times); DateTime firstTime = getDateTime(times.get(0)); DateTime lastTime = getDateTime(times.get(times.size() - 1)); // temporal extent writer.addGroupAttribute(null, new Attribute(ACDDConstants.TIME_COVERAGE_START, firstTime.toString())); writer.addGroupAttribute(null, new Attribute(ACDDConstants.TIME_COVERAGE_END, lastTime.toString())); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
populateHeightDepthArray__(AbstractSensorDataset sensorDataset, Array heightDephtArray, Variable v)
populateHeightDepthArray__(AbstractSensorDataset sensorDataset, Array heightDephtArray, Variable v)
private Double populateHeightDepthArray(AbstractSensorDataset sensorDataset, Array heightDephtArray, Variable v) throws CodedException { Index index = heightDephtArray.getIndex(); int indexCounter = 0; Double consistentBinHeight = null; for (SubSensor subSensor : sensorDataset.getSubSensors()) { if (subSensor instanceof ProfileSubSensor) { index.setDim(0, indexCounter++); heightDephtArray.setDouble(index, checkValue(v, ((ProfileSubSensor) subSensor).getHeight())); // check for consistent bin size if (subSensor instanceof BinProfileSubSensor) { double binHeight = checkValue(v, ((BinProfileSubSensor) subSensor).getBinHeight()); if (consistentBinHeight == null) { consistentBinHeight = binHeight; } else if (consistentBinHeight != NetcdfHelper.getInstance().getFillValue() && consistentBinHeight != binHeight) { // mark bin height as inconsistent consistentBinHeight = NetcdfHelper.getInstance().getFillValue(); } } } else { throw new NoApplicableCodeException().withMessage("Non-profile subsensors not supported."); } } return consistentBinHeight; }
private Double populateHeightDepthArray(AbstractSensorDataset sensorDataset, Array heightDephtArray, Variable v) throws EncodingException { Index index = heightDephtArray.getIndex(); int indexCounter = 0; Double consistentBinHeight = null; for (SubSensor subSensor : sensorDataset.getSubSensors()) { if (subSensor instanceof ProfileSubSensor) { index.setDim(0, indexCounter++); heightDephtArray.setDouble(index, checkValue(v, ((ProfileSubSensor) subSensor).getHeight())); // check for consistent bin size if (subSensor instanceof BinProfileSubSensor) { double binHeight = checkValue(v, ((BinProfileSubSensor) subSensor).getBinHeight()); if (consistentBinHeight == null) { consistentBinHeight = binHeight; } else if (consistentBinHeight != getNetcdfHelper().getFillValue() && consistentBinHeight != binHeight) { // mark bin height as inconsistent consistentBinHeight = getNetcdfHelper().getFillValue(); } } } else { throw new EncodingException("Non-profile subsensors not supported."); } } return consistentBinHeight; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
initHeightDephtArray__(List<Dimension> zDims)
initHeightDephtArray__(List<Dimension> zDims)
private Array initHeightDephtArray(List<Dimension> zDims) { Array array = getArray(zDims); initArrayWithFillValue(array, NetcdfHelper.getInstance().getFillValue()); return array; }
private Array initHeightDephtArray(List<Dimension> zDims) { Array array = getArray(zDims); initArrayWithFillValue(array, getNetcdfHelper().getFillValue()); return array; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
getLatitudeArray__(AbstractSensorDataset sensorDataset)
getLatitudeArray__(AbstractSensorDataset sensorDataset)
protected Array getLatitudeArray(AbstractSensorDataset sensorDataset) throws CodedException { if (sensorDataset instanceof StaticLocationDataset) { StaticLocationDataset locationDataset = (StaticLocationDataset) sensorDataset; if (locationDataset.getLat() != null) { Array array = getArray(); initArrayWithFillValue(array, NetcdfHelper.getInstance().getFillValue()); Index index = array.getIndex(); index.set(0); array.setDouble(index, locationDataset.getLat()); } } else { // TODO support varying lat throw new NoApplicableCodeException().withMessage("Varying lat are not yet supported."); } return null; }
protected Array getLatitudeArray(AbstractSensorDataset sensorDataset) throws EncodingException { if (sensorDataset instanceof StaticLocationDataset) { StaticLocationDataset locationDataset = (StaticLocationDataset) sensorDataset; if (locationDataset.getLat() != null) { Array array = getArray(); initArrayWithFillValue(array, getNetcdfHelper().getFillValue()); Index index = array.getIndex(); index.set(0); array.setDouble(index, locationDataset.getLat()); } } else { // TODO support varying lat throw new EncodingException("Varying lat are not yet supported."); } return null; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
getLongitudeArray__(AbstractSensorDataset sensorDataset)
getLongitudeArray__(AbstractSensorDataset sensorDataset)
protected Array getLongitudeArray(AbstractSensorDataset sensorDataset) throws CodedException { if (sensorDataset instanceof StaticLocationDataset) { StaticLocationDataset locationDataset = (StaticLocationDataset) sensorDataset; if (locationDataset.getLat() != null) { Array array = getArray(); initArrayWithFillValue(array, NetcdfHelper.getInstance().getFillValue()); Index index = array.getIndex(); index.set(0); array.setDouble(index, locationDataset.getLat()); } } else { // TODO support varying lat throw new NoApplicableCodeException().withMessage("Varying longs are not yet supported."); } return null; }
protected Array getLongitudeArray(AbstractSensorDataset sensorDataset) throws EncodingException { if (sensorDataset instanceof StaticLocationDataset) { StaticLocationDataset locationDataset = (StaticLocationDataset) sensorDataset; if (locationDataset.getLat() != null) { Array array = getArray(); initArrayWithFillValue(array, getNetcdfHelper().getFillValue()); Index index = array.getIndex(); index.set(0); array.setDouble(index, locationDataset.getLat()); } } else { // TODO support varying lat throw new EncodingException("Varying longs are not yet supported."); } return null; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
getNetcdfProfileSpecificVariablesArrays__(NetcdfFileWriter writer, AbstractSensorDataset dataset)
getNetcdfProfileSpecificVariablesArrays__(NetcdfFileWriter writer, AbstractSensorDataset dataset)
protected Map<Variable, Array> getNetcdfProfileSpecificVariablesArrays(NetcdfFileWriter writer, AbstractSensorDataset dataset) throws CodedException { return Maps.newHashMap(); }
protected Map<Variable, Array> getNetcdfProfileSpecificVariablesArrays(NetcdfFileWriter writer, AbstractSensorDataset dataset) throws EncodingException { return Maps.newHashMap(); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
writeToFile__(NetcdfFileWriter writer, Map<Variable, Array> variableArrayMap)
writeToFile__(NetcdfFileWriter writer, Map<Variable, Array> variableArrayMap)
private void writeToFile(NetcdfFileWriter writer, Map<Variable, Array> variableArrayMap) throws CodedException { try { writer.create(); } catch (IOException e) { throw new NoApplicableCodeException().causedBy(e).withMessage("Couldn't create empty netCDF file"); } // fill the netCDF file with data try { for (Entry<Variable, Array> varEntry : variableArrayMap.entrySet()) { writer.write(varEntry.getKey(), varEntry.getValue()); } } catch (Exception e) { throw new NoApplicableCodeException().causedBy(e).withMessage("Error writing netCDF variable data"); } }
private void writeToFile(NetcdfFileWriter writer, Map<Variable, Array> variableArrayMap) throws EncodingException, IOException { writer.create(); // fill the netCDF file with data try { for (Entry<Variable, Array> varEntry : variableArrayMap.entrySet()) { writer.write(varEntry.getKey(), varEntry.getValue()); } } catch (InvalidRangeException e) { throw new EncodingException("Error writing netCDF variable data"); } }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
useHeight__()
useHeight__()
protected boolean useHeight() { if (CFStandardNames.HEIGHT.equals(NetcdfHelper.getInstance().getHeightDepth())) { return true; } return false; }
protected boolean useHeight() { return CFStandardNames.HEIGHT.equals(getNetcdfHelper().getHeightDepth()); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
getKeywords__(AbstractSensorDataset sensorDataset)
getKeywords__(AbstractSensorDataset sensorDataset)
protected Iterable<?> getKeywords(AbstractSensorDataset sensorDataset) { LinkedHashSet<String> keywords = Sets.newLinkedHashSet(); // keywords.add(sensor.getAuthority()); // keywords.add(sensor.getStation()); // keywords.add(sensor.getSensor()); for (OmObservableProperty obsProp : sensorDataset.getPhenomena()) { keywords.add(obsProp.getIdentifier()); } return keywords; }
protected Iterable<?> getKeywords(AbstractSensorDataset sensorDataset) { LinkedHashSet<String> keywords = Sets.newLinkedHashSet(); // keywords.add(sensor.getAuthority()); // keywords.add(sensor.getStation()); // keywords.add(sensor.getSensor()); sensorDataset.getPhenomena() .forEach(obsProp -> { keywords.add(obsProp.getIdentifier()); }); return keywords; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addVariableForObservedProperty__(NetcdfFileWriter writer, OmObservableProperty obsProp, List<Dimension> obsPropDims, String coordinateString)
addVariableForObservedProperty__(NetcdfFileWriter writer, OmObservableProperty obsProp, List<Dimension> obsPropDims, String coordinateString)
protected Variable addVariableForObservedProperty(NetcdfFileWriter writer, OmObservableProperty obsProp, List<Dimension> obsPropDims, String coordinateString) { String standardName = getObservedPropertyStandardName(obsProp); String longName = getObservedPropertyLongName(obsProp); Variable v = writer.addVariable(null, getVariableDimensionCaseName(standardName), getDataType(), obsPropDims); v.addAttribute(new Attribute(CFConstants.STANDARD_NAME, standardName)); if (!Strings.isNullOrEmpty(longName)) { v.addAttribute(new Attribute(CFConstants.LONG_NAME, longName)); } v.addAttribute(new Attribute(CFConstants.COORDINATES, coordinateString)); v.addAttribute(new Attribute(CFConstants.FILL_VALUE, NetcdfHelper.getInstance().getFillValue())); // if (obsProp.getUnit() != null) { // vObsProp.addAttribute(new Attribute(CFConstants.UNITS, // IoosSosUtil.getNameFromUri(obsProp.getUnit()))); // } if (obsProp.getUnit() != null) { v.addAttribute(new Attribute(CFConstants.UNITS, obsProp.getUnit())); } return v; }
protected Variable addVariableForObservedProperty(NetcdfFileWriter writer, OmObservableProperty obsProp, List<Dimension> obsPropDims, String coordinateString) { String standardName = getObservedPropertyStandardName(obsProp); String longName = getObservedPropertyLongName(obsProp); Variable v = writer.addVariable(null, getVariableDimensionCaseName(standardName), getDataType(), obsPropDims); v.addAttribute(new Attribute(CFConstants.STANDARD_NAME, standardName)); if (!Strings.isNullOrEmpty(longName)) { v.addAttribute(new Attribute(CFConstants.LONG_NAME, longName)); } v.addAttribute(new Attribute(CFConstants.COORDINATES, coordinateString)); v.addAttribute(new Attribute(CFConstants.FILL_VALUE, getNetcdfHelper().getFillValue())); // if (obsProp.getUnit() != null) { // vObsProp.addAttribute(new Attribute(CFConstants.UNITS, // IoosSosUtil.getNameFromUri(obsProp.getUnit()))); // } if (obsProp.getUnit() != null) { v.addAttribute(new Attribute(CFConstants.UNITS, obsProp.getUnit())); } return v; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addVariableTime__(NetcdfFileWriter writer, List<Dimension> dims)
addVariableTime__(NetcdfFileWriter writer, List<Dimension> dims)
protected Variable addVariableTime(NetcdfFileWriter writer, List<Dimension> dims) { Variable v = writer.addVariable(null, getVariableDimensionCaseName(CFStandardNames.TIME.getName()), DataType.DOUBLE, dims); v.addAttribute(new Attribute(CFConstants.STANDARD_NAME, CFStandardNames.TIME.getName())); v.addAttribute(new Attribute(CFConstants.LONG_NAME, getLongName(CFStandardNames.TIME.getName()))); v.addAttribute(new Attribute(CFConstants.UNITS, getTimeUnits())); v.addAttribute(new Attribute(CFConstants.AXIS, CFConstants.AXIS_T)); v.addAttribute(new Attribute(CFConstants.FILL_VALUE, NetcdfHelper.getInstance().getFillValue())); return v; }
protected Variable addVariableTime(NetcdfFileWriter writer, List<Dimension> dims) { Variable v = writer.addVariable(null, getVariableDimensionCaseName(CFStandardNames.TIME.getName()), DataType.DOUBLE, dims); v.addAttribute(new Attribute(CFConstants.STANDARD_NAME, CFStandardNames.TIME.getName())); v.addAttribute(new Attribute(CFConstants.LONG_NAME, getLongName(CFStandardNames.TIME.getName()))); v.addAttribute(new Attribute(CFConstants.UNITS, getTimeUnits())); v.addAttribute(new Attribute(CFConstants.AXIS, CFConstants.AXIS_T)); v.addAttribute(new Attribute(CFConstants.FILL_VALUE, getNetcdfHelper().getFillValue())); return v; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addVariableLatitude__(NetcdfFileWriter writer, List<Dimension> dims)
addVariableLatitude__(NetcdfFileWriter writer, List<Dimension> dims)
protected Variable addVariableLatitude(NetcdfFileWriter writer, List<Dimension> dims) { Variable v = writer.addVariable(null, getVariableDimensionCaseName(CFStandardNames.LATITUDE.getName()), getDataType(), dims); v.addAttribute(new Attribute(CFConstants.STANDARD_NAME, CFStandardNames.LATITUDE.getName())); v.addAttribute(new Attribute(CFConstants.LONG_NAME, getLongName(CFStandardNames.LATITUDE.getName()))); v.addAttribute(new Attribute(CFConstants.UNITS, CFConstants.UNITS_DEGREES_NORTH)); v.addAttribute(new Attribute(CFConstants.AXIS, CFConstants.AXIS_Y)); v.addAttribute(new Attribute(CFConstants.FILL_VALUE, NetcdfHelper.getInstance().getFillValue())); return v; }
protected Variable addVariableLatitude(NetcdfFileWriter writer, List<Dimension> dims) { Variable v = writer.addVariable(null, getVariableDimensionCaseName(CFStandardNames.LATITUDE.getName()), getDataType(), dims); v.addAttribute(new Attribute(CFConstants.STANDARD_NAME, CFStandardNames.LATITUDE.getName())); v.addAttribute(new Attribute(CFConstants.LONG_NAME, getLongName(CFStandardNames.LATITUDE.getName()))); v.addAttribute(new Attribute(CFConstants.UNITS, CFConstants.UNITS_DEGREES_NORTH)); v.addAttribute(new Attribute(CFConstants.AXIS, CFConstants.AXIS_Y)); v.addAttribute(new Attribute(CFConstants.FILL_VALUE, getNetcdfHelper().getFillValue())); return v; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addVariableLongitude__(NetcdfFileWriter writer, List<Dimension> dims)
addVariableLongitude__(NetcdfFileWriter writer, List<Dimension> dims)
protected Variable addVariableLongitude(NetcdfFileWriter writer, List<Dimension> dims) { Variable v = writer.addVariable(null, getVariableDimensionCaseName(CFStandardNames.LONGITUDE.getName()), getDataType(), dims); v.addAttribute(new Attribute(CFConstants.STANDARD_NAME, CFStandardNames.LONGITUDE.getName())); v.addAttribute(new Attribute(CFConstants.LONG_NAME, getLongName(CFStandardNames.LONGITUDE.getName()))); v.addAttribute(new Attribute(CFConstants.UNITS, CFConstants.UNITS_DEGREES_EAST)); v.addAttribute(new Attribute(CFConstants.AXIS, CFConstants.AXIS_X)); v.addAttribute(new Attribute(CFConstants.FILL_VALUE, NetcdfHelper.getInstance().getFillValue())); return v; }
protected Variable addVariableLongitude(NetcdfFileWriter writer, List<Dimension> dims) { Variable v = writer.addVariable(null, getVariableDimensionCaseName(CFStandardNames.LONGITUDE.getName()), getDataType(), dims); v.addAttribute(new Attribute(CFConstants.STANDARD_NAME, CFStandardNames.LONGITUDE.getName())); v.addAttribute(new Attribute(CFConstants.LONG_NAME, getLongName(CFStandardNames.LONGITUDE.getName()))); v.addAttribute(new Attribute(CFConstants.UNITS, CFConstants.UNITS_DEGREES_EAST)); v.addAttribute(new Attribute(CFConstants.AXIS, CFConstants.AXIS_X)); v.addAttribute(new Attribute(CFConstants.FILL_VALUE, getNetcdfHelper().getFillValue())); return v; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addVariableHeight__(NetcdfFileWriter writer, List<Dimension> dims)
addVariableHeight__(NetcdfFileWriter writer, List<Dimension> dims)
protected Variable addVariableHeight(NetcdfFileWriter writer, List<Dimension> dims) { Variable v = writer.addVariable(null, getVariableDimensionCaseName(CFStandardNames.HEIGHT.getName()), getDataType(), dims); v.addAttribute(new Attribute(CFConstants.STANDARD_NAME, CFStandardNames.HEIGHT.getName())); v.addAttribute(new Attribute(CFConstants.LONG_NAME, getLongName(CFStandardNames.HEIGHT.getName()))); v.addAttribute(new Attribute(CFConstants.UNITS, CFConstants.UNITS_METERS)); v.addAttribute(new Attribute(CFConstants.AXIS, CFConstants.AXIS_Z)); v.addAttribute(new Attribute(CFConstants.POSITIVE, CFConstants.POSITIVE_UP)); v.addAttribute(new Attribute(CFConstants.FILL_VALUE, NetcdfHelper.getInstance().getFillValue())); return v; }
protected Variable addVariableHeight(NetcdfFileWriter writer, List<Dimension> dims) { Variable v = writer.addVariable(null, getVariableDimensionCaseName(CFStandardNames.HEIGHT.getName()), getDataType(), dims); v.addAttribute(new Attribute(CFConstants.STANDARD_NAME, CFStandardNames.HEIGHT.getName())); v.addAttribute(new Attribute(CFConstants.LONG_NAME, getLongName(CFStandardNames.HEIGHT.getName()))); v.addAttribute(new Attribute(CFConstants.UNITS, CFConstants.UNITS_METERS)); v.addAttribute(new Attribute(CFConstants.AXIS, CFConstants.AXIS_Z)); v.addAttribute(new Attribute(CFConstants.POSITIVE, CFConstants.POSITIVE_UP)); v.addAttribute(new Attribute(CFConstants.FILL_VALUE, getNetcdfHelper().getFillValue())); return v; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addVariableDepth__(NetcdfFileWriter writer, List<Dimension> dims)
addVariableDepth__(NetcdfFileWriter writer, List<Dimension> dims)
protected Variable addVariableDepth(NetcdfFileWriter writer, List<Dimension> dims) { Variable v = writer.addVariable(null, getVariableDimensionCaseName(CFStandardNames.DEPTH.getName()), getDataType(), dims); v.addAttribute(new Attribute(CFConstants.STANDARD_NAME, CFStandardNames.DEPTH.getName())); v.addAttribute(new Attribute(CFConstants.LONG_NAME, getLongName(CFStandardNames.DEPTH.getName()))); v.addAttribute(new Attribute(CFConstants.UNITS, CFConstants.UNITS_METERS)); v.addAttribute(new Attribute(CFConstants.AXIS, CFConstants.AXIS_Z)); v.addAttribute(new Attribute(CFConstants.POSITIVE, CFConstants.POSITIVE_DOWN)); v.addAttribute(new Attribute(CFConstants.FILL_VALUE, NetcdfHelper.getInstance().getFillValue())); return v; }
protected Variable addVariableDepth(NetcdfFileWriter writer, List<Dimension> dims) { Variable v = writer.addVariable(null, getVariableDimensionCaseName(CFStandardNames.DEPTH.getName()), getDataType(), dims); v.addAttribute(new Attribute(CFConstants.STANDARD_NAME, CFStandardNames.DEPTH.getName())); v.addAttribute(new Attribute(CFConstants.LONG_NAME, getLongName(CFStandardNames.DEPTH.getName()))); v.addAttribute(new Attribute(CFConstants.UNITS, CFConstants.UNITS_METERS)); v.addAttribute(new Attribute(CFConstants.AXIS, CFConstants.AXIS_Z)); v.addAttribute(new Attribute(CFConstants.POSITIVE, CFConstants.POSITIVE_DOWN)); v.addAttribute(new Attribute(CFConstants.FILL_VALUE, getNetcdfHelper().getFillValue())); return v; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
getVariableDimensionCaseName__(String name)
getVariableDimensionCaseName__(String name)
protected String getVariableDimensionCaseName(String name) { if (NetcdfHelper.getInstance().isUpperCaseNames()) { return name.toUpperCase(Locale.ROOT); } return name; }
protected String getVariableDimensionCaseName(String name) { if (getNetcdfHelper().isUpperCaseNames()) { return name.toUpperCase(Locale.ROOT); } return name; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
getDataType__()
getDataType__()
protected DataType getDataType() { if (Float.class.getSimpleName().equals(NetcdfHelper.getInstance().getVariableType())) { return DataType.FLOAT; } return DataType.DOUBLE; }
protected DataType getDataType() { if (Float.class.getSimpleName().equals(getNetcdfHelper().getVariableType())) { return DataType.FLOAT; } return DataType.DOUBLE; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
getNodcTemplateVersion__(CF.FeatureType featureType)
getNodcTemplateVersion__(CF.FeatureType featureType)
private String getNodcTemplateVersion(CF.FeatureType featureType) throws CodedException { if (featureType.equals(CF.FeatureType.timeSeries)) { return NODCConstants.NODC_TIMESERIES_ORTHOGONAL_TEMPLATE_1_0; } else if (featureType.equals(CF.FeatureType.timeSeriesProfile)) { return NODCConstants.NODC_TIMESERIESPROFILE_ORTHOGONAL_TEMPLATE_1_0; } throw new NoApplicableCodeException().withMessage("Feature type " + featureType.name() + " is not supported for netCDF output"); }
private String getNodcTemplateVersion(CF.FeatureType featureType) throws EncodingException { if (featureType.equals(CF.FeatureType.timeSeries)) { return NODCConstants.NODC_TIMESERIES_ORTHOGONAL_TEMPLATE_1_0; } else if (featureType.equals(CF.FeatureType.timeSeriesProfile)) { return NODCConstants.NODC_TIMESERIESPROFILE_ORTHOGONAL_TEMPLATE_1_0; } throw new EncodingException("Feature type %s is not supported for netCDF output", featureType.name()); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
getCfRole__(CF.FeatureType featureType)
getCfRole__(CF.FeatureType featureType)
protected String getCfRole(CF.FeatureType featureType) throws CodedException { if (featureType.equals(CF.FeatureType.timeSeries)) { return CF.TIMESERIES_ID; } else if (featureType.equals(CF.FeatureType.timeSeriesProfile)) { return CF.TIMESERIES_ID; } else if (featureType.equals(CF.FeatureType.trajectory) || featureType.equals(CF.FeatureType.trajectoryProfile)) { return CF.TRAJECTORY_ID; } else { throw new NoApplicableCodeException().withMessage("Feature type " + featureType.name() + " is not supported for netCDF output"); } }
protected String getCfRole(CF.FeatureType featureType) throws CodedException { switch (featureType) { case timeSeries: return CF.TIMESERIES_ID; case timeSeriesProfile: return CF.TIMESERIES_ID; case trajectory: case trajectoryProfile: return CF.TRAJECTORY_ID; default: throw new NoApplicableCodeException().withMessage("Feature type " + featureType.name() + " is not supported for netCDF output"); } }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
getDateTime__(Time time)
getDateTime__(Time time)
protected DateTime getDateTime(Time time) throws CodedException { if (!(time instanceof TimeInstant)) { throw new NoApplicableCodeException().withMessage("Time class " + time.getClass().getCanonicalName() + " not supported"); } TimeInstant timeInstant = (TimeInstant) time; return timeInstant.getValue(); }
protected DateTime getDateTime(Time time) throws EncodingException { if (!(time instanceof TimeInstant)) { throw new EncodingException("Time class %s not supported", time.getClass().getCanonicalName()); } TimeInstant timeInstant = (TimeInstant) time; return timeInstant.getValue(); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
getTimeValue__(Time time)
getTimeValue__(Time time)
protected double getTimeValue(Time time) throws CodedException { return DateTimeHelper.getSecondsSinceEpoch(getDateTime(time)); }
protected double getTimeValue(Time time) throws EncodingException { return DateTimeHelper.getSecondsSinceEpoch(getDateTime(time)); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
getProcedureDescription__(String procedure, SosProcedureDescription procedureDescription)
getProcedureDescription__(String procedure, AbstractFeature procedureDescription)
private AbstractSensorML getProcedureDescription(String procedure, SosProcedureDescription procedureDescription) throws OwsExceptionReport { SosProcedureDescription sosProcedureDescription = procedureDescription; // query full procedure description if necessary if (sosProcedureDescription == null || procedureDescription instanceof SosProcedureDescriptionUnknowType) { sosProcedureDescription = queryProcedureDescription(procedure); } AbstractSensorML abstractSensor = null; if (sosProcedureDescription instanceof AbstractSensorML) { abstractSensor = (AbstractSensorML) sosProcedureDescription; // check for SensorML to get members if (sosProcedureDescription instanceof SensorML) { SensorML sml = (SensorML) sosProcedureDescription; if (sml.isWrapper()) { abstractSensor = (AbstractSensorML) sml.getMembers().get(0); } } // set the identifier if missing if (!abstractSensor.isSetIdentifier()) { abstractSensor.setIdentifier(procedure); } } if (abstractSensor == null) { throw new NoApplicableCodeException() .withMessage("Only SensorML procedure descriptions are supported, found " + sosProcedureDescription.getClass().getName() + " for " + procedure); } return abstractSensor; }
private AbstractSensorML getProcedureDescription(String procedure, AbstractFeature procedureDescription) throws EncodingException { // query full procedure description if necessary if (procedureDescription == null || procedureDescription instanceof SosProcedureDescriptionUnknownType) { return getProcedureDescription(procedure, queryProcedureDescription(procedure)); } AbstractSensorML abstractSensor = null; if (procedureDescription instanceof AbstractSensorML) { abstractSensor = (AbstractSensorML) procedureDescription; // check for SensorML to get members if (procedureDescription instanceof SensorML) { SensorML sml = (SensorML) procedureDescription; if (sml.isWrapper()) { abstractSensor = (AbstractSensorML) sml.getMembers().get(0); } } // set the identifier if missing if (!abstractSensor.isSetIdentifier()) { abstractSensor.setIdentifier(procedure); } } if (abstractSensor == null) { throw new EncodingException("Only SensorML procedure descriptions are supported, found %s for %s", procedureDescription.getClass().getName(), procedure); } return abstractSensor; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
queryProcedureDescription__(String procedure)
queryProcedureDescription__(String procedure)
private SosProcedureDescription queryProcedureDescription(String procedure) throws CodedException { DescribeSensorRequest req = new DescribeSensorRequest(); req.setService(SosConstants.SOS); req.setVersion(Sos2Constants.SERVICEVERSION); req.setProcedure(procedure); Set<String> pdfs = ProcedureDescriptionFormatRepository.getInstance().getAllSupportedProcedureDescriptionFormats(SosConstants.SOS, Sos2Constants.SERVICEVERSION); if (pdfs.contains(SensorML20Constants.NS_SML)) { req.setProcedureDescriptionFormat(SensorML20Constants.NS_SML); } else if (pdfs.contains(SensorMLConstants.NS_SML)) { req.setProcedureDescriptionFormat(SensorMLConstants.NS_SML); } else { throw new NoApplicableCodeException() .withMessage( "Error getting sensor description for %s! Required procedureDescriptionFormats are not supported!", procedure); } DescribeSensorResponse resp; try { resp = getDescribeSensorHandler().getSensorDescription(req); } catch (OwsExceptionReport e) { throw new NoApplicableCodeException().withMessage("Error getting sensor description for " + procedure) .causedBy(e); } return resp.getProcedureDescriptions().get(0); }
private SosProcedureDescription<?> queryProcedureDescription(String procedure) throws EncodingException { DescribeSensorRequest req = new DescribeSensorRequest(); req.setService(SosConstants.SOS); req.setVersion(Sos2Constants.SERVICEVERSION); req.setProcedure(procedure); Set<String> pdfs = (this.procedureDescriptionFormatRepository).getAllSupportedProcedureDescriptionFormats(SosConstants.SOS, Sos2Constants.SERVICEVERSION); if (pdfs.contains(SensorML20Constants.NS_SML)) { req.setProcedureDescriptionFormat(SensorML20Constants.NS_SML); } else if (pdfs.contains(SensorMLConstants.NS_SML)) { req.setProcedureDescriptionFormat(SensorMLConstants.NS_SML); } else { throw new EncodingException( "Error getting sensor description for %s! Required procedureDescriptionFormats are not supported!", procedure); } DescribeSensorResponse resp; try { resp = getDescribeSensorHandler().getSensorDescription(req); } catch (OwsExceptionReport e) { throw new EncodingException(e, "Error getting sensor description for %s", procedure); } return resp.getProcedureDescriptions().get(0); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
getDescribeSensorHandler__()
getDescribeSensorHandler__()
protected AbstractDescribeSensorHandler getDescribeSensorHandler() throws CodedException { OperationHandler operationHandler = OperationHandlerRepository.getInstance().getOperationHandler(SosConstants.SOS, SosConstants.Operations.DescribeSensor.toString()); if (operationHandler != null && operationHandler instanceof AbstractDescribeSensorHandler) { return (AbstractDescribeSensorHandler) operationHandler; } throw new NoApplicableCodeException().withMessage("Could not get DescribeSensor handler"); }
protected AbstractDescribeSensorHandler getDescribeSensorHandler() throws CodedException { OperationHandler operationHandler = (this.operationHandlerRepository).getOperationHandler(SosConstants.SOS, SosConstants.Operations.DescribeSensor.toString()); if (operationHandler != null && operationHandler instanceof AbstractDescribeSensorHandler) { return (AbstractDescribeSensorHandler) operationHandler; } throw new NoApplicableCodeException().withMessage("Could not get DescribeSensor handler"); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addAttributeIfClassifierExists__(Variable variable, AbstractSensorML sml, String classifierDefinition, String attributeName)
addAttributeIfClassifierExists__(Variable variable, AbstractSensorML sml, String classifierDefinition, String attributeName)
protected boolean addAttributeIfClassifierExists(Variable variable, AbstractSensorML sml, String classifierDefinition, String attributeName) { String value = getClassifierValue(sml, classifierDefinition); if (value != null) { variable.addAttribute(new Attribute(attributeName, value)); return true; } return false; }
protected boolean addAttributeIfClassifierExists(Variable variable, AbstractSensorML sml, String classifierDefinition, String attributeName) { String value = getClassifierValue(sml, classifierDefinition); if (value != null) { variable.addAttribute(new Attribute(attributeName, value)); return true; } return false; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addPublisher__(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset)
addPublisher__(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset)
protected boolean addPublisher(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset) throws OwsExceptionReport { if (sensorDataset.getSensor().isSetSensorDescription()) { AbstractSensorML sml = sensorDataset.getSensor().getSensorDescritpion(); if (addPublisher(sml, NetcdfHelper.getInstance().getPublisher(), writer)) { return true; } return addPublisher(sml, CiRoleCodes.CI_RoleCode_publisher, writer); } return false; }
protected boolean addPublisher(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset) { if (sensorDataset.getSensor().isSetSensorDescription()) { AbstractSensorML sml = sensorDataset.getSensor().getSensorDescritpion(); if (addPublisher(sml, getNetcdfHelper().getPublisher(), writer)) { return true; } return addPublisher(sml, CiRoleCodes.CI_RoleCode_publisher, writer); } return false; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addPublisher__(AbstractSensorML sml, CiRoleCodes ciRoleCode, NetcdfFileWriter writer)
addPublisher__(AbstractSensorML sml, CiRoleCodes ciRoleCode, NetcdfFileWriter writer)
protected boolean addPublisher(AbstractSensorML sml, CiRoleCodes ciRoleCode, NetcdfFileWriter writer) throws OwsExceptionReport { return addPublisher(sml, ciRoleCode.getIdentifier(), writer); }
protected boolean addPublisher(AbstractSensorML sml, CiRoleCodes ciRoleCode, NetcdfFileWriter writer) { return addPublisher(sml, ciRoleCode.getIdentifier(), writer); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addPublisher__(AbstractSensorML sml, String contactRole, NetcdfFileWriter writer)
addPublisher__(AbstractSensorML sml, String contactRole, NetcdfFileWriter writer)
protected boolean addPublisher(AbstractSensorML sml, String contactRole, NetcdfFileWriter writer) throws OwsExceptionReport { SmlResponsibleParty responsibleParty = getResponsibleParty(sml, contactRole); if (responsibleParty != null) { if (responsibleParty.isSetOrganizationName()) { writer.addGroupAttribute(null, new Attribute(ACDDConstants.PUBLISHER_NAME, responsibleParty.getOrganizationName())); } if (responsibleParty.isSetEmail()) { writer.addGroupAttribute(null, new Attribute(ACDDConstants.PUBLISHER_EMAIL, responsibleParty.getEmail())); } if (responsibleParty.isSetOnlineResources()) { writer.addGroupAttribute(null, new Attribute(ACDDConstants.PUBLISHER_URL, responsibleParty .getOnlineResources().get(0))); } } else { writer.addGroupAttribute(null, new Attribute(ACDDConstants.PUBLISHER_NAME, getServiceProvider().getName())); writer.addGroupAttribute(null, new Attribute(ACDDConstants.PUBLISHER_EMAIL, getServiceProvider() .getMailAddress())); writer.addGroupAttribute(null, new Attribute(ACDDConstants.PUBLISHER_URL, getServiceProvider().getSite())); } return true; }
protected boolean addPublisher(AbstractSensorML sml, String contactRole, NetcdfFileWriter writer) { SmlResponsibleParty responsibleParty = getResponsibleParty(sml, contactRole); if (responsibleParty != null) { if (responsibleParty.isSetOrganizationName()) { writer.addGroupAttribute(null, new Attribute(ACDDConstants.PUBLISHER_NAME, responsibleParty.getOrganizationName())); } if (responsibleParty.isSetEmail()) { writer.addGroupAttribute(null, new Attribute(ACDDConstants.PUBLISHER_EMAIL, responsibleParty.getEmail())); } if (responsibleParty.isSetOnlineResources()) { writer.addGroupAttribute(null, new Attribute(ACDDConstants.PUBLISHER_URL, responsibleParty .getOnlineResources().get(0))); } } else { String mail = getServiceProvider().getServiceContact().getContactInfo().flatMap(OwsContact::getAddress) .map(OwsAddress::getElectronicMailAddress).map(l -> Iterables.getFirst(l, null)).orElse(null); String name = getServiceProvider().getProviderName(); String url = getServiceProvider().getProviderSite().flatMap(OwsOnlineResource::getHref).map(URI::toString) .orElse(null); writer.addGroupAttribute(null, new Attribute(ACDDConstants.PUBLISHER_NAME, name)); writer.addGroupAttribute(null, new Attribute(ACDDConstants.PUBLISHER_EMAIL, mail)); writer.addGroupAttribute(null, new Attribute(ACDDConstants.PUBLISHER_URL, url)); } return true; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addContributor__(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset)
addContributor__(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset)
protected boolean addContributor(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset) throws OwsExceptionReport { if (sensorDataset.getSensor().isSetSensorDescription()) { AbstractSensorML sml = sensorDataset.getSensor().getSensorDescritpion(); if (addContributor(sml, NetcdfHelper.getInstance().getContributor(), writer)) { return true; } else if (addContributor(sml, CiRoleCodes.CI_RoleCode_principalInvestigator, writer)) { return true; } return addContributor(sml, CiRoleCodes.CI_RoleCode_author, writer); } return false; }
protected boolean addContributor(NetcdfFileWriter writer, AbstractSensorDataset sensorDataset) { if (sensorDataset.getSensor().isSetSensorDescription()) { AbstractSensorML sml = sensorDataset.getSensor().getSensorDescritpion(); if (addContributor(sml, getNetcdfHelper().getContributor(), writer)) { return true; } else if (addContributor(sml, CiRoleCodes.CI_RoleCode_principalInvestigator, writer)) { return true; } return addContributor(sml, CiRoleCodes.CI_RoleCode_author, writer); } return false; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addContributor__(AbstractSensorML sml, CiRoleCodes ciRoleCode, NetcdfFileWriter writer)
addContributor__(AbstractSensorML sml, CiRoleCodes ciRoleCode, NetcdfFileWriter writer)
protected boolean addContributor(AbstractSensorML sml, CiRoleCodes ciRoleCode, NetcdfFileWriter writer) throws OwsExceptionReport { return addContributor(sml, ciRoleCode.getIdentifier(), writer); }
protected boolean addContributor(AbstractSensorML sml, CiRoleCodes ciRoleCode, NetcdfFileWriter writer) { return addContributor(sml, ciRoleCode.getIdentifier(), writer); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
addContributor__(AbstractSensorML sml, String contactRole, NetcdfFileWriter writer)
addContributor__(AbstractSensorML sml, String contactRole, NetcdfFileWriter writer)
protected boolean addContributor(AbstractSensorML sml, String contactRole, NetcdfFileWriter writer) throws OwsExceptionReport { SmlResponsibleParty responsibleParty = getResponsibleParty(sml, contactRole); if (responsibleParty != null) { if (responsibleParty.isSetOrganizationName()) { writer.addGroupAttribute(null, new Attribute(ACDDConstants.CONTRIBUTOR_NAME, responsibleParty.getOrganizationName())); } if (responsibleParty.isSetEmail()) { writer.addGroupAttribute(null, new Attribute(ACDDConstants.CONTRIBUTOR_ROLE, responsibleParty.getRole())); } if (responsibleParty.isSetOnlineResources()) { writer.addGroupAttribute(null, new Attribute(NetcdfConstants.CONTRIBUTOR_EMAIL, responsibleParty.getEmail())); } } else { writer.addGroupAttribute(null, new Attribute(ACDDConstants.CONTRIBUTOR_NAME, getServiceProvider() .getIndividualName())); writer.addGroupAttribute(null, new Attribute(ACDDConstants.CONTRIBUTOR_ROLE, getServiceProvider() .getPositionName())); writer.addGroupAttribute(null, new Attribute(NetcdfConstants.CONTRIBUTOR_EMAIL, getServiceProvider().getMailAddress())); } return true; }
protected boolean addContributor(AbstractSensorML sml, String contactRole, NetcdfFileWriter writer) { SmlResponsibleParty responsibleParty = getResponsibleParty(sml, contactRole); if (responsibleParty != null) { if (responsibleParty.isSetOrganizationName()) { writer.addGroupAttribute(null, new Attribute(ACDDConstants.CONTRIBUTOR_NAME, responsibleParty.getOrganizationName())); } if (responsibleParty.isSetEmail()) { writer.addGroupAttribute(null, new Attribute(ACDDConstants.CONTRIBUTOR_ROLE, responsibleParty.getRole())); } if (responsibleParty.isSetOnlineResources()) { writer.addGroupAttribute(null, new Attribute(NetcdfConstants.CONTRIBUTOR_EMAIL, responsibleParty.getEmail())); } } else { String individualName = getServiceProvider().getServiceContact().getIndividualName().orElse(null); String positionName = getServiceProvider().getServiceContact().getPositionName().orElse(null); String mail = getServiceProvider().getServiceContact().getContactInfo().flatMap(OwsContact::getAddress) .map(OwsAddress::getElectronicMailAddress).map(l -> Iterables.getFirst(l, null)).orElse(null); writer.addGroupAttribute(null, new Attribute(ACDDConstants.CONTRIBUTOR_NAME, individualName)); writer.addGroupAttribute(null, new Attribute(ACDDConstants.CONTRIBUTOR_ROLE, positionName)); writer.addGroupAttribute(null, new Attribute(NetcdfConstants.CONTRIBUTOR_EMAIL, mail)); } return true; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
getServiceProvider__()
getServiceProvider__()
protected OwsServiceProvider getServiceProvider() throws OwsExceptionReport { return this.serviceMetadataRepository.getServiceProviderFactory(SosConstants.SOS).get(); }
protected OwsServiceProvider getServiceProvider() { return this.serviceMetadataRepository.getServiceProviderFactory(SosConstants.SOS).get(); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
getAttribute__(NetcdfFileWriter writer, String name)
getAttribute__(NetcdfFileWriter writer, String name)
protected Attribute getAttribute(NetcdfFileWriter writer, String name) { if (CollectionHelper.isNotEmpty(writer.getNetcdfFile().getRootGroup().getAttributes())) { for (Attribute attr : writer.getNetcdfFile().getRootGroup().getAttributes()) { if (name.equals(attr.getShortName())) { return attr; } } } return null; }
protected Attribute getAttribute(NetcdfFileWriter writer, String name) { return writer.findGlobalAttribute(name); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
getPrefixlessIdentifier__(String identifier)
getPrefixlessIdentifier__(String identifier)
protected String getPrefixlessIdentifier(String identifier) { String splitter = ""; if (identifier.startsWith(Constants.URN)) { splitter = Constants.COLON_STRING; } else if (identifier.startsWith(Constants.HTTP)) { splitter = Constants.SLASH_STRING; } if (identifier.lastIndexOf(splitter) < identifier.length()) { return identifier.substring(identifier.lastIndexOf(splitter) + 1); } return identifier; }
protected String getPrefixlessIdentifier(String identifier) { String splitter = ""; if (identifier.startsWith("urn")) { splitter = ":"; } else if (identifier.startsWith("http")) { splitter = "/"; } if (identifier.lastIndexOf(splitter) < identifier.length()) { return identifier.substring(identifier.lastIndexOf(splitter) + 1); } return identifier; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
coding/netcdf/coding/src/main/java/org/n52/sos/encode/AbstractNetcdfEncoder.java
AbstractNetcdfEncoder
AbstractNetcdfEncoder
getFilename__(AbstractSensorDataset sensorDataset)
getFilename__(AbstractSensorDataset sensorDataset)
protected String getFilename(AbstractSensorDataset sensorDataset) throws OwsExceptionReport { List<Time> times = Lists.newArrayList(sensorDataset.getTimes()); Collections.sort(times); DateTime firstTime = getDateTime(times.get(0)); DateTime lastTime = getDateTime(times.get(times.size() - 1)); StringBuffer pathBuffer = new StringBuffer(); pathBuffer.append(sensorDataset.getSensorIdentifier().replaceAll("http://", "").replaceAll("/", "_")); pathBuffer.append("_" + sensorDataset.getFeatureType().name().toLowerCase(Locale.ROOT)); pathBuffer.append("_" + makeDateSafe(firstTime)); // if (!(sensorDataset instanceof IStaticTimeDataset)) { pathBuffer.append("_" + makeDateSafe(lastTime)); // } pathBuffer.append("_" + Long.toString(java.lang.System.nanoTime()) + ".nc"); return pathBuffer.toString(); }
protected String getFilename(AbstractSensorDataset sensorDataset) throws EncodingException { List<Time> times = Lists.newArrayList(sensorDataset.getTimes()); Collections.sort(times); DateTime firstTime = getDateTime(times.get(0)); DateTime lastTime = getDateTime(times.get(times.size() - 1)); StringBuilder pathBuffer = new StringBuilder(); pathBuffer.append(sensorDataset.getSensorIdentifier().replaceAll("http://", "").replaceAll("/", "_")); pathBuffer.append("_").append(sensorDataset.getFeatureType().name().toLowerCase(Locale.ROOT)); pathBuffer.append("_").append(makeDateSafe(firstTime)); // if (!(sensorDataset instanceof IStaticTimeDataset)) { pathBuffer.append("_").append(makeDateSafe(lastTime)); // } pathBuffer.append("_").append(Long.toString(java.lang.System.nanoTime())).append(".nc"); return pathBuffer.toString(); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/aqd/split-and-merge/src/main/java/org/n52/sos/converter/AqdSplitMergeObservations.java
converter/split-and-merge/src/main/java/org/n52/sos/converter/AqdSplitMergeObservations.java
AqdSplitMergeObservations
AqdSplitMergeObservations
modifyRequest__(AbstractServiceRequest<?> request)
modifyRequest__(OwsServiceRequest request)
@Override public AbstractServiceRequest<?> modifyRequest(AbstractServiceRequest<?> request) throws OwsExceptionReport { if (request instanceof InsertObservationRequest) { // TODO } return request; }
@Override public OwsServiceRequest modifyRequest(OwsServiceRequest request) throws OwsExceptionReport { return request; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/aqd/split-and-merge/src/main/java/org/n52/sos/converter/AqdSplitMergeObservations.java
converter/split-and-merge/src/main/java/org/n52/sos/converter/AqdSplitMergeObservations.java
AqdSplitMergeObservations
AqdSplitMergeObservations
modifyResponse__(AbstractServiceRequest<?> request, AbstractServiceResponse response)
modifyResponse__(OwsServiceRequest request, OwsServiceResponse response)
@Override public AbstractServiceResponse modifyResponse(AbstractServiceRequest<?> request, AbstractServiceResponse response) throws OwsExceptionReport { if (response instanceof GetObservationResponse) { return mergeObservations((GetObservationResponse) response); } return response; }
@Override public OwsServiceResponse modifyResponse(OwsServiceRequest request, OwsServiceResponse response) throws OwsExceptionReport { if (response instanceof GetObservationResponse) { ObservationMergeIndicator indicator = ObservationMergeIndicator.sameObservationConstellation().withoutObservationType(); GetObservationResponse observationResponse = (GetObservationResponse) response; observationResponse.setMergeObservations(true); observationResponse .setObservationCollection(observationResponse.getObservationCollection().merge(indicator)); } return response; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
statistics/src/test/java/org/n52/sos/statistics/sos/handlers/requests/InsertObservationRequestHandlerTest.java
statistics/src/test/java/org/n52/sos/statistics/sos/handlers/requests/InsertObservationRequestHandlerTest.java
InsertObservationRequestHandlerTest
InsertObservationRequestHandlerTest
validateAllFields__()
validateAllFields__()
@SuppressWarnings("unchecked") @Test public void validateAllFields() { InsertObservationRequest request = new InsertObservationRequest(); request.addObservation(omObservation); request.setAssignedSensorId("sensorId"); request.setOfferings(Arrays.asList("of1")); Map<String, Object> map = handler.resolveAsMap(request); Assert.assertEquals("sensorId", map.get(SosDataMapping.IO_ASSIGNED_SENSORID.getName())); Assert.assertThat((List<String>) map.get(SosDataMapping.IO_OFFERINGS.getName()), CoreMatchers.hasItem("of1")); Assert.assertNotNull(map.get(SosDataMapping.IO_OBSERVATION.getName())); }
@SuppressWarnings("unchecked") @Test public void validateAllFields() throws OwsExceptionReport { InsertObservationRequest request = new InsertObservationRequest(); request.addObservation(omObservation); request.setAssignedSensorId(SENSOR_ID); request.setOfferings(Arrays.asList(OF_1)); Map<String, Object> map = handler.resolveAsMap(request); Assert.assertEquals(SENSOR_ID, map.get(SosDataMapping.IO_ASSIGNED_SENSORID.getName())); Assert.assertThat((List<String>) map.get(SosDataMapping.IO_OFFERINGS.getName()), CoreMatchers.hasItem(OF_1)); Assert.assertNotNull(map.get(SosDataMapping.IO_OBSERVATION.getName())); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/util/observation/ObservationConstellationOmObservationCreator.java
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/util/observation/ObservationConstellationOmObservationCreator.java
ObservationConstellationOmObservationCreator
ObservationConstellationOmObservationCreator
create__()
create__()
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public List<OmObservation> create() throws OwsExceptionReport, ConverterException { final List<OmObservation> observations = Lists.newLinkedList(); if (getObservationConstellation() != null && getFeatureIds() != null) { SosProcedureDescription procedure = createProcedure(getObservationConstellation().getProcedure().getIdentifier()); OmObservableProperty obsProp = createObservableProperty(getObservationConstellation().getObservableProperty()); obsProp.setUnit(queryUnit()); for (final String featureId : getFeatureIds()) { final AbstractFeature feature = createFeatureOfInterest(featureId); final OmObservationConstellation obsConst = getObservationConstellation(procedure, obsProp, feature); final OmObservation sosObservation = new OmObservation(); sosObservation.setNoDataValue(getNoDataValue()); sosObservation.setTokenSeparator(getTokenSeparator()); sosObservation.setTupleSeparator(getTupleSeparator()); sosObservation.setDecimalSeparator(getDecimalSeparator()); sosObservation.setObservationConstellation(obsConst); final NilTemplateValue value = new NilTemplateValue(); value.setUnit(obsProp.getUnit()); sosObservation.setValue(new SingleObservationValue(new TimeInstant(), value)); observations.add(sosObservation); } } return observations; }
@SuppressWarnings({ "unchecked", "rawtypes" }) @Override public ObservationStream create() throws OwsExceptionReport, ConverterException { final List<OmObservation> observations = Lists.newLinkedList(); if (getObservationConstellation() == null || getFeatureIds() == null) { return ObservationStream.empty(); } SosProcedureDescription procedure = createProcedure(getObservationConstellation().getProcedure().getIdentifier()); OmObservableProperty obsProp = createObservableProperty(getObservationConstellation().getObservableProperty()); obsProp.setUnit(queryUnit()); FeatureOfInterestDAO featureOfInterestDAO = new FeatureOfInterestDAO(getDaoFactory()); for (final String featureId : getFeatureIds()) { final AbstractFeature feature = createFeatureOfInterest(featureOfInterestDAO.get(featureId, getSession())); final OmObservationConstellation obsConst = getObservationConstellation(procedure, obsProp, feature); final OmObservation sosObservation = new OmObservation(); sosObservation.setNoDataValue(getNoDataValue()); sosObservation.setTokenSeparator(getTokenSeparator()); sosObservation.setTupleSeparator(getTupleSeparator()); sosObservation.setDecimalSeparator(getDecimalSeparator()); sosObservation.setObservationConstellation(obsConst); final NilTemplateValue value = new NilTemplateValue(); value.setUnit(obsProp.getUnit()); sosObservation.setValue(new SingleObservationValue(new TimeInstant(), value)); observations.add(sosObservation); } return ObservationStream.of(observations); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/util/observation/ObservationConstellationOmObservationCreator.java
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/util/observation/ObservationConstellationOmObservationCreator.java
ObservationConstellationOmObservationCreator
ObservationConstellationOmObservationCreator
getObservationConstellation__(SosProcedureDescription procedure, OmObservableProperty obsProp, AbstractFeature feature)
getObservationConstellation__(SosProcedureDescription<?> procedure, OmObservableProperty obsProp, AbstractFeature feature)
private OmObservationConstellation getObservationConstellation(SosProcedureDescription procedure, OmObservableProperty obsProp, AbstractFeature feature) { OmObservationConstellation obsConst = new OmObservationConstellation(procedure, obsProp, null, feature, null); /* get the offerings to find the templates */ if (obsConst.getOfferings() == null) { obsConst.setOfferings(Sets.newHashSet(getCache().getOfferingsForProcedure( obsConst.getProcedure().getIdentifier()))); } return obsConst; }
private OmObservationConstellation getObservationConstellation(SosProcedureDescription<?> procedure, OmObservableProperty obsProp, AbstractFeature feature) { OmObservationConstellation obsConst = new OmObservationConstellation(procedure, obsProp, null, feature, null); /* get the offerings to find the templates */ if (obsConst.getOfferings() == null) { obsConst.setOfferings( Sets.newHashSet(getCache().getOfferingsForProcedure(obsConst.getProcedure().getIdentifier()))); } return obsConst; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/util/observation/ObservationConstellationOmObservationCreator.java
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/util/observation/ObservationConstellationOmObservationCreator.java
ObservationConstellationOmObservationCreator
ObservationConstellationOmObservationCreator
queryUnit__()
queryUnit__()
private String queryUnit() { if (HibernateHelper.isNamedQuerySupported( AbstractHibernateProcedureDescriptionGeneratorSml.SQL_QUERY_GET_UNIT_FOR_OBSERVABLE_PROPERTY_PROCEDURE_OFFERING, getSession())) { Query namedQuery = getSession() .getNamedQuery( AbstractHibernateProcedureDescriptionGeneratorSml.SQL_QUERY_GET_UNIT_FOR_OBSERVABLE_PROPERTY_PROCEDURE_OFFERING); namedQuery.setParameter(ObservationConstellation.OBSERVABLE_PROPERTY, oc.getObservableProperty() .getIdentifier()); namedQuery.setParameter(ObservationConstellation.PROCEDURE, oc.getProcedure().getIdentifier()); namedQuery.setParameter(ObservationConstellation.OFFERING, oc.getOffering().getIdentifier()); LOGGER.debug( "QUERY queryUnit(observationConstellation) with NamedQuery: {}", AbstractHibernateProcedureDescriptionGeneratorSml.SQL_QUERY_GET_UNIT_FOR_OBSERVABLE_PROPERTY_PROCEDURE_OFFERING); return (String) namedQuery.uniqueResult(); } else if (HibernateHelper.isNamedQuerySupported( AbstractHibernateProcedureDescriptionGeneratorSml.SQL_QUERY_GET_UNIT_FOR_OBSERVABLE_PROPERTY_PROCEDURE, getSession())) { Query namedQuery = getSession() .getNamedQuery( AbstractHibernateProcedureDescriptionGeneratorSml.SQL_QUERY_GET_UNIT_FOR_OBSERVABLE_PROPERTY_PROCEDURE); namedQuery.setParameter(ObservationConstellation.OBSERVABLE_PROPERTY, oc.getObservableProperty() .getIdentifier()); namedQuery.setParameter(ObservationConstellation.PROCEDURE, oc.getProcedure().getIdentifier()); LOGGER.debug("QUERY queryUnit(observationConstellation) with NamedQuery: {}", AbstractHibernateProcedureDescriptionGeneratorSml.SQL_QUERY_GET_UNIT_FOR_OBSERVABLE_PROPERTY_PROCEDURE); return (String) namedQuery.uniqueResult(); } else if (HibernateHelper.isNamedQuerySupported( AbstractHibernateProcedureDescriptionGeneratorSml.SQL_QUERY_GET_UNIT_FOR_OBSERVABLE_PROPERTY, getSession())) { Query namedQuery = getSession().getNamedQuery( AbstractHibernateProcedureDescriptionGeneratorSml.SQL_QUERY_GET_UNIT_FOR_OBSERVABLE_PROPERTY); namedQuery.setParameter(ObservationConstellation.OBSERVABLE_PROPERTY, oc.getObservableProperty() .getIdentifier()); LOGGER.debug("QUERY queryUnit(observationConstellation) with NamedQuery: {}", AbstractHibernateProcedureDescriptionGeneratorSml.SQL_QUERY_GET_UNIT_FOR_OBSERVABLE_PROPERTY); return (String) namedQuery.uniqueResult(); } return null; }
private String queryUnit() { if (HibernateHelper.isNamedQuerySupported( AbstractHibernateProcedureDescriptionGeneratorSml. SQL_QUERY_GET_UNIT_FOR_OBSERVABLE_PROPERTY_PROCEDURE_OFFERING, getSession())) { Query namedQuery = getSession().getNamedQuery( AbstractHibernateProcedureDescriptionGeneratorSml. SQL_QUERY_GET_UNIT_FOR_OBSERVABLE_PROPERTY_PROCEDURE_OFFERING); namedQuery.setParameter(DatasetEntity.PROPERTY_PHENOMENON, oc.getObservableProperty().getIdentifier()); namedQuery.setParameter(DatasetEntity.PROPERTY_PROCEDURE, oc.getProcedure().getIdentifier()); namedQuery.setParameter(DatasetEntity.PROPERTY_OFFERING, oc.getOffering().getIdentifier()); LOGGER.debug(QUERY_LOG_TEMPLATE, AbstractHibernateProcedureDescriptionGeneratorSml. SQL_QUERY_GET_UNIT_FOR_OBSERVABLE_PROPERTY_PROCEDURE_OFFERING); return (String) namedQuery.uniqueResult(); } else if (HibernateHelper.isNamedQuerySupported( AbstractHibernateProcedureDescriptionGeneratorSml.SQL_QUERY_GET_UNIT_FOR_OBSERVABLE_PROPERTY_PROCEDURE, getSession())) { Query namedQuery = getSession().getNamedQuery( AbstractHibernateProcedureDescriptionGeneratorSml. SQL_QUERY_GET_UNIT_FOR_OBSERVABLE_PROPERTY_PROCEDURE); namedQuery.setParameter(DatasetEntity.PROPERTY_PHENOMENON, oc.getObservableProperty().getIdentifier()); namedQuery.setParameter(DatasetEntity.PROPERTY_PROCEDURE, oc.getProcedure().getIdentifier()); LOGGER.debug(QUERY_LOG_TEMPLATE, AbstractHibernateProcedureDescriptionGeneratorSml. SQL_QUERY_GET_UNIT_FOR_OBSERVABLE_PROPERTY_PROCEDURE); return (String) namedQuery.uniqueResult(); } else if (HibernateHelper.isNamedQuerySupported( AbstractHibernateProcedureDescriptionGeneratorSml.SQL_QUERY_GET_UNIT_FOR_OBSERVABLE_PROPERTY, getSession())) { Query namedQuery = getSession().getNamedQuery( AbstractHibernateProcedureDescriptionGeneratorSml.SQL_QUERY_GET_UNIT_FOR_OBSERVABLE_PROPERTY); namedQuery.setParameter(DatasetEntity.PROPERTY_PHENOMENON, oc.getObservableProperty().getIdentifier()); LOGGER.debug(QUERY_LOG_TEMPLATE, AbstractHibernateProcedureDescriptionGeneratorSml.SQL_QUERY_GET_UNIT_FOR_OBSERVABLE_PROPERTY); return (String) namedQuery.uniqueResult(); } return null; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/util/observation/ObservationConstellationOmObservationCreator.java
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/util/observation/ObservationConstellationOmObservationCreator.java
ObservationConstellationOmObservationCreator
ObservationConstellationOmObservationCreator
getObservationConstellation__()
getObservationConstellation__()
protected ObservationConstellation getObservationConstellation() { return oc; }
protected DatasetEntity getObservationConstellation() { return oc; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/series/SeriesObservationTimeDAO.java
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/series/SeriesObservationTimeDAO.java
SeriesObservationTimeDAO
SeriesObservationTimeDAO
getObservationTimeClass__()
getObservationTimeClass__()
@Override protected Class<?> getObservationTimeClass() { return TemporalReferencedSeriesObservation.class; }
@Override protected Class<?> getObservationTimeClass() { return DataEntity.class; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
setInspireId__(String inspireId)
setInspireId__(String inspireId)
public void setInspireId(String inspireId) { Validation.notNullOrEmpty("The INSPIRE id", inspireId); this.inspireId = inspireId; }
@Setting(InspireSettings.INSPIRE_ID_KEY) public void setInspireId(String inspireId) { Validation.notNullOrEmpty("The INSPIRE id", inspireId); this.inspireId = inspireId; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
getInspireId__()
getInspireId__()
public String getInspireId() { return inspireId; }
public String getInspireId() { return inspireId; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
setDefaultLanguage__(final String defaultLanguage)
setDefaultLanguage__(final String defaultLanguage)
@Setting(I18NSettings.I18N_DEFAULT_LANGUAGE) public void setDefaultLanguage(final String defaultLanguage) { Validation.notNullOrEmpty("Default language as three character string", defaultLanguage); this.defaultLanguage = InspireLanguageISO6392B.fromValue(defaultLanguage); }
@Setting(I18NSettings.I18N_DEFAULT_LANGUAGE) public void setDefaultLanguage(final String defaultLanguage) { Validation.notNullOrEmpty("Default language as three character string", defaultLanguage); this.defaultLanguage = InspireLanguageISO6392B.fromValue(defaultLanguage); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
getDefaultLanguage__()
getDefaultLanguage__()
public InspireLanguageISO6392B getDefaultLanguage() { return defaultLanguage; }
public InspireLanguageISO6392B getDefaultLanguage() { return defaultLanguage; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
getSupportedLanguages__()
getSupportedLanguages__()
public Set<InspireLanguageISO6392B> getSupportedLanguages() { if (supportedLanguages.size() != getCache().getSupportedLanguages().size()) { updateSupportedLanguages(); } return supportedLanguages; }
public Set<InspireLanguageISO6392B> getSupportedLanguages() { if (supportedLanguages.size() != getCache().getSupportedLanguages().size()) { updateSupportedLanguages(); } return supportedLanguages; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
updateSupportedLanguages__()
updateSupportedLanguages__()
private void updateSupportedLanguages() { supportedLanguages.clear(); supportedLanguages.add(getDefaultLanguage()); for (Locale language : getCache().getSupportedLanguages()) { try { supportedLanguages.add(InspireLanguageISO6392B.fromValue(language)); } catch (IllegalArgumentException iae) { LOGGER.error(String.format("The supported language %s is not valid for INSPIRE", language), iae); } } }
private void updateSupportedLanguages() { supportedLanguages.clear(); supportedLanguages.add(getDefaultLanguage()); for (Locale language : getCache().getSupportedLanguages()) { try { supportedLanguages.add(InspireLanguageISO6392B.fromValue(language)); } catch (IllegalArgumentException iae) { LOGGER.error(String.format("The supported language %s is not valid for INSPIRE", language), iae); } } }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
setEnabled__(boolean enabled)
setEnabled__(boolean enabled)
@Setting(InspireSettings.INSPIRE_ENABLED_KEY) public void setEnabled(boolean enabled) { this.enabled = enabled; }
@Setting(InspireSettings.INSPIRE_ENABLED_KEY) public void setEnabled(boolean enabled) { this.enabled = enabled; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
isEnabled__()
isEnabled__()
public boolean isEnabled() { return enabled; }
public boolean isEnabled() { return enabled; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
setFullExtendedCapabilities__(boolean fullExtendedCapabilities)
setFullExtendedCapabilities__(boolean fullExtendedCapabilities)
@Setting(InspireSettings.INSPIRE_FULL_EXTENDED_CAPABILITIES_KEY) public void setFullExtendedCapabilities(boolean fullExtendedCapabilities) { this.fullExtendedCapabilities = fullExtendedCapabilities; }
@Setting(InspireSettings.INSPIRE_FULL_EXTENDED_CAPABILITIES_KEY) public void setFullExtendedCapabilities(boolean fullExtendedCapabilities) { this.fullExtendedCapabilities = fullExtendedCapabilities; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
isFullExtendedCapabilities__()
isFullExtendedCapabilities__()
public boolean isFullExtendedCapabilities() { return fullExtendedCapabilities; }
public boolean isFullExtendedCapabilities() { return fullExtendedCapabilities; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
setMetadataUrlURL__(URI url)
setMetadataUrlURL__(URI url)
@Setting(InspireSettings.INSPIRE_METADATA_URL_URL_KEY) public void setMetadataUrlURL(URI url) { this.metadataUrlURL = url; }
@Setting(InspireSettings.INSPIRE_METADATA_URL_URL_KEY) public void setMetadataUrlURL(URI url) { this.metadataUrlURL = url; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
getMetadataUrlURL__()
getMetadataUrlURL__()
public URI getMetadataUrlURL() { return metadataUrlURL; }
public URI getMetadataUrlURL() { return metadataUrlURL; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
isSetMetadataUrlURL__()
isSetMetadataUrlURL__()
public boolean isSetMetadataUrlURL() { return getMetadataUrlURL() != null; }
public boolean isSetMetadataUrlURL() { return getMetadataUrlURL() != null; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
setMetadataUrlMediaType__(String mediaType)
setMetadataUrlMediaType__(String mediaType)
@Setting(InspireSettings.INSPIRE_METADATA_URL_MEDIA_TYPE_KEY) public void setMetadataUrlMediaType(String mediaType) { this.metadataUrlMediatType = mediaType; }
@Setting(InspireSettings.INSPIRE_METADATA_URL_MEDIA_TYPE_KEY) public void setMetadataUrlMediaType(String mediaType) { this.metadataUrlMediatType = mediaType; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
getMetadataUrlMediaType__()
getMetadataUrlMediaType__()
public String getMetadataUrlMediaType() { return metadataUrlMediatType; }
public String getMetadataUrlMediaType() { return metadataUrlMediatType; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
isSetMetadataUrlMediaType__()
isSetMetadataUrlMediaType__()
public boolean isSetMetadataUrlMediaType() { return StringHelper.isNotEmpty(getMetadataUrlMediaType()); }
public boolean isSetMetadataUrlMediaType() { return !Strings.isNullOrEmpty(getMetadataUrlMediaType()); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
setMetadataDate__(String time)
setMetadataDate__(String time)
@Setting(InspireSettings.INSPIRE_METADATA_DATE_KEY) public void setMetadataDate(String time) { this.metadataDate = time; }
@Setting(InspireSettings.INSPIRE_METADATA_DATE_KEY) public void setMetadataDate(String time) { this.metadataDate = time; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
getMetadataDate__()
getMetadataDate__()
public String getMetadataDate() { return metadataDate; }
public String getMetadataDate() { return metadataDate; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
setConformityTitle__(String title)
setConformityTitle__(String title)
@Setting(InspireSettings.INSPIRE_CONFORMITY_TITLE_KEY) public void setConformityTitle(String title) { this.conformityTitle = title; }
@Setting(InspireSettings.INSPIRE_CONFORMITY_TITLE_KEY) public void setConformityTitle(String title) { this.conformityTitle = title; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
getConformityTitle__()
getConformityTitle__()
public String getConformityTitle() { return conformityTitle; }
public String getConformityTitle() { return conformityTitle; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
setConformityDateOfCreation__(String time)
setConformityDateOfCreation__(String time)
@Setting(InspireSettings.INSPIRE_CONFORMITY_DATE_OF_CREATION_KEY) public void setConformityDateOfCreation(String time) { this.conformityDateOfCreation = time; }
@Setting(InspireSettings.INSPIRE_CONFORMITY_DATE_OF_CREATION_KEY) public void setConformityDateOfCreation(String time) { this.conformityDateOfCreation = time; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
getConformityDateOfCreation__()
getConformityDateOfCreation__()
public String getConformityDateOfCreation() { return conformityDateOfCreation; }
public String getConformityDateOfCreation() { return conformityDateOfCreation; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
setUseAuthority__(boolean useAuthority)
setUseAuthority__(boolean useAuthority)
@Setting(InspireSettings.INSPIRE_USE_AUTHORITY_KEY) public void setUseAuthority(boolean useAuthority) { this.useAuthority = useAuthority; }
@Setting(InspireSettings.INSPIRE_USE_AUTHORITY_KEY) public void setUseAuthority(boolean useAuthority) { this.useAuthority = useAuthority; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java
InspireHelper
InspireHelper
checkRequestedLanguage__(String language)
checkRequestedLanguage__(String language)
public InspireLanguageISO6392B checkRequestedLanguage(String language) { if (StringHelper.isNotEmpty(language)) { try { InspireLanguageISO6392B requestedLanguage = InspireLanguageISO6392B.fromValue(language); if (requestedLanguage != null && getSupportedLanguages().contains(requestedLanguage)) { return requestedLanguage; } } catch (Exception e) { LOGGER.debug("Requested language '{}' is invalid!", language); } } return getDefaultLanguage(); }
public InspireLanguageISO6392B checkRequestedLanguage(String language) { if (!Strings.isNullOrEmpty(language)) { try { InspireLanguageISO6392B requestedLanguage = InspireLanguageISO6392B.fromValue(language); if (requestedLanguage != null && getSupportedLanguages().contains(requestedLanguage)) { return requestedLanguage; } } catch (Exception e) { LOGGER.debug("Requested language '{}' is invalid!", language); } } return getDefaultLanguage(); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
webapp/src/test/java/org/n52/sos/service/it/functional/ContentNegotiationEndpointTest.java
webapp/src/test/java/org/n52/sos/service/it/functional/ContentNegotiationEndpointTest.java
ContentNegotiationEndpointTest
ContentNegotiationEndpointTest
isJsonBindingSupported__()
isJsonBindingSupported__()
private boolean isJsonBindingSupported() { return BindingRepository.getInstance().isBindingSupported(MediaTypes.APPLICATION_JSON); }
private boolean isJsonBindingSupported() { BindingRepository bindingRepository = new BindingRepository(); bindingRepository.setComponents(Optional.of(Sets.newHashSet(new JSONBinding()))); return bindingRepository.isBindingSupported(MediaTypes.APPLICATION_JSON); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
webapp/src/test/java/org/n52/sos/service/it/functional/ContentNegotiationEndpointTest.java
webapp/src/test/java/org/n52/sos/service/it/functional/ContentNegotiationEndpointTest.java
ContentNegotiationEndpointTest
ContentNegotiationEndpointTest
unknownMediaType__()
unknownMediaType__()
@Test public void unknownMediaType() { Response response = post(null) .contentType("some/thing") .accept(APPLICATION_XML) .entity(validPoxRequest()) .response(); errors.checkThat(response.getStatus(), is(HTTPStatus.UNSUPPORTED_MEDIA_TYPE .getCode())); }
@Test public void unknownMediaType() { Response response = post(null) .contentType("some/thing") .accept(APPLICATION_XML) .entity(validPoxRequest()) .response(); errors.checkThat(response.getStatus(), is(HTTPStatus.UNSUPPORTED_MEDIA_TYPE .getCode())); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
spring/install-controller/src/main/java/org/n52/sos/web/install/InstallDatasourceController.java
spring/install-controller/src/main/java/org/n52/sos/web/install/InstallDatasourceController.java
InstallDatasourceController
InstallDatasourceController
process__(Map<String, String> parameters, InstallationConfiguration c)
process__(Map<String, String> parameters, InstallationConfiguration c)
@Override protected void process(Map<String, String> parameters, InstallationConfiguration c) throws InstallationSettingsError { boolean overwriteTables; boolean alreadyExistent; boolean createTables; boolean forceUpdateTables; Datasource datasource; try { datasource = checkDatasource(parameters, c); overwriteTables = checkOverwrite(datasource, parameters, c); createTables = checkCreate(datasource, parameters, overwriteTables, c); forceUpdateTables = checkUpdate(datasource, parameters, overwriteTables, c); c.setDatabaseSettings(parseDatasourceSettings(datasource, parameters)); datasource.validateConnection(c.getDatabaseSettings()); datasource.validatePrerequisites(c.getDatabaseSettings()); if (datasource.needsSchema()) { alreadyExistent = datasource.checkIfSchemaExists(c.getDatabaseSettings()); if (createTables) { if (alreadyExistent) { if (!overwriteTables) { throw new InstallationSettingsError(c, ErrorMessages.TABLES_ALREADY_CREATED_BUT_SHOULD_NOT_OVERWRITE); } else { try { datasource.validateSchema(c.getDatabaseSettings()); } catch (ConfigurationError e) { throw new InstallationSettingsError(c, String.format( ErrorMessages.EXISTING_SCHEMA_DIFFERS_DROP_CREATE_SCHEMA, e.getMessage()), e); } } } if (!datasource.checkSchemaCreation(c.getDatabaseSettings())) { throw new InstallationSettingsError(c, String.format( ErrorMessages.COULD_NOT_CREATE_SOS_TABLES, "schema creation test table")); } } else if (!alreadyExistent) { throw new InstallationSettingsError(c, ErrorMessages.NO_TABLES_AND_SHOULD_NOT_CREATE); } else { try { datasource.validateSchema(c.getDatabaseSettings()); } catch (ConfigurationError e) { if (StringHelper.isNotEmpty(e.getMessage()) && (e.getMessage().contains(ErrorMessages.TO_CHECK_ERROR_MESSAGE_FOI_COL_IN_OBS_TAB) || e .getMessage().contains(ErrorMessages.TO_CHECK_ERROR_MESSAGE_SERIES_COL_IN_OBS_TAB))) { throw new InstallationSettingsError(c, String.format( ErrorMessages.EXISTING_SCHEMA_DIFFERS_UPDATE_SCHEMA, e.getMessage()), e); } else if (!forceUpdateTables) { throw new InstallationSettingsError(c, String.format( ErrorMessages.EXISTING_SCHEMA_REQUIRES_UPDATE, e.getMessage()), e); } } } } } catch (ConfigurationError e) { throw new InstallationSettingsError(c, e.getMessage(), e); } }
@Override protected void process(Map<String, String> parameters, InstallationConfiguration c) throws InstallationSettingsError { boolean overwriteTables; boolean alreadyExistent; boolean createTables; boolean forceUpdateTables; Datasource datasource; try { datasource = checkDatasource(parameters, c); overwriteTables = checkOverwrite(datasource, parameters, c); createTables = checkCreate(datasource, parameters, overwriteTables, c); forceUpdateTables = checkUpdate(datasource, parameters, overwriteTables, c); c.setDatabaseSettings(parseDatasourceSettings(datasource, parameters)); datasource.validateConnection(c.getDatabaseSettings()); datasource.validatePrerequisites(c.getDatabaseSettings()); if (datasource.needsSchema()) { alreadyExistent = datasource.checkIfSchemaExists(c.getDatabaseSettings()); if (createTables) { if (alreadyExistent) { if (!overwriteTables) { throw new InstallationSettingsError( c, ErrorMessages.TABLES_ALREADY_CREATED_BUT_SHOULD_NOT_OVERWRITE); } else { try { datasource.validateSchema(c.getDatabaseSettings()); } catch (ConfigurationError e) { throw new InstallationSettingsError(c, ErrorMessages.EXISTING_SCHEMA_DIFFERS_DROP_CREATE_SCHEMA, e); } } } if (!datasource.checkSchemaCreation(c.getDatabaseSettings())) { throw new InstallationSettingsError( c, String.format(ErrorMessages.COULD_NOT_CREATE_SOS_TABLES, "schema creation test table")); } } else if (!alreadyExistent) { throw new InstallationSettingsError(c, ErrorMessages.NO_TABLES_AND_SHOULD_NOT_CREATE); } else { try { datasource.validateSchema(c.getDatabaseSettings()); } catch (ConfigurationError e) { if (!Strings.isNullOrEmpty(e.getMessage()) && (e.getMessage().contains(ErrorMessages.TO_CHECK_ERROR_MESSAGE_FOI_COL_IN_OBS_TAB) || e .getMessage().contains(ErrorMessages.TO_CHECK_ERROR_MESSAGE_SERIES_COL_IN_OBS_TAB))) { throw new InstallationSettingsError( c, ErrorMessages.EXISTING_SCHEMA_DIFFERS_UPDATE_SCHEMA, e); } else if (!forceUpdateTables) { throw new InstallationSettingsError( c, String.format(ErrorMessages.EXISTING_SCHEMA_REQUIRES_UPDATE, e.getMessage()), e); } } } } } catch (ConfigurationError e) { throw new InstallationSettingsError(c, e.getMessage(), e); } }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
spring/install-controller/src/main/java/org/n52/sos/web/install/InstallDatasourceController.java
spring/install-controller/src/main/java/org/n52/sos/web/install/InstallDatasourceController.java
InstallDatasourceController
InstallDatasourceController
checkCreate__(Datasource datasource, Map<String, String> parameters, boolean overwriteTables, InstallationConfiguration settings)
checkCreate__(Datasource datasource, Map<String, String> parameters, boolean overwriteTables, InstallationConfiguration settings)
protected boolean checkCreate(Datasource datasource, Map<String, String> parameters, boolean overwriteTables, InstallationConfiguration settings) { boolean createTables = false; if (datasource.needsSchema()) { Boolean createTablesParameter = parseBoolean(parameters, InstallConstants.CREATE_TABLES_PARAMETER); if (createTablesParameter != null) { createTables = (overwriteTables) ? overwriteTables : createTablesParameter; } } parameters.remove(InstallConstants.CREATE_TABLES_PARAMETER); settings.setCreateSchema(createTables); return createTables; }
protected boolean checkCreate(Datasource datasource, Map<String, String> parameters, boolean overwriteTables, InstallationConfiguration settings) { boolean createTables = false; if (datasource.needsSchema()) { Boolean createTablesParameter = parseBoolean(parameters, InstallConstants.CREATE_TABLES_PARAMETER); if (createTablesParameter != null) { createTables = overwriteTables ? overwriteTables : createTablesParameter; } } parameters.remove(InstallConstants.CREATE_TABLES_PARAMETER); settings.setCreateSchema(createTables); return createTables; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
spring/install-controller/src/main/java/org/n52/sos/web/install/InstallDatasourceController.java
spring/install-controller/src/main/java/org/n52/sos/web/install/InstallDatasourceController.java
InstallDatasourceController
InstallDatasourceController
checkUpdate__(Datasource datasource, Map<String, String> parameters, boolean createTables, InstallationConfiguration settings)
checkUpdate__(Datasource datasource, Map<String, String> parameters, boolean createTables, InstallationConfiguration settings)
protected boolean checkUpdate(Datasource datasource, Map<String, String> parameters, boolean createTables, InstallationConfiguration settings) { boolean updateTables = false; if (datasource.needsSchema()) { Boolean updateTablesParameter = parseBoolean(parameters, InstallConstants.UPDATE_TABLES_PARAMETER); if (updateTablesParameter != null) { updateTables = (createTables) ? false : updateTablesParameter; } } parameters.remove(InstallConstants.UPDATE_TABLES_PARAMETER); settings.setForceUpdateSchema(updateTables); return updateTables; }
protected boolean checkUpdate(Datasource datasource, Map<String, String> parameters, boolean createTables, InstallationConfiguration settings) { boolean updateTables = false; if (datasource.needsSchema()) { Boolean updateTablesParameter = parseBoolean(parameters, InstallConstants.UPDATE_TABLES_PARAMETER); if (updateTablesParameter != null) { updateTables = createTables ? false : updateTablesParameter; } } parameters.remove(InstallConstants.UPDATE_TABLES_PARAMETER); settings.setForceUpdateSchema(updateTables); return updateTables; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
spring/install-controller/src/main/java/org/n52/sos/web/install/InstallDatasourceController.java
spring/install-controller/src/main/java/org/n52/sos/web/install/InstallDatasourceController.java
InstallDatasourceController
InstallDatasourceController
parseDatasourceSettings__(Datasource datasource, Map<String, String> parameters)
parseDatasourceSettings__(Datasource datasource, Map<String, String> parameters)
protected Map<String, Object> parseDatasourceSettings(Datasource datasource, Map<String, String> parameters) { Set<SettingDefinition<?, ?>> defs = datasource.getSettingDefinitions(); Map<String, Object> parsedSettings = new HashMap<>(parameters.size()); for (SettingDefinition<?, ?> def : defs) { SettingValue<?> newValue = this.settingValueFactory.newSettingValue(def, parameters.get(def.getKey())); parsedSettings.put(def.getKey(), newValue.getValue()); } return parsedSettings; }
protected Map<String, Object> parseDatasourceSettings(Datasource datasource, Map<String, String> parameters) { return datasource.getSettingDefinitions().stream().collect(toMap(def -> def.getKey(), def -> this.settingValueFactory.newSettingValue(def, parameters.get(def.getKey())).getValue())); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
spring/install-controller/src/main/java/org/n52/sos/web/install/InstallDatasourceController.java
spring/install-controller/src/main/java/org/n52/sos/web/install/InstallDatasourceController.java
InstallDatasourceController
InstallDatasourceController
getDatasources__()
getDatasources__()
protected Map<String, Datasource> getDatasources() { Map<String, Datasource> dialects = new HashMap<>(this.datasources.size()); for (Datasource dd : this.datasources) { dialects.put(dd.getDialectName(), dd); } return dialects; }
protected Map<String, Datasource> getDatasources() { return this.datasources.stream().collect(toMap(Datasource::getDialectName, Function.identity())); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
spring/install-controller/src/main/java/org/n52/sos/web/install/InstallDatasourceController.java
spring/install-controller/src/main/java/org/n52/sos/web/install/InstallDatasourceController.java
InstallDatasourceController
InstallDatasourceController
checkDatasource__(Map<String, String> parameters, InstallationConfiguration settings)
checkDatasource__(Map<String, String> parameters, InstallationConfiguration settings)
protected Datasource checkDatasource(Map<String, String> parameters, InstallationConfiguration settings) throws InstallationSettingsError { String datasourceName = parameters.get(InstallConstants.DATASOURCE_PARAMETER); parameters.remove(InstallConstants.DATASOURCE_PARAMETER); Datasource datasource = getDatasources().get(datasourceName); if (datasource == null) { throw new InstallationSettingsError(settings, String.format(ErrorMessages.INVALID_DATASOURCE, datasourceName)); } else { settings.setDatasource(datasource); } return datasource; }
protected Datasource checkDatasource(Map<String, String> parameters, InstallationConfiguration settings) throws InstallationSettingsError { String datasourceName = parameters.get(InstallConstants.DATASOURCE_PARAMETER); parameters.remove(InstallConstants.DATASOURCE_PARAMETER); Datasource datasource = getDatasources().get(datasourceName); if (datasource == null) { throw new InstallationSettingsError(settings, String.format(ErrorMessages.INVALID_DATASOURCE, datasourceName)); } else { settings.setDatasource(datasource); } return datasource; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
hibernate/dao/src/main/java/org/n52/sos/ds/hibernate/GetResultDAO.java
hibernate/handler/src/main/java/org/n52/sos/ds/hibernate/GetResultHandler.java
GetResultDAO
GetResultHandler
GetResultDAO__()
GetResultHandler__()
public GetResultDAO() { super(SosConstants.SOS); }
public GetResultHandler() { super(SosConstants.SOS); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
hibernate/dao/src/main/java/org/n52/sos/ds/hibernate/GetResultDAO.java
hibernate/handler/src/main/java/org/n52/sos/ds/hibernate/GetResultHandler.java
GetResultDAO
GetResultHandler
getResult__(final GetResultRequest request)
getResult__(final GetResultRequest request)
@Override public GetResultResponse getResult(final GetResultRequest request) throws OwsExceptionReport { Session session = null; try { session = sessionHolder.getSession(); final GetResultResponse response = new GetResultResponse(); response.setService(request.getService()); response.setVersion(request.getVersion()); final Set<String> featureIdentifier = QueryHelper.getFeatures(this.featureQueryHandler, request, session); final List<ResultTemplate> resultTemplates = queryResultTemplate(request, featureIdentifier, session); if (isNotEmpty(resultTemplates)) { final SosResultEncoding sosResultEncoding = new SosResultEncoding(resultTemplates.get(0).getResultEncoding()); final SosResultStructure sosResultStructure = new SosResultStructure(resultTemplates.get(0).getResultStructure()); final List<Observation<?>> observations; if (EntitiyHelper.getInstance().isSeriesObservationSupported()) { observations = querySeriesObservation(request, featureIdentifier, session); } else { observations = queryObservation(request, featureIdentifier, session); } response.setResultValues(ResultHandlingHelper.createResultValuesFromObservations(observations, sosResultEncoding, sosResultStructure)); } return response; } catch (final HibernateException he) { throw new NoApplicableCodeException().causedBy(he).withMessage("Error while querying result data!") .setStatus(INTERNAL_SERVER_ERROR); } finally { sessionHolder.returnSession(session); } }
@Override public GetResultResponse getResult(final GetResultRequest request) throws OwsExceptionReport { Session session = null; try { session = sessionHolder.getSession(); final GetResultResponse response = new GetResultResponse(); response.setService(request.getService()); response.setVersion(request.getVersion()); final Set<String> featureIdentifier = QueryHelper.getFeatures(this.featureQueryHandler, request, session); final List<ResultTemplateEntity> resultTemplates = queryResultTemplate(request, featureIdentifier, session); if (CollectionHelper.isNotEmpty(resultTemplates)) { final SosResultEncoding sosResultEncoding = createSosResultEncoding(resultTemplates.get(0).getEncoding()); final SosResultStructure sosResultStructure = createSosResultStructure(resultTemplates.get(0).getStructure()); final List<DataEntity<?>> observations; observations = querySeriesObservation(request, featureIdentifier, session); response.setResultValues(new ResultHandlingHelper(geometryHandler, daoFactory.getSweHelper()) .createResultValuesFromObservations(observations, sosResultEncoding, sosResultStructure, getProfileHandler().getActiveProfile().getResponseNoDataPlaceholder())); } return response; } catch (final HibernateException he) { throw new NoApplicableCodeException().causedBy(he).withMessage("Error while querying result data!") .setStatus(HTTPStatus.INTERNAL_SERVER_ERROR); } finally { sessionHolder.returnSession(session); } }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
hibernate/dao/src/main/java/org/n52/sos/ds/hibernate/GetResultDAO.java
hibernate/handler/src/main/java/org/n52/sos/ds/hibernate/GetResultHandler.java
GetResultDAO
GetResultHandler
getConformanceClasses__(String service, String version)
getConformanceClasses__(String service, String version)
@Override public Set<String> getConformanceClasses(String service, String version) { if(SosConstants.SOS.equals(service) && Sos2Constants.SERVICEVERSION.equals(version)) { try { Session session = sessionHolder.getSession(); if (ServiceConfiguration.getInstance().isStrictSpatialFilteringProfile()) { return Sets.newHashSet(ConformanceClasses.SOS_V2_SPATIAL_FILTERING_PROFILE); } sessionHolder.returnSession(session); } catch (OwsExceptionReport owse) { LOGGER.error("Error while getting Spatial Filtering Profile conformance class!", owse); } } return super.getConformanceClasses(service, version); }
@Override public Set<String> getConformanceClasses(String service, String version) { if (SosConstants.SOS.equals(service) && Sos2Constants.SERVICEVERSION.equals(version)) { try { Session session = sessionHolder.getSession(); if (strictSpatialFilteringProfile) { return Sets.newHashSet(ConformanceClasses.SOS_V2_SPATIAL_FILTERING_PROFILE); } sessionHolder.returnSession(session); } catch (OwsExceptionReport owse) { LOGGER.error("Error while getting Spatial Filtering Profile conformance class!", owse); } } return super.getConformanceClasses(service, version); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
hibernate/dao/src/main/java/org/n52/sos/ds/hibernate/GetResultDAO.java
hibernate/handler/src/main/java/org/n52/sos/ds/hibernate/GetResultHandler.java
GetResultDAO
GetResultHandler
querySeriesObservation__(GetResultRequest request, Collection<String> featureIdentifiers, Session session)
querySeriesObservation__(GetResultRequest request, Collection<String> featureIdentifiers, Session session)
@SuppressWarnings("unchecked") protected List<Observation<?>> querySeriesObservation(GetResultRequest request, Collection<String> featureIdentifiers, Session session) throws OwsExceptionReport { final Criteria c = createCriteriaFor(AbstractSeriesObservation.class, session); addSpatialFilteringProfileRestrictions(c, request, session); List<Series> series = DaoFactory.getInstance().getSeriesDAO().getSeries(request.getObservedProperty(), featureIdentifiers, session); if (CollectionHelper.isEmpty(series)) { return null; } else { c.add(Restrictions.in(AbstractSeriesObservation.SERIES, series)); } if (request.isSetOffering()) { addOfferingRestriction(c, request.getOffering()); } if (request.getTemporalFilter() != null && !request.getTemporalFilter().isEmpty()) { addTemporalFilter(c, request.getTemporalFilter()); } LOGGER.debug("QUERY queryObservation(request, featureIdentifiers): {}", HibernateHelper.getSqlString(c)); return c.list(); }
@SuppressWarnings("unchecked") protected List<DataEntity<?>> querySeriesObservation(GetResultRequest request, Collection<String> featureIdentifiers, Session session) throws OwsExceptionReport { final Criteria c = createCriteriaFor(DataEntity.class, session); addSpatialFilteringProfileRestrictions(c, request, session); addParentChildRestriction(c); List<DatasetEntity> series = daoFactory.getSeriesDAO().getSeries(request, featureIdentifiers, session); if (CollectionHelper.isEmpty(series)) { return null; } else { c.add(Restrictions.in(DataEntity.PROPERTY_DATASET, series)); } if (request.getTemporalFilter() != null && !request.getTemporalFilter().isEmpty()) { addTemporalFilter(c, request.getTemporalFilter()); } LOGGER.debug("QUERY queryObservation(request, featureIdentifiers): {}", HibernateHelper.getSqlString(c)); return c.list(); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
hibernate/dao/src/main/java/org/n52/sos/ds/hibernate/GetResultDAO.java
hibernate/handler/src/main/java/org/n52/sos/ds/hibernate/GetResultHandler.java
GetResultDAO
GetResultHandler
queryResultTemplate__(final GetResultRequest request, final Set<String> featureIdentifier, final Session session)
queryResultTemplate__(final GetResultRequest request, final Set<String> featureIdentifier, final Session session)
private List<ResultTemplate> queryResultTemplate(final GetResultRequest request, final Set<String> featureIdentifier, final Session session) { final List<ResultTemplate> resultTemplates = new ResultTemplateDAO().getResultTemplateObject(request.getOffering(), request.getObservedProperty(), featureIdentifier, session); return resultTemplates; }
private List<ResultTemplateEntity> queryResultTemplate(final GetResultRequest request, final Set<String> featureIdentifier, final Session session) { final List<ResultTemplateEntity> resultTemplates = daoFactory.getResultTemplateDAO().getResultTemplateObject( request.getOffering(), request.getObservedProperty(), featureIdentifier, session); return resultTemplates; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
hibernate/dao/src/main/java/org/n52/sos/ds/hibernate/GetResultDAO.java
hibernate/handler/src/main/java/org/n52/sos/ds/hibernate/GetResultHandler.java
GetResultDAO
GetResultHandler
addTemporalFilter__(Criteria c, List<TemporalFilter> temporalFilter)
addTemporalFilter__(Criteria c, List<TemporalFilter> temporalFilter)
private void addTemporalFilter(Criteria c, List<TemporalFilter> temporalFilter) throws UnsupportedTimeException, UnsupportedValueReferenceException, UnsupportedOperatorException { c.add(TemporalRestrictions.filter(temporalFilter)); }
private void addTemporalFilter(Criteria c, List<TemporalFilter> temporalFilter) throws UnsupportedTimeException, UnsupportedValueReferenceException, UnsupportedOperatorException { c.add(SosTemporalRestrictions.filter(temporalFilter)); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
hibernate/dao/src/main/java/org/n52/sos/ds/hibernate/GetResultDAO.java
hibernate/handler/src/main/java/org/n52/sos/ds/hibernate/GetResultHandler.java
GetResultDAO
GetResultHandler
createCriteriaFor__(Class clazz, Session session)
createCriteriaFor__(Class clazz, Session session)
@SuppressWarnings("rawtypes") private Criteria createCriteriaFor(Class clazz, Session session) { return session.createCriteria(clazz).setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY) .add(Restrictions.eq(AbstractLegacyObservation.DELETED, false)) .addOrder(Order.asc(AbstractLegacyObservation.PHENOMENON_TIME_START)); }
@SuppressWarnings("rawtypes") private Criteria createCriteriaFor(Class clazz, Session session) { return session.createCriteria(clazz).setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY) .add(Restrictions.eq(DataEntity.PROPERTY_DELETED, false)) .addOrder(Order.asc(DataEntity.PROPERTY_SAMPLING_TIME_START)); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
hibernate/dao/src/main/java/org/n52/sos/ds/hibernate/GetResultDAO.java
hibernate/handler/src/main/java/org/n52/sos/ds/hibernate/GetResultHandler.java
GetResultDAO
GetResultHandler
addSpatialFilteringProfileRestrictions__(Criteria criteria, GetResultRequest request, Session session)
addSpatialFilteringProfileRestrictions__(Criteria criteria, GetResultRequest request, Session session)
private void addSpatialFilteringProfileRestrictions(Criteria criteria, GetResultRequest request, Session session) throws OwsExceptionReport { if (request.hasSpatialFilteringProfileSpatialFilter()) { criteria.add(SpatialRestrictions.filter( AbstractObservation.SAMPLING_GEOMETRY, request.getSpatialFilter().getOperator(), GeometryHandler.getInstance().switchCoordinateAxisFromToDatasourceIfNeeded( request.getSpatialFilter().getGeometry()))); } }
private void addSpatialFilteringProfileRestrictions(Criteria criteria, GetResultRequest request, Session session) throws OwsExceptionReport { if (request.hasSpatialFilteringProfileSpatialFilter()) { criteria.add(SpatialRestrictions.filter(DataEntity.PROPERTY_GEOMETRY_ENTITY, request.getSpatialFilter().getOperator(), geometryHandler.switchCoordinateAxisFromToDatasourceIfNeeded( request.getSpatialFilter().getGeometry().toGeometry()))); } }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
converter/split-and-merge/src/main/java/org/n52/sos/converter/SplitMergeObservations.java
converter/split-and-merge/src/main/java/org/n52/sos/converter/SplitMergeObservations.java
SplitMergeObservations
SplitMergeObservations
splitObservations__(InsertObservationRequest request)
splitObservations__(InsertObservationRequest request)
private void splitObservations(InsertObservationRequest request) throws OwsExceptionReport { if (request.isSetExtensionSplitDataArrayIntoObservations()) { splitDataArrayIntoObservations(request); } }
private void splitObservations(InsertObservationRequest request) throws OwsExceptionReport { if (request.isSetExtensionSplitDataArrayIntoObservations()) { splitDataArrayIntoObservations(request); } }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
converter/split-and-merge/src/main/java/org/n52/sos/converter/SplitMergeObservations.java
converter/split-and-merge/src/main/java/org/n52/sos/converter/SplitMergeObservations.java
SplitMergeObservations
SplitMergeObservations
splitDataArrayIntoObservations__(final InsertObservationRequest request)
splitDataArrayIntoObservations__(final InsertObservationRequest request)
private void splitDataArrayIntoObservations(final InsertObservationRequest request) throws OwsExceptionReport { LOGGER.debug("Start splitting observations. Count: {}", request.getObservations().size()); final Collection<OmObservation> finalObservationCollection = Sets.newHashSet(); for (final OmObservation observation : request.getObservations()) { if (isSweArrayObservation(observation)) { LOGGER.debug("Found SweArrayObservation to split."); final SweDataArrayValue sweDataArrayValue = (SweDataArrayValue) observation.getValue().getValue(); final OmObservationConstellation observationConstellation = observation.getObservationConstellation(); int counter = 0; final int resultTimeIndex = getResultTimeIndex((SweDataRecord) sweDataArrayValue.getValue().getElementType()); final int phenomenonTimeIndex = getPhenomenonTimeIndex((SweDataRecord) sweDataArrayValue.getValue().getElementType()); final int resultValueIndex = getResultValueIndex((SweDataRecord) sweDataArrayValue.getValue().getElementType(), observationConstellation.getObservableProperty()); observationConstellation.setObservationType(getObservationTypeFromElementType( (SweDataRecord) sweDataArrayValue.getValue().getElementType(), observationConstellation.getObservableProperty())); // split into single observation for (final List<String> block : sweDataArrayValue.getValue().getValues()) { LOGGER.debug("Processing block {}/{}", ++counter, sweDataArrayValue.getValue().getValues().size()); final OmObservation newObservation = new OmObservation(); newObservation.setObservationConstellation(observationConstellation); // identifier if (observation.isSetIdentifier()) { final CodeWithAuthority identifier = observation.getIdentifierCodeWithAuthority(); identifier.setValue(identifier.getValue() + counter); newObservation.setIdentifier(identifier); } // phen time Time phenomenonTime; if (phenomenonTimeIndex == -1) { phenomenonTime = observation.getPhenomenonTime(); } else { phenomenonTime = DateTimeHelper.parseIsoString2DateTime2Time(block.get(phenomenonTimeIndex)); } // result time if (resultTimeIndex == -1) { // use phenomenon time if outer observation's resultTime // value // or nilReason is "template" if ((!observation.isSetResultTime() || observation.isTemplateResultTime()) && phenomenonTime instanceof TimeInstant) { newObservation.setResultTime((TimeInstant) phenomenonTime); } else { newObservation.setResultTime(observation.getResultTime()); } } else { newObservation.setResultTime( new TimeInstant(DateTimeHelper.parseIsoString2DateTime(block.get(resultTimeIndex)))); } if (observation.isSetParameter()) { newObservation.setParameter(observation.getParameter()); } // value final ObservationValue<?> value = createObservationResultValue( observationConstellation.getObservationType(), block.get(resultValueIndex), phenomenonTime, ((SweDataRecord) sweDataArrayValue.getValue().getElementType()).getFields() .get(resultValueIndex)); newObservation.setValue(value); finalObservationCollection.add(newObservation); } } else { LOGGER.debug("Found non splittable observation"); finalObservationCollection.add(observation); } } request.setObservation(Lists.newArrayList(finalObservationCollection)); }
private void splitDataArrayIntoObservations(final InsertObservationRequest request) throws OwsExceptionReport { LOGGER.debug("Start splitting observations. Count: {}", request.getObservations().size()); final Collection<OmObservation> finalObservationCollection = Sets.newHashSet(); for (final OmObservation observation : request.getObservations()) { if (isSweArrayObservation(observation)) { LOGGER.debug("Found SweArrayObservation to split."); final SweDataArrayValue sweDataArrayValue = (SweDataArrayValue) observation.getValue().getValue(); final OmObservationConstellation observationConstellation = observation.getObservationConstellation(); int counter = 0; final int resultTimeIndex = getResultTimeIndex((SweDataRecord) sweDataArrayValue.getValue().getElementType()); final int phenomenonTimeIndex = getPhenomenonTimeIndex((SweDataRecord) sweDataArrayValue.getValue().getElementType()); final int resultValueIndex = getResultValueIndex((SweDataRecord) sweDataArrayValue.getValue().getElementType(), observationConstellation.getObservableProperty()); observationConstellation.setObservationType(getObservationTypeFromElementType( (SweDataRecord) sweDataArrayValue.getValue().getElementType(), observationConstellation.getObservableProperty())); // split into single observation CodeWithAuthority metaIdentifier = null; if (observation.isSetIdentifier()) { metaIdentifier = observation.getIdentifierCodeWithAuthority(); } for (final List<String> block : sweDataArrayValue.getValue().getValues()) { LOGGER.trace("Processing block {}/{}", ++counter, sweDataArrayValue.getValue().getValues().size()); final OmObservation newObservation = new OmObservation(); newObservation.setObservationConstellation(observationConstellation); // identifier if (metaIdentifier != null) { newObservation.setIdentifier(new CodeWithAuthority(metaIdentifier.getValue() + counter, metaIdentifier.getCodeSpace())); } // phen time Time phenomenonTime; if (phenomenonTimeIndex == -1) { phenomenonTime = observation.getPhenomenonTime(); } else { phenomenonTime = DateTimeHelper.parseIsoString2DateTime2Time(block.get(phenomenonTimeIndex)); } // result time if (resultTimeIndex == -1) { // use phenomenon time if outer observation's resultTime // value // or nilReason is "template" if ((!observation.isSetResultTime() || observation.isTemplateResultTime()) && phenomenonTime instanceof TimeInstant) { newObservation.setResultTime((TimeInstant) phenomenonTime); } else { newObservation.setResultTime(observation.getResultTime()); } } else { newObservation.setResultTime( new TimeInstant(DateTimeHelper.parseIsoString2DateTime(block.get(resultTimeIndex)))); } if (observation.isSetParameter()) { newObservation.setParameter(observation.getParameter()); } // value final ObservationValue<?> value = createObservationResultValue( observationConstellation.getObservationType(), block.get(resultValueIndex), phenomenonTime, ((SweDataRecord) sweDataArrayValue.getValue().getElementType()).getFields() .get(resultValueIndex)); newObservation.setValue(value); finalObservationCollection.add(newObservation); } } else { LOGGER.debug("Found non splittable observation"); finalObservationCollection.add(observation); } } request.setObservation(Lists.newArrayList(finalObservationCollection)); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
converter/split-and-merge/src/main/java/org/n52/sos/converter/SplitMergeObservations.java
converter/split-and-merge/src/main/java/org/n52/sos/converter/SplitMergeObservations.java
SplitMergeObservations
SplitMergeObservations
createObservationResultValue__(final String observationType, final String valueString, final Time phenomenonTime, final SweField resultDefinitionField)
createObservationResultValue__(String observationType, String valueString, Time phenomenonTime, SweField resultDefinitionField)
private ObservationValue<?> createObservationResultValue(final String observationType, final String valueString, final Time phenomenonTime, final SweField resultDefinitionField) throws OwsExceptionReport { ObservationValue<?> value = null; if (observationType.equalsIgnoreCase(OmConstants.OBS_TYPE_TRUTH_OBSERVATION)) { value = new SingleObservationValue<Boolean>(new BooleanValue(Boolean.parseBoolean(valueString))); } else if (observationType.equalsIgnoreCase(OmConstants.OBS_TYPE_COUNT_OBSERVATION)) { value = new SingleObservationValue<Integer>(new CountValue(Integer.parseInt(valueString))); } else if (observationType.equalsIgnoreCase(OmConstants.OBS_TYPE_MEASUREMENT)) { final QuantityValue quantity = new QuantityValue(Double.parseDouble(valueString)); quantity.setUnit(getUom(resultDefinitionField)); value = new SingleObservationValue<Double>(quantity); } else if (observationType.equalsIgnoreCase(OmConstants.OBS_TYPE_CATEGORY_OBSERVATION)) { final CategoryValue cat = new CategoryValue(valueString); cat.setUnit(getUom(resultDefinitionField)); value = new SingleObservationValue<String>(cat); } else if (observationType.equalsIgnoreCase(OmConstants.OBS_TYPE_TEXT_OBSERVATION)) { value = new SingleObservationValue<String>(new TextValue(valueString)); } // TODO Check for missing types if (value != null) { value.setPhenomenonTime(phenomenonTime); } else { throw new NoApplicableCodeException().withMessage("Observation type '{}' not supported.", observationType) .setStatus(HTTPStatus.BAD_REQUEST); } return value; }
private ObservationValue<?> createObservationResultValue(String observationType, String valueString, Time phenomenonTime, SweField resultDefinitionField) throws OwsExceptionReport { ObservationValue<?> value = null; if (observationType.equalsIgnoreCase(OmConstants.OBS_TYPE_TRUTH_OBSERVATION)) { value = new SingleObservationValue<>(new BooleanValue(Boolean.parseBoolean(valueString))); } else if (observationType.equalsIgnoreCase(OmConstants.OBS_TYPE_COUNT_OBSERVATION)) { value = new SingleObservationValue<>(new CountValue(Integer.parseInt(valueString))); } else if (observationType.equalsIgnoreCase(OmConstants.OBS_TYPE_MEASUREMENT)) { final QuantityValue quantity = new QuantityValue(Double.parseDouble(valueString)); quantity.setUnit(getUom(resultDefinitionField)); value = new SingleObservationValue<>(quantity); } else if (observationType.equalsIgnoreCase(OmConstants.OBS_TYPE_CATEGORY_OBSERVATION)) { final CategoryValue cat = new CategoryValue(valueString); cat.setUnit(getUom(resultDefinitionField)); value = new SingleObservationValue<>(cat); } else if (observationType.equalsIgnoreCase(OmConstants.OBS_TYPE_TEXT_OBSERVATION)) { value = new SingleObservationValue<>(new TextValue(valueString)); } // TODO Check for missing types if (value != null) { value.setPhenomenonTime(phenomenonTime); } else { throw new NoApplicableCodeException().withMessage("Observation type '{}' not supported.", observationType) .setStatus(HTTPStatus.BAD_REQUEST); } return value; }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
converter/split-and-merge/src/main/java/org/n52/sos/converter/SplitMergeObservations.java
converter/split-and-merge/src/main/java/org/n52/sos/converter/SplitMergeObservations.java
SplitMergeObservations
SplitMergeObservations
getUom__(final SweField resultDefinitionField)
getUom__(SweField resultDefinitionField)
private String getUom(final SweField resultDefinitionField) { return ((SweAbstractUomType<?>) resultDefinitionField.getElement()).getUom(); }
private String getUom(SweField resultDefinitionField) { return ((SweAbstractUomType<?>) resultDefinitionField.getElement()).getUom(); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
converter/split-and-merge/src/main/java/org/n52/sos/converter/SplitMergeObservations.java
converter/split-and-merge/src/main/java/org/n52/sos/converter/SplitMergeObservations.java
SplitMergeObservations
SplitMergeObservations
getResultValueIndex__(final SweDataRecord elementTypeDataRecord, final AbstractPhenomenon observableProperty)
getResultValueIndex__(SweDataRecord elementTypeDataRecord, AbstractPhenomenon observableProperty)
private int getResultValueIndex(final SweDataRecord elementTypeDataRecord, final AbstractPhenomenon observableProperty) { return elementTypeDataRecord.getFieldIndexByIdentifier(observableProperty.getIdentifier()); }
private int getResultValueIndex(SweDataRecord elementTypeDataRecord, AbstractPhenomenon observableProperty) { return elementTypeDataRecord.getFieldIndexByIdentifier(observableProperty.getIdentifier()); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
converter/split-and-merge/src/main/java/org/n52/sos/converter/SplitMergeObservations.java
converter/split-and-merge/src/main/java/org/n52/sos/converter/SplitMergeObservations.java
SplitMergeObservations
SplitMergeObservations
getPhenomenonTimeIndex__(final SweDataRecord elementTypeDataRecord)
getPhenomenonTimeIndex__(SweDataRecord elementTypeDataRecord)
private int getPhenomenonTimeIndex(final SweDataRecord elementTypeDataRecord) { return elementTypeDataRecord.getFieldIndexByIdentifier(OmConstants.PHENOMENON_TIME); }
private int getPhenomenonTimeIndex(SweDataRecord elementTypeDataRecord) { return elementTypeDataRecord.getFieldIndexByIdentifier(OmConstants.PHENOMENON_TIME); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
converter/split-and-merge/src/main/java/org/n52/sos/converter/SplitMergeObservations.java
converter/split-and-merge/src/main/java/org/n52/sos/converter/SplitMergeObservations.java
SplitMergeObservations
SplitMergeObservations
getResultTimeIndex__(final SweDataRecord elementTypeDataRecord)
getResultTimeIndex__(SweDataRecord elementTypeDataRecord)
private int getResultTimeIndex(final SweDataRecord elementTypeDataRecord) { return elementTypeDataRecord.getFieldIndexByIdentifier(OmConstants.PHEN_SAMPLING_TIME); }
private int getResultTimeIndex(SweDataRecord elementTypeDataRecord) { return elementTypeDataRecord.getFieldIndexByIdentifier(OmConstants.PHEN_SAMPLING_TIME); }
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
converter/split-and-merge/src/main/java/org/n52/sos/converter/SplitMergeObservations.java
converter/split-and-merge/src/main/java/org/n52/sos/converter/SplitMergeObservations.java
SplitMergeObservations
SplitMergeObservations
getObservationTypeFromElementType__(final SweDataRecord elementTypeDataRecord, final AbstractPhenomenon observableProperty)
getObservationTypeFromElementType__(SweDataRecord elementTypeDataRecord, AbstractPhenomenon observableProperty)
private String getObservationTypeFromElementType(final SweDataRecord elementTypeDataRecord, final AbstractPhenomenon observableProperty) throws OwsExceptionReport { for (final SweField sweField : elementTypeDataRecord.getFields()) { if (sweField.getElement() != null && sweField.getElement().isSetDefinition() && sweField.getElement().getDefinition().equalsIgnoreCase(observableProperty.getIdentifier())) { return OMHelper.getObservationTypeFrom(sweField.getElement()); } } throw new NoApplicableCodeException().withMessage( "Not able to derive observation type from elementType element '{}' for observable property '{}'.", elementTypeDataRecord, observableProperty).setStatus(HTTPStatus.BAD_REQUEST); }
private String getObservationTypeFromElementType(SweDataRecord elementTypeDataRecord, AbstractPhenomenon observableProperty) throws OwsExceptionReport { for (final SweField sweField : elementTypeDataRecord.getFields()) { if (sweField.getElement() != null && sweField.getElement().isSetDefinition() && sweField.getElement().getDefinition().equalsIgnoreCase(observableProperty.getIdentifier())) { return OMHelper.getObservationTypeFrom(sweField.getElement()); } } throw new NoApplicableCodeException().withMessage( "Not able to derive observation type from elementType element '{}' for observable property '{}'.", elementTypeDataRecord, observableProperty).setStatus(HTTPStatus.BAD_REQUEST); }