org.n52.shetland.ogc.ows.extension.Extension.getValue()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中org.n52.shetland.ogc.ows.extension.Extension.getValue()方法的一些代码示例,展示了Extension.getValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Extension.getValue()方法的具体详情如下:
包路径:org.n52.shetland.ogc.ows.extension.Extension
类名称:Extension
方法名:getValue

Extension.getValue介绍

暂无

代码示例

代码示例来源:origin: org.n52.arctic-sea/shetland

private boolean isFesFilterExtension(Extension<?> extension) {
  return !((extension instanceof ResultFilter)
      || (extension instanceof SpatialFilter)
      || (extension instanceof SosSpatialFilter))
      && extension.getValue() instanceof Filter<?>;
}

代码示例来源:origin: org.n52.shetland/shetland

private boolean isFesFilterExtension(Extension<?> extension) {
  return extension.getValue() instanceof Filter<?>;
}

代码示例来源:origin: org.n52.arctic-sea/svalbard-xmlstream

protected void writeExtensions(Extensions extensions) throws XMLStreamException, EncodingException {
  for (Extension<?> extension : extensions.getExtensions()) {
    if (extension.getValue() instanceof SweAbstractDataComponent) {
      writeExtension((SweAbstractDataComponent) extension.getValue());
    }
  }
}

代码示例来源:origin: org.n52.arctic-sea/shetland

public static ReportObligationType getFlow(Extensions extensions) throws OwsExceptionReport {
    return extensions.getExtension(AqdConstants.EXTENSION_FLOW)
        .map(x -> x.getValue())
        .flatMap(Functions.castIfInstanceOf(SweText.class))
        .map(SweText::getValue)
        .map(ReportObligationType::from)
        .orElse(ReportObligationType.E2A);
  }
}

代码示例来源:origin: org.n52.shetland/shetland

public static ReportObligationType getFlow(Extensions extensions) throws OwsExceptionReport {
    return extensions.getExtension(AqdConstants.EXTENSION_FLOW)
        .map(x -> x.getValue())
        .flatMap(Functions.castIfInstanceOf(SweText.class))
        .map(SweText::getValue)
        .map(ReportObligationType::from)
        .orElse(ReportObligationType.E2A);
  }
}

代码示例来源:origin: 52North/SOS

/**
 * Check if extensions contains a temporal filter with valueReference
 * phenomenonTime
 *
 * @param extensions
 *            Extensions to check
 * @return <code>true</code>, if extensions contains a temporal filter with
 *         valueReference phenomenonTime
 */
private boolean hasPhenomenonTimeFilter(Extensions extensions) {
  boolean hasFilter = false;
  for (Extension<?> extension : extensions.getExtensions()) {
    if (extension.getValue() instanceof TemporalFilter) {
      TemporalFilter filter = (TemporalFilter) extension.getValue();
      if (SosConstants.PHENOMENON_TIME_VALUE_REFERENCE.equals(filter.getValueReference())) {
        hasFilter = true;
      }
    }
  }
  return hasFilter;
}

代码示例来源:origin: org.n52.sensorweb.sos/hibernate-handler

/**
 * Get the temporal filter with valueReference phenomenonTime from
 * extensions
 *
 * @param extensions
 *            To get filter from
 * @return Temporal filter with valueReference phenomenonTime
 */
private TemporalFilter getPhenomenonTimeFilter(Extensions extensions) {
  for (Extension<?> extension : extensions.getExtensions()) {
    if (extension.getValue() instanceof TemporalFilter) {
      TemporalFilter filter = (TemporalFilter) extension.getValue();
      if (TemporalRestrictions.PHENOMENON_TIME_VALUE_REFERENCE.equals(filter.getValueReference())) {
        return filter;
      }
    }
  }
  return null;
}

代码示例来源:origin: org.n52.arctic-sea/shetland

public String getRequestedLanguage() {
  return getExtension(OWSConstants.AdditionalRequestParams.language).map(e -> e.getValue()).map(value -> {
    if (value instanceof Value<?, ?>) {
      return ((Value<?, ?>) value).getStringValue();
    } else if (value instanceof String) {
      return (String) value;
    } else if (value instanceof SweText) {
      return ((SweText) value).getValue();
    } else {
      return "";
    }
  }).orElse("");
}

