private static boolean validate(NodeDetails nodeDetails) { boolean result = false; if (nodeDetails != null) { if (nodeDetails.getUniqueId() != null && nodeDetails.getUniqueId().trim().length() > 0 && nodeDetails.getHost() != null && nodeDetails.getHost().trim().length() > 0 && nodeDetails.getDynamicTags() != null && nodeDetails.getDynamicTags().size() > 0 && nodeDetails.getCredentialName() != null && nodeDetails.getCredentialName().trim().length() > 0) { result = true; } } return result; }
private static NodeDetails convert(Map<String, String> columnsMap) { NodeDetails result = new NodeDetails(); if (columnsMap.get(NodeDetailsKeys.ID.name()) != null) { result.setDisplayId(columnsMap.get(NodeDetailsKeys.ID.name())); } if (columnsMap.get(NodeDetailsKeys.HOST.name()) != null) { result.setHost(columnsMap.get(NodeDetailsKeys.HOST.name())); } if (columnsMap.get(NodeDetailsKeys.PORT.name()) != null) { result.setPort(Integer.parseInt(columnsMap.get(NodeDetailsKeys.PORT.name()))); } else { result.setPort(22); } if (columnsMap.get(NodeDetailsKeys.NAME.name()) != null) { result.setName(columnsMap.get(NodeDetailsKeys.NAME.name())); } if (columnsMap.get(NodeDetailsKeys.JUMP_HOST.name()) != null) { result.setJumpHost(columnsMap.get(NodeDetailsKeys.JUMP_HOST.name())); } if (columnsMap.get(NodeDetailsKeys.CREDENTIALS_NAME.name()) != null) { result.setCredentialName(columnsMap.get(NodeDetailsKeys.CREDENTIALS_NAME.name())); } if (columnsMap.get(NodeDetailsKeys.TAGS.name()) != null) { result.setTagNames(parseTags(columnsMap.get(NodeDetailsKeys.TAGS.name()))); } if (columnsMap.get(NodeDetailsKeys.MULTI_FACTOR.name()) != null) { result.setMultiFactorAuthenticate( parseMultiFactorMode(columnsMap.get(NodeDetailsKeys.MULTI_FACTOR.name()))); } if (columnsMap.get(NodeDetailsKeys.GROUP_PATH.name()) != null) { result.setGroupPaths(parseGroupPath(columnsMap.get(NodeDetailsKeys.GROUP_PATH.name()))); } if (columnsMap.get(NodeDetailsKeys.CLOUD_TYPE.name()) != null) { result.setCloudType(parseCloudType(columnsMap.get(NodeDetailsKeys.CLOUD_TYPE.name()))); } if (columnsMap.get(NodeDetailsKeys.TEMP.name()) != null) { result.setTemporary(parseTemporaryNodeMode(columnsMap.get(NodeDetailsKeys.TEMP.name()))); } if (columnsMap.get(NodeDetailsKeys.UNIQUE_ID.name()) != null) { result.setUniqueId(columnsMap.get(NodeDetailsKeys.UNIQUE_ID.name())); } if (columnsMap.get(NodeDetailsKeys.DYNAMIC_TAGS.name()) != null) { result.setDynamicTags(parseTags(columnsMap.get(NodeDetailsKeys.DYNAMIC_TAGS.name()))); } return result; }