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; }
private void checkAndRemoveEmptyComponents(final SystemType system) { boolean removeComponents = false; final Components components = system.getComponents(); if (components != null) { if (components.getComponentList() == null) { removeComponents = true; } else if (components.getComponentList().getComponentArray() == null || ((components.getComponentList().getComponentArray() != null && components.getComponentList().getComponentArray().length == 0))) { removeComponents = true; } } if (removeComponents) { system.unsetComponents(); } }