Ejemplo n.º 1
0
 private String addSensorMLWrapperForXmlDescription(final AbstractProcessType xbProcessType) {
   final SensorMLDocument xbSensorMLDoc =
       SensorMLDocument.Factory.newInstance(XmlOptionsHelper.getInstance().getXmlOptions());
   final net.opengis.sensorML.x101.SensorMLDocument.SensorML xbSensorML =
       xbSensorMLDoc.addNewSensorML();
   xbSensorML.setVersion(SensorMLConstants.VERSION_V101);
   final Member member = xbSensorML.addNewMember();
   final AbstractProcessType xbAbstractProcessType =
       (AbstractProcessType)
           member
               .addNewProcess()
               .substitute(
                   getQnameForType(xbProcessType.schemaType()), xbProcessType.schemaType());
   xbAbstractProcessType.set(xbProcessType);
   return xbSensorMLDoc.xmlText(XmlOptionsHelper.getInstance().getXmlOptions());
 }
Ejemplo n.º 2
0
 private SensorML parseSensorML(final SensorMLDocument xbSensorML) throws OwsExceptionReport {
   final SensorML sensorML = new SensorML();
   // get member process
   for (final Member xbMember : xbSensorML.getSensorML().getMemberArray()) {
     if (xbMember.getProcess() != null) {
       if (xbMember.getProcess() instanceof AbstractProcessType) {
         final AbstractProcessType xbAbstractProcess = xbMember.getProcess();
         AbstractProcess abstractProcess = null;
         if (xbAbstractProcess.schemaType() == SystemType.type) {
           abstractProcess = parseSystem((SystemType) xbAbstractProcess);
         } else if (xbAbstractProcess.schemaType() == ProcessModelType.type) {
           abstractProcess = parseProcessModel((ProcessModelType) xbAbstractProcess);
         } else if (xbAbstractProcess.schemaType() == ComponentType.type) {
           abstractProcess = parseComponent((ComponentType) xbAbstractProcess);
         } else {
           throw new InvalidParameterValueException()
               .at(XmlHelper.getLocalName(xbMember))
               .withMessage(
                   "The process of a member of the SensorML Document (%s) is not supported!",
                   xbMember.getProcess().getDomNode().getNodeName());
         }
         sensorML.addMember(abstractProcess);
       } else {
         throw new InvalidParameterValueException()
             .at(XmlHelper.getLocalName(xbMember))
             .withMessage(
                 "The process of a member of the SensorML Document (%s) is not supported!",
                 xbMember.getProcess().getDomNode().getNodeName());
       }
     } else {
       throw new InvalidParameterValueException()
           .at(XmlHelper.getLocalName(xbMember))
           .withMessage(
               "The process of a member of the SensorML Document is null (%s)!",
               xbMember.getProcess());
     }
   }
   sensorML.setSensorDescriptionXmlString(
       xbSensorML.xmlText(XmlOptionsHelper.getInstance().getXmlOptions()));
   return sensorML;
 }
Ejemplo n.º 3
0
 private void parseAbstractProcess(
     final AbstractProcessType xbAbstractProcess, final AbstractProcess abstractProcess)
     throws OwsExceptionReport {
   if (xbAbstractProcess.getId() != null) {
     abstractProcess.setGmlId(xbAbstractProcess.getId());
   }
   if (xbAbstractProcess.getIdentificationArray() != null) {
     parseIdentifications(abstractProcess, xbAbstractProcess.getIdentificationArray());
   }
   if (xbAbstractProcess.getClassificationArray() != null) {
     abstractProcess.setClassifications(
         parseClassification(xbAbstractProcess.getClassificationArray()));
   }
   if (xbAbstractProcess.getCharacteristicsArray() != null) {
     abstractProcess.setCharacteristics(
         parseCharacteristics(xbAbstractProcess.getCharacteristicsArray()));
   }
   if (xbAbstractProcess.getCapabilitiesArray() != null) {
     parseCapabilities(abstractProcess, xbAbstractProcess.getCapabilitiesArray());
     final List<Integer> capsToRemove =
         checkCapabilitiesForRemoval(xbAbstractProcess.getCapabilitiesArray());
     for (final Integer integer : capsToRemove) {
       xbAbstractProcess.removeCapabilities(integer);
     }
   }
   if (xbAbstractProcess.isSetDescription()) {
     abstractProcess.addDescription(xbAbstractProcess.getDescription().getStringValue());
   }
   if (xbAbstractProcess.isSetValidTime()) {
     abstractProcess.setValidTime(parseValidTime(xbAbstractProcess.getValidTime()));
   }
   if (xbAbstractProcess.getContactArray() != null) {
     abstractProcess.setContact(parseContact(xbAbstractProcess.getContactArray()));
   }
   if (xbAbstractProcess.getDocumentationArray() != null) {
     abstractProcess.setDocumentation(
         parseDocumentation(xbAbstractProcess.getDocumentationArray()));
   }
   if (xbAbstractProcess.getHistoryArray() != null) {
     abstractProcess.setHistory(parseHistory(xbAbstractProcess.getHistoryArray()));
   }
   if (xbAbstractProcess.getKeywordsArray() != null) {
     abstractProcess.setKeywords(parseKeywords(xbAbstractProcess.getKeywordsArray()));
   }
   if (xbAbstractProcess.getNameArray() != null) {
     final int length = xbAbstractProcess.getNameArray().length;
     for (int i = 0; i < length; i++) {
       final Object decodedElement =
           CodingHelper.decodeXmlElement(xbAbstractProcess.getNameArray(i));
       if (decodedElement instanceof CodeType) {
         abstractProcess.addName((CodeType) decodedElement);
       }
     }
   }
 }