* @throws Exception if executing request fails
*/
public void execute(MmdQueryCriteria queryCriteria) throws Exception {
int nRows = 0;
String sAction = getActionCriteria().getActionKey();
ImsMetadataAdminDao adminDao = new ImsMetadataAdminDao(getRequestContext());
// check for approval status updates
if (sAction.equalsIgnoreCase("setPosted")) {
nRows = adminDao.updateApprovalStatus(getPublisher(),queryCriteria,MmdEnums.ApprovalStatus.posted);
} else if (sAction.equalsIgnoreCase("setApproved")) {
nRows = adminDao.updateApprovalStatus(getPublisher(),queryCriteria,MmdEnums.ApprovalStatus.approved);
} else if (sAction.equalsIgnoreCase("setIncomplete")) {
nRows = adminDao.updateApprovalStatus(getPublisher(),queryCriteria,MmdEnums.ApprovalStatus.incomplete);
} else if (sAction.equalsIgnoreCase("setDisapproved")) {
nRows = adminDao.updateApprovalStatus(getPublisher(),queryCriteria,MmdEnums.ApprovalStatus.disapproved);
} else if (sAction.equalsIgnoreCase("setReviewed")) {
nRows = adminDao.updateApprovalStatus(getPublisher(),queryCriteria,MmdEnums.ApprovalStatus.reviewed);
}
this.hadUnalteredDraftDocuments = adminDao.hadUnalteredDraftDocuments();
// check for a delete request
if (sAction.equalsIgnoreCase("delete")) {
nRows = adminDao.deleteRecord(getPublisher(), queryCriteria);
}
// check for an ownership transfer request
if (sAction.equalsIgnoreCase("transfer")) {
String sNewOwner = getActionCriteria().getTransferToOwner();
if (sNewOwner.length() > 0) {
Publisher newOwner = new Publisher(getRequestContext(), sNewOwner);
nRows = adminDao.transferOwnership(getPublisher(), queryCriteria, newOwner.getLocalID());
}
}
// check for an assign Acl request
if (sAction.equalsIgnoreCase("assignAcl")) {
ArrayList<String> selectedGroups = getActionCriteria().getMetadataAccessPolicy();
Groups groups = Publisher.buildSelectableGroups(getRequestContext());
if (selectedGroups != null && selectedGroups.size() > 0) {
MetadataAcl acl = new MetadataAcl(getRequestContext());
nRows = adminDao.updateAcl(getPublisher(), queryCriteria, acl.buildAclGroups(groups, selectedGroups));
} else {
nRows = adminDao.updateAcl(getPublisher(), queryCriteria, null);
}
}
getActionResult().setNumberOfRecordsModified(nRows);
}