コード例 #1
1
 /**
  * Create result values from observation according to ResultEncoding and ResultStructure
  *
  * @param observations Observation to create result values from
  * @param sosResultEncoding The ResultEncoding
  * @param sosResultStructure The ResultStructure
  * @return Result values String from observation according to ResultEncoding and ResultStructure
  * @throws OwsExceptionReport If creation fails
  */
 public static String createResultValuesFromObservations(
     final List<AbstractObservation> observations,
     final SosResultEncoding sosResultEncoding,
     final SosResultStructure sosResultStructure)
     throws OwsExceptionReport {
   final StringBuilder builder = new StringBuilder();
   if (CollectionHelper.isNotEmpty(observations)) {
     final String tokenSeparator = getTokenSeparator(sosResultEncoding.getEncoding());
     final String blockSeparator = getBlockSeparator(sosResultEncoding.getEncoding());
     final Map<Integer, String> valueOrder =
         getValueOrderMap(sosResultStructure.getResultStructure());
     addElementCount(builder, observations.size(), blockSeparator);
     for (final AbstractObservation observation : observations) {
       for (final Integer intger : valueOrder.keySet()) {
         final String definition = valueOrder.get(intger);
         if (definition.equals(PHENOMENON_TIME)) {
           builder.append(
               getTimeStringForPhenomenonTime(
                   observation.getPhenomenonTimeStart(), observation.getPhenomenonTimeEnd()));
         } else if (definition.equals(RESULT_TIME)) {
           builder.append(getTimeStringForResultTime(observation.getResultTime()));
         } else {
           builder.append(getValueAsStringForObservedProperty(observation, definition));
         }
         builder.append(tokenSeparator);
       }
       builder.delete(builder.lastIndexOf(tokenSeparator), builder.length());
       builder.append(blockSeparator);
     }
     if (builder.length() > 0) {
       builder.delete(builder.lastIndexOf(blockSeparator), builder.length());
     }
   }
   return builder.toString();
 }
コード例 #2
0
 /**
  * Create internal ResultStructure from String representation
  *
  * @param resultStructure String representation of ResultStructure
  * @return Internal ResultStructure
  */
 public static SosResultStructure createSosResultStructure(final String resultStructure) {
   final SosResultStructure sosResultStructure = new SosResultStructure();
   sosResultStructure.setXml(resultStructure);
   return sosResultStructure;
 }