String ids = this.getAttributeAsString(SNAPSHOT_ID);
// ids contains the id of the snapshots to be deleted separated by ,
String[] idArray = ids.split(",");
for (int i = 0; i < idArray.length; i++) {
Integer id = new Integer(idArray[i]);
Snapshot snapshot = null;
try {
snapshot = dao.loadSnapshot(id);
} catch (EMFUserError e) {
logger.error("Snapshot with id = " + id + " not found", e);
throw new SpagoBIServiceException(SERVICE_NAME, "Scheduled execution not found", e);
}
if (snapshot.getBiobjId().equals(obj.getId())) {
logger.info("User [id: " + userProfile.getUserUniqueIdentifier() + ", userId: " + userProfile.getUserId() + ", name: " + userProfile.getUserName() + "] " +
"is deleting scheduled execution [id: " + snapshot.getId() + ", name: " + snapshot.getName() + "] ...");
try {
dao.deleteSnapshot(id);
} catch (EMFUserError e) {
throw new SpagoBIServiceException(SERVICE_NAME, "Error while deleting scheduled execution", e);
}
logger.debug("Scheduled execution [id: " + snapshot.getId() + ", name: " + snapshot.getName() + "] deleted.");
} else {
logger.error("Cannot delete scheduled execution with id = " + snapshot.getBiobjId() + ": " +
"it is not relevant to the current document [id: " + obj.getId() + ", label: " + obj.getLabel() + ", name: " + obj.getName() + "]");
throw new SpagoBIServiceException(SERVICE_NAME, "Cannot delete scheduled execution: it is not relevant to the current document");
}
}