private System parseSystem(final SystemType xbSystemType, final System system) throws OwsExceptionReport { parseAbstractProcess(xbSystemType, system); parseAbstractComponent(xbSystemType, system); parseAbstractDerivableComponent(xbSystemType, system); if (xbSystemType.isSetComponents() && xbSystemType.getComponents().isSetComponentList()) { system.addComponents(parseComponents(xbSystemType.getComponents())); final List<Integer> compsToRemove = checkComponentsForRemoval(xbSystemType.getComponents().getComponentList()); for (final Integer integer : compsToRemove) { xbSystemType.getComponents().getComponentList().removeComponent(integer); } checkAndRemoveEmptyComponents(xbSystemType); } final String xmlDescription = addSensorMLWrapperForXmlDescription(xbSystemType); system.setSensorDescriptionXmlString(xmlDescription); return system; }
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(); } }