public RemotePortSchema(Map map) { super(map, "RemoteInputPort(id: {id}, name: {name})"); String wrapperName = getWrapperName(); comment = getOptionalKeyAsType(map, COMMENT_KEY, String.class, wrapperName, DEFAULT_COMMENT); maxConcurrentTasks = getOptionalKeyAsType(map, MAX_CONCURRENT_TASKS_KEY, Number.class, wrapperName, DEFAULT_MAX_CONCURRENT_TASKS); useCompression = getOptionalKeyAsType(map, USE_COMPRESSION_KEY, Boolean.class, wrapperName, DEFAULT_USE_COMPRESSION); }
protected static void addRemoteGroupPort(final Element parentElement, RemotePortSchema inputPort, String tagName) throws ConfigurationChangeException { try { final Document doc = parentElement.getOwnerDocument(); final Element element = doc.createElement(tagName); parentElement.appendChild(element); addTextElement(element, "id", inputPort.getId()); addTextElement(element, "name", inputPort.getName()); addPosition(element); addTextElement(element, "comments", inputPort.getComment()); addTextElement(element, "scheduledState", "RUNNING"); addTextElement(element, "maxConcurrentTasks", String.valueOf(inputPort.getMax_concurrent_tasks())); addTextElement(element, "useCompression", String.valueOf(inputPort.getUseCompression())); parentElement.appendChild(element); } catch (Exception e) { throw new ConfigurationChangeException("Failed to parse the config YAML while trying to add the input port of the Remote Process Group", e); } }
@Override public RemotePortSchema apply(RemoteProcessGroupPortDTO remoteProcessGroupPortDTO) { Map<String, Object> map = new HashMap<>(); // If a targetId is specified, it takes precedence over the original id final String targetId = remoteProcessGroupPortDTO.getTargetId(); map.put(ID_KEY, StringUtils.isNotBlank(targetId) ? targetId : remoteProcessGroupPortDTO.getId()); map.put(NAME_KEY, remoteProcessGroupPortDTO.getName()); map.put(CommonPropertyKeys.COMMENT_KEY, remoteProcessGroupPortDTO.getComments()); map.put(CommonPropertyKeys.MAX_CONCURRENT_TASKS_KEY, remoteProcessGroupPortDTO.getConcurrentlySchedulableTaskCount()); map.put(CommonPropertyKeys.USE_COMPRESSION_KEY, remoteProcessGroupPortDTO.getUseCompression()); return new RemotePortSchema(map); } }
protected static void getRemotePortParentIdMap(ProcessGroupSchema processGroupSchema, Map<String, String> output, Function<RemoteProcessGroupSchema, List<RemotePortSchema>> getPortsFunction) { for (RemoteProcessGroupSchema remoteProcessGroupSchema : processGroupSchema.getRemoteProcessGroups()) { for (RemotePortSchema remotePortSchema : getPortsFunction.apply(remoteProcessGroupSchema)) { output.put(remotePortSchema.getId(), remoteProcessGroupSchema.getId()); } } processGroupSchema.getProcessGroupSchemas().forEach(p -> getRemotePortParentIdMap(p, output, getPortsFunction)); }
@Override public RemotePortSchema apply(RemoteProcessGroupPortDTO remoteProcessGroupPortDTO) { Map<String, Object> map = new HashMap<>(); // If a targetId is specified, it takes precedence over the original id final String targetId = remoteProcessGroupPortDTO.getTargetId(); map.put(ID_KEY, StringUtils.isNotBlank(targetId) ? targetId : remoteProcessGroupPortDTO.getId()); map.put(NAME_KEY, remoteProcessGroupPortDTO.getName()); map.put(CommonPropertyKeys.COMMENT_KEY, remoteProcessGroupPortDTO.getComments()); map.put(CommonPropertyKeys.MAX_CONCURRENT_TASKS_KEY, remoteProcessGroupPortDTO.getConcurrentlySchedulableTaskCount()); map.put(CommonPropertyKeys.USE_COMPRESSION_KEY, remoteProcessGroupPortDTO.getUseCompression()); return new RemotePortSchema(map); } }
@Override public RemotePortSchema apply(VersionedRemoteGroupPort versionedRemoteGroupPort) { Map<String, Object> map = new HashMap<>(); // If a targetId is specified, it takes precedence over the original id final String targetId = versionedRemoteGroupPort.getTargetId(); map.put(ID_KEY, StringUtils.isNotBlank(targetId) ? targetId : versionedRemoteGroupPort.getIdentifier()); map.put(NAME_KEY, versionedRemoteGroupPort.getName()); map.put(CommonPropertyKeys.COMMENT_KEY, versionedRemoteGroupPort.getComments()); map.put(CommonPropertyKeys.MAX_CONCURRENT_TASKS_KEY, versionedRemoteGroupPort.getConcurrentlySchedulableTaskCount()); map.put(CommonPropertyKeys.USE_COMPRESSION_KEY, versionedRemoteGroupPort.isUseCompression()); return new RemotePortSchema(map); } }
@Override public RemotePortSchema apply(VersionedRemoteGroupPort versionedRemoteGroupPort) { Map<String, Object> map = new HashMap<>(); // If a targetId is specified, it takes precedence over the original id final String targetId = versionedRemoteGroupPort.getTargetId(); map.put(ID_KEY, StringUtils.isNotBlank(targetId) ? targetId : versionedRemoteGroupPort.getIdentifier()); map.put(NAME_KEY, versionedRemoteGroupPort.getName()); map.put(CommonPropertyKeys.COMMENT_KEY, versionedRemoteGroupPort.getComments()); map.put(CommonPropertyKeys.MAX_CONCURRENT_TASKS_KEY, versionedRemoteGroupPort.getConcurrentlySchedulableTaskCount()); map.put(CommonPropertyKeys.USE_COMPRESSION_KEY, versionedRemoteGroupPort.isUseCompression()); return new RemotePortSchema(map); } }