代码示例来源:origin: org.n52.shetland/shetland

public String getRequestedLanguage() {
  return getExtension(OWSConstants.AdditionalRequestParams.language).map(e -> e.getValue()).map(value -> {
    if (value instanceof Value<?, ?>) {
      return ((Value<?, ?>) value).getStringValue();
    } else if (value instanceof String) {
      return (String) value;
    } else if (value instanceof SweText) {
      return ((SweText) value).getValue();
    } else {
      return "";
    }
  }).orElse("");
}

代码示例来源:origin: org.n52.shetland/shetland

public boolean getBooleanExtension(String identifier, boolean defaultValue) {
  return getExtension(identifier).map(e -> e.getValue()).map(value -> {
    if (value instanceof Boolean) {
      return (Boolean) value;
    } else if (value instanceof Value && ((Value) value).getValue() instanceof Boolean) {
      return (Boolean) ((Value) value).getValue();
    } else if (value instanceof SweBoolean) {
      return ((SweBoolean) value).getValue();
    }
    return false;
  }).orElse(defaultValue);
}

代码示例来源:origin: org.n52.arctic-sea/shetland

public boolean getBooleanExtension(String identifier, boolean defaultValue) {
  return getExtension(identifier).map(e -> e.getValue()).map(value -> {
    if (value instanceof Boolean) {
      return (Boolean) value;
    } else if (value instanceof Value && ((Value) value).getValue() instanceof Boolean) {
      return (Boolean) ((Value) value).getValue();
    } else if (value instanceof SweBoolean) {
      return ((SweBoolean) value).getValue();
    }
    return false;
  }).orElse(defaultValue);
}

代码示例来源:origin: 52North/SOS

public boolean checkIsReturnHumanReadableIdentifierFlagExtensionSet(Extensions extensions)
    throws InvalidParameterValueException {
  if (extensions == null) {
    return false;
  }
  Optional<Extension<?>> extension = extensions.getExtension(RETURN_HUMAN_READABLE_IDENTIFIER);
  if (extension.isPresent()) {
    Object value = extension.get().getValue();
    if (!(value instanceof SweBoolean)) {
      throw new InvalidParameterValueException(RETURN_HUMAN_READABLE_IDENTIFIER, JavaHelper.asString(value));
    }
    return true;
  } else {
    return false;
  }
}

代码示例来源:origin: org.n52.sensorweb.sos/flexible-identifier

public boolean checkIsReturnHumanReadableIdentifierFlagExtensionSet(Extensions extensions)
    throws InvalidParameterValueException {
  if (extensions == null) {
    return false;
  }
  Optional<Extension<?>> extension = extensions.getExtension(RETURN_HUMAN_READABLE_IDENTIFIER);
  if (extension.isPresent()) {
    Object value = extension.get().getValue();
    if (!(value instanceof SweBoolean)) {
      throw new InvalidParameterValueException(RETURN_HUMAN_READABLE_IDENTIFIER, JavaHelper.asString(value));
    }
    return true;
  } else {
    return false;
  }
}

代码示例来源:origin: 52North/SOS

public boolean checkForReturnHumanReadableIdentifierFlagExtension(Extensions extensions)
    throws InvalidParameterValueException {
  if (extensions == null) {
    return false;
  }
  Optional<Extension<?>> extension = extensions.getExtension(RETURN_HUMAN_READABLE_IDENTIFIER);
  if (extension.isPresent()) {
    Object value = extension.get().getValue();
    if (!(value instanceof SweBoolean)) {
      throw new InvalidParameterValueException(RETURN_HUMAN_READABLE_IDENTIFIER, JavaHelper.asString(value));
    }
    return ((SweBoolean) value).getValue();
  } else {
    return false;
  }
}

代码示例来源:origin: org.n52.sensorweb.sos/flexible-identifier

public boolean checkForReturnHumanReadableIdentifierFlagExtension(Extensions extensions)
    throws InvalidParameterValueException {
  if (extensions == null) {
    return false;
  }
  Optional<Extension<?>> extension = extensions.getExtension(RETURN_HUMAN_READABLE_IDENTIFIER);
  if (extension.isPresent()) {
    Object value = extension.get().getValue();
    if (!(value instanceof SweBoolean)) {
      throw new InvalidParameterValueException(RETURN_HUMAN_READABLE_IDENTIFIER, JavaHelper.asString(value));
    }
    return ((SweBoolean) value).getValue();
  } else {
    return false;
  }
}

