private void addRemoteGroupPort(final Element parentElement, final RemoteGroupPort port, final String elementName, final ScheduledStateLookup scheduledStateLookup) { final Document doc = parentElement.getOwnerDocument(); final Element element = doc.createElement(elementName); parentElement.appendChild(element); addTextElement(element, "id", port.getIdentifier()); addTextElement(element, "versionedComponentId", port.getVersionedComponentId()); addTextElement(element, "name", port.getName()); addPosition(element, port.getPosition()); addTextElement(element, "comments", port.getComments()); addTextElement(element, "scheduledState", scheduledStateLookup.getScheduledState(port).name()); addTextElement(element, "targetId", port.getTargetIdentifier()); addTextElement(element, "maxConcurrentTasks", port.getMaxConcurrentTasks()); addTextElement(element, "useCompression", String.valueOf(port.isUseCompression())); final Integer batchCount = port.getBatchCount(); if (batchCount != null && batchCount > 0) { addTextElement(element, "batchCount", batchCount); } final String batchSize = port.getBatchSize(); if (batchSize != null && batchSize.length() > 0) { addTextElement(element, "batchSize", batchSize); } final String batchDuration = port.getBatchDuration(); if (batchDuration != null && batchDuration.length() > 0) { addTextElement(element, "batchDuration", batchDuration); } parentElement.appendChild(element); }