@Override public void _finalizePurge(Subject subject, BundleDeployment bundleDeployment, Map<BundleResourceDeployment, String> failedToPurge) throws Exception { bundleDeployment = entityManager.find(BundleDeployment.class, bundleDeployment.getId()); if (failedToPurge.isEmpty()) { bundleDeployment.setLive(false); // all deployments are purged, no where is this live anymore bundleDeployment.setErrorMessage(null); bundleDeployment.setStatus(BundleDeploymentStatus.SUCCESS); } else { bundleDeployment.setLive(true); // not all deployments are purged - error indicates it is still live somewhere StringBuilder errorStr = new StringBuilder(); int totalDeployments = bundleDeployment.getResourceDeployments().size(); int failedPurges = failedToPurge.size(); if (failedPurges < totalDeployments) { bundleDeployment.setStatus(BundleDeploymentStatus.MIXED); // some deployments were purged, so show MIXED status errorStr.append("Failed to purge [").append(failedPurges).append("] of [").append(totalDeployments) .append("] remote resource deployments"); } else { bundleDeployment.setStatus(BundleDeploymentStatus.FAILURE); // all deployments failed to be purged errorStr.append("Failed to purge all [").append(failedPurges).append("] remote resource deployments"); } // key is the resource deployment that failed to be purged; value is the error message for (Map.Entry<BundleResourceDeployment, String> entry : failedToPurge.entrySet()) { errorStr.append("\n\n"); errorStr.append(entry.getKey().getResource().getName()).append(": ").append(entry.getValue()); } bundleDeployment.setErrorMessage(errorStr.toString()); } }
List<BundleResourceDeployment> deployments = deployment.getResourceDeployments(); boolean someInProgress = false; boolean someSuccess = false;
List<BundleResourceDeployment> resourceDeploys = liveDeployment.getResourceDeployments(); if (resourceDeploys == null || resourceDeploys.isEmpty()) { return; // nothing to do int totalDeployments = liveDeployment.getResourceDeployments().size(); int failedPurges = failedToPurge.size(); throw new Exception("Failed to purge [" + failedPurges + "] of [" + totalDeployments