private List<SmlComponent> parseComponents(final Components components) throws OwsExceptionReport { final List<SmlComponent> sosSmlComponents = Lists.newLinkedList(); if (components.isSetComponentList() && components.getComponentList().getComponentArray() != null) { for (final Component component : components.getComponentList().getComponentArray()) { if (component.isSetProcess() || component.isSetHref()) { final SmlComponent sosSmlcomponent = new SmlComponent(component.getName()); AbstractProcess abstractProcess = null; if (component.isSetProcess()) { if (component.getProcess() instanceof SystemType) { abstractProcess = new System(); parseSystem((SystemType) component.getProcess(), (System) abstractProcess); } else { abstractProcess = new AbstractProcess(); parseAbstractProcess(component.getProcess(), abstractProcess); } } else { abstractProcess = new AbstractProcess(); abstractProcess.setIdentifier(component.getHref()); } sosSmlcomponent.setProcess(abstractProcess); sosSmlComponents.add(sosSmlcomponent); } } } return sosSmlComponents; }
/** * Parses the identifications and sets the AbstractProcess' identifiers * * @param abstractProcess The AbstractProcess to which identifiers are added * @param identificationArray XML identification */ private void parseIdentifications( final AbstractProcess abstractProcess, final Identification[] identificationArray) { for (final Identification xbIdentification : identificationArray) { if (xbIdentification.getIdentifierList() != null) { for (final Identifier xbIdentifier : xbIdentification.getIdentifierList().getIdentifierArray()) { if (xbIdentifier.getName() != null && xbIdentifier.getTerm() != null) { final SmlIdentifier identifier = new SmlIdentifier( xbIdentifier.getName(), xbIdentifier.getTerm().getDefinition(), xbIdentifier.getTerm().getValue()); abstractProcess.addIdentifier(identifier); if (isIdentificationProcedureIdentifier(identifier)) { abstractProcess.setIdentifier(identifier.getValue()); } } } } } }