private BatchSize mapBatchSettings(final RemoteGroupPort remotePort) { final BatchSize batchSize = new BatchSize(); batchSize.setCount(remotePort.getBatchCount()); batchSize.setDuration(remotePort.getBatchDuration()); batchSize.setSize(remotePort.getBatchSize()); return batchSize; } }
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); }
public RemoteProcessGroupPortDTO createRemoteProcessGroupPortDto(final RemoteGroupPort port) { if (port == null) { return null; } final RemoteProcessGroupPortDTO dto = new RemoteProcessGroupPortDTO(); dto.setId(port.getIdentifier()); dto.setGroupId(port.getRemoteProcessGroup().getIdentifier()); dto.setTargetId(port.getTargetIdentifier()); dto.setName(port.getName()); dto.setComments(port.getComments()); dto.setTransmitting(port.isRunning()); dto.setTargetRunning(port.isTargetRunning()); dto.setConcurrentlySchedulableTaskCount(port.getMaxConcurrentTasks()); dto.setUseCompression(port.isUseCompression()); dto.setExists(port.getTargetExists()); dto.setVersionedComponentId(port.getVersionedComponentId().orElse(null)); final BatchSettingsDTO batchDTO = new BatchSettingsDTO(); batchDTO.setCount(port.getBatchCount()); batchDTO.setSize(port.getBatchSize()); batchDTO.setDuration(port.getBatchDuration()); dto.setBatchSettings(batchDTO); // determine if this port is currently connected to another component locally if (ConnectableType.REMOTE_OUTPUT_PORT.equals(port.getConnectableType())) { dto.setConnected(!port.getConnections().isEmpty()); } else { dto.setConnected(port.hasIncomingConnection()); } return dto; }