private ReferenceType getFeatureOfInterestReferenceType(
     Object featureOfInterest, Map<String, ReferenceType> featuresOfInterest)
     throws OwsExceptionReport {
   String identifier = null;
   if (featureOfInterest instanceof FeatureOfInterest) {
     identifier = ((FeatureOfInterest) featureOfInterest).getIdentifier();
   } else if (featureOfInterest instanceof String) {
     identifier = (String) featureOfInterest;
   } else {
     throw new NoApplicableCodeException()
         .withMessage(
             "GetDataAvailability procedure query object type {} is not supported!",
             featureOfInterest.getClass().getName());
   }
   if (!featuresOfInterest.containsKey(identifier)) {
     ReferenceType referenceType = new ReferenceType(identifier);
     FeatureQueryHandlerQueryObject queryObject =
         new FeatureQueryHandlerQueryObject()
             .addFeatureIdentifier(identifier)
             .setConnection(session)
             .setVersion(Sos2Constants.SERVICEVERSION);
     AbstractFeature feature =
         Configurator.getInstance().getFeatureQueryHandler().getFeatureByID(queryObject);
     if (feature.isSetName() && feature.getFirstName().isSetValue()) {
       referenceType.setTitle(feature.getFirstName().getValue());
     }
     featuresOfInterest.put(identifier, referenceType);
   }
   return featuresOfInterest.get(identifier);
 }
 /**
  * Add names to abstract feature
  *
  * @param abstractFeature Abstract feature to add name
  * @param i18n I18N with language specific values
  */
 public static void addLanguageSpecificNameToFeature(
     AbstractFeature abstractFeature, AbstractI18NMetadata i18n) {
   if (i18n != null) {
     for (LocalizedString name : i18n.getName()) {
       abstractFeature.addName(name.asCodeType());
     }
   }
 }
 /**
  * Add name to abstract feature
  *
  * @param abstractFeature Abstract feature to add name
  * @param abstractI18N I18N with language specific values
  */
 public static void addLanguageSpecificNameToFeature(
     AbstractFeature abstractFeature, AbstractHibernateI18NMetadata abstractI18N) {
   if (abstractI18N != null && abstractI18N.isSetName()) {
     // FIXME autermann: create a setting to control in which format the locale is outputted
     String locale = abstractI18N.getLocale().getISO3Language();
     abstractFeature.addName(new CodeType(abstractI18N.getName(), locale));
   }
 }
 private ReferenceType getFeatureOfInterestReference(
     Series series, Map<String, ReferenceType> featuresOfInterest, Session session)
     throws OwsExceptionReport {
   String identifier = series.getFeatureOfInterest().getIdentifier();
   if (!featuresOfInterest.containsKey(identifier)) {
     ReferenceType referenceType = new ReferenceType(identifier);
     FeatureQueryHandlerQueryObject queryObject = new FeatureQueryHandlerQueryObject();
     queryObject
         .addFeatureIdentifier(identifier)
         .setConnection(session)
         .setVersion(Sos2Constants.SERVICEVERSION);
     AbstractFeature feature =
         Configurator.getInstance().getFeatureQueryHandler().getFeatureByID(queryObject);
     if (feature.isSetName() && feature.getFirstName().isSetValue()) {
       referenceType.setTitle(feature.getFirstName().getValue());
     }
     featuresOfInterest.put(identifier, referenceType);
   }
   return featuresOfInterest.get(identifier);
 }
Beispiel #5
0
 /**
  * Get a list of all SosSamplingFeatures contained in the abstract feature.
  *
  * @param abstractFeature the abstract feature
  * @return a list of all sampling features
  */
 protected List<SamplingFeature> sosFeaturesToList(AbstractFeature abstractFeature) {
   if (abstractFeature instanceof FeatureCollection) {
     return getAllFeaturesFrom((FeatureCollection) abstractFeature);
   } else if (abstractFeature instanceof SamplingFeature) {
     return Collections.singletonList((SamplingFeature) abstractFeature);
   } else {
     String errorMessage =
         String.format(
             "Feature Type \"%s\" not supported.",
             abstractFeature != null ? abstractFeature.getClass().getName() : abstractFeature);
     LOGGER.error(errorMessage);
     throw new IllegalArgumentException(errorMessage); // TODO change
     // type of
     // exception to
     // OER?
   }
 }
 /**
  * Add description to abstract feature
  *
  * @param abstractFeature Abstract feature to add description
  * @param abstractI18N I18N with language specific values
  */
 public static void addLanguageSpecificDescriptionToFeature(
     AbstractFeature abstractFeature, AbstractHibernateI18NMetadata abstractI18N) {
   if (abstractI18N != null && abstractI18N.isSetDescription()) {
     abstractFeature.setDescription(abstractI18N.getDescription());
   }
 }