try {
// retrieving execution instance from session, no need to check if user is able to execute the current document
ExecutionInstance executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
BIObject obj = executionInstance.getBIObject();
UserProfile userProfile = (UserProfile) this.getUserProfile();
ISnapshotDAO dao = null;
try {
dao = DAOFactory.getSnapshotDAO();
} catch (EMFUserError e) {
logger.error("Error while istantiating DAO", e);
throw new SpagoBIServiceException(SERVICE_NAME, "Cannot access database", e);
}
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 {