代码示例来源:origin: 52North/SOS

/**
 * Get the CRS from the request or if the CRS parameter is not set, return
 * the {@link #NOT_SET_EPSG}.
 *
 * @param request
 *            the request to check
 * @return the requested CRS or {@link #NOT_SET_EPSG}
 * @throws OwsExceptionReport
 *             If an error occurs when parsing the request
 */
private int getCrsFrom(OwsServiceRequest request) throws OwsExceptionReport {
  Optional<?> crsExtension = request.getExtension(OWSConstants.AdditionalRequestParams.crs).map((extension) ->
      extension.getValue());
  if (crsExtension.isPresent()) {
    return getCrs(crsExtension.get());
  } else if (request instanceof SrsNameRequest && ((SrsNameRequest) request).isSetSrsName()) {
    return getCrs(((SrsNameRequest) request).getSrsName());
  }
  return NOT_SET_EPSG;
}

代码示例来源:origin: 52North/SOS

@Override
  protected Map<String, Object> getAsMap() {
    if (extension == null) {
      return null;
    }
    put(ObjectEsParameterFactory.EXTENSION_DEFINITION, extension.getDefinition());
    put(ObjectEsParameterFactory.EXTENSION_IDENTIFIER, extension.getIdentifier());
    put(ObjectEsParameterFactory.EXTENSION_VALUE, extension.getValue().toString());
    return dataMap;
  }
}

代码示例来源:origin: org.n52.sensorweb.sos/statistics

@Override
  protected Map<String, Object> getAsMap() {
    if (extension == null) {
      return null;
    }
    put(ObjectEsParameterFactory.EXTENSION_DEFINITION, extension.getDefinition());
    put(ObjectEsParameterFactory.EXTENSION_IDENTIFIER, extension.getIdentifier());
    put(ObjectEsParameterFactory.EXTENSION_VALUE, extension.getValue().toString());
    return dataMap;
  }
}

代码示例来源:origin: 52North/SOS

protected void checkResultFilterExtension(OwsServiceRequest request) throws CodedException {
  if (request.hasExtension(ResultFilterConstants.RESULT_FILTER)) {
    if (request.getExtensionCount(ResultFilterConstants.RESULT_FILTER) > 1) {
      throw new InvalidParameterValueException(ResultFilterConstants.RESULT_FILTER, "duplicated");
    }
    Optional<Extension<?>> extension = request.getExtension(ResultFilterConstants.RESULT_FILTER);
    if (extension.isPresent() && extension.get().getValue() == null) {
      throw new MissingParameterValueException(ResultFilterConstants.RESULT_FILTER);
    }
    Filter<?> filter = ((ResultFilter) extension.get()).getValue();
    if (filter instanceof BinaryLogicFilter) {
      checkBinaryLogicFilter((BinaryLogicFilter) filter);
    } else if (filter instanceof ComparisonFilter) {
      checkFilter((ComparisonFilter) filter);
    } else {
      throw new OptionNotSupportedException().withMessage("The %s does not yet support filters of type '%s'", ResultFilterConstants.RESULT_FILTER, filter);
    }
  }
}

代码示例来源:origin: org.n52.svalbard/svalbard-xmlbeans

private void encodeOfferingExtension(SosObservationOffering sosOffering, ObservationOfferingType xbObsOff)
    throws EncodingException {
  for (Extension<?> extention : sosOffering.getExtensions().getExtensions()) {
    if (extention.getValue() instanceof SosObservationOfferingExtension) {
      SosObservationOfferingExtension extension = (SosObservationOfferingExtension) extention.getValue();
      try {
        xbObsOff.addNewExtension().set(XmlObject.Factory.parse(extension.getExtension()));
      } catch (XmlException ex) {
        throw errorEncodingSwesExtension(ex);
      }
    } else {
      xbObsOff.addNewExtension().set(encodeObjectToXml(extention.getNamespace(), extention));
    }
  }
}

相关文章