Source:
<code>private BundleHandoverResponse handleDeployment(BundleHandoverRequest handoverRequest) { <START> String serverGroup = handoverRequest.getParams().get("serverGroup"); <END> if (isBlank(serverGroup)) { return BundleHandoverResponse.failure(MISSING_PARAMETER, "serverGroup parameter is missing"); } HandoverContentUploader contentUploader = new HandoverContentUploader(handoverRequest, getASConnection()); boolean uploaded = contentUploader.upload(); if (!uploaded) { return contentUploader.getFailureResponse(); } Operation addDeploymentStep = new Operation("add", "deployment", contentUploader.getRuntimeName()); List<Object> addDeploymentContentProperty = new ArrayList<Object>(1); Map<String, Object> contentValues = new HashMap<String, Object>(); contentValues.put("hash", new PROPERTY_VALUE("BYTES_VALUE", contentUploader.getHash())); addDeploymentContentProperty.add(contentValues); addDeploymentStep.addAdditionalProperty("content", addDeploymentContentProperty); addDeploymentStep.addAdditionalProperty("name", contentUploader.getFilename()); addDeploymentStep.addAdditionalProperty("runtime-name", contentUploader.getRuntimeName()); Address serverGroupDeploymentAddress = new Address(); serverGroupDeploymentAddress.add("server-group", serverGroup); serverGroupDeploymentAddress.add("deployment", contentUploader.getRuntimeName()); Operation addToServerGroupStep = new Operation("add", serverGroupDeploymentAddress); addToServerGroupStep.addAdditionalProperty("runtime-name", contentUploader.getRuntimeName()); addToServerGroupStep.addAdditionalProperty("enabled", true); CompositeOperation compositeOperation = new CompositeOperation(); compositeOperation.addStep(addDeploymentStep); compositeOperation.addStep(addToServerGroupStep); Result result = getASConnection().execute(compositeOperation, 300); if (!result.isSuccess()) { return BundleHandoverResponse.failure(EXECUTION, result.getFailureDescription()); } else { return BundleHandoverResponse.success(); } }</code><technical_language>I sense "serverGroup" parameter optional. User want upload DomainDeployment assign groups manually (or additional CLI script)</technical_language>

Target:
private BundleHandoverResponse handleDeployment(BundleHandoverRequest handoverRequest) { String serverGroup = handoverRequest.getParams().get("serverGroup"); if (isBlank(serverGroup)) { return BundleHandoverResponse.failure(MISSING_PARAMETER, "serverGroup parameter is missing"); } HandoverContentUploader contentUploader = new HandoverContentUploader(handoverRequest, getASConnection()); boolean uploaded = contentUploader.upload(); if (!uploaded) { return contentUploader.getFailureResponse(); } String filename = contentUploader.getFilename(); String runtimeName = contentUploader.getRuntimeName(); String hash = contentUploader.getHash(); Redeployer redeployer = new Redeployer(runtimeName, hash, getASConnection()); if (redeployer.deploymentExists()) { Result result = redeployer.redeployOnServer(); if (result.isRolledBack()) { return BundleHandoverResponse.failure(EXECUTION, result.getFailureDescription()); } return BundleHandoverResponse.success(); } Operation addDeploymentStep = new Operation("add", "deployment", runtimeName); List<Object> addDeploymentContentProperty = new ArrayList<Object>(1); Map<String, Object> contentValues = new HashMap<String, Object>(); contentValues.put("hash", new PROPERTY_VALUE("BYTES_VALUE", hash)); addDeploymentContentProperty.add(contentValues); addDeploymentStep.addAdditionalProperty("content", addDeploymentContentProperty); addDeploymentStep.addAdditionalProperty("name", filename); addDeploymentStep.addAdditionalProperty("runtime-name", runtimeName); Address serverGroupDeploymentAddress = new Address(); serverGroupDeploymentAddress.add("server-group", serverGroup); serverGroupDeploymentAddress.add("deployment", runtimeName); Operation addToServerGroupStep = new Operation("add", serverGroupDeploymentAddress); addToServerGroupStep.addAdditionalProperty("runtime-name", runtimeName); addToServerGroupStep.addAdditionalProperty("enabled", true); CompositeOperation compositeOperation = new CompositeOperation(); compositeOperation.addStep(addDeploymentStep); compositeOperation.addStep(addToServerGroupStep); Result result = getASConnection().execute(compositeOperation, 300); if (!result.isSuccess()) { return BundleHandoverResponse.failure(EXECUTION, result.getFailureDescription()); } else { return BundleHandoverResponse.success(); } }