*
* @see ContentFacet#removePackages(Set)
*/
public RemovePackagesResponse removePackages(Set<ResourcePackageDetails> packages) {
RemovePackagesResponse response = new RemovePackagesResponse();
RemoveIndividualPackageResponse individualResponse;
for (ResourcePackageDetails detail : packages) {
individualResponse = new RemoveIndividualPackageResponse(detail.getKey());
response.addPackageResponse(individualResponse);
try {
File packageFile = getPackageFile(detail);
if (packageFile.delete()) {
individualResponse.setResult(ContentResponseResult.SUCCESS);
} else {
individualResponse.setErrorMessage("Failed to delete [" + packageFile.getAbsolutePath() + "]");
individualResponse.setResult(ContentResponseResult.FAILURE);
}
} catch (Exception e) {
individualResponse.setErrorMessage(ThrowableUtil.getStackAsString(e));
individualResponse.setResult(ContentResponseResult.FAILURE);
}
}
return response;
}