gpt4 book ai didi

org.n52.svalbard.util.XmlHelper.makeGmlIdsUnique()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-27 11:55:05 28 4
gpt4 key购买 nike

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

XmlHelper.makeGmlIdsUnique介绍

[英]Recurse through a node and its children and make all gml:ids unique
[中]递归一个节点及其子节点,并使所有gml:id唯一

代码示例

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

/**
 * Recurse through a node and its children and make all gml:ids unique
 *
 * @param node
 *            The root node
 */
public static void makeGmlIdsUnique(final Node node) {
  makeGmlIdsUnique(node, new HashMap<>());
}

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

/**
 * Recurse through a node and its children and make all gml:ids unique
 *
 * @param node
 *            The root node
 */
public static void makeGmlIdsUnique(final Node node) {
  makeGmlIdsUnique(node, new HashMap<>());
}

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

if (children != null) {
  for (int i = 0, len = children.getLength(); i < len; i++) {
    makeGmlIdsUnique(children.item(i), foundIds);

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

if (children != null) {
  for (int i = 0, len = children.getLength(); i < len; i++) {
    makeGmlIdsUnique(children.item(i), foundIds);

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

@Override
public XmlObject encode(final Object response, final EncodingContext additionalValues) throws EncodingException {
  XmlObject encodedObject = null;
  if (response instanceof AbstractSensorML) {
    encodedObject = createSensorDescription((AbstractSensorML) response);
    // }
    // FIXME workaround? if of type UnknowProcedureType try to parse the
    // description string, UNIT is missing "NOT_DEFINED"?!
    // else if (response instanceof SosProcedureDescriptionUnknownType)
    // {
    // final String procDescXMLString = ((SosProcedureDescription)
    // response).getXml();
    // final AbstractSensorML sensorDesc = new AbstractSensorML();
    // sensorDesc.setXml(procDescXMLString);
    // encodedObject = createSensorDescriptionFromString(sensorDesc);
  } else {
    throw new UnsupportedEncoderInputException(this, response);
  }
  // check if all gml:id are unique
  XmlHelper.makeGmlIdsUnique(encodedObject.getDomNode());
  XmlHelper.validateDocument(encodedObject, EncodingException::new);
  return encodedObject;
}

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

@Override
protected XmlObject create(GetFeatureOfInterestResponse response) throws EncodingException {
  GetFeatureOfInterestResponseDocument document =
      GetFeatureOfInterestResponseDocument.Factory.newInstance(getXmlOptions());
  GetFeatureOfInterestResponseType xbGetFoiResponse = document.addNewGetFeatureOfInterestResponse();
  AbstractFeature feature = response.getAbstractFeature();
  if (feature instanceof FeatureCollection) {
    for (AbstractFeature f : (FeatureCollection) feature) {
      addFeatureOfInterest(f, xbGetFoiResponse);
    }
  } else if (feature instanceof SamplingFeature) {
    addFeatureOfInterest(feature, xbGetFoiResponse);
  }
  XmlHelper.makeGmlIdsUnique(document.getDomNode());
  return document;
}

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

@Override
protected XmlObject createResponse(ObservationEncoder<XmlObject, OmObservation> encoder,
    GetObservationByIdResponse response) throws EncodingException {
  GetObservationByIdResponseDocument doc =
      GetObservationByIdResponseDocument.Factory.newInstance(getXmlOptions());
  GetObservationByIdResponseType xbResponse = doc.addNewGetObservationByIdResponse();
  ObservationStream observations = getObservationsAndCheckForStreaming(response, encoder);
  HashMap<CodeWithAuthority, String> gmlID4sfIdentifier = new HashMap<>();
  try {
    while (observations.hasNext()) {
      OmObservation observation = observations.next();
      EncodingContext codingContext = EncodingContext.empty();
      CodeWithAuthority foiId = observation.getObservationConstellation().getFeatureOfInterest()
          .getIdentifierCodeWithAuthority();
      if (gmlID4sfIdentifier.containsKey(foiId)) {
        codingContext = codingContext.with(XmlBeansEncodingFlags.EXIST_FOI_IN_DOC, true);
      } else {
        gmlID4sfIdentifier.put(foiId, GML_ID);
        codingContext = codingContext.with(XmlBeansEncodingFlags.EXIST_FOI_IN_DOC, false);
      }
      codingContext = codingContext.with(XmlBeansEncodingFlags.GMLID, gmlID4sfIdentifier.get(foiId));
      xbResponse.addNewObservation().addNewOMObservation().set(encoder.encode(observation, codingContext));
    }
  } catch (OwsExceptionReport ex) {
    throw new EncodingException(ex);
  }
  XmlHelper.makeGmlIdsUnique(xbResponse.getDomNode());
  return doc;
}

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

@Override
public XmlObject encode(Object objectToEncode, EncodingContext additionalValues) throws EncodingException {
  XmlObject encodedObject = null;
  try {
    if (objectToEncode instanceof AbstractSensorML) {
      AbstractSensorML description = (AbstractSensorML) objectToEncode;
      if (description.isSetXml()) {
        encodedObject = XmlObject.Factory.parse(((AbstractSensorML) objectToEncode).getXml());
        addValuesToXmlObject(encodedObject, (AbstractSensorML) objectToEncode);
        encodedObject = checkForAdditionalValues(encodedObject, additionalValues);
      } else {
        encodedObject = encodeDescription(description, additionalValues);
      }
    } else {
      throw new UnsupportedEncoderInputException(this, objectToEncode);
    }
  } catch (XmlException xmle) {
    throw new EncodingException(xmle);
  }
  // check if all gml:id are unique
  XmlHelper.makeGmlIdsUnique(encodedObject.getDomNode());
  XmlHelper.validateDocument(encodedObject, EncodingException::new);
  return encodedObject;
}

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

xbObservation.setHref(GmlConstants.NIL_INAPPLICABLE);
XmlHelper.makeGmlIdsUnique(xbObservationCollectionDoc.getDomNode());
N52XmlHelper.setSchemaLocationsToDocument(xbObservationCollectionDoc,
    Sets.newHashSet(N52XmlHelper.getSchemaLocationForSOS100(), N52XmlHelper.getSchemaLocationForOM100(),

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

@Override
protected XmlObject createResponse(ObservationEncoder<XmlObject, OmObservation> encoder,
                  GetObservationResponse response) throws EncodingException {
  try {
    GetObservationResponseDocument doc = GetObservationResponseDocument.Factory.newInstance(getXmlOptions());
    GetObservationResponseType xbResponse = doc.addNewGetObservationResponse();
    ObservationStream observationCollection = response.getObservationCollection();
    while (observationCollection.hasNext()) {
      xbResponse.addNewObservationData()
          .addNewOMObservation()
          .set(encoder.encode(observationCollection.next()));
    }
    // in a single observation the gml:ids must be unique
    XmlHelper.makeGmlIdsUnique(doc.getDomNode());
    return doc;
  } catch (OwsExceptionReport ex) {
    throw new EncodingException(ex);
  }
}

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

@Override
protected XmlObject create(DescribeSensorResponse response)
    throws EncodingException {
  DescribeSensorResponseDocument doc = DescribeSensorResponseDocument.Factory.newInstance(getXmlOptions());
  DescribeSensorResponseType dsr = doc.addNewDescribeSensorResponse();
  dsr.setProcedureDescriptionFormat(response.getOutputFormat());
  for (SosProcedureDescription<?> sosProcedureDescription : response.getProcedureDescriptions()) {
    SensorDescriptionType sensorDescription = dsr.addNewDescription().addNewSensorDescription();
    sensorDescription.addNewData().set(getSensorDescription(response, sosProcedureDescription));
    if (sosProcedureDescription.isSetValidTime()) {
      XmlObject xoValidTime =
          encodeObjectToXml(GmlConstants.NS_GML_32, sosProcedureDescription.getValidTime());
      XmlObject substitution = sensorDescription.addNewValidTime().addNewAbstractTimeGeometricPrimitive()
          .substitute(GmlHelper.getGml321QnameForITime(sosProcedureDescription.getValidTime()),
              xoValidTime.schemaType());
      substitution.set(xoValidTime);
    }
  }
  // in a single observation the gml:ids must be unique
  if (response.getProcedureDescriptions().size() > 1) {
    XmlHelper.makeGmlIdsUnique(doc.getDomNode());
  }
  return doc;
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com