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
|
core/api/src/main/java/org/n52/sos/ogc/om/values/ComplexValue.java
|
core/api/src/main/java/org/n52/sos/ogc/om/values/SosXmlValue.java
|
ComplexValue
|
SosXmlValue
|
setUnit__(String unit)
|
setUnit__(String unit)
|
@Override
public void setUnit(String unit) {
this.unit = unit;
}
|
@Override
public void setUnit(String unit) {
this.unit = new UoM(unit);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/api/src/main/java/org/n52/sos/ogc/om/values/ComplexValue.java
|
core/api/src/main/java/org/n52/sos/ogc/om/values/SosXmlValue.java
|
ComplexValue
|
SosXmlValue
|
getUnit__()
|
getUnit__()
|
@Override
public String getUnit() {
return this.unit;
}
|
@Override
public String getUnit() {
if (isSetUnit()) {
return unit.getUom();
}
return null;
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/api/src/main/java/org/n52/sos/ogc/om/values/ComplexValue.java
|
core/api/src/main/java/org/n52/sos/ogc/om/values/SosXmlValue.java
|
ComplexValue
|
SosXmlValue
|
isSetValue__()
|
isSetValue__()
|
@Override
public boolean isSetValue() {
return this.value != null;
}
|
@Override
public boolean isSetValue() {
return this.xml != null;
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/api/src/main/java/org/n52/sos/ogc/om/values/ComplexValue.java
|
core/api/src/main/java/org/n52/sos/ogc/om/values/SosXmlValue.java
|
ComplexValue
|
SosXmlValue
|
isSetUnit__()
|
isSetUnit__()
|
@Override
public boolean isSetUnit() {
return this.unit != null && !this.unit.isEmpty();
}
|
@Override
public boolean isSetUnit() {
return getUnitObject() != null && !getUnitObject().isEmpty();
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/api/src/main/java/org/n52/sos/ogc/om/values/ComplexValue.java
|
core/api/src/main/java/org/n52/sos/ogc/om/values/SosXmlValue.java
|
ComplexValue
|
SosXmlValue
|
hashCode__()
|
hashCode__()
|
@Override
public int hashCode() {
return Objects.hashCode(this.value, this.unit);
}
|
@Override
public int hashCode() {
int hash = 7;
hash = 41 * hash + Objects.hashCode(this.xml);
hash = 41 * hash + Objects.hashCode(this.unit);
return hash;
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/api/src/main/java/org/n52/sos/ogc/om/values/ComplexValue.java
|
core/api/src/main/java/org/n52/sos/ogc/om/values/SosXmlValue.java
|
ComplexValue
|
SosXmlValue
|
equals__(Object obj)
|
equals__(Object obj)
|
@Override
public boolean equals(Object obj) {
if (obj instanceof ComplexValue) {
ComplexValue that = (ComplexValue) obj;
return Objects.equal(this.getValue(), that.getValue()) &&
Objects.equal(this.getUnit(), that.getUnit());
}
return false;
}
|
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final SosXmlValue other = (SosXmlValue) obj;
if (!Objects.equals(this.unit, other.unit)) {
return false;
}
if (!Objects.equals(this.xml, other.xml)) {
return false;
}
return true;
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/api/src/main/java/org/n52/sos/ogc/om/values/ComplexValue.java
|
core/api/src/main/java/org/n52/sos/ogc/om/values/SosXmlValue.java
|
ComplexValue
|
SosXmlValue
|
accept__(ValueVisitor<X> visitor)
|
accept__(ValueVisitor<X, E> visitor)
|
@Override
public <X> X accept(ValueVisitor<X> visitor)
throws OwsExceptionReport {
return visitor.visit(this);
}
|
@Override
public <X, E extends Exception> X accept(ValueVisitor<X, E> visitor) throws E {
return visitor.visit(this);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
WriteableCacheTest
|
WriteableCacheTest
|
init__()
|
init__()
|
@Before
public void init() {
cache = new InMemoryCacheImpl();
cache.addFeatureOfInterestIdentifierHumanReadableName(feature, featureName);
cache.addProcedureIdentifierHumanReadableName(procedure, procedureName);
cache.addObservablePropertyIdentifierHumanReadableName(observedProperty, observedPropertyName);
cache.addOfferingIdentifierHumanReadableName(offering, offeringName);
}
|
@Before
public void init() {
cache = new InMemoryCacheImpl();
cache.addFeatureOfInterestIdentifierHumanReadableName(FEATURE, FEATURE_NAME);
cache.addProcedureIdentifierHumanReadableName(PROCEDURE, PROCEDURE_NAME);
cache.addObservablePropertyIdentifierHumanReadableName(OBSERVED_PROPERTY, OBSERVED_PROPERTY_NAME);
cache.addOfferingIdentifierHumanReadableName(OFFERING, OFFERING_NAME);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
WriteableCacheTest
|
WriteableCacheTest
|
test_same_identifier_name_feature__()
|
test_same_identifier_name_feature__()
|
@Test
public void test_same_identifier_name_feature() {
cache.addFeatureOfInterestIdentifierHumanReadableName(feature, featureName);
}
|
@Test
public void test_same_identifier_name_feature() {
cache.addFeatureOfInterestIdentifierHumanReadableName(FEATURE, FEATURE_NAME);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
WriteableCacheTest
|
WriteableCacheTest
|
test_same_identifier_other_name_feature__()
|
test_same_identifier_other_name_feature__()
|
@Test
public void test_same_identifier_other_name_feature() {
cache.addFeatureOfInterestIdentifierHumanReadableName(feature, featureNameOther);
}
|
@Test
public void test_same_identifier_other_name_feature() {
cache.addFeatureOfInterestIdentifierHumanReadableName(FEATURE, FEATURE_NAME_OTHER);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
WriteableCacheTest
|
WriteableCacheTest
|
test_other_identifier_same_name_feature__()
|
test_other_identifier_same_name_feature__()
|
@Test
public void test_other_identifier_same_name_feature() {
cache.addFeatureOfInterestIdentifierHumanReadableName(featureOther, featureName);
}
|
@Test
public void test_other_identifier_same_name_feature() {
cache.addFeatureOfInterestIdentifierHumanReadableName(FEATUREA_OTHER, FEATURE_NAME);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
WriteableCacheTest
|
WriteableCacheTest
|
test_other_identifier_name_feature__()
|
test_other_identifier_name_feature__()
|
@Test
public void test_other_identifier_name_feature() {
cache.addFeatureOfInterestIdentifierHumanReadableName(featureOther, featureNameOther);
}
|
@Test
public void test_other_identifier_name_feature() {
cache.addFeatureOfInterestIdentifierHumanReadableName(FEATUREA_OTHER, FEATURE_NAME_OTHER);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
WriteableCacheTest
|
WriteableCacheTest
|
test_same_identifier_name_procedure__()
|
test_same_identifier_name_procedure__()
|
@Test
public void test_same_identifier_name_procedure() {
cache.addProcedureIdentifierHumanReadableName(procedure, procedureName);
}
|
@Test
public void test_same_identifier_name_procedure() {
cache.addProcedureIdentifierHumanReadableName(PROCEDURE, PROCEDURE_NAME);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
WriteableCacheTest
|
WriteableCacheTest
|
test_same_identifier_other_name_procedure__()
|
test_same_identifier_other_name_procedure__()
|
@Test
public void test_same_identifier_other_name_procedure() {
cache.addProcedureIdentifierHumanReadableName(procedure, procedureNameOther);
}
|
@Test
public void test_same_identifier_other_name_procedure() {
cache.addProcedureIdentifierHumanReadableName(PROCEDURE, PROCEDURE_NAME_OTHER);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
WriteableCacheTest
|
WriteableCacheTest
|
test_other_identifier_same_name_procedure__()
|
test_other_identifier_same_name_procedure__()
|
@Test
public void test_other_identifier_same_name_procedure() {
cache.addProcedureIdentifierHumanReadableName(procedureOther, procedureName);
}
|
@Test
public void test_other_identifier_same_name_procedure() {
cache.addProcedureIdentifierHumanReadableName(PROCEDURE_OTHER, PROCEDURE_NAME);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
WriteableCacheTest
|
WriteableCacheTest
|
test_other_identifier_name_procedure__()
|
test_other_identifier_name_procedure__()
|
@Test
public void test_other_identifier_name_procedure() {
cache.addProcedureIdentifierHumanReadableName(procedureOther, procedureNameOther);
}
|
@Test
public void test_other_identifier_name_procedure() {
cache.addProcedureIdentifierHumanReadableName(PROCEDURE_OTHER, PROCEDURE_NAME_OTHER);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
WriteableCacheTest
|
WriteableCacheTest
|
test_same_identifier_name_obsProp__()
|
test_same_identifier_name_obsProp__()
|
@Test
public void test_same_identifier_name_obsProp() {
cache.addObservablePropertyIdentifierHumanReadableName(observedProperty, observedPropertyName);
}
|
@Test
public void test_same_identifier_name_obsProp() {
cache.addObservablePropertyIdentifierHumanReadableName(OBSERVED_PROPERTY, OBSERVED_PROPERTY_NAME);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
WriteableCacheTest
|
WriteableCacheTest
|
test_same_identifier_other_name_obsProp__()
|
test_same_identifier_other_name_obsProp__()
|
@Test
public void test_same_identifier_other_name_obsProp() {
cache.addObservablePropertyIdentifierHumanReadableName(observedProperty, observedPropertyNameOther);
}
|
@Test
public void test_same_identifier_other_name_obsProp() {
cache.addObservablePropertyIdentifierHumanReadableName(OBSERVED_PROPERTY, OBSERVED_PROPERTY_NAME_OTHER);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
WriteableCacheTest
|
WriteableCacheTest
|
test_other_identifier_same_name_obsProp__()
|
test_other_identifier_same_name_obsProp__()
|
@Test
public void test_other_identifier_same_name_obsProp() {
cache.addObservablePropertyIdentifierHumanReadableName(observedPropertyOther, observedPropertyName);
}
|
@Test
public void test_other_identifier_same_name_obsProp() {
cache.addObservablePropertyIdentifierHumanReadableName(OBSERVED_PROPERTY_OTHER, OBSERVED_PROPERTY_NAME);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
WriteableCacheTest
|
WriteableCacheTest
|
test_other_identifier_name_obsProp__()
|
test_other_identifier_name_obsProp__()
|
@Test
public void test_other_identifier_name_obsProp() {
cache.addObservablePropertyIdentifierHumanReadableName(observedPropertyOther, observedPropertyNameOther);
}
|
@Test
public void test_other_identifier_name_obsProp() {
cache.addObservablePropertyIdentifierHumanReadableName(OBSERVED_PROPERTY_OTHER, OBSERVED_PROPERTY_NAME_OTHER);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
WriteableCacheTest
|
WriteableCacheTest
|
test_same_identifier_name_offering__()
|
test_same_identifier_name_offering__()
|
@Test
public void test_same_identifier_name_offering() {
cache.addOfferingIdentifierHumanReadableName(offering, offeringName);
}
|
@Test
public void test_same_identifier_name_offering() {
cache.addOfferingIdentifierHumanReadableName(OFFERING, OFFERING_NAME);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
WriteableCacheTest
|
WriteableCacheTest
|
test_same_identifier_other_name_offering__()
|
test_same_identifier_other_name_offering__()
|
@Test
public void test_same_identifier_other_name_offering() {
cache.addOfferingIdentifierHumanReadableName(offering, offeringNameOther);
}
|
@Test
public void test_same_identifier_other_name_offering() {
cache.addOfferingIdentifierHumanReadableName(OFFERING, OFFERING_NAME_OTHER);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
WriteableCacheTest
|
WriteableCacheTest
|
test_other_identifier_same_name_offering__()
|
test_other_identifier_same_name_offering__()
|
@Test
public void test_other_identifier_same_name_offering() {
cache.addOfferingIdentifierHumanReadableName(offeringOther, offeringName);
}
|
@Test
public void test_other_identifier_same_name_offering() {
cache.addOfferingIdentifierHumanReadableName(OFFERING_OTHER, OFFERING_NAME);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
core/cache/src/test/java/org/n52/sos/cache/WriteableCacheTest.java
|
WriteableCacheTest
|
WriteableCacheTest
|
test_other_identifier_name_offering__()
|
test_other_identifier_name_offering__()
|
@Test
public void test_other_identifier_name_offering() {
cache.addOfferingIdentifierHumanReadableName(offeringOther, offeringNameOther);
}
|
@Test
public void test_other_identifier_name_offering() {
cache.addOfferingIdentifierHumanReadableName(OFFERING_OTHER, OFFERING_NAME_OTHER);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/util/procedure/enrich/RelatedProceduresEnrichment.java
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/util/procedure/enrich/RelatedProceduresEnrichment.java
|
RelatedProceduresEnrichment
|
RelatedProceduresEnrichment
|
getChildProcedures__()
|
getChildProcedures__()
|
private Set<SosProcedureDescription> getChildProcedures()
throws OwsExceptionReport {
final Collection<String> childIdentfiers =
getCache().getChildProcedures(getIdentifier(), false, false);
if (CollectionHelper.isEmpty(childIdentfiers)) {
return Sets.newHashSet();
}
if (procedureCache == null) {
procedureCache = createProcedureCache();
}
Set<SosProcedureDescription> childProcedures = Sets.newHashSet();
for (String childId : childIdentfiers) {
Procedure child = procedureCache.get(childId);
//if child has valid vpts, use the most recent one within
//the validTime to create the child procedure
ValidProcedureTime childVpt = null;
if (child instanceof TProcedure) {
TProcedure tChild = (TProcedure) child;
for (ValidProcedureTime cvpt : tChild.getValidProcedureTimes()) {
TimePeriod thisCvptValidTime = new TimePeriod(cvpt.getStartTime(),
cvpt.getEndTime());
if (validTime != null && !validTime.isSetEnd() && !thisCvptValidTime.isSetEnd()) {
childVpt = cvpt;
} else {
//make sure this child's validtime is within the parent's valid time,
//if parent has one
if (validTime != null && !thisCvptValidTime.isWithin(validTime)){
continue;
}
if (childVpt == null || cvpt.getEndTime() == null ||
(cvpt.getEndTime() != null && childVpt.getEndTime() != null &&
cvpt.getEndTime().after(childVpt.getEndTime()))) {
childVpt = cvpt;
}
}
}
}
if (childVpt != null) {
//matching child validProcedureTime was found, use it to build procedure description
SosProcedureDescription childDescription =
converter.createSosProcedureDescriptionFromValidProcedureTime(
child, procedureDescriptionFormat, childVpt, getVersion(), getLocale(), getSession());
childProcedures.add(childDescription);
} else if (child != null) {
//no matching child validProcedureTime, generate the procedure description
SosProcedureDescription childDescription = converter.createSosProcedureDescription(
child, procedureDescriptionFormat, getVersion(), procedureCache, getLocale(), getSession());
// TODO check if call is necessary because it is also called in
// createSosProcedureDescription()
// addValuesToSensorDescription(childProcID,childProcedureDescription,
// version, outputFormat, session);
childProcedures.add(childDescription);
}
}
return childProcedures;
}
|
protected Set<AbstractSensorML> getChildProcedures()
throws OwsExceptionReport {
if (!getProcedure().hasChildren()) {
return Sets.newHashSet();
}
Set<AbstractSensorML> childProcedures = Sets.newHashSet();
for (ProcedureEntity child : getProcedure().getChildren()) {
if (child != null) {
// if child has valid vpts, use the most recent one within
// the validTime to create the child procedure
ProcedureHistoryEntity childHistory = null;
for (ProcedureHistoryEntity cph : child.getProcedureHistory()) {
TimePeriod thisCvptValidTime = new TimePeriod(cph.getStartTime(), cph.getEndTime());
if (getValidTime() != null && !getValidTime().isSetEnd() && !thisCvptValidTime.isSetEnd()) {
childHistory = cph;
} else {
// make sure this child's validtime is within the
// parent's valid time,
// if parent has one
if (getValidTime() != null && !thisCvptValidTime.isWithin(getValidTime())) {
continue;
}
if (childHistory == null || cph.getEndTime() == null
|| (cph.getEndTime() != null && childHistory.getEndTime() != null
&& cph.getEndTime().after(childHistory.getEndTime()))) {
childHistory = cph;
}
}
}
if (childHistory != null) {
// matching child validProcedureTime was found, use it to build
// procedure description
SosProcedureDescription<?> childDescription = ((HibernateProcedureConverter) getConverter())
.createSosProcedureDescriptionFromValidProcedureTime(child, getProcedureDescriptionFormat(),
childHistory, getVersion(), getLocale(), getSession());
if (childDescription.getProcedureDescription() instanceof AbstractSensorML) {
childProcedures.add((AbstractSensorML) childDescription.getProcedureDescription());
}
} else {
// no matching child validProcedureTime, generate the procedure
// description
SosProcedureDescription<?> childDescription = getConverter().createSosProcedureDescription(child,
getProcedureDescriptionFormat(), getVersion(), getLocale(), getSession());
// TODO check if call is necessary because it is also called in
// createSosProcedureDescription()
// addValuesToSensorDescription(childProcID,childProcedureDescription,
// version, outputFormat, session);
if (childDescription.getProcedureDescription() instanceof AbstractSensorML) {
childProcedures.add((AbstractSensorML) childDescription.getProcedureDescription());
}
}
}
}
return childProcedures;
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/util/procedure/enrich/RelatedProceduresEnrichment.java
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/util/procedure/enrich/RelatedProceduresEnrichment.java
|
RelatedProceduresEnrichment
|
RelatedProceduresEnrichment
|
getParentProcedures__()
|
getParentProcedures__()
|
private Set<String> getParentProcedures() throws OwsExceptionReport {
return getCache().getParentProcedures(getIdentifier(), false, false);
}
|
protected Set<String> getParentProcedures()
throws OwsExceptionReport {
return getCache().getParentProcedures(getIdentifier(), false, false);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/api/src/test/java/org/n52/sos/encode/XmlEncoderKeyTest.java
|
core/api/src/test/java/org/n52/sos/encode/XmlEncoderKeyTest.java
|
XmlEncoderKeyTest
|
XmlEncoderKeyTest
|
testHashCode__()
|
testHashCode__()
|
@Test
public void testHashCode() {
assertEquals(new XmlEncoderKey("test", C1.class).hashCode(), new XmlEncoderKey("test", C1.class).hashCode());
assertEquals(new XmlEncoderKey(null, C1.class).hashCode(), new XmlEncoderKey(null, C1.class).hashCode());
assertEquals(new XmlEncoderKey("test", null).hashCode(), new XmlEncoderKey("test", null).hashCode());
assertNotEquals(new XmlEncoderKey("test", C1.class).hashCode(), new XmlEncoderKey(null, C1.class).hashCode());
assertNotEquals(new XmlEncoderKey("test", null).hashCode(), new XmlEncoderKey("test", C1.class).hashCode());
assertNotEquals(new XmlEncoderKey("test1", C1.class).hashCode(),
new XmlEncoderKey("test", C1.class).hashCode());
assertNotEquals(new XmlEncoderKey("test", C1.class).hashCode(),
new XmlEncoderKey("test1", C1.class).hashCode());
assertNotEquals(new XmlEncoderKey("test", C1.class).hashCode(), new XmlEncoderKey("test", C2.class).hashCode());
assertNotEquals(new XmlEncoderKey("test", C1.class).hashCode(), new XmlEncoderKey("test", C2.class).hashCode());
}
|
@Test
public void testHashCode() {
Assert.assertEquals(new XmlEncoderKey(TEST, C1.class).hashCode(),
new XmlEncoderKey(TEST, C1.class).hashCode());
Assert.assertEquals(new XmlEncoderKey(null, C1.class).hashCode(),
new XmlEncoderKey(null, C1.class).hashCode());
Assert.assertEquals(new XmlEncoderKey(TEST, null).hashCode(), new XmlEncoderKey(TEST, null).hashCode());
Assert.assertNotEquals(new XmlEncoderKey(TEST, C1.class).hashCode(),
new XmlEncoderKey(null, C1.class).hashCode());
Assert.assertNotEquals(new XmlEncoderKey(TEST, null).hashCode(), new XmlEncoderKey(TEST, C1.class).hashCode());
Assert.assertNotEquals(new XmlEncoderKey(TEST_1, C1.class).hashCode(),
new XmlEncoderKey(TEST, C1.class).hashCode());
Assert.assertNotEquals(new XmlEncoderKey(TEST, C1.class).hashCode(),
new XmlEncoderKey(TEST_1, C1.class).hashCode());
Assert.assertNotEquals(new XmlEncoderKey(TEST, C1.class).hashCode(),
new XmlEncoderKey(TEST, C2.class).hashCode());
Assert.assertNotEquals(new XmlEncoderKey(TEST, C1.class).hashCode(),
new XmlEncoderKey(TEST, C2.class).hashCode());
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/api/src/test/java/org/n52/sos/encode/XmlEncoderKeyTest.java
|
core/api/src/test/java/org/n52/sos/encode/XmlEncoderKeyTest.java
|
XmlEncoderKeyTest
|
XmlEncoderKeyTest
|
testEquals__()
|
testEquals__()
|
@Test
public void testEquals() {
assertEquals(new XmlEncoderKey("test", C1.class), new XmlEncoderKey("test", C1.class));
assertEquals(new XmlEncoderKey(null, C1.class), new XmlEncoderKey(null, C1.class));
assertEquals(new XmlEncoderKey("test", null), new XmlEncoderKey("test", null));
assertNotEquals(new XmlEncoderKey("test", C1.class), new XmlEncoderKey(null, C1.class));
assertNotEquals(new XmlEncoderKey("test", null), new XmlEncoderKey("test", C1.class));
assertNotEquals(new XmlEncoderKey("test1", C1.class), new XmlEncoderKey("test", C1.class));
assertNotEquals(new XmlEncoderKey("test", C1.class), new XmlEncoderKey("test1", C1.class));
assertNotEquals(new XmlEncoderKey("test", C1.class), new XmlEncoderKey("test", C2.class));
assertNotEquals(new XmlEncoderKey("test", C1.class), new XmlEncoderKey("test", C2.class));
}
|
@Test
public void testEquals() {
Assert.assertEquals(new XmlEncoderKey(TEST, C1.class), new XmlEncoderKey(TEST, C1.class));
Assert.assertEquals(new XmlEncoderKey(null, C1.class), new XmlEncoderKey(null, C1.class));
Assert.assertEquals(new XmlEncoderKey(TEST, null), new XmlEncoderKey(TEST, null));
Assert.assertNotEquals(new XmlEncoderKey(TEST, C1.class), new XmlEncoderKey(null, C1.class));
Assert.assertNotEquals(new XmlEncoderKey(TEST, null), new XmlEncoderKey(TEST, C1.class));
Assert.assertNotEquals(new XmlEncoderKey(TEST_1, C1.class), new XmlEncoderKey(TEST, C1.class));
Assert.assertNotEquals(new XmlEncoderKey(TEST, C1.class), new XmlEncoderKey(TEST_1, C1.class));
Assert.assertNotEquals(new XmlEncoderKey(TEST, C1.class), new XmlEncoderKey(TEST, C2.class));
Assert.assertNotEquals(new XmlEncoderKey(TEST, C1.class), new XmlEncoderKey(TEST, C2.class));
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/api/src/test/java/org/n52/sos/encode/XmlEncoderKeyTest.java
|
core/api/src/test/java/org/n52/sos/encode/XmlEncoderKeyTest.java
|
XmlEncoderKeyTest
|
XmlEncoderKeyTest
|
test__(Class<?> a, Class<?> b, int expected)
|
test__(Class<?> a, Class<?> b, int expected)
|
private void test(Class<?> a, Class<?> b, int expected) {
assertEquals(expected, new XmlEncoderKey("test", a).getSimilarity(new XmlEncoderKey("test", b)));
}
|
private void test(Class<?> a, Class<?> b, int expected) {
Assert.assertEquals(expected, new XmlEncoderKey(TEST, a).getSimilarity(new XmlEncoderKey(TEST, b)));
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/api/src/test/java/org/n52/sos/encode/XmlEncoderKeyTest.java
|
core/api/src/test/java/org/n52/sos/encode/XmlEncoderKeyTest.java
|
XmlEncoderKeyTest
|
XmlEncoderKeyTest
|
testSimilartiy__()
|
testSimilartiy__()
|
@Test
public void testSimilartiy() {
assertEquals(-1, new XmlEncoderKey("test", C1.class).getSimilarity(new XmlEncoderKey("test1", C1.class)));
test(C1.class, C2.class, 1);
test(C1.class, C3.class, 2);
test(C1.class, C4.class, 3);
test(C3.class, C4.class, 1);
test(I1.class, C4.class, 5);
test(I1.class, I4.class, -1);
test(C1.class, C5.class, -1);
test(C1.class, I1.class, -1);
test(C1[].class, C2[].class, 1);
test(C1[].class, C3[].class, 2);
test(C1[].class, C4[].class, 3);
test(C3[].class, C4[].class, 1);
test(I1[].class, C4[].class, 5);
test(I1[].class, I4[].class, -1);
test(C1[].class, C5[].class, -1);
test(C1[].class, I1[].class, -1);
test(C1[].class, C1.class, -1);
}
|
@Test
public void testSimilartiy() {
Assert.assertEquals(-1, new XmlEncoderKey(TEST, C1.class).getSimilarity(new XmlEncoderKey(TEST_1, C1.class)));
test(C1.class, C2.class, 1);
test(C1.class, C3.class, 2);
test(C1.class, C4.class, 3);
test(C3.class, C4.class, 1);
test(I1.class, C4.class, 5);
test(I1.class, I4.class, -1);
test(C1.class, C5.class, -1);
test(C1.class, I1.class, -1);
test(C1[].class, C2[].class, 1);
test(C1[].class, C3[].class, 2);
test(C1[].class, C4[].class, 3);
test(C3[].class, C4[].class, 1);
test(I1[].class, C4[].class, 5);
test(I1[].class, I4[].class, -1);
test(C1[].class, C5[].class, -1);
test(C1[].class, I1[].class, -1);
test(C1[].class, C1.class, -1);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
operations/core-v20/src/main/java/org/n52/sos/request/operator/SosGetObservationOperatorV20.java
|
operations/core-v20/src/main/java/org/n52/sos/request/operator/SosGetObservationOperatorV20.java
|
SosGetObservationOperatorV20
|
SosGetObservationOperatorV20
|
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)) {
return Collections.unmodifiableSet(CONFORMANCE_CLASSES);
}
return Collections.emptySet();
}
|
@Override
public Set<String> getConformanceClasses(String service, String version) {
if (SosConstants.SOS.equals(service) && Sos2Constants.SERVICEVERSION.equals(version)) {
return Collections.unmodifiableSet(CONFORMANCE_CLASSES);
}
return Collections.emptySet();
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
operations/core-v20/src/main/java/org/n52/sos/request/operator/SosGetObservationOperatorV20.java
|
operations/core-v20/src/main/java/org/n52/sos/request/operator/SosGetObservationOperatorV20.java
|
SosGetObservationOperatorV20
|
SosGetObservationOperatorV20
|
checkParameters__(final GetObservationRequest sosRequest)
|
checkParameters__(GetObservationRequest request)
|
@Override
protected void checkParameters(final GetObservationRequest sosRequest) throws OwsExceptionReport {
final CompositeOwsException exceptions = new CompositeOwsException();
try {
checkServiceParameter(sosRequest.getService());
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
try {
checkSingleVersionParameter(sosRequest);
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
try {
checkOfferingId(sosRequest.getOfferings());
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
try {
checkObservedProperties(sosRequest.getObservedProperties(), SosConstants.GetObservationParams.observedProperty, false);
// add child observedProperties if isInclude == true and requested observedProperty is parent.
if (sosRequest.isSetObservableProperty()) {
sosRequest.setObservedProperties(addChildObservableProperties(sosRequest.getObservedProperties()));
}
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
try {
checkQueryableProcedureIDs(sosRequest.getProcedures(), SosConstants.GetObservationParams.procedure.name());
// add instance and child procedures to request
if (sosRequest.isSetProcedure()) {
sosRequest.setProcedures(addChildProcedures(addInstanceProcedures(sosRequest.getProcedures())));
}
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
try {
checkFeatureOfInterestIdentifiers(sosRequest.getFeatureIdentifiers(),
SosConstants.GetObservationParams.featureOfInterest.name());
if (sosRequest.isSetFeatureOfInterest()) {
sosRequest.setFeatureIdentifiers(addChildFeatures(sosRequest.getFeatureIdentifiers()));
}
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
try {
checkSpatialFilter(sosRequest.getSpatialFilter(),
SosConstants.GetObservationParams.featureOfInterest.name());
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
try {
if (sosRequest.isSetTemporalFilter()) {
checkTemporalFilter(sosRequest.getTemporalFilters(),
Sos2Constants.GetObservationParams.temporalFilter.name());
} else if (getActiveProfile().isReturnLatestValueIfTemporalFilterIsMissingInGetObservation()) {
sosRequest.setTemporalFilters(CollectionHelper.list(TEMPORAL_FILTER_LATEST));
}
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
try {
if (sosRequest.getResponseFormat() == null) {
sosRequest.setResponseFormat(getActiveProfile().getObservationResponseFormat());
}
SosHelper.checkResponseFormat(sosRequest.getResponseFormat(), sosRequest.getService(),
sosRequest.getVersion());
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
checkExtensions(sosRequest, exceptions);
exceptions.throwIfNotEmpty();
// check if parameters are set, if not throw ResponseExceedsSizeLimit
// exception
// TODO remove after finishing CITE tests
if (sosRequest.isEmpty() && isBlockRequestsWithoutRestriction()) {
throw new ResponseExceedsSizeLimitException()
.withMessage("The response exceeds the size limit! Please define some filtering parameters.");
}
}
|
@Override
protected void checkParameters(GetObservationRequest request) throws OwsExceptionReport {
final CompositeOwsException exceptions = new CompositeOwsException();
try {
checkServiceParameter(request.getService());
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
try {
checkSingleVersionParameter(request);
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
try {
checkOfferingId(request.getOfferings());
// add child offerings to request
if (request.isSetOffering()) {
request.setOfferings(addChildOfferings(request.getOfferings()));
}
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
try {
checkObservedProperties(request.getObservedProperties(),
SosConstants.GetObservationParams.observedProperty, false);
// add child observedProperties if isInclude == true and requested
// observedProperty is parent.
if (request.isSetObservableProperty()) {
request.setObservedProperties(addChildObservableProperties(request.getObservedProperties()));
}
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
try {
checkQueryableProcedures(request.getProcedures(), SosConstants.GetObservationParams.procedure.name());
// add instance and child procedures to request
if (request.isSetProcedure()) {
request.setProcedures(addChildProcedures(addInstanceProcedures(request.getProcedures())));
}
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
try {
checkFeatureOfInterestIdentifiers(request.getFeatureIdentifiers(),
SosConstants.GetObservationParams.featureOfInterest.name());
if (request.isSetFeatureOfInterest()) {
request.setFeatureIdentifiers(addChildFeatures(request.getFeatureIdentifiers()));
}
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
try {
checkSpatialFilter(request.getSpatialFilter(),
SosConstants.GetObservationParams.featureOfInterest.name());
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
try {
if (request.isSetTemporalFilter()) {
checkTemporalFilter(request.getTemporalFilters(),
Sos2Constants.GetObservationParams.temporalFilter.name());
} else if (getActiveProfile().isReturnLatestValueIfTemporalFilterIsMissingInGetObservation()) {
request.setTemporalFilters(CollectionHelper.list(TEMPORAL_FILTER_LATEST));
}
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
try {
if (!request.isSetResponseFormat()) {
request.setResponseFormat(getActiveProfile().getObservationResponseFormat());
}
checkResponseFormat(request.getResponseFormat(), request.getService(),
request.getVersion());
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
try {
if (request.isSetResultModel()) {
if (request.getResultModel() != null && !request.getResultModel().isEmpty()) {
throw new MissingParameterValueException(SosConstants.GetObservationParams.resultType);
} else {
if (!getResponseFormatsForObservationType(request.getResultModel(),
request.getService(), request.getVersion())
.contains(request.getResponseFormat())) {
throw new InvalidParameterValueException().withMessage(
"The requested resultType {} is not valid for the responseFormat {}!",
request.getResultModel(), request.getResponseFormat());
}
}
}
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
if (getActiveProfile().isMergeValues()) {
if (!request.getExtensions()
.containsExtension(Sos2Constants.Extensions.MergeObservationsIntoDataArray)) {
Extensions extensions = new Extensions();
extensions.addExtension(new SwesExtension<SweBoolean>()
.setDefinition(Sos2Constants.Extensions.MergeObservationsIntoDataArray.name())
.setValue((SweBoolean) new SweBoolean()
.setValue(getProfileHandler().getActiveProfile()
.isMergeValues())
.setDefinition(Sos2Constants.Extensions.MergeObservationsIntoDataArray.name())));
request.setExtensions(extensions);
}
}
try {
checkResultFilterExtension(request);
} catch (OwsExceptionReport owse) {
exceptions.add(owse);
}
checkExtensions(request, exceptions);
exceptions.throwIfNotEmpty();
// check if parameters are set, if not throw ResponseExceedsSizeLimit
// exception
// TODO remove after finishing CITE tests
if (request.isEmpty() && isBlockRequestsWithoutRestriction()) {
throw new ResponseExceedsSizeLimitException()
.withMessage("The response exceeds the size limit! Please define some filtering parameters.");
}
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
operations/core-v20/src/main/java/org/n52/sos/request/operator/SosGetObservationOperatorV20.java
|
operations/core-v20/src/main/java/org/n52/sos/request/operator/SosGetObservationOperatorV20.java
|
SosGetObservationOperatorV20
|
SosGetObservationOperatorV20
|
checkOfferingId__(final List<String> offeringIds)
|
checkOfferingId__(final List<String> offeringIds)
|
private void checkOfferingId(final List<String> offeringIds) throws OwsExceptionReport {
if (offeringIds != null) {
final Set<String> offerings = Configurator.getInstance().getCache().getOfferings();
final CompositeOwsException exceptions = new CompositeOwsException();
for (final String offeringId : offeringIds) {
if (offeringId == null || offeringId.isEmpty()) {
exceptions.add(new MissingOfferingParameterException());
} else if (offeringId.contains(SosConstants.SEPARATOR_4_OFFERINGS)) {
final String[] offArray = offeringId.split(SosConstants.SEPARATOR_4_OFFERINGS);
if (!offerings.contains(offArray[0])
|| !getCache().getProceduresForOffering(offArray[0]).contains(offArray[1])) {
exceptions.add(new InvalidOfferingParameterException(offeringId));
}
} else if (!offerings.contains(offeringId)) {
exceptions.add(new InvalidOfferingParameterException(offeringId));
}
}
exceptions.throwIfNotEmpty();
}
}
|
private void checkOfferingId(final List<String> offeringIds) throws OwsExceptionReport {
if (offeringIds != null) {
Set<String> offerings = getCache().getOfferings();
CompositeOwsException exceptions = new CompositeOwsException();
offeringIds.forEach(offeringId -> {
if (offeringId == null || offeringId.isEmpty()) {
exceptions.add(new MissingOfferingParameterException());
} else if (offeringId.contains(SosConstants.SEPARATOR_4_OFFERINGS)) {
final String[] offArray = offeringId.split(SosConstants.SEPARATOR_4_OFFERINGS);
if (!offerings.contains(offArray[0])
|| !getCache().getProceduresForOffering(offArray[0]).contains(offArray[1])) {
exceptions.add(new InvalidOfferingParameterException(offeringId));
}
} else if (!offerings.contains(offeringId)) {
exceptions.add(new InvalidOfferingParameterException(offeringId));
}
});
exceptions.throwIfNotEmpty();
}
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
coding/netcdf/api/src/main/java/org/n52/sos/netcdf/data/dataset/TimeSeriesSensorDataset.java
|
coding/netcdf/api/src/main/java/org/n52/sos/netcdf/data/dataset/TimeSeriesSensorDataset.java
|
TimeSeriesSensorDataset
|
TimeSeriesSensorDataset
|
TimeSeriesSensorDataset__( DatasetSensor sensor, Double lng, Double lat, Double alt,
Map<Time, Map<OmObservableProperty, Map<SubSensor, Value<?>>>> dataValues, SosProcedureDescription procedure)
|
TimeSeriesSensorDataset__(DatasetSensor sensor, Double lng, Double lat, Double alt,
Map<Time, Map<OmObservableProperty, Map<SubSensor, Value<?>>>> dataValues, AbstractFeature procedure)
|
public TimeSeriesSensorDataset( DatasetSensor sensor, Double lng, Double lat, Double alt,
Map<Time, Map<OmObservableProperty, Map<SubSensor, Value<?>>>> dataValues, SosProcedureDescription procedure) {
super( CF.FeatureType.timeSeries, sensor, dataValues, procedure);
this.lng = lng;
this.lat = lat;
this.alt = alt;
}
|
public TimeSeriesSensorDataset(DatasetSensor sensor, Double lng, Double lat, Double alt,
Map<Time, Map<OmObservableProperty, Map<SubSensor, Value<?>>>> dataValues, AbstractFeature procedure) {
super(CF.FeatureType.timeSeries, sensor, dataValues, procedure);
this.lng = lng;
this.lat = lat;
this.alt = alt;
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/main/java/org/n52/sos/cache/ContentCacheFactoryImpl.java
|
core/cache/src/main/java/org/n52/sos/cache/ContentCacheFactoryImpl.java
|
ContentCacheFactoryImpl
|
ContentCacheFactoryImpl
|
get__()
|
get__()
|
@Override
public WritableContentCache get() {
return new InMemoryCacheImpl();
}
|
@Override
public WritableContentCache get() {
return (InMemoryCacheImpl) new InMemoryCacheImpl().setSupportedTypeRepository(getSupportedTypeRepository());
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/dao/src/main/java/org/n52/sos/ds/hibernate/cache/base/ResultTemplateCacheUpdate.java
|
handler/src/main/java/org/n52/sos/ds/cache/base/ResultTemplateCacheUpdate.java
|
ResultTemplateCacheUpdate
|
ResultTemplateCacheUpdate
|
execute__()
|
execute__()
|
@Override
public void execute() {
LOGGER.debug("Executing ResultTemplateCacheUpdate");
startStopwatch();
if (HibernateHelper.isEntitySupported(ResultTemplate.class)) {
List<ResultTemplate> resultTemplates = new ResultTemplateDAO().getResultTemplateObjects(getSession());
for (ResultTemplate resultTemplate : resultTemplates) {
String id = resultTemplate.getIdentifier();
getCache().addResultTemplate(id);
getCache().addResultTemplateForOffering(resultTemplate.getOffering().getIdentifier(), id);
getCache().addObservablePropertyForResultTemplate(id,
resultTemplate.getObservableProperty().getIdentifier());
getCache().addFeatureOfInterestForResultTemplate(id,
resultTemplate.getFeatureOfInterest().getIdentifier());
}
}
LOGGER.debug("Finished executing ResultTemplateCacheUpdate ({})", getStopwatchResult());
}
|
@Override
public void execute() {
LOGGER.debug("Executing ResultTemplateCacheUpdate");
startStopwatch();
if (HibernateHelper.isEntitySupported(ResultTemplateEntity.class)) {
List<ResultTemplateEntity> resultTemplates = getResultTemplateObjects(getSession());
for (ResultTemplateEntity resultTemplate : resultTemplates) {
String id = resultTemplate.getIdentifier();
getCache().addResultTemplate(id);
getCache().addResultTemplateForOffering(resultTemplate.getOffering().getIdentifier(), id);
getCache().addObservablePropertyForResultTemplate(id, resultTemplate.getPhenomenon().getIdentifier());
if (resultTemplate.getFeature() != null) {
getCache().addFeatureOfInterestForResultTemplate(id, resultTemplate.getFeature().getIdentifier());
}
}
}
LOGGER.debug("Finished executing ResultTemplateCacheUpdate ({})", getStopwatchResult());
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
operations/core-v20/src/test/java/org/n52/sos/request/operator/SosGetObservationOperatorV20Test.java
|
operations/core-v20/src/test/java/org/n52/sos/request/operator/SosGetObservationOperatorV20Test.java
|
SosGetObservationOperatorV20Test
|
SosGetObservationOperatorV20Test
|
should_return_empty_list_for_bad_parameters__()
|
should_return_empty_list_for_bad_parameters__()
|
@Test
public void should_return_empty_list_for_bad_parameters() {
final SosGetObservationOperatorV20 operator = mock(SosGetObservationOperatorV20.class);
when(operator.addChildFeatures(anyCollectionOf(String.class))).thenCallRealMethod();
// null
List<String> childFeatures = operator.addChildFeatures(null);
assertThat(childFeatures.isEmpty(), is(TRUE));
// empty list
childFeatures = operator.addChildFeatures(new ArrayList<String>(0));
assertThat(childFeatures.isEmpty(), is(TRUE));
}
|
@Test
public void should_return_empty_list_for_bad_parameters() {
final SosGetObservationOperatorV20 operator = Mockito.mock(SosGetObservationOperatorV20.class);
Mockito.when(operator.addChildFeatures(Matchers.anyCollectionOf(String.class))).thenCallRealMethod();
// null
List<String> childFeatures = operator.addChildFeatures(null);
Assert.assertThat(childFeatures.isEmpty(), Is.is(Boolean.TRUE));
// empty list
childFeatures = operator.addChildFeatures(new ArrayList<String>(0));
Assert.assertThat(childFeatures.isEmpty(), Is.is(Boolean.TRUE));
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
operations/core-v20/src/test/java/org/n52/sos/request/operator/SosGetObservationOperatorV20Test.java
|
operations/core-v20/src/test/java/org/n52/sos/request/operator/SosGetObservationOperatorV20Test.java
|
SosGetObservationOperatorV20Test
|
SosGetObservationOperatorV20Test
|
should_add_childs_for_features__()
|
should_add_childs_for_features__()
|
@Test
public void should_add_childs_for_features() {
final SosGetObservationOperatorV20 operator = mock(SosGetObservationOperatorV20.class);
final SosContentCache cache = mock(SosContentCache.class);
final Set<String> myChildFeatures = new HashSet<String>(1);
myChildFeatures.add("child-feature");
when(cache.getChildFeatures(anyString(), anyBoolean(), anyBoolean())).thenReturn(myChildFeatures);
when(operator.getCache()).thenReturn(cache);
when(operator.addChildFeatures(anyCollectionOf(String.class))).thenCallRealMethod();
final List<String> childFeatures = operator.addChildFeatures(Lists.newArrayList("feature"));
assertThat(childFeatures.isEmpty(), is(FALSE));
assertThat(childFeatures.size(), is(2));
assertThat(childFeatures, hasItem("child-feature"));
assertThat(childFeatures, hasItem("feature"));
}
|
@Test
public void should_add_childs_for_features() {
final SosGetObservationOperatorV20 operator = Mockito.mock(SosGetObservationOperatorV20.class);
final SosContentCache cache = Mockito.mock(SosContentCache.class);
final Set<String> myChildFeatures = new HashSet<String>(1);
myChildFeatures.add(CHILD_FEATURE);
Mockito.when(cache.getChildFeatures(Matchers.anyString(), Matchers.anyBoolean(), Matchers.anyBoolean()))
.thenReturn(myChildFeatures);
Mockito.when(operator.getCache()).thenReturn(cache);
Mockito.when(operator.addChildFeatures(Matchers.anyCollectionOf(String.class))).thenCallRealMethod();
final List<String> childFeatures = operator.addChildFeatures(Lists.newArrayList(FEATURE));
Assert.assertThat(childFeatures.isEmpty(), Is.is(Boolean.FALSE));
Assert.assertThat(childFeatures.size(), Is.is(2));
Assert.assertThat(childFeatures, IsCollectionContaining.hasItem(CHILD_FEATURE));
Assert.assertThat(childFeatures, IsCollectionContaining.hasItem(FEATURE));
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/series/SeriesDAO.java
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/series/SeriesDAO.java
|
SeriesDAO
|
SeriesDAO
|
getSeries__(GetObservationRequest request, Collection<String> features, Session session)
|
getSeries__(GetObservationRequest request, Collection<String> features, Session session)
|
@Override
@SuppressWarnings("unchecked")
public List<Series> getSeries(GetObservationRequest request, Collection<String> features, Session session) throws CodedException {
return getSeriesCriteria(request, features, session).list();
}
|
@Override
public List<DatasetEntity> getSeries(GetObservationRequest request, Collection<String> features, Session session)
throws OwsExceptionReport {
List<DatasetEntity> series = new ArrayList<>();
if (CollectionHelper.isNotEmpty(features)) {
for (List<String> ids : QueryHelper.getListsForIdentifiers(features)) {
series.addAll(getSeriesSet(request, ids, session));
}
} else {
series.addAll(getSeriesSet(request, features, session));
}
return series;
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/series/SeriesDAO.java
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/series/SeriesDAO.java
|
SeriesDAO
|
SeriesDAO
|
getSeries__(Collection<String> procedures, Collection<String> observedProperties,
Collection<String> features, Session session)
|
getSeries__(Collection<String> procedures, Collection<String> observedProperties,
Collection<String> features, Session session)
|
@Override
@SuppressWarnings("unchecked")
public List<Series> getSeries(Collection<String> procedures, Collection<String> observedProperties,
Collection<String> features, Session session) {
return getSeriesCriteria(procedures, observedProperties, features, session).list();
}
|
@Override
@SuppressWarnings("unchecked")
public List<DatasetEntity> getSeries(Collection<String> procedures, Collection<String> observedProperties,
Collection<String> features, Session session) {
if (CollectionHelper.isNotEmpty(features)) {
List<DatasetEntity> series = new ArrayList<>();
for (List<String> ids : QueryHelper.getListsForIdentifiers(features)) {
series.addAll(getSeriesCriteria(procedures, observedProperties, ids, session).list());
}
return series;
} else {
return getSeriesCriteria(procedures, observedProperties, features, session).list();
}
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/series/SeriesDAO.java
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/series/SeriesDAO.java
|
SeriesDAO
|
SeriesDAO
|
getSeries__(String observedProperty, Collection<String> features, Session session)
|
getSeries__(String observedProperty, Collection<String> features, Session session)
|
@Override
@SuppressWarnings("unchecked")
public List<Series> getSeries(String observedProperty, Collection<String> features, Session session) {
return getSeriesCriteria(observedProperty, features, session).list();
}
|
@Override
@SuppressWarnings("unchecked")
public List<DatasetEntity> getSeries(String observedProperty, Collection<String> features, Session session) {
if (CollectionHelper.isNotEmpty(features)) {
List<DatasetEntity> series = new ArrayList<>();
for (List<String> ids : QueryHelper.getListsForIdentifiers(features)) {
series.addAll(getSeriesCriteria(observedProperty, ids, session).list());
}
return series;
} else {
return getSeriesCriteria(observedProperty, features, session).list();
}
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/test/java/org/n52/sos/ds/hibernate/dao/CacheQueryTest.java
|
hibernate/common/src/test/java/org/n52/sos/ds/hibernate/dao/CacheQueryTest.java
|
CacheQueryTest
|
CacheQueryTest
|
runtimeComparisonObservationQueries__()
|
runtimeComparisonObservationQueries__()
|
@Test
public void runtimeComparisonObservationQueries() throws ConnectionProviderException, OwsExceptionReport {
// run the query types in random order
List<QueryType> queryTypes = Arrays.asList(QueryType.values());
// run each query once and discard the result to warm up hibernate
getFoiForOfferingObservationInfoTime();
getFoiForOfferingObservationTime();
getFoiForOfferingHqlTime();
// note: performance tests on multiple types of queries seem to be
// affected by each other (first run is slower,
// subsequent queries are very fast).
Map<QueryType, Long> resultTimes = new HashMap<>();
final int runs = 100;
for (int i = 0; i < runs; i++) {
Collections.shuffle(queryTypes);
for (QueryType qt : queryTypes) {
LOGGER.info("Running foiForOffering query: " + qt.name());
switch (qt) {
case OBSERVATION_INFO:
addToResultTimeMap(resultTimes, qt, getFoiForOfferingObservationInfoTime());
break;
case OBSERVATION:
addToResultTimeMap(resultTimes, qt, getFoiForOfferingObservationTime());
break;
case HQL:
addToResultTimeMap(resultTimes, qt, getFoiForOfferingHqlTime());
break;
}
}
}
long observationInfoTime = resultTimes.get(QueryType.OBSERVATION_INFO) / runs;
long observationTime = resultTimes.get(QueryType.OBSERVATION) / runs;
long hqlTime = resultTimes.get(QueryType.HQL) / runs;
LOGGER.info("foi for offering, new way {} ms, the arithmetic mean of {} runs", observationInfoTime, runs);
LOGGER.info("foi for offering, old way {} ms, the arithmetic mean of {} runs", observationTime, runs);
LOGGER.info("foi for offering, hql way {} ms, the arithmetic mean of {} runs", hqlTime, runs);
// note: this will fail for very low numbers of observations (old way is
// faster)
assertTrue("Old way is faster", observationInfoTime < observationTime);
// note: hql is faster!
// assertTrue("HQL is faster", observationInfoTime < hqlTime);
}
|
@Test
public void runtimeComparisonObservationQueries() throws ConnectionProviderException, OwsExceptionReport {
// run the query types in random order
List<QueryType> queryTypes = Arrays.asList(QueryType.values());
// run each query once and discard the result to warm up hibernate
getFoiForOfferingObservationInfoTime();
getFoiForOfferingObservationTime();
getFoiForOfferingHqlTime();
// note: performance tests on multiple types of queries seem to be
// affected by each other (first run is slower,
// subsequent queries are very fast).
Map<QueryType, Long> resultTimes = new HashMap<>();
final int runs = 100;
for (int i = 0; i < runs; i++) {
Collections.shuffle(queryTypes);
for (QueryType qt : queryTypes) {
LOGGER.info("Running foiForOffering query: " + qt.name());
switch (qt) {
case OBSERVATION_INFO:
addToResultTimeMap(resultTimes, qt, getFoiForOfferingObservationInfoTime());
break;
case OBSERVATION:
addToResultTimeMap(resultTimes, qt, getFoiForOfferingObservationTime());
break;
case HQL:
addToResultTimeMap(resultTimes, qt, getFoiForOfferingHqlTime());
break;
default:
break;
}
}
}
long observationInfoTime = resultTimes.get(QueryType.OBSERVATION_INFO) / runs;
long observationTime = resultTimes.get(QueryType.OBSERVATION) / runs;
long hqlTime = resultTimes.get(QueryType.HQL) / runs;
LOGGER.info("foi for offering, new way {} ms, the arithmetic mean of {} runs", observationInfoTime, runs);
LOGGER.info("foi for offering, old way {} ms, the arithmetic mean of {} runs", observationTime, runs);
LOGGER.info("foi for offering, hql way {} ms, the arithmetic mean of {} runs", hqlTime, runs);
// note: this will fail for very low numbers of observations (old way is
// faster)
Assert.assertTrue("Old way is faster", observationInfoTime < observationTime);
// note: hql is faster!
// Assert.assertTrue("HQL is faster", observationInfoTime < hqlTime);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/test/java/org/n52/sos/ds/hibernate/dao/CacheQueryTest.java
|
hibernate/common/src/test/java/org/n52/sos/ds/hibernate/dao/CacheQueryTest.java
|
CacheQueryTest
|
CacheQueryTest
|
addToResultTimeMap__(Map<QueryType, Long> resultTimes, QueryType qt, long foiForOfferingObservationInfoTime)
|
addToResultTimeMap__(Map<QueryType, Long> resultTimes, QueryType qt,
long foiForOfferingObservationInfoTime)
|
private void addToResultTimeMap(Map<QueryType, Long> resultTimes, QueryType qt, long foiForOfferingObservationInfoTime) {
if (resultTimes.containsKey(qt)) {
foiForOfferingObservationInfoTime += resultTimes.get(qt);
}
resultTimes.put(qt, foiForOfferingObservationInfoTime);
}
|
private void addToResultTimeMap(Map<QueryType, Long> resultTimes, QueryType qt,
long foiForOfferingObservationInfoTime) {
if (resultTimes.containsKey(qt)) {
resultTimes.put(qt, foiForOfferingObservationInfoTime + resultTimes.get(qt));
}
resultTimes.put(qt, foiForOfferingObservationInfoTime);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/test/java/org/n52/sos/ds/hibernate/dao/CacheQueryTest.java
|
hibernate/common/src/test/java/org/n52/sos/ds/hibernate/dao/CacheQueryTest.java
|
CacheQueryTest
|
CacheQueryTest
|
getFoiForOfferingObservationInfoTime__()
|
getFoiForOfferingObservationInfoTime__()
|
private long getFoiForOfferingObservationInfoTime() throws OwsExceptionReport {
// new way using ObservationInfo class (excludes value table joins)
Session session = getSession();
long start = System.currentTimeMillis();
Criteria c = session.createCriteria(getContextualReferencedObservationClass()).add(Restrictions.eq(AbstractObservation.DELETED, false));
c.createCriteria(Observation.FEATURE_OF_INTEREST).setProjection(
Projections.distinct(Projections.property(FeatureOfInterest.IDENTIFIER)));
c.createCriteria(Observation.OFFERINGS).add(
Restrictions.eq(Offering.IDENTIFIER, HibernateObservationBuilder.OFFERING_1));
c.list();
long time = System.currentTimeMillis() - start;
LOGGER.debug("QUERY get featureOfInterest identifiers for offering new way: {}",
HibernateHelper.getSqlString(c));
returnSession(session);
return time;
}
|
private long getFoiForOfferingObservationInfoTime() throws OwsExceptionReport {
// new way using ObservationInfo class (excludes value table joins)
Session session = getSession();
long start = System.currentTimeMillis();
Criteria c = session.createCriteria(getContextualReferencedObservationClass())
.add(Restrictions.eq(DataEntity.PROPERTY_DELETED, false));
// c.createCriteria(DataEntity.FEATURE_OF_INTEREST).setProjection(
// Projections.distinct(Projections.property(AbstractFeatureEntity.IDENTIFIER)));
// c.createCriteria(DataEntity.OFFERINGS).add(
// Restrictions.eq(Offering.IDENTIFIER,
// HibernateObservationBuilder.OFFERING_1));
c.list();
long time = System.currentTimeMillis() - start;
LOGGER.debug("QUERY get featureOfInterest identifiers for offering new way: {}",
HibernateHelper.getSqlString(c));
returnSession(session);
return time;
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/test/java/org/n52/sos/ds/hibernate/dao/CacheQueryTest.java
|
hibernate/common/src/test/java/org/n52/sos/ds/hibernate/dao/CacheQueryTest.java
|
CacheQueryTest
|
CacheQueryTest
|
getFoiForOfferingObservationTime__()
|
getFoiForOfferingObservationTime__()
|
private long getFoiForOfferingObservationTime() throws OwsExceptionReport {
// old way using full Observation class (includes value table joins)
Session session = getSession();
long start = System.currentTimeMillis();
final Criteria c = session.createCriteria(getObservationClass()).add(Restrictions.eq(AbstractObservation.DELETED, false));
c.createCriteria(AbstractObservation.FEATURE_OF_INTEREST).setProjection(
Projections.distinct(Projections.property(FeatureOfInterest.IDENTIFIER)));
c.createCriteria(AbstractObservation.OFFERINGS).add(
Restrictions.eq(Offering.IDENTIFIER, HibernateObservationBuilder.OFFERING_1));
c.list();
long time = System.currentTimeMillis() - start;
LOGGER.debug("QUERY get featureOfInterest identifiers for offering old way: {}",
HibernateHelper.getSqlString(c));
returnSession(session);
return time;
}
|
private long getFoiForOfferingObservationTime() throws OwsExceptionReport {
// old way using full Observation class (includes value table joins)
Session session = getSession();
long start = System.currentTimeMillis();
final Criteria c =
session.createCriteria(getObservationClass()).add(Restrictions.eq(DataEntity.PROPERTY_DELETED, false));
// c.createCriteria(DataEntity.FEATURE_OF_INTEREST).setProjection(
// Projections.distinct(Projections.property(AbstractFeatureEntity.IDENTIFIER)));
// c.createCriteria(DataEntity.OFFERINGS).add(
// Restrictions.eq(Offering.IDENTIFIER,
// HibernateObservationBuilder.OFFERING_1));
c.list();
long time = System.currentTimeMillis() - start;
LOGGER.debug("QUERY get featureOfInterest identifiers for offering old way: {}",
HibernateHelper.getSqlString(c));
returnSession(session);
return time;
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/test/java/org/n52/sos/ds/hibernate/dao/CacheQueryTest.java
|
hibernate/common/src/test/java/org/n52/sos/ds/hibernate/dao/CacheQueryTest.java
|
CacheQueryTest
|
CacheQueryTest
|
getFoiForOfferingHqlTime__()
|
getFoiForOfferingHqlTime__()
|
private long getFoiForOfferingHqlTime() {
// hql method
Session session = getSession();
long start = System.currentTimeMillis();
Query query =
session.createQuery(
"select distinct foi." + FeatureOfInterest.IDENTIFIER + " from Observation o" + " join o."
+ AbstractObservation.OFFERINGS + " offs " + " join o." + AbstractObservation.FEATURE_OF_INTEREST
+ " foi" + " where o.deleted = 'F' and offs." + Offering.IDENTIFIER + " = :offering")
.setString("offering", HibernateObservationBuilder.OFFERING_1);
query.list();
long time = System.currentTimeMillis() - start;
LOGGER.debug("QUERY get featureOfInterest identifiers for offering HQL way: {}",
HibernateHelper.getSqlString(query, session));
return time;
}
|
private long getFoiForOfferingHqlTime() {
// hql method
Session session = getSession();
long start = System.currentTimeMillis();
// Query<?> query =
// session.createQuery(
// "select distinct foi." + FeatureOfInterest.IDENTIFIER + " from
// Observation o" + " join o."
// + AbstractObservation.OFFERINGS + " offs " + " join o." +
// AbstractObservation.FEATURE_OF_INTEREST
// + " foi" + " where o.deleted = 'F' and offs." + Offering.IDENTIFIER +
// " = :offering")
// .setParameter("offering", HibernateObservationBuilder.OFFERING_1);
// query.list();
long time = System.currentTimeMillis() - start;
// LOGGER.debug("QUERY get featureOfInterest identifiers for offering
// HQL way: {}",
// HibernateHelper.getSqlString(query, session));
return time;
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/test/java/org/n52/sos/ds/hibernate/dao/CacheQueryTest.java
|
hibernate/common/src/test/java/org/n52/sos/ds/hibernate/dao/CacheQueryTest.java
|
CacheQueryTest
|
CacheQueryTest
|
fillObservations__()
|
fillObservations__()
|
@BeforeClass
public static void fillObservations() throws OwsExceptionReport {
Session session = getSession();
Transaction transaction = null;
try {
transaction = session.beginTransaction();
HibernateObservationBuilder b = new HibernateObservationBuilder(session);
DateTime begin = new DateTime();
int numObs = 10000;
for (int i = 0; i < numObs; ++i) {
if (i % 50 == 0) {
LOGGER.debug("Creating test observation {} of {}", i, numObs);
session.flush();
session.clear();
}
b.createObservation(String.valueOf(i), begin.plusHours(i));
}
LOGGER.debug("Creating test observation {} of {}", numObs, numObs);
session.flush();
transaction.commit();
} catch (HibernateException | CodedException he) {
if (transaction != null) {
transaction.rollback();
}
throw he;
} finally {
returnSession(session);
}
}
|
@BeforeClass
public static void fillObservations() throws OwsExceptionReport {
Session session = getSession();
Transaction transaction = null;
try {
transaction = session.beginTransaction();
I18NDAORepository i18NDAORepository = new I18NDAORepository();
DaoFactory daoFactory = new DaoFactory();
daoFactory.setI18NDAORepository(i18NDAORepository);
HibernateObservationBuilder b = new HibernateObservationBuilder(session, daoFactory);
DateTime begin = new DateTime();
int numObs = 10000;
for (int i = 0; i < numObs; ++i) {
if (i % 50 == 0) {
LOGGER.debug(LOG_TEMPLATE, i, numObs);
session.flush();
session.clear();
}
b.createObservation(String.valueOf(i), begin.plusHours(i));
}
LOGGER.debug(LOG_TEMPLATE, numObs, numObs);
session.flush();
transaction.commit();
} catch (HibernateException | CodedException he) {
if (transaction != null) {
transaction.rollback();
}
throw he;
} finally {
returnSession(session);
}
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/test/java/org/n52/sos/ds/hibernate/dao/CacheQueryTest.java
|
hibernate/common/src/test/java/org/n52/sos/ds/hibernate/dao/CacheQueryTest.java
|
CacheQueryTest
|
CacheQueryTest
|
clearObservations__()
|
clearObservations__()
|
@AfterClass
public static void clearObservations() throws OwsExceptionReport {
Session session = null;
Transaction transaction = null;
try {
session = getSession();
transaction = session.beginTransaction();
try (ScrollableIterable<AbstractObservation<?>> i
= ScrollableIterable.fromCriteria(session.createCriteria(getObservationClass()))) {
for (AbstractObservation<?> o : i) {
session.delete(o);
}
}
session.flush();
transaction.commit();
} catch (HibernateException he) {
if (transaction != null) {
transaction.rollback();
}
throw he;
} finally {
returnSession(session);
}
// SettingsManager.getInstance().cleanup();
}
|
@AfterClass
public static void clearObservations() throws OwsExceptionReport {
Session session = null;
Transaction transaction = null;
try {
session = getSession();
transaction = session.beginTransaction();
try (ScrollableIterable<DataEntity<?>> i =
ScrollableIterable.fromCriteria(session.createCriteria(getObservationClass()))) {
for (DataEntity<?> o : i) {
session.delete(o);
}
}
session.flush();
transaction.commit();
} catch (HibernateException he) {
if (transaction != null) {
transaction.rollback();
}
throw he;
} finally {
returnSession(session);
}
// SettingsManager.getInstance().cleanup();
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
TestDataSqlScriptGenerator
|
TestDataSqlScriptGenerator
|
main__(String[] args)
|
main__(String[] args)
|
public static void main(String[] args) {
LOGGER.debug(String.format("Received args: %s", Arrays.toString(args)));
if (args.length != 3) {
LOGGER.error("3 input parameters are required: " + Arrays.toString(args));
}
int featuresCount = Integer.parseInt(args[FEATURE_COUNT_INDEX]);
int sensorCount = Integer.parseInt(args[SENSOR_COUNT_INDEX]);
int observationsPerFeaturePerSensorCount = Integer.parseInt(args[OBSERVATION_COUNT_INDEX]);
// try to open file
String fileName = DEFAULT_FILENAME;
if (args.length >= 4) {
fileName = args[FILENAME_INDEX];
}
BufferedWriter bw = null;
try {
File file = new File(fileName);
if (fileExistsThanDeleteItAndCreateNew(file)) {
FileWriter fw = new FileWriter(file);
LOGGER.debug("Writing results to file '{}'", file.getAbsolutePath());
bw = new BufferedWriter(fw);
// add header to sql file
bw.write(createHeaderStatements());
bw.flush();
// add content to sql file
// add features
bw.newLine();
bw.newLine();
bw.write("---- START GENERATED CONTENT");
bw.newLine();
bw.newLine();
bw.write("---- FEATURES");
bw.newLine();
Map<Double, Double> uniqueCoordinates = new HashMap<Double, Double>(featuresCount);
for (int featureId = 0; featureId < featuresCount; featureId++) {
bw.write(createFeatureStatement(featureId,
generateRandomUniqueCoordinateTuple(-90.0, 90.0, -180.0, 180.0, uniqueCoordinates)));
bw.newLine();
}
bw.flush();
DateTime start = new DateTime(0l);
bw.write("---- SENSORS incl. sensor, offering, and observation constellation");
bw.newLine();
for (int sensorId = 0; sensorId < sensorCount; sensorId++) {
// add sensor
bw.write(createSensorStatement(sensorId, generateRandomCoordinateTuple(-90.0, 90.0, -180.0, 180.0),
start, OBSERVATION_TYPE, OBSERVED_PROPERTY_ID, FEATURE_TYPE));
bw.newLine();
// add offering
bw.write(createOfferingStatement(sensorId));
bw.newLine();
// add observation constellation
bw.write(
createObservationConstellationStatement(OBSERVATION_TYPE, sensorId, OBSERVED_PROPERTY_ID));
bw.newLine();
}
bw.flush();
// add observations
// observation loop
bw.write("---- OBSERVATIONS");
bw.newLine();
for (int observationBatch =
0; observationBatch < observationsPerFeaturePerSensorCount; observationBatch++) {
// 1 generate timestamp by incrementing from 0l by
// TIMESTAMP_INCREMENT_IN_MS
DateTime timeStamp = new DateTime(observationBatch * TIMESTAMP_INCREMENT_IN_MS);
// feature loop
for (int featureId = 0; featureId < featuresCount; featureId++) {
// sensor loop
for (int sensorId = 0; sensorId < sensorCount; sensorId++) {
// generate random result from range
// RESULT_MIN_VALUE and RESULT_MAX_VALUE
bw.write(createInsertNumericObservationStatement(OBSERVATION_TYPE, sensorId, sensorId,
OBSERVED_PROPERTY_ID, featureId, UNIT_ID, timeStamp,
generateRandomResult(RESULT_MIN_VALUE, RESULT_MAX_VALUE)));
bw.newLine();
}
bw.flush();
}
}
bw.newLine();
bw.newLine();
bw.write("---- END GENERATED CONTENT");
bw.newLine();
bw.newLine();
bw.write(createFooterStatements());
bw.flush();
} else {
LOGGER.error(String.format("Result file could be accessed. File: \"%s\".", file.getAbsolutePath()));
}
} catch (IOException e) {
LOGGER.error(String.format("Exception thrown: %s", e.getMessage()), e);
} finally {
if (bw != null) {
try {
bw.close();
} catch (IOException e) {
LOGGER.error(String.format("Exception thrown while closing stream: %s", e.getMessage()), e);
}
}
}
}
|
public static void main(String[] args) {
LOGGER.debug(String.format("Received args: %s", Arrays.toString(args)));
if (args.length > 4 || args.length < 3) {
LOGGER.error("3 or 4 input parameters are required: " + Arrays.toString(args));
}
int featuresCount = Integer.parseInt(args[0]);
int sensorCount = Integer.parseInt(args[1]);
int obsPerFeaturePerSensorCount = Integer.parseInt(args[2]);
// try to open file
String fileName = DEFAULT_FILENAME;
if (args.length > 3) {
fileName = args[3];
}
Path file = Paths.get(fileName);
try (BufferedWriter bw = Files.newBufferedWriter(file, StandardCharsets.UTF_8, StandardOpenOption.CREATE)) {
LOGGER.debug("Writing results to file '{}'", file.toAbsolutePath().toString());
// add header to sql file
bw.write(createHeaderStatements());
bw.flush();
// add content to sql file
// add features
bw.newLine();
bw.newLine();
bw.write("---- START GENERATED CONTENT");
bw.newLine();
bw.newLine();
bw.write("---- FEATURES");
bw.newLine();
Map<Double, Double> uniqueCoordinates = new HashMap<>(featuresCount);
for (int featureId = 0; featureId < featuresCount; featureId++) {
bw.write(createFeatureStatement(featureId,
generateRandomUniqueCoordinateTuple(-90.0, 90.0, -180.0, 180.0, uniqueCoordinates)));
bw.newLine();
}
bw.flush();
DateTime start = new DateTime(0L);
bw.write("---- SENSORS incl. sensor, offering, and observation constellation");
bw.newLine();
for (int sensorId = 0; sensorId < sensorCount; sensorId++) {
// add sensor
bw.write(createSensorStatement(sensorId, generateRandomCoordinateTuple(-90.0, 90.0, -180.0, 180.0),
start, OBSERVATION_TYPE, OBSERVED_PROPERTY_ID, FEATURE_TYPE));
bw.newLine();
// add offering
bw.write(createOfferingStatement(sensorId));
bw.newLine();
// add observation constellation
bw.write(createObservationConstellationStatement(OBSERVATION_TYPE, sensorId, OBSERVED_PROPERTY_ID));
bw.newLine();
}
bw.flush();
// add observations
// observation loop
bw.write("---- OBSERVATIONS");
bw.newLine();
for (int observationBatch = 0; observationBatch < obsPerFeaturePerSensorCount; observationBatch++) {
// 1 generate timestamp by incrementing from 0l by
// TIMESTAMP_INCREMENT_IN_MS
DateTime timeStamp = new DateTime(observationBatch * TIMESTAMP_INCREMENT_IN_MS);
// feature loop
for (int featureId = 0; featureId < featuresCount; featureId++) {
// sensor loop
for (int sensorId = 0; sensorId < sensorCount; sensorId++) {
// generate random result from range
// RESULT_MIN_VALUE and RESULT_MAX_VALUE
bw.write(createInsertNumericObservationStatement(OBSERVATION_TYPE, sensorId, sensorId,
OBSERVED_PROPERTY_ID, featureId, UNIT_ID, timeStamp,
generateRandomResult(RESULT_MIN_VALUE, RESULT_MAX_VALUE)));
bw.newLine();
}
bw.flush();
}
}
bw.newLine();
bw.newLine();
bw.write("---- END GENERATED CONTENT");
bw.newLine();
bw.newLine();
bw.write(createFooterStatements());
bw.flush();
} catch (IOException e) {
LOGGER.error(String.format("Exception thrown: %s", e.getMessage()), e);
}
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
TestDataSqlScriptGenerator
|
TestDataSqlScriptGenerator
|
createHeaderStatements__()
|
createHeaderStatements__()
|
private static String createHeaderStatements() throws FileNotFoundException {
String headerStatement = new Scanner(TestDataSqlScriptGenerator.class.getResourceAsStream(HEADER_FILE_NAME))
.useDelimiter("\\A").next();
LOGGER.debug(headerStatement);
return headerStatement;
}
|
private static String createHeaderStatements() throws FileNotFoundException {
return createHeaderFooterStatements(HEADER_FILE_NAME);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
TestDataSqlScriptGenerator
|
TestDataSqlScriptGenerator
|
createFooterStatements__()
|
createFooterStatements__()
|
private static String createFooterStatements() throws FileNotFoundException {
String headerStatement = new Scanner(TestDataSqlScriptGenerator.class.getResourceAsStream(FOOTER_FILE_NAME))
.useDelimiter("\\A").next();
LOGGER.debug(headerStatement);
return headerStatement;
}
|
private static String createFooterStatements() throws FileNotFoundException {
return createHeaderFooterStatements(FOOTER_FILE_NAME);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
TestDataSqlScriptGenerator
|
TestDataSqlScriptGenerator
|
createInsertNumericObservationStatement__(String observationType, int sensorId, int offeringId,
String observedProperty, int featureId, String unitId, DateTime timestamp, double value)
|
createInsertNumericObservationStatement__(String observationType, int sensorId, int offeringId,
String observedProperty, int featureId, String unitId,
DateTime timestamp, double value)
|
private static String createInsertNumericObservationStatement(String observationType, int sensorId, int offeringId,
String observedProperty, int featureId, String unitId, DateTime timestamp, double value) {
String insertNumericObservationStatement =
String.format(SQL_INSERT_NUMERIC_OBSERVATION, observationType, Integer.toString(sensorId),
Integer.toString(offeringId), observedProperty, Integer.toString(featureId), unitId,
timestamp.toString(SQL_TIMESTAMP_PATTERN), Double.toString(value).replaceAll(",", "."));
LOGGER.debug(insertNumericObservationStatement);
return insertNumericObservationStatement;
}
|
private static String createInsertNumericObservationStatement(String observationType, int sensorId, int offeringId,
String observedProperty, int featureId, String unitId,
DateTime timestamp, double value) {
String insertNumericObservationStatement = String
.format(SQL_INSERT_NUMERIC_OBSERVATION, observationType, Integer.toString(sensorId),
Integer.toString(offeringId), observedProperty, Integer.toString(featureId), unitId,
timestamp.toString(SQL_TIMESTAMP_PATTERN), Double.toString(value).replaceAll(",", "."));
LOGGER.debug(insertNumericObservationStatement);
return insertNumericObservationStatement;
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
TestDataSqlScriptGenerator
|
TestDataSqlScriptGenerator
|
createObservationConstellationStatement__(String observationType, int sensorId,
String observedPropertyId)
|
createObservationConstellationStatement__(String observationType, int sensorId,
String observedPropertyId)
|
private static String createObservationConstellationStatement(String observationType, int sensorId,
String observedPropertyId) {
String observationConstellationStatement = String.format(SQL_INSERT_OBSERVATION_CONSTELLATION, observationType,
Integer.toString(sensorId), Integer.toString(sensorId), observedPropertyId);
LOGGER.debug(observationConstellationStatement);
return observationConstellationStatement;
}
|
private static String createObservationConstellationStatement(String observationType, int sensorId,
String observedPropertyId) {
String observationConstellationStatement = String.format(SQL_INSERT_OBSERVATION_CONSTELLATION, observationType,
Integer.toString(sensorId), Integer.toString(sensorId),
observedPropertyId);
LOGGER.debug(observationConstellationStatement);
return observationConstellationStatement;
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
TestDataSqlScriptGenerator
|
TestDataSqlScriptGenerator
|
createFeatureStatement__(int featureId, Double[] coordinates)
|
createFeatureStatement__(int featureId, Double[] coordinates)
|
private static String createFeatureStatement(int featureId, Double[] coordinates) {
// SELECT insert_feature_of_interest('test_feature_1', 20.401108,
// 49.594538);
String featureStatement = String.format(SQL_INSERT_FEATURE, Integer.toString(featureId),
Double.toString(coordinates[X_COORD_INDEX]).replaceAll(",", "."),
Double.toString(coordinates[Y_COORD_INDEX]).replaceAll(",", "."));
LOGGER.debug(featureStatement);
return featureStatement;
}
|
private static String createFeatureStatement(int featureId, Double[] coordinates) {
// SELECT insert_feature_of_interest('test_feature_1', 20.401108,
// 49.594538);
String featureStatement = String.format(SQL_INSERT_FEATURE, Integer.toString(featureId),
Double.toString(coordinates[X_COORD_INDEX]).replaceAll(",", "."),
Double.toString(coordinates[Y_COORD_INDEX]).replaceAll(",", "."));
LOGGER.debug(featureStatement);
return featureStatement;
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
TestDataSqlScriptGenerator
|
TestDataSqlScriptGenerator
|
createSensorStatement__(int sensorId, Double[] generateRandomCoordinateTuple,
DateTime timestamp, String observationType, String observedProperty, String featureType)
|
createSensorStatement__(int sensorId, Double[] generateRandomCoordinateTuple,
DateTime timestamp, String observationType, String observedProperty,
String featureType)
|
private static String createSensorStatement(int sensorId, Double[] generateRandomCoordinateTuple,
DateTime timestamp, String observationType, String observedProperty, String featureType) {
/*
* SELECT insert_procedure('http://www.example.org/sensors/101',
* '2012-11-19 13:00', 'test_observable_property_1', 20.401108,
* 49.594538, 0.0, 'Measurement', 'Point');
*/
String sensorStatement = String.format(SQL_INSERT_SENSOR, Integer.toString(sensorId),
timestamp.toString(SQL_TIMESTAMP_PATTERN), observedProperty,
Double.toString(generateRandomCoordinateTuple[X_COORD_INDEX]).replaceAll(",", "."),
Double.toString(generateRandomCoordinateTuple[Y_COORD_INDEX]).replaceAll(",", "."), observationType,
featureType);
LOGGER.debug(sensorStatement);
return sensorStatement;
}
|
private static String createSensorStatement(int sensorId, Double[] generateRandomCoordinateTuple,
DateTime timestamp, String observationType, String observedProperty,
String featureType) {
/*
* SELECT insert_procedure('http://www.example.org/sensors/101',
* '2012-11-19 13:00', 'test_observable_property_1', 20.401108,
* 49.594538, 0.0, 'Measurement', 'Point');
*/
String sensorStatement = String.format(
SQL_INSERT_SENSOR,
Integer.toString(sensorId),
timestamp.toString(SQL_TIMESTAMP_PATTERN), observedProperty,
Double.toString(generateRandomCoordinateTuple[X_COORD_INDEX]).replaceAll(",", "."),
Double.toString(generateRandomCoordinateTuple[Y_COORD_INDEX]).replaceAll(",", "."),
observationType, featureType);
LOGGER.debug(sensorStatement);
return sensorStatement;
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
TestDataSqlScriptGenerator
|
TestDataSqlScriptGenerator
|
generateRandomCoordinateTuple__(double yMin, double yMax, double xMin, double xMax)
|
generateRandomCoordinateTuple__(double yMin, double yMax, double xMin, double xMax)
|
private static Double[] generateRandomCoordinateTuple(double yMin, double yMax, double xMin, double xMax) {
if (xMax > xMin && yMax > yMin) {
Random randomizer = new Random(System.currentTimeMillis());
double xCoord = xMin + (randomizer.nextDouble() * (Math.abs(xMax) + Math.abs(xMin)));
double yCoord = yMin + (randomizer.nextDouble() * (Math.abs(yMax) + Math.abs(yMin)));
Double[] result = new Double[2];
result[X_COORD_INDEX] = xCoord;
result[Y_COORD_INDEX] = yCoord;
return result;
}
throw new IllegalArgumentException(String.format(
"Given parameter values wrong: xMax: %s, xMin: %s, yMax: %s, yMin: %s", xMax, xMin, yMax, yMin));
}
|
private static Double[] generateRandomCoordinateTuple(double yMin, double yMax, double xMin, double xMax) {
if (xMax > xMin && yMax > yMin) {
Random randomizer = new Random(System.currentTimeMillis());
double xCoord = xMin + (randomizer.nextDouble() * (Math.abs(xMax) + Math.abs(xMin)));
double yCoord = yMin + (randomizer.nextDouble() * (Math.abs(yMax) + Math.abs(yMin)));
Double[] result = new Double[2];
result[X_COORD_INDEX] = xCoord;
result[Y_COORD_INDEX] = yCoord;
return result;
}
throw invalidCoordinateTuple(xMax, xMin, yMax, yMin);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
TestDataSqlScriptGenerator
|
TestDataSqlScriptGenerator
|
generateRandomUniqueCoordinateTuple__(double yMin, double yMax, double xMin, double xMax,
Map<Double, Double> uniqueCoordinates)
|
generateRandomUniqueCoordinateTuple__(double yMin, double yMax, double xMin, double xMax,
Map<Double, Double> uniqueCoordinates)
|
private static Double[] generateRandomUniqueCoordinateTuple(double yMin, double yMax, double xMin, double xMax,
Map<Double, Double> uniqueCoordinates) {
if (xMax > xMin && yMax > yMin && uniqueCoordinates != null) {
// generate coordinates
Double[] sample = null;
do {
sample = generateRandomCoordinateTuple(yMin, yMax, xMin, xMax);
} while (sample == null || sampleAlreadyInList(uniqueCoordinates, sample));
uniqueCoordinates.put(sample[X_COORD_INDEX], sample[Y_COORD_INDEX]);
return sample;
}
throw new IllegalArgumentException(String.format(
"Given parameter values wrong: xMax: %s, xMin: %s, yMax: %s, yMin: %s", xMax, xMin, yMax, yMin));
}
|
private static Double[] generateRandomUniqueCoordinateTuple(double yMin, double yMax, double xMin, double xMax,
Map<Double, Double> uniqueCoordinates) {
if (xMax > xMin && yMax > yMin && uniqueCoordinates != null) {
// generate coordinates
Double[] sample = null;
do {
sample = generateRandomCoordinateTuple(yMin, yMax, xMin, xMax);
} while (sample == null || sampleAlreadyInList(uniqueCoordinates, sample));
uniqueCoordinates.put(sample[X_COORD_INDEX], sample[Y_COORD_INDEX]);
return sample;
}
throw invalidCoordinateTuple(xMax, xMin, yMax, yMin);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
core/test/src/main/java/org/n52/sos/ds/TestDataSqlScriptGenerator.java
|
TestDataSqlScriptGenerator
|
TestDataSqlScriptGenerator
|
sampleAlreadyInList__(Map<Double, Double> uniqueCoordinates, Double[] sample)
|
sampleAlreadyInList__(Map<Double, Double> uniqueCoordinates, Double[] sample)
|
private static boolean sampleAlreadyInList(Map<Double, Double> uniqueCoordinates, Double[] sample) {
return sample != null && !uniqueCoordinates.isEmpty() && uniqueCoordinates.containsKey(sample[X_COORD_INDEX])
&& uniqueCoordinates.get(sample[X_COORD_INDEX]).equals(sample[Y_COORD_INDEX]);
}
|
private static boolean sampleAlreadyInList(Map<Double, Double> uniqueCoordinates, Double[] sample) {
return sample != null && !uniqueCoordinates.isEmpty() && uniqueCoordinates.containsKey(sample[X_COORD_INDEX]) &&
uniqueCoordinates.get(sample[X_COORD_INDEX]).equals(sample[Y_COORD_INDEX]);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/profile/coding/src/main/java/org/n52/sos/profile/ProfileParser.java
|
core/profile/coding/src/main/java/org/n52/sos/profile/ProfileParser.java
|
ProfileParser
|
ProfileParser
|
parseSosProfile__(JsonNode node)
|
parseProfile__(JsonNode node)
|
public Profile parseSosProfile(JsonNode node) {
ProfileImpl profile = new ProfileImpl();
profile.setIdentifier(parseIdentifier(node));
profile.setActiveProfile(parseActiveProfile(node));
profile.setListFeatureOfInterestsInOfferings(parseListFeatureOfInterestsInOfferings(node));
profile.setEncodeChildProcedureDescriptions(parseEncodeChildProcedureDescriptions(node));
profile.setShowFullOperationsMetadata(parseShowFullOperationsMetadata(node));
profile.setShowFullOperationsMetadataForObservations(parseShowFullOperationsMetadataForObservations(node));
profile.setAllowSubsettingForSOS20OM20(parseAllowSubsettingForSOS20OM20(node));
profile.setEncodeFeatureOfInterestInObservations(parseEncodeFeatureOfInterestInObservations(node));
profile.setEncodingNamespaceForFeatureOfInterest(parseEncodingNamespaceForFeatureOfInterestEncoding(node));
profile.setMergeValues(parseMergeValues(node));
profile.setObservationResponseFormat(parseObservationResponseFormat(node));
parseNoDataPlaceholder(profile, node);
profile.setReturnLatestValueIfTemporalFilterIsMissingInGetObservation(parseReturnLatestValueIfTemporalFilterIsMissingInGetObservation(node));
profile.setShowMetadataOfEmptyObservations(parseShowMetadataOfEmptyObservations(node));
parseDefaultObservationTypesForEncoding(profile, node);
parseEncodeProcedure(profile, node);
return profile;
}
|
public Profile parseProfile(JsonNode node) {
ProfileImpl profile = new ProfileImpl();
profile.setIdentifier(parseIdentifier(node));
profile.setActiveProfile(parseActiveProfile(node));
profile.setDefinition(parseDefinition(node));
profile.setListFeatureOfInterestsInOfferings(parseListFeatureOfInterestsInOfferings(node));
profile.setEncodeChildProcedureDescriptions(parseEncodeChildProcedureDescriptions(node));
profile.setShowFullOperationsMetadata(parseShowFullOperationsMetadata(node));
profile.setShowFullOperationsMetadataForObservations(parseShowFullOperationsMetadataForObservations(node));
profile.setAllowSubsettingForSOS20OM20(parseAllowSubsettingForSOS20OM20(node));
profile.setEncodeFeatureOfInterestInObservations(parseEncodeFeatureOfInterestInObservations(node));
profile.setEncodingNamespaceForFeatureOfInterest(parseEncodingNamespaceForFeatureOfInterestEncoding(node));
profile.setMergeValues(parseMergeValues(node));
profile.setObservationResponseFormat(parseObservationResponseFormat(node));
parseNoDataPlaceholder(profile, node);
profile.setReturnLatestValueIfTemporalFilterIsMissingInGetObservation(
parseReturnLatestValueIfTemporalFilterIsMissingInGetObservation(node));
profile.setShowMetadataOfEmptyObservations(parseShowMetadataOfEmptyObservations(node));
parseDefaultObservationTypesForEncoding(profile, node);
parseEncodeProcedure(profile, node);
return profile;
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/profile/coding/src/main/java/org/n52/sos/profile/ProfileParser.java
|
core/profile/coding/src/main/java/org/n52/sos/profile/ProfileParser.java
|
ProfileParser
|
ProfileParser
|
parseEncodingNamespaceForFeatureOfInterestEncoding__(JsonNode node)
|
parseEncodingNamespaceForFeatureOfInterestEncoding__(JsonNode node)
|
private String parseEncodingNamespaceForFeatureOfInterestEncoding(JsonNode node) {
if (isNotMissingNode(node.path(ENCODE_NAMESPACE_FOIS))) {
return parseText(node.path(ENCODE_NAMESPACE_FOIS));
}
return Constants.EMPTY_STRING;
}
|
private String parseEncodingNamespaceForFeatureOfInterestEncoding(JsonNode node) {
if (isNotMissingNode(node.path(ENCODE_NAMESPACE_FOIS))) {
return parseText(node.path(ENCODE_NAMESPACE_FOIS));
}
return "";
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/profile/coding/src/main/java/org/n52/sos/profile/ProfileParser.java
|
core/profile/coding/src/main/java/org/n52/sos/profile/ProfileParser.java
|
ProfileParser
|
ProfileParser
|
parseNoDataPlaceholder__(ProfileImpl profile, JsonNode node)
|
parseNoDataPlaceholder__(ProfileImpl profile, JsonNode node)
|
private void parseNoDataPlaceholder(ProfileImpl profile, JsonNode node) {
if (isNotMissingNode(node.path(NO_DATA_PLACEHOLDER))) {
if (isNotMissingNode(node.path(NO_DATA_PLACEHOLDER).path(RESPONSE_PLACEHOLDER))) {
profile.setResponseNoDataPlaceholder(parseText(node.path(NO_DATA_PLACEHOLDER).path(RESPONSE_PLACEHOLDER)));
}
if (isNotMissingNode(node.path(NO_DATA_PLACEHOLDER).path(PLACEHOLDER))) {
Set<String> placeholder = Sets.newHashSet();
JsonNode phNode = node.path(NO_DATA_PLACEHOLDER).path(PLACEHOLDER);
if (node.path(NO_DATA_PLACEHOLDER).path(PLACEHOLDER).isArray()) {
for (int i = 0; i < phNode.size(); i++) {
placeholder.add(phNode.get(i).asText());
}
} else {
placeholder.add(phNode.asText());
}
profile.setNoDataPlaceholder(placeholder);
}
}
}
|
private void parseNoDataPlaceholder(ProfileImpl profile, JsonNode node) {
if (isNotMissingNode(node.path(NO_DATA_PLACEHOLDER))) {
if (isNotMissingNode(node.path(NO_DATA_PLACEHOLDER).path(RESPONSE_PLACEHOLDER))) {
profile.setResponseNoDataPlaceholder(
parseText(node.path(NO_DATA_PLACEHOLDER).path(RESPONSE_PLACEHOLDER)));
}
if (isNotMissingNode(node.path(NO_DATA_PLACEHOLDER).path(PLACEHOLDER))) {
Set<String> placeholder = Sets.newHashSet();
JsonNode phNode = node.path(NO_DATA_PLACEHOLDER).path(PLACEHOLDER);
if (node.path(NO_DATA_PLACEHOLDER).path(PLACEHOLDER).isArray()) {
for (int i = 0; i < phNode.size(); i++) {
placeholder.add(phNode.get(i).asText());
}
} else {
placeholder.add(phNode.asText());
}
profile.setNoDataPlaceholder(placeholder);
}
}
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
statistics/src/test/java/org/n52/sos/statistics/sos/resolvers/SosExceptionEventResolverIt.java
|
statistics/src/test/java/org/n52/sos/statistics/sos/resolvers/SosExceptionEventResolverIt.java
|
SosExceptionEventResolverIt
|
SosExceptionEventResolverIt
|
persistRequestToDb__()
|
persistRequestToDb__()
|
@Test
public void persistRequestToDb() throws Exception {
JSONDecodingException exp = new JSONDecodingException("message");
resolve.setEvent(new ExceptionEvent(exp));
dataHandler.persist(resolve.resolve());
// eventually realtime should be enough
Thread.sleep(2500);
SearchResponse resp = getEmbeddedClient().prepareSearch(clientSettings.getIndexId()).setTypes(clientSettings.getTypeId()).get();
Assert.assertEquals(1L, resp.getHits().getTotalHits());
}
|
@Test
public void persistRequestToDb() throws Exception {
JSONDecodingException exp = new JSONDecodingException("message");
resolve.setEvent(new ExceptionEvent(exp));
dataHandler.persist(resolve.resolve());
// eventually realtime should be enough
Thread.sleep(2500);
SearchResponse resp = getEmbeddedClient().prepareSearch(clientSettings.getIndexId())
.setTypes(clientSettings.getTypeId()).get();
Assert.assertEquals(1L, resp.getHits().getTotalHits());
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/api/src/main/java/org/n52/sos/exception/sos/InvalidPropertyOfferingCombinationException.java
|
core/api/src/main/java/org/n52/sos/exception/sos/InvalidPropertyOfferingCombinationException.java
|
InvalidPropertyOfferingCombinationException
|
InvalidPropertyOfferingCombinationException
|
InvalidPropertyOfferingCombinationException__()
|
InvalidPropertyOfferingCombinationException__()
|
public InvalidPropertyOfferingCombinationException() {
super(SosExceptionCode.InvalidPropertyOfferingCombination);
setStatus(BAD_REQUEST);
}
|
public InvalidPropertyOfferingCombinationException() {
super(SosExceptionCode.InvalidPropertyOfferingCombination);
setStatus(HTTPStatus.BAD_REQUEST);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/util/SpatialRestrictions.java
|
hibernate/utils/src/main/java/org/n52/sos/ds/hibernate/util/SpatialRestrictions.java
|
SpatialRestrictions
|
SpatialRestrictions
|
filter__(String propertyName, SpatialOperator operator, Geometry geometry)
|
filter__(String propertyName, SpatialOperator operator, Geometry geometry)
|
public static Criterion filter(String propertyName, SpatialOperator operator, Geometry geometry)
throws OwsExceptionReport {
switch (operator) {
case BBOX:
return within(propertyName, geometry);
// TODO why are these commented?
case Contains:
// return contains(propertyName, geometry);
case Crosses:
// return crosses(propertyName, geometry);
case Disjoint:
// return disjoint(propertyName, geometry);
case DWithin:
// return distanceWithin(propertyName, geometry, 10);
case Equals:
// return eq(propertyName, geometry);
case Intersects:
// return intersects(propertyName, geometry);
case Overlaps:
// return overlaps(propertyName, geometry);
case Touches:
// return touches(propertyName, geometry);
case Within:
// return within(propertyName, geometry);
case Beyond:
default:
throw new UnsupportedOperatorException(operator);
}
}
|
public static Criterion filter(String propertyName, SpatialOperator operator, Geometry geometry)
throws OwsExceptionReport {
switch (operator) {
case BBOX:
return within(propertyName, geometry);
case Contains:
return contains(propertyName, geometry);
case Crosses:
return crosses(propertyName, geometry);
case Disjoint:
return disjoint(propertyName, geometry);
case DWithin:
return distanceWithin(propertyName, geometry, DWITHIN_DISTANCE);
case Equals:
return eq(propertyName, geometry);
case Intersects:
return intersects(propertyName, geometry);
case Overlaps:
return overlaps(propertyName, geometry);
case Touches:
return touches(propertyName, geometry);
case Within:
return within(propertyName, geometry);
case Beyond:
default:
throw new UnsupportedOperatorException(operator);
}
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/util/SpatialRestrictions.java
|
hibernate/utils/src/main/java/org/n52/sos/ds/hibernate/util/SpatialRestrictions.java
|
SpatialRestrictions
|
SpatialRestrictions
|
spatialRestriction__(int relation, String propertyName, Geometry value)
|
spatialRestriction__(int relation, String propertyName, Geometry value)
|
public static Criterion spatialRestriction(int relation, String propertyName, Geometry value) {
return org.hibernate.spatial.criterion.SpatialRestrictions.spatialRestriction(relation, propertyName, value);
}
|
public static Criterion spatialRestriction(int relation, String propertyName, Geometry value) {
return org.hibernate.spatial.criterion.SpatialRestrictions.spatialRestriction(relation,
propertyName,
value);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/ereporting/EReportingSeriesDAO.java
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/ereporting/EReportingSeriesDAO.java
|
EReportingSeriesDAO
|
EReportingSeriesDAO
|
getSeries__(GetObservationRequest request, Collection<String> features, Session session)
|
getSeries__(GetObservationRequest request, Collection<String> features, Session session)
|
@Override
@SuppressWarnings("unchecked")
public List<Series> getSeries(GetObservationRequest request, Collection<String> features, Session session) throws CodedException {
return getSeriesCriteria(request, features, session).list();
}
|
@Override
public List<DatasetEntity> getSeries(GetObservationRequest request, Collection<String> features, Session session)
throws OwsExceptionReport {
List<DatasetEntity> series = new ArrayList<>();
if (CollectionHelper.isNotEmpty(features)) {
for (List<String> ids : QueryHelper.getListsForIdentifiers(features)) {
series.addAll(getSeriesSet(request, ids, session));
}
} else {
series.addAll(getSeriesSet(request, features, session));
}
return series;
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/ereporting/EReportingSeriesDAO.java
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/ereporting/EReportingSeriesDAO.java
|
EReportingSeriesDAO
|
EReportingSeriesDAO
|
getSeries__(String observedProperty, Collection<String> features, Session session)
|
getSeries__(String observedProperty, Collection<String> features, Session session)
|
@Override
@SuppressWarnings("unchecked")
public List<Series> getSeries(String observedProperty, Collection<String> features, Session session) {
return getSeriesCriteria(observedProperty, features, session).list();
}
|
@Override
@SuppressWarnings("unchecked")
public List<DatasetEntity> getSeries(String observedProperty, Collection<String> features, Session session) {
if (CollectionHelper.isNotEmpty(features)) {
List<DatasetEntity> series = new ArrayList<>();
for (List<String> ids : QueryHelper.getListsForIdentifiers(features)) {
series.addAll(getSeriesCriteria(observedProperty, ids, session).list());
}
return series;
} else {
return getSeriesCriteria(observedProperty, features, session).list();
}
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/ereporting/EReportingSeriesDAO.java
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/ereporting/EReportingSeriesDAO.java
|
EReportingSeriesDAO
|
EReportingSeriesDAO
|
getSeries__(Collection<String> procedures, Collection<String> observedProperties,
Collection<String> features, Session session)
|
getSeries__(Collection<String> procedures, Collection<String> observedProperties,
Collection<String> features, Session session)
|
@Override
@SuppressWarnings("unchecked")
public List<Series> getSeries(Collection<String> procedures, Collection<String> observedProperties,
Collection<String> features, Session session) {
return getSeriesCriteria(procedures, observedProperties, features, session).list();
}
|
@Override
@SuppressWarnings("unchecked")
public List<DatasetEntity> getSeries(Collection<String> procedures, Collection<String> observedProperties,
Collection<String> features, Session session) {
if (CollectionHelper.isNotEmpty(features)) {
List<DatasetEntity> series = new ArrayList<>();
for (List<String> ids : QueryHelper.getListsForIdentifiers(features)) {
series.addAll(getSeriesCriteria(procedures, observedProperties, ids, session).list());
}
return series;
} else {
return getSeriesCriteria(procedures, observedProperties, features, session).list();
}
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/ereporting/EReportingSeriesDAO.java
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/ereporting/EReportingSeriesDAO.java
|
EReportingSeriesDAO
|
EReportingSeriesDAO
|
getSeriesFor__(String procedure, String observableProperty, String featureOfInterest,
Session session)
|
getSeriesFor__(String procedure, String observableProperty, String featureOfInterest,
Session session)
|
@Override
public EReportingSeries getSeriesFor(String procedure, String observableProperty, String featureOfInterest,
Session session) {
return (EReportingSeries) getSeriesCriteriaFor(procedure, observableProperty, featureOfInterest, session).uniqueResult();
}
|
@Override
public DatasetEntity getSeriesFor(String procedure, String observableProperty, String featureOfInterest,
Session session) {
return (DatasetEntity) getSeriesCriteriaFor(procedure, observableProperty, featureOfInterest, session)
.uniqueResult();
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/ereporting/EReportingSeriesDAO.java
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/ereporting/EReportingSeriesDAO.java
|
EReportingSeriesDAO
|
EReportingSeriesDAO
|
addEReportingSamplingPointToCriteria__(Criteria c, String samplingPoint)
|
addEReportingSamplingPointToCriteria__(Criteria c, String samplingPoint)
|
public void addEReportingSamplingPointToCriteria(Criteria c, String samplingPoint) {
c.createCriteria(EReportingSeries.SAMPLING_POINT).add(Restrictions.eq(EReportingSamplingPoint.IDENTIFIER, samplingPoint));
}
|
public void addEReportingSamplingPointToCriteria(Criteria c, String samplingPoint) {
c.createCriteria(getSamplingPointAssociationPath())
.add(Restrictions.eq(EReportingSamplingPointEntity.IDENTIFIER, samplingPoint));
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/ereporting/EReportingSeriesDAO.java
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/ereporting/EReportingSeriesDAO.java
|
EReportingSeriesDAO
|
EReportingSeriesDAO
|
addEReportingSamplingPointToCriteria__(Criteria c, Collection<String> samplingPoints)
|
addEReportingSamplingPointToCriteria__(Criteria c, Collection<String> samplingPoints)
|
public void addEReportingSamplingPointToCriteria(Criteria c, Collection<String> samplingPoints) {
c.createCriteria(EReportingSeries.SAMPLING_POINT).add(Restrictions.in(EReportingSamplingPoint.IDENTIFIER, samplingPoints));
}
|
public void addEReportingSamplingPointToCriteria(Criteria c, Collection<String> samplingPoints) {
c.createCriteria(getSamplingPointAssociationPath())
.add(Restrictions.in(EReportingSamplingPointEntity.IDENTIFIER, samplingPoints));
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/ereporting/EReportingSeriesDAO.java
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/ereporting/EReportingSeriesDAO.java
|
EReportingSeriesDAO
|
EReportingSeriesDAO
|
addSpecificRestrictions__(Criteria c, GetObservationRequest request)
|
addSpecificRestrictions__(Criteria c, GetObservationRequest request)
|
@Override
protected void addSpecificRestrictions(Criteria c, GetObservationRequest request) throws CodedException {
if (request.isSetResponseFormat() && AqdConstants.NS_AQD.equals(request.getResponseFormat())) {
ReportObligationType flow = AqdHelper.getInstance().getFlow(request.getExtensions());
if (ReportObligationType.E1A.equals(flow) || ReportObligationType.E2A.equals(flow)) {
addAssessmentType(c, AqdConstants.AssessmentType.Fixed.name());
} else if (ReportObligationType.E1B.equals(flow)) {
addAssessmentType(c, AqdConstants.AssessmentType.Model.name());
} else {
throw new OptionNotSupportedException().withMessage("The requested e-Reporting flow %s is not supported!", flow.name());
}
}
}
|
@Override
protected void addSpecificRestrictions(Criteria c, GetObservationRequest request) throws OwsExceptionReport {
if (request.isSetResponseFormat() && AqdConstants.NS_AQD.equals(request.getResponseFormat())) {
ReportObligationType flow = ReportObligations.getFlow(request.getExtensions());
if (null == flow) {
throw new OptionNotSupportedException()
.withMessage("The request does not conatain an e-Reporting flow parameter!");
} else {
switch (flow) {
case E1A:
case E2A:
addAssessmentType(c, AqdConstants.AssessmentType.Fixed.name());
break;
case E1B:
addAssessmentType(c, AqdConstants.AssessmentType.Model.name());
break;
default:
throw new OptionNotSupportedException()
.withMessage("The requested e-Reporting flow %s is not supported!", flow.name());
}
}
}
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/ereporting/EReportingSeriesDAO.java
|
hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/observation/ereporting/EReportingSeriesDAO.java
|
EReportingSeriesDAO
|
EReportingSeriesDAO
|
addAssessmentType__(Criteria c, String assessmentType)
|
addAssessmentType__(Criteria c, String assessmentType)
|
private void addAssessmentType(Criteria c, String assessmentType) {
c.createCriteria(EReportingSeries.SAMPLING_POINT).createCriteria(EReportingSamplingPoint.ASSESSMENTTYPE).
add(Restrictions.ilike(EReportingAssessmentType.ASSESSMENT_TYPE, assessmentType));
}
|
private void addAssessmentType(Criteria c, String assessmentType) {
c.createCriteria(getSamplingPointAssociationPath())
.createCriteria(EReportingSamplingPointEntity.ASSESSMENTTYPE)
.add(Restrictions.ilike(EReportingAssessmentTypeEntity.ASSESSMENT_TYPE, assessmentType));
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
spring/admin-controller/src/main/java/org/n52/sos/web/admin/AdminSettingsController.java
|
spring/admin-controller/src/main/java/org/n52/sos/web/admin/AdminSettingsController.java
|
AdminSettingsController
|
AdminSettingsController
|
displaySettings__(Principal user)
|
displaySettings__(Principal user)
|
@RequestMapping(value = ControllerConstants.Paths.ADMIN_SETTINGS, method = RequestMethod.GET)
public ModelAndView displaySettings(Principal user) throws ConfigurationError, JSONException, ConnectionProviderException {
Map<String, Object> model = new HashMap<>(2);
model.put(ControllerConstants.SETTINGS_MODEL_ATTRIBUTE, getSettingsJsonString());
model.put(ControllerConstants.ADMIN_USERNAME_REQUEST_PARAMETER, user.getName());
return new ModelAndView(ControllerConstants.Views.ADMIN_SETTINGS, model);
}
|
@RequestMapping(value = ControllerConstants.Paths.ADMIN_SETTINGS, method = RequestMethod.GET)
public ModelAndView displaySettings(Principal user)
throws ConfigurationError, JSONException, ConnectionProviderException {
Map<String, Object> model = new HashMap<>(2);
model.put(ControllerConstants.SETTINGS_MODEL_ATTRIBUTE, getSettingsJsonString());
model.put(ControllerConstants.ADMIN_USERNAME_REQUEST_PARAMETER, user.getName());
return new ModelAndView(ControllerConstants.Views.ADMIN_SETTINGS, model);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
spring/admin-controller/src/main/java/org/n52/sos/web/admin/AdminSettingsController.java
|
spring/admin-controller/src/main/java/org/n52/sos/web/admin/AdminSettingsController.java
|
AdminSettingsController
|
AdminSettingsController
|
dump__()
|
dump__()
|
@ResponseBody
@RequestMapping(value = ControllerConstants.Paths.ADMIN_SETTINGS_DUMP, method = RequestMethod.GET, produces = "application/json; charset=UTF-8")
public String dump() {
try {
return getSettingsJsonString();
} catch (Exception ex) {
LOG.error("Could not load settings", ex);
throw new RuntimeException(ex);
}
}
|
@ResponseBody
@RequestMapping(value = ControllerConstants.Paths.ADMIN_SETTINGS_DUMP,
method = RequestMethod.GET,
produces = "application/json; charset=UTF-8")
public String dump() {
try {
return getSettingsJsonString();
} catch (Exception ex) {
LOG.error("Could not load settings", ex);
throw new RuntimeException(ex);
}
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
spring/admin-controller/src/main/java/org/n52/sos/web/admin/AdminSettingsController.java
|
spring/admin-controller/src/main/java/org/n52/sos/web/admin/AdminSettingsController.java
|
AdminSettingsController
|
AdminSettingsController
|
getSettingsJsonString__()
|
getSettingsJsonString__()
|
private String getSettingsJsonString()
throws ConfigurationError, JSONException,
ConnectionProviderException {
return JSONUtils.print(encodeValues(settingsManager.getSettings()));
}
|
private String getSettingsJsonString() throws ConfigurationError, JSONException, ConnectionProviderException {
return Json.print(encodeValues(settingsManager.getSettings()));
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
spring/admin-controller/src/main/java/org/n52/sos/web/admin/AdminSettingsController.java
|
spring/admin-controller/src/main/java/org/n52/sos/web/admin/AdminSettingsController.java
|
AdminSettingsController
|
AdminSettingsController
|
updateSettings__(HttpServletRequest request)
|
updateSettings__(HttpServletRequest request)
|
private void updateSettings(HttpServletRequest request) {
Map<SettingDefinition<?, ?>, SettingValue<?>> changedSettings = new HashMap<>();
for (SettingDefinition<?, ?> def : settingsManager.getSettingDefinitions()) {
SettingValue<?> newValue =
settingsManager.getSettingFactory().newSettingValue(def, request.getParameter(def.getKey()));
changedSettings.put(def, newValue);
}
logSettings(changedSettings.values());
for (SettingValue<?> e : changedSettings.values()) {
settingsManager.changeSetting(e);
}
}
|
@SuppressFBWarnings("PT_ABSOLUTE_PATH_TRAVERSAL")
private void updateSettings(HttpServletRequest request) {
Map<SettingDefinition<?>, SettingValue<?>> changedSettings = new HashMap<>();
for (SettingDefinition<?> def : settingsManager.getSettingDefinitions()) {
SettingValue<?> newValue =
settingsManager.getSettingFactory().newSettingValue(def, request.getParameter(def.getKey()));
changedSettings.put(def, newValue);
}
logSettings(changedSettings.values());
for (SettingValue<?> e : changedSettings.values()) {
settingsManager.changeSetting(e);
}
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
spring/admin-controller/src/main/java/org/n52/sos/web/admin/AdminSettingsController.java
|
spring/admin-controller/src/main/java/org/n52/sos/web/admin/AdminSettingsController.java
|
AdminSettingsController
|
AdminSettingsController
|
updateAdminUser__(HttpServletRequest request, Principal user)
|
updateAdminUser__(HttpServletRequest request, Principal user)
|
private void updateAdminUser(HttpServletRequest request, Principal user) throws AuthenticationException,
ConfigurationError {
String password = request.getParameter(ControllerConstants.ADMIN_PASSWORD_REQUEST_PARAMETER);
String username = request.getParameter(ControllerConstants.ADMIN_USERNAME_REQUEST_PARAMETER);
String currentPassword = request.getParameter(ControllerConstants.ADMIN_CURRENT_PASSWORD_REQUEST_PARAMETER);
updateAdminUser(request, password, username, currentPassword, user.getName());
}
|
private void updateAdminUser(HttpServletRequest request, Principal user)
throws AuthenticationException, ConfigurationError {
String password = request.getParameter(ControllerConstants.ADMIN_PASSWORD_REQUEST_PARAMETER);
String username = request.getParameter(ControllerConstants.ADMIN_USERNAME_REQUEST_PARAMETER);
String currentPassword = request.getParameter(ControllerConstants.ADMIN_CURRENT_PASSWORD_REQUEST_PARAMETER);
updateAdminUser(request, password, username, currentPassword, user.getName());
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
spring/admin-controller/src/main/java/org/n52/sos/web/admin/AdminSettingsController.java
|
spring/admin-controller/src/main/java/org/n52/sos/web/admin/AdminSettingsController.java
|
AdminSettingsController
|
AdminSettingsController
|
updateAdminUser__(HttpServletRequest req, String newPassword, String newUsername,
String currentPassword, String currentUsername)
|
updateAdminUser__(HttpServletRequest req, String newPassword, String newUsername,
String currentPassword, String currentUsername)
|
private void updateAdminUser(HttpServletRequest req, String newPassword, String newUsername,
String currentPassword, String currentUsername) throws AuthenticationException, ConfigurationError {
if (StringHelper.isNotEmpty(newPassword) || !currentUsername.equals(newUsername)) {
if (currentPassword == null) {
throw new BadCredentialsException("You have to submit your current password.");
}
AdministratorUser loggedInAdmin = getUserService().authenticate(currentUsername, currentPassword);
if (loggedInAdmin instanceof DefaultAdministratorUser) {
getUserService().createAdmin(newUsername, newPassword);
HttpSession session = req.getSession(false);
if (session != null) {
session.invalidate();
}
SecurityContextHolder.clearContext();
} else {
if (!currentPassword.equals(newPassword)) {
getUserService().setAdminPassword(loggedInAdmin, newPassword);
}
if (!currentUsername.equals(newUsername)) {
getUserService().setAdminUserName(loggedInAdmin, newUsername);
}
}
}
}
|
private void updateAdminUser(HttpServletRequest req, String newPassword, String newUsername,
String currentPassword, String currentUsername) throws AuthenticationException, ConfigurationError {
if (!Strings.isNullOrEmpty(newPassword) || !currentUsername.equals(newUsername)) {
if (currentPassword == null) {
throw new BadCredentialsException("You have to submit your current password.");
}
AdministratorUser loggedInAdmin = getUserService().authenticate(currentUsername, currentPassword);
if (loggedInAdmin instanceof DefaultAdministratorUser) {
getUserService().createAdmin(newUsername, newPassword);
HttpSession session = req.getSession(false);
if (session != null) {
session.invalidate();
}
SecurityContextHolder.clearContext();
} else {
if (!currentPassword.equals(newPassword)) {
getUserService().setAdminPassword(loggedInAdmin, newPassword);
}
if (!currentUsername.equals(newUsername)) {
getUserService().setAdminUserName(loggedInAdmin, newUsername);
}
}
}
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/dao/src/main/java/org/n52/sos/ds/hibernate/InsertResultTemplateCapabilitiesExtensionProvider.java
|
hibernate/handler/src/main/java/org/n52/sos/ds/hibernate/InsertResultTemplateCapabilitiesExtensionProvider.java
|
InsertResultTemplateCapabilitiesExtensionProvider
|
InsertResultTemplateCapabilitiesExtensionProvider
|
getExtension__()
|
getExtension__()
|
@Override
public CapabilitiesExtension getExtension() {
SosInsertionCapabilities insertionCapabilities = new SosInsertionCapabilities();
SosContentCache cache = getCache();
insertionCapabilities.addFeatureOfInterestTypes(cache.getFeatureOfInterestTypes());
insertionCapabilities.addObservationTypes(cache.getObservationTypes());
insertionCapabilities.addProcedureDescriptionFormats(ProcedureDescriptionFormatRepository.getInstance()
.getSupportedProcedureDescriptionFormats(SosConstants.SOS, Sos2Constants.SERVICEVERSION));
// TODO dynamic
insertionCapabilities.addSupportedEncoding(SweConstants.ENCODING_TEXT);
return insertionCapabilities;
}
|
@Override
public OwsCapabilitiesExtension getExtension() {
SosInsertionCapabilities insertionCapabilities = new SosInsertionCapabilities();
SosContentCache cache = getCache();
insertionCapabilities.addFeatureOfInterestTypes(cache.getFeatureOfInterestTypes());
insertionCapabilities.addObservationTypes(cache.getObservationTypes());
insertionCapabilities.addProcedureDescriptionFormats(procedureDescriptionFormatRepository
.getSupportedProcedureDescriptionFormats(SosConstants.SOS, Sos2Constants.SERVICEVERSION));
// TODO dynamic
insertionCapabilities.addSupportedEncoding(SweConstants.ENCODING_TEXT);
return insertionCapabilities;
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/dao/src/main/java/org/n52/sos/ds/hibernate/InsertResultTemplateCapabilitiesExtensionProvider.java
|
hibernate/handler/src/main/java/org/n52/sos/ds/hibernate/InsertResultTemplateCapabilitiesExtensionProvider.java
|
InsertResultTemplateCapabilitiesExtensionProvider
|
InsertResultTemplateCapabilitiesExtensionProvider
|
getKeys__()
|
getKeys__()
|
@Override
public Set<CapabilitiesExtensionKey> getKeys() {
return Collections.singleton(KEY);
}
|
@Override
public Set<OwsCapabilitiesExtensionKey> getKeys() {
return Collections.singleton(KEY);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/sqlite-config/src/main/java/org/n52/sos/config/sqlite/hibernate/AbstractStringBasedHibernateUserType.java
|
hibernate/session-factory/src/main/java/org/n52/sos/ds/hibernate/type/AbstractStringBasedHibernateUserType.java
|
AbstractStringBasedHibernateUserType
|
AbstractStringBasedHibernateUserType
|
nullSafeGet__(ResultSet rs, String[] names, SessionImplementor session, Object owner)
|
nullSafeGet__(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
|
@Override
public Object nullSafeGet(ResultSet rs, String[] names, SessionImplementor session, Object owner) throws
HibernateException, SQLException {
String s = rs.getString(names[0]);
return (s == null) ? null : decode(s);
}
|
@Override
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner)
throws HibernateException, SQLException {
String s = rs.getString(names[0]);
return (s == null) ? null : decode(s);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/sqlite-config/src/main/java/org/n52/sos/config/sqlite/hibernate/AbstractStringBasedHibernateUserType.java
|
hibernate/session-factory/src/main/java/org/n52/sos/ds/hibernate/type/AbstractStringBasedHibernateUserType.java
|
AbstractStringBasedHibernateUserType
|
AbstractStringBasedHibernateUserType
|
nullSafeSet__(PreparedStatement st, Object value, int index, SessionImplementor session)
|
nullSafeSet__(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session)
|
@Override
@SuppressWarnings("unchecked")
public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session) throws
HibernateException, SQLException {
if (value == null) {
st.setNull(index, Types.VARCHAR);
} else {
st.setString(index, encode((T) value));
}
}
|
@Override
@SuppressWarnings("unchecked")
public void nullSafeSet(PreparedStatement st, Object value, int index, SharedSessionContractImplementor session)
throws HibernateException, SQLException {
if (value == null) {
st.setNull(index, Types.VARCHAR);
} else {
st.setString(index, encode((T) value));
}
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/session-factory/src/main/java/org/n52/sos/ds/hibernate/type/UtcTimestampTypeDescriptor.java
|
hibernate/session-factory/src/main/java/org/n52/sos/ds/hibernate/type/UtcTimestampTypeDescriptor.java
|
UtcTimestampTypeDescriptor
|
UtcTimestampTypeDescriptor
|
getBinder__(final JavaTypeDescriptor<X> javaTypeDescriptor)
|
getBinder__(final JavaTypeDescriptor<X> javaTypeDescriptor)
|
public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicBinder<X>(javaTypeDescriptor, this) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options)
throws SQLException {
st.setTimestamp(index, javaTypeDescriptor.unwrap(value, Timestamp.class, options),
Calendar.getInstance(UTC));
}
};
}
|
public <X> ValueBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicBinder<X>(javaTypeDescriptor, this) {
@Override
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options)
throws SQLException {
st.setTimestamp(index, javaTypeDescriptor.unwrap(value, Timestamp.class, options),
Calendar.getInstance(UTC));
}
@Override
protected void doBind(CallableStatement st, X value, String name, WrapperOptions options)
throws SQLException {
st.setTimestamp(name, javaTypeDescriptor.unwrap(value, Timestamp.class, options),
Calendar.getInstance(UTC));
}
};
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/session-factory/src/main/java/org/n52/sos/ds/hibernate/type/UtcTimestampTypeDescriptor.java
|
hibernate/session-factory/src/main/java/org/n52/sos/ds/hibernate/type/UtcTimestampTypeDescriptor.java
|
UtcTimestampTypeDescriptor
|
UtcTimestampTypeDescriptor
|
getExtractor__(final JavaTypeDescriptor<X> javaTypeDescriptor)
|
getExtractor__(final JavaTypeDescriptor<X> javaTypeDescriptor)
|
public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicExtractor<X>(javaTypeDescriptor, this) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
if (rs.getObject(name) != null) {
return javaTypeDescriptor.wrap(rs.getTimestamp(name, Calendar.getInstance(UTC)), options);
}
return null;
}
@Override
protected X doExtract(CallableStatement statement, int index, WrapperOptions options) throws SQLException {
return javaTypeDescriptor.wrap( statement.getTimestamp( index , Calendar.getInstance(UTC)), options );
}
@Override
protected X doExtract(CallableStatement statement, String name, WrapperOptions options) throws SQLException {
return javaTypeDescriptor.wrap( statement.getTimestamp( name, Calendar.getInstance(UTC) ), options );
}
};
}
|
public <X> ValueExtractor<X> getExtractor(final JavaTypeDescriptor<X> javaTypeDescriptor) {
return new BasicExtractor<X>(javaTypeDescriptor, this) {
@Override
protected X doExtract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
if (rs.getObject(name) != null) {
return javaTypeDescriptor.wrap(rs.getTimestamp(name, Calendar.getInstance(UTC)), options);
}
return null;
}
@Override
protected X doExtract(CallableStatement statement, int index, WrapperOptions options) throws SQLException {
return javaTypeDescriptor.wrap(statement.getTimestamp(index, Calendar.getInstance(UTC)), options);
}
@Override
protected X doExtract(CallableStatement statement, String name, WrapperOptions options)
throws SQLException {
return javaTypeDescriptor.wrap(statement.getTimestamp(name, Calendar.getInstance(UTC)), options);
}
};
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/datasource/mysql/src/main/java/org/hibernate/spatial/dialect/mysql/MySQLSpatial5InnoDBTimestampDialect.java
|
hibernate/datasource/mysql/src/main/java/org/hibernate/spatial/dialect/mysql/MySQLSpatial5InnoDBTimestampDialect.java
|
MySQLSpatial5InnoDBTimestampDialect
|
MySQLSpatial5InnoDBTimestampDialect
|
MySQLSpatial5InnoDBTimestampDialect__()
|
MySQLSpatial5InnoDBTimestampDialect__()
|
public MySQLSpatial5InnoDBTimestampDialect() {
super();
registerColumnType( Types.TIMESTAMP, "timestamp" );
}
|
public MySQLSpatial5InnoDBTimestampDialect() {
super();
registerColumnType(Types.TIMESTAMP, TIMESTAMP);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/datasource/mysql/src/main/java/org/hibernate/spatial/dialect/mysql/MySQLSpatial5InnoDBTimestampDialect.java
|
hibernate/datasource/mysql/src/main/java/org/hibernate/spatial/dialect/mysql/MySQLSpatial5InnoDBTimestampDialect.java
|
MySQLSpatial5InnoDBTimestampDialect
|
MySQLSpatial5InnoDBTimestampDialect
|
getTypeName__(int code, long length, int precision, int scale)
|
getTypeName__(int code, long length, int precision, int scale)
|
@Override
public String getTypeName(int code, long length, int precision, int scale) throws HibernateException {
if (Types.TIMESTAMP == code ) {
return "timestamp";
}
return super.getTypeName(code, length, precision, scale);
}
|
@Override
public String getTypeName(int code, long length, int precision, int scale) throws HibernateException {
if (Types.TIMESTAMP == code) {
return TIMESTAMP;
}
return super.getTypeName(code, length, precision, scale);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/datasource/mysql/src/main/java/org/hibernate/spatial/dialect/mysql/MySQLSpatial5InnoDBTimestampDialect.java
|
hibernate/datasource/mysql/src/main/java/org/hibernate/spatial/dialect/mysql/MySQLSpatial5InnoDBTimestampDialect.java
|
MySQLSpatial5InnoDBTimestampDialect
|
MySQLSpatial5InnoDBTimestampDialect
|
getTypeName__(int code)
|
getTypeName__(int code)
|
@Override
public String getTypeName(int code) throws HibernateException {
if (Types.TIMESTAMP == code ) {
return "timestamp";
}
return super.getTypeName(code);
}
|
@Override
public String getTypeName(int code) throws HibernateException {
if (Types.TIMESTAMP == code) {
return TIMESTAMP;
}
return super.getTypeName(code);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/datasource/mysql/src/main/java/org/hibernate/spatial/dialect/mysql/MySQLSpatial5InnoDBTimestampDialect.java
|
hibernate/datasource/mysql/src/main/java/org/hibernate/spatial/dialect/mysql/MySQLSpatial5InnoDBTimestampDialect.java
|
MySQLSpatial5InnoDBTimestampDialect
|
MySQLSpatial5InnoDBTimestampDialect
|
buildSqlCreateSpatialIndexString__(Index index, String defaultCatalog, String defaultSchema)
|
buildSqlCreateSpatialIndexString__(Index index, String defaultCatalog, String defaultSchema)
|
public String buildSqlCreateSpatialIndexString(Index index, String defaultCatalog, String defaultSchema) {
// only for NOT NULL columns and ENGINE=MyISAM
// https://dev.mysql.com/doc/refman/5.7/en/creating-spatial-indexes.html
// String name = index.getName();
// Table table = index.getTable();
// Iterator<Column> columns = index.getColumnIterator();
// java.util.Map<Column, String> columnOrderMap = new HashMap<Column, String>();
//
//
// StringBuilder buf = new StringBuilder( "create" )
// .append( " spatial index " )
// .append( this.qualifyIndexName() ?
// name :
// StringHelper.unqualify( name ) )
// .append( " on " )
// .append( table.getQualifiedName( this, defaultCatalog, defaultSchema ) )
// .append( " (" );
// while (columns.hasNext()) {
// Column column = columns.next();
// buf.append(column.getQuotedName(this));
// if (columnOrderMap.containsKey(column)) {
// buf.append(" ").append(columnOrderMap.get(column));
// }
// if (columns.hasNext())
// buf.append(", ");
// }
// buf.append(")");
// return buf.toString();
return "";
}
|
public String buildSqlCreateSpatialIndexString(Index index, String defaultCatalog, String defaultSchema) {
// only for NOT NULL columns and ENGINE=MyISAM
// https://dev.mysql.com/doc/refman/5.7/en/creating-spatial-indexes.html
// String name = index.getName();
// Table table = index.getTable();
// Iterator<Column> columns = index.getColumnIterator();
// java.util.Map<Column, String> columnOrderMap = new HashMap<Column,
// String>();
//
//
// StringBuilder buf = new StringBuilder( "create" )
// .append( " spatial index " )
// .append( this.qualifyIndexName() ?
// name :
// StringHelper.unqualify( name ) )
// .append( " on " )
// .append( table.getQualifiedName( this, defaultCatalog, defaultSchema
// ) )
// .append( " (" );
// while (columns.hasNext()) {
// Column column = columns.next();
// buf.append(column.getQuotedName(this));
// if (columnOrderMap.containsKey(column)) {
// buf.append(" ").append(columnOrderMap.get(column));
// }
// if (columns.hasNext())
// buf.append(", ");
// }
// buf.append(")");
// return buf.toString();
return "";
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/datasource/oracle/src/test/java/org/n52/sos/ds/datasource/OracleDatasourceTest.java
|
hibernate/datasource/oracle/src/test/java/org/n52/sos/ds/datasource/OracleDatasourceTest.java
|
OracleDatasourceTest
|
OracleDatasourceTest
|
initialize__()
|
initialize__()
|
private static final void initialize() {
String conf = System.getenv(SOS_TEST_CONF);
if (conf == null) {
throw new RuntimeException(
"SOS_TEST_CONF environment variable not set!!");
}
Properties props = new Properties();
try {
props.load(new FileInputStream(conf));
} catch (IOException e) {
throw new RuntimeException("Invalid SOS_TEST_CONF file: " + conf, e);
}
host = props.getProperty(ORACLE_HOST);
port = Integer.parseInt(props.getProperty(ORACLE_PORT));
schema = props.getProperty(ORACLE_SCHEMA);
user = props.getProperty(ORACLE_USER);
pass = props.getProperty(ORACLE_PASS);
userNoRights = props.getProperty(ORACLE_USER_NO_RIGHTS);
passNoRights = props.getProperty(ORACLE_PASS_NO_RIGHTS);
}
|
private static void initialize() {
String conf = System.getenv(SOS_TEST_CONF);
if (conf == null) {
throw new RuntimeException(
"SOS_TEST_CONF environment variable not set!!");
}
Properties props = new Properties();
try {
props.load(new FileInputStream(conf));
} catch (IOException e) {
throw new RuntimeException("Invalid SOS_TEST_CONF file: " + conf, e);
}
host = props.getProperty(ORACLE_HOST);
port = Integer.parseInt(props.getProperty(ORACLE_PORT));
schema = props.getProperty(ORACLE_SCHEMA);
user = props.getProperty(ORACLE_USER);
pass = props.getProperty(ORACLE_PASS);
userNoRights = props.getProperty(ORACLE_USER_NO_RIGHTS);
passNoRights = props.getProperty(ORACLE_PASS_NO_RIGHTS);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/datasource/oracle/src/test/java/org/n52/sos/ds/datasource/OracleDatasourceTest.java
|
hibernate/datasource/oracle/src/test/java/org/n52/sos/ds/datasource/OracleDatasourceTest.java
|
OracleDatasourceTest
|
OracleDatasourceTest
|
testSchemaCreationSuccess__()
|
testSchemaCreationSuccess__()
|
public void testSchemaCreationSuccess() throws Exception {
ds.doCheckSchemaCreation("oracle", stmt);
}
|
public void testSchemaCreationSuccess() throws Exception {
ds.doCheckSchemaCreation(ORACLE, stmt);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/datasource/oracle/src/test/java/org/n52/sos/ds/datasource/OracleDatasourceTest.java
|
hibernate/datasource/oracle/src/test/java/org/n52/sos/ds/datasource/OracleDatasourceTest.java
|
OracleDatasourceTest
|
OracleDatasourceTest
|
testCheckSchemaCreationSuccess__()
|
testCheckSchemaCreationSuccess__()
|
@SuppressWarnings("unchecked")
public void testCheckSchemaCreationSuccess() throws Exception {
ds = spy(ds);
Statement stmt = mock(Statement.class);
Connection conn = mock(Connection.class);
when(conn.createStatement()).thenReturn(stmt);
doReturn(conn).when(ds).openConnection(anyMap());
assertTrue(ds.checkSchemaCreation(new HashMap<String, Object>()));
}
|
@SuppressWarnings("unchecked")
public void testCheckSchemaCreationSuccess() throws Exception {
ds = Mockito.spy(ds);
Statement s = Mockito.mock(Statement.class);
Connection c = Mockito.mock(Connection.class);
Mockito.when(c.createStatement()).thenReturn(s);
Mockito.doReturn(c).when(ds).openConnection(ArgumentMatchers.anyMap());
assertTrue(ds.checkSchemaCreation(new HashMap<String, Object>()));
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/datasource/oracle/src/test/java/org/n52/sos/ds/datasource/OracleDatasourceTest.java
|
hibernate/datasource/oracle/src/test/java/org/n52/sos/ds/datasource/OracleDatasourceTest.java
|
OracleDatasourceTest
|
OracleDatasourceTest
|
testCheckSchemaCreationFailure__()
|
testCheckSchemaCreationFailure__()
|
@SuppressWarnings("unchecked")
public void testCheckSchemaCreationFailure() throws Exception {
ds = spy(ds);
Statement stmt = mock(Statement.class);
when(stmt.execute(anyString())).thenThrow(new SQLException());
Connection conn = mock(Connection.class);
when(conn.createStatement()).thenReturn(stmt);
doReturn(conn).when(ds).openConnection(anyMap());
assertFalse(ds.checkSchemaCreation(new HashMap<String, Object>()));
}
|
public void testCheckSchemaCreationFailure() throws Exception {
ds = Mockito.spy(ds);
Statement s = Mockito.mock(Statement.class);
Mockito.when(s.execute(ArgumentMatchers.anyString())).thenThrow(new SQLException());
Connection c = Mockito.mock(Connection.class);
Mockito.when(c.createStatement()).thenReturn(stmt);
Mockito.doReturn(c).when(ds).openConnection(ArgumentMatchers.anyMap());
assertFalse(ds.checkSchemaCreation(new HashMap<String, Object>()));
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/datasource/oracle/src/test/java/org/n52/sos/ds/datasource/OracleDatasourceTest.java
|
hibernate/datasource/oracle/src/test/java/org/n52/sos/ds/datasource/OracleDatasourceTest.java
|
OracleDatasourceTest
|
OracleDatasourceTest
|
testToURL__()
|
testToURL__()
|
public void testToURL() throws Exception {
Map<String, Object> settings = new HashMap<String, Object>();
settings.put(AbstractHibernateDatasource.HOST_KEY, "localhost");
settings.put(AbstractHibernateDatasource.PORT_KEY, 1521);
settings.put(AbstractHibernateDatasource.USERNAME_KEY, "oracle");
settings.put(AbstractHibernateDatasource.PASSWORD_KEY, "oracle");
settings.put(AbstractHibernateDatasource.DATABASE_KEY, "db");
settings.put(AbstractHibernateDatasource.SCHEMA_KEY, "schema");
assertEquals("jdbc:oracle:thin://localhost:1521/db", ds.toURL(settings));
}
|
public void testToURL() throws Exception {
Map<String, Object> settings = new HashMap<String, Object>();
settings.put(AbstractHibernateDatasource.HOST_KEY, LOCALHOST);
settings.put(AbstractHibernateDatasource.PORT_KEY, 1521);
settings.put(AbstractHibernateDatasource.USERNAME_KEY, ORACLE);
settings.put(AbstractHibernateDatasource.PASSWORD_KEY, ORACLE);
settings.put(AbstractHibernateDatasource.DATABASE_KEY, DB);
settings.put(AbstractHibernateDatasource.SCHEMA_KEY, "schema");
assertEquals(JDBC_URL, ds.toURL(settings));
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/datasource/oracle/src/test/java/org/n52/sos/ds/datasource/OracleDatasourceTest.java
|
hibernate/datasource/oracle/src/test/java/org/n52/sos/ds/datasource/OracleDatasourceTest.java
|
OracleDatasourceTest
|
OracleDatasourceTest
|
testFromURL__()
|
testFromURL__()
|
public void testFromURL() throws Exception {
String url = "jdbc:oracle:thin://localhost:1521/db";
String[] parsed = ds.parseURL(url);
assertEquals(3, parsed.length);
assertEquals("localhost", parsed[0]);
assertEquals("1521", parsed[1]);
assertEquals("db", parsed[2]);
}
|
public void testFromURL() throws Exception {
String[] parsed = ds.parseURL(JDBC_URL);
assertEquals(3, parsed.length);
assertEquals(LOCALHOST, parsed[0]);
assertEquals("1521", parsed[1]);
assertEquals(DB, parsed[2]);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
hibernate/datasource/oracle/src/test/java/org/n52/sos/ds/datasource/OracleDatasourceTest.java
|
hibernate/datasource/oracle/src/test/java/org/n52/sos/ds/datasource/OracleDatasourceTest.java
|
OracleDatasourceTest
|
OracleDatasourceTest
|
getDefaultSettings__()
|
getDefaultSettings__()
|
private static Map<String, Object> getDefaultSettings() {
Map<String, Object> settings = new HashMap<String, Object>();
settings.put(AbstractHibernateDatasource.HOST_KEY, host);
settings.put(AbstractHibernateDatasource.PORT_KEY, port);
settings.put(AbstractHibernateDatasource.USERNAME_KEY, user);
settings.put(AbstractHibernateDatasource.PASSWORD_KEY, pass);
settings.put(AbstractHibernateDatasource.SCHEMA_KEY, schema);
settings.put(AbstractHibernateDatasource.TRANSACTIONAL_KEY, true);
return settings;
}
|
private static Map<String, Object> getDefaultSettings() {
Map<String, Object> settings = new HashMap<String, Object>();
settings.put(AbstractHibernateDatasource.HOST_KEY, host);
settings.put(AbstractHibernateDatasource.PORT_KEY, port);
settings.put(AbstractHibernateDatasource.USERNAME_KEY, user);
settings.put(AbstractHibernateDatasource.PASSWORD_KEY, pass);
settings.put(AbstractHibernateDatasource.SCHEMA_KEY, schema);
return settings;
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/main/java/org/n52/sos/cache/ctrl/action/InMemoryCacheUpdate.java
|
core/cache/src/main/java/org/n52/sos/cache/ctrl/action/InMemoryCacheUpdate.java
|
InMemoryCacheUpdate
|
InMemoryCacheUpdate
|
sosFeaturesToList__(AbstractFeature abstractFeature)
|
sosFeaturesToList__(AbstractFeature abstractFeature)
|
protected List<SamplingFeature> sosFeaturesToList(AbstractFeature abstractFeature) {
return asStream(abstractFeature).collect(Collectors.toList());
}
|
protected List<AbstractSamplingFeature> sosFeaturesToList(AbstractFeature abstractFeature) {
return asStream(abstractFeature).collect(Collectors.toList());
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/main/java/org/n52/sos/cache/ctrl/action/InMemoryCacheUpdate.java
|
core/cache/src/main/java/org/n52/sos/cache/ctrl/action/InMemoryCacheUpdate.java
|
InMemoryCacheUpdate
|
InMemoryCacheUpdate
|
asStream__(FeatureCollection fc)
|
asStream__(FeatureCollection fc)
|
private Stream<SamplingFeature> asStream(FeatureCollection fc) {
return fc.getMembers().values().stream().flatMap(this::asStream);
}
|
private Stream<AbstractSamplingFeature> asStream(FeatureCollection fc) {
return fc.getMembers().values().stream().flatMap(this::asStream);
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/main/java/org/n52/sos/cache/ctrl/action/InMemoryCacheUpdate.java
|
core/cache/src/main/java/org/n52/sos/cache/ctrl/action/InMemoryCacheUpdate.java
|
InMemoryCacheUpdate
|
InMemoryCacheUpdate
|
asStream__(AbstractFeature f)
|
asStream__(AbstractFeature f)
|
private Stream<SamplingFeature> asStream(AbstractFeature f) {
if (f instanceof SamplingFeature) {
return Stream.of((SamplingFeature) f);
} else if (f instanceof FeatureCollection) {
return asStream((FeatureCollection) f);
} else {
Object name = f != null ? f .getClass().getName() : f;
String errorMessage = String.format("Feature Type \"%s\" not supported.", name);
LOGGER.error(errorMessage);
throw new IllegalArgumentException(errorMessage);
}
}
|
private Stream<AbstractSamplingFeature> asStream(AbstractFeature f) {
if (f instanceof AbstractSamplingFeature) {
return Stream.of((AbstractSamplingFeature) f);
} else if (f instanceof FeatureCollection) {
return asStream((FeatureCollection) f);
} else {
String errorMessage =
String.format("Feature Type \"%s\" not supported.", f != null ? f.getClass().getName() : "null");
LOGGER.error(errorMessage);
throw new IllegalArgumentException(errorMessage);
}
}
|
52North_SOS__520cc60fd93dbfb6e48d75f23765d72556ef7fa1__c92d475de8a1b1cf5cb71462302fc510d7a69446
|
core/cache/src/main/java/org/n52/sos/cache/ctrl/action/InMemoryCacheUpdate.java
|
core/cache/src/main/java/org/n52/sos/cache/ctrl/action/InMemoryCacheUpdate.java
|
InMemoryCacheUpdate
|
InMemoryCacheUpdate
|
createEnvelopeFrom__(List<SamplingFeature> samplingFeatures)
|
createEnvelopeFrom__(List<AbstractSamplingFeature> AbstractSamplingFeatures)
|
protected Envelope createEnvelopeFrom(List<SamplingFeature> samplingFeatures) {
return samplingFeatures.stream()
.filter(SamplingFeature::isSetGeometry)
.map(SamplingFeature::getGeometry)
.map(Geometry::getEnvelopeInternal)
.collect(Envelope::new,
Envelope::expandToInclude,
Envelope::expandToInclude);
}
|
protected Envelope createEnvelopeFrom(List<AbstractSamplingFeature> AbstractSamplingFeatures) {
return AbstractSamplingFeatures.stream()
.filter(AbstractSamplingFeature::isSetGeometry)
.map(AbstractSamplingFeature::getGeometry)
.map(Geometry::getEnvelopeInternal)
.collect(Envelope::new,
Envelope::expandToInclude,
Envelope::expandToInclude);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.