Source:
public GeneralClusterConfigs generalClusterConfigs(Stack stack, Cluster cluster) { boolean gatewayInstanceMetadataPresented = false; boolean instanceMetadataPresented = false; if (stack.getInstanceGroups() != null && !stack.getInstanceGroups().isEmpty()) { List<InstanceMetaData> gatewayInstanceMetadata = stack.getGatewayInstanceMetadata(); gatewayInstanceMetadataPresented = !gatewayInstanceMetadata.isEmpty() && stack.getCluster().getGateway() != null; instanceMetadataPresented = true; } GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs(); generalClusterConfigs.setClusterManagerIp(cluster.getClusterManagerIp()); generalClusterConfigs.setInstanceGroupsPresented(instanceMetadataPresented); generalClusterConfigs.setGatewayInstanceMetadataPresented(gatewayInstanceMetadataPresented); generalClusterConfigs.setClusterName(cluster.getName()); generalClusterConfigs.setExecutorType(cluster.getExecutorType()); generalClusterConfigs.setStackName(stack.getName()); generalClusterConfigs.setUuid(stack.getUuid()); generalClusterConfigs.setUserName(cluster.getUserName()); generalClusterConfigs.setPassword(cluster.getPassword()); generalClusterConfigs.setCloudbreakAmbariUser(cluster.getCloudbreakAmbariUser()); generalClusterConfigs.setCloudbreakAmbariPassword(cluster.getCloudbreakAmbariPassword()); generalClusterConfigs.setNodeCount(stack.getFullNodeCount()); generalClusterConfigs.setPrimaryGatewayInstanceDiscoveryFQDN(Optional.ofNullable(stack.getPrimaryGatewayInstance().getDiscoveryFQDN())); generalClusterConfigs.setVariant(cluster.getVariant()); generalClusterConfigs.setAutoTlsEnabled(cluster.getAutoTlsEnabled()); boolean userFacingCertHasBeenGenerated = StringUtils.isNotEmpty(stack.getSecurityConfig().getUserFacingKey()) && StringUtils.isNotEmpty(stack.getSecurityConfig().getUserFacingCert()); generalClusterConfigs.setKnoxUserFacingCertConfigured(userFacingCertHasBeenGenerated); generalClusterConfigs.setExternalFQDN(cluster.getFqdn()); generalClusterConfigs.setEnableRangerRaz(cluster.isRangerRazEnabled()); generalClusterConfigs.setUserCrn(stack.getEnvironmentCrn()); Crn crn = Crn.safeFromString(generalClusterConfigs.getUserCrn()); generalClusterConfigs.setAccountId(crn.getAccountId()); return generalClusterConfigs; }

Target:
public GeneralClusterConfigs generalClusterConfigs(Stack stack, Cluster cluster) { boolean gatewayInstanceMetadataPresented = false; boolean instanceMetadataPresented = false; if (stack.getInstanceGroups() != null && !stack.getInstanceGroups().isEmpty()) { List<InstanceMetaData> gatewayInstanceMetadata = stack.getGatewayInstanceMetadata(); gatewayInstanceMetadataPresented = !gatewayInstanceMetadata.isEmpty() && stack.getCluster().getGateway() != null; instanceMetadataPresented = true; } GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs(); generalClusterConfigs.setClusterManagerIp(cluster.getClusterManagerIp()); generalClusterConfigs.setInstanceGroupsPresented(instanceMetadataPresented); generalClusterConfigs.setGatewayInstanceMetadataPresented(gatewayInstanceMetadataPresented); generalClusterConfigs.setClusterName(cluster.getName()); generalClusterConfigs.setExecutorType(cluster.getExecutorType()); generalClusterConfigs.setStackName(stack.getName()); generalClusterConfigs.setUuid(stack.getUuid()); generalClusterConfigs.setUserName(cluster.getUserName()); generalClusterConfigs.setPassword(cluster.getPassword()); generalClusterConfigs.setCloudbreakAmbariUser(cluster.getCloudbreakAmbariUser()); generalClusterConfigs.setCloudbreakAmbariPassword(cluster.getCloudbreakAmbariPassword()); generalClusterConfigs.setNodeCount(stack.getFullNodeCount()); generalClusterConfigs.setPrimaryGatewayInstanceDiscoveryFQDN(Optional.ofNullable(stack.getPrimaryGatewayInstance().getDiscoveryFQDN())); generalClusterConfigs.setVariant(cluster.getVariant()); generalClusterConfigs.setAutoTlsEnabled(cluster.getAutoTlsEnabled()); boolean userFacingCertHasBeenGenerated = StringUtils.isNotEmpty(stack.getSecurityConfig().getUserFacingKey()) && StringUtils.isNotEmpty(stack.getSecurityConfig().getUserFacingCert()); generalClusterConfigs.setKnoxUserFacingCertConfigured(userFacingCertHasBeenGenerated); generalClusterConfigs.setExternalFQDN(cluster.getFqdn()); generalClusterConfigs.setEnableRangerRaz(cluster.isRangerRazEnabled()); return generalClusterConfigs; }