private List<?> executeNamedQuery(GetDataAvailabilityRequest req, Session session) {
   final boolean features = req.isSetFeaturesOfInterest();
   final boolean observableProperties = req.isSetObservedProperties();
   final boolean procedures = req.isSetProcedures();
   String namedQueryName = null;
   Map<String, Collection<String>> parameter = Maps.newHashMap();
   // all
   if (features && observableProperties && procedures) {
     namedQueryName = SQL_QUERY_GET_DATA_AVAILABILITY_FOR_FEATURES_PROCEDURES_OBSERVED_PROPERTIES;
     parameter.put(FEATURES, req.getFeaturesOfInterest());
     parameter.put(OBSERVABLE_PROPERTIES, req.getObservedProperties());
     parameter.put(PROCEDURES, req.getProcedures());
   }
   // observableProperties and procedures
   else if (!features && observableProperties && procedures) {
     namedQueryName = SQL_QUERY_GET_DATA_AVAILABILITY_FOR_PROCEDURES_OBSERVED_PROPERTIES;
     parameter.put(OBSERVABLE_PROPERTIES, req.getObservedProperties());
     parameter.put(PROCEDURES, req.getProcedures());
   }
   // only observableProperties
   else if (!features && observableProperties && !procedures) {
     namedQueryName = SQL_QUERY_GET_DATA_AVAILABILITY_FOR_OBSERVED_PROPERTIES;
     parameter.put(OBSERVABLE_PROPERTIES, req.getObservedProperties());
   }
   // only procedures
   else if (!features && !observableProperties && procedures) {
     namedQueryName = SQL_QUERY_GET_DATA_AVAILABILITY_FOR_PROCEDURES;
     parameter.put(PROCEDURES, req.getProcedures());
   }
   // features and observableProperties
   else if (features && observableProperties && !procedures) {
     namedQueryName = SQL_QUERY_GET_DATA_AVAILABILITY_FOR_FEATURES_OBSERVED_PROPERTIES;
     parameter.put(FEATURES, req.getFeaturesOfInterest());
     parameter.put(OBSERVABLE_PROPERTIES, req.getObservedProperties());
   }
   // features and procedures
   else if (features && !observableProperties && procedures) {
     namedQueryName = SQL_QUERY_GET_DATA_AVAILABILITY_FOR_FEATURES_PROCEDURES;
     parameter.put(FEATURES, req.getFeaturesOfInterest());
     parameter.put(PROCEDURES, req.getProcedures());
   }
   // only features
   else if (features && !observableProperties && procedures) {
     namedQueryName = SQL_QUERY_GET_DATA_AVAILABILITY_FOR_FEATURES;
     parameter.put(FEATURES, req.getFeaturesOfInterest());
   }
   if (StringHelper.isNotEmpty(namedQueryName)) {
     Query namedQuery = session.getNamedQuery(namedQueryName);
     for (String key : parameter.keySet()) {
       namedQuery.setParameterList(key, parameter.get(key));
     }
     LOGGER.debug(
         "QUERY getProceduresForFeatureOfInterest(feature) with NamedQuery: {}", namedQuery);
     namedQuery.setResultTransformer(new DataAvailabilityTransformer(session));
     return namedQuery.list();
   }
   return Lists.newLinkedList();
 }
 @Override
 public boolean isSetDescription() {
   return StringHelper.isNotEmpty(getDescription());
 }
Example #3
0
 @Override
 public boolean isSetValue() {
   return StringHelper.isNotEmpty(value);
 }
Example #4
0
 public boolean isSetEReportingObservationPrefix() {
   return StringHelper.isNotEmpty(getEReportingObservationPrefix());
 }
Example #5
0
 public boolean isSetEReportingNamespace() {
   return StringHelper.isNotEmpty(getEReportingNamespace());
 }
 public boolean isSetAssignedSensorId() {
   return StringHelper.isNotEmpty(getAssignedSensorId());
 }
Example #7
0
 /**
  * Check if the URL is set
  *
  * @return <code>true</code>, if the URL is set
  */
 public boolean isSetUrl() {
   return StringHelper.isNotEmpty(getURL());
 }