ucEditDelete
Purpose
ucEditDelete is called during the delete process prior to the actual delete.
Applies To
Edit Issue screen
Signature
public String ucEditDelete(
Problem item, // the item object
ArrayList attachments, // the list of attachments
ArrayList interestList, // the interest list
ArrayList releases, // the list of release
ArrayList modules, // the list of modules
ArrayList udfs, // the list of udfs
SesameSession session, // current session
ProblemFormParam values) // values of from the form
Notes
Returning a message from this method will prevent the delete occurring and will display the message as an alert.
Example
This example shows how an error message is returned, and the deletion of the issue is prevented if the status of the issue is not “In Work”, or the person trying to delete the issue is not the Originator of the issue.
public String ucEditDelete (
Problem item, // the item object
ArrayList attachments, // the list of attachments
ArrayList interestList, // the interest list
ArrayList releases, // the list of release
ArrayList modules, // the list of modules
ArrayList udfs, // the list of udfs
SesameSession session, // current session
ProblemFormParam values) { // values of from the form.
// For Bugs allow delete when the status = Work and user is the Originator
String areaId = item.getAreaId();
String status = item.getStatus();
String originator = item.getOriginator();
String userId = session.getUserId();
String role = session.getUserRole();
String error = null;
if (AREA__BUGS.equals(areaId) && ! ROLE__ADMIN.equals(role)
&& ! ROLE__COORDINATOR.equals(role)
&& ! ROLE__IMPORT_SECURITY.equals(role) ) {
if (! ("IN_WORK".equals(status) || "SUBMIT".equals(status)) ) {
return Z.m.msg(session,
"Sorry, only records In Work may be deleted.
Since this is an official record on the Master Bug Log,
this issue can't be deleted.");
} else if (! userId.equals(originator) ) {
return Z.m.msg(session,
"Sorry, only the originator may delete the record!");
}
}
error = deleteRecordHistory(item, attachments, interestList, releases,
modules, udfs, session, values);
if (error == null)
removeCurrentEditSession(item, session);
return error;
}