This can be used to generate the ALT_ID value to store an issue when cloning an issue.
Edit screen buttons
public HashMap ucCloneGenAltId(
ProblemFormParam values, // contains values of form params
FormParameters fp, // contains values of form params
HashMap msg, // contains msg that goes into COMMENTS field
Connection con, // the database connection
SesameSession session) // the session object
It can also be used to manipulate the cloning message that goes into the inbuilt COMMENTS field. For example, if you want to insert a message that is different from the standard “Issue # xxxxx cloned from Issue # yyyyy”, then use this method to overwrite the value for the COMMENTS parameter.
This method shows how a cloning message can be changed from the standard. Instead, it overwrites the value for the comments parameter, and returns the modified message.
public HashMap ucCloneGenAltId(
ProblemFormParam values, // contains values of form params
FormParameters fp, // contains values of form params
HashMap msg, // contains msg that goes into COMMENTS field
Connection con, // the database connection
SesameSession session) throws Exception // the session object
{
String project_prefix = null;
String area = null;
String project = null;
String new_alt_id = null;
ProblemFormParam npfp = (ProblemFormParam) session.getAttribute("CLONEE_PFP");
if (npfp == null) {
project = (String) fp.get("p_project");
} else {
project = (String) npfp.get("PROJECT_ID");
}
int index1 = project.indexOf("|");
if (index1 > -1) {
area = project.substring(0, index1);
project = project.substring(index1 + 1, project.length());
}
// Get current issue's ALT_ID
String alt_id = (String) values.get("ALT_ID");
if (alt_id == null) {
Problem p = Problem.getReference(con, (String) values.get("ID"));
alt_id = p.getAltId();
}
if (area == null) { area = "AREA"; }
if (project == null) { project = "PROJECT"; }
project_prefix = area + "_" + project;
String preAltId = null;
String seq = (String) values.get("ID");
int len = seq.length();
// fill with preceeding zeros if length is less than 5 digits
while (len < 5) {
seq = "0" + seq;
len++;
}
preAltId = project_prefix + seq;
new_alt_id = preAltId;
msg.put("alt_id", new_alt_id);
String attr = Z.appDefaults.getAttribute("ITEM_ID_DISPLAY");
attr = attr.trim().toUpperCase();
if (attr.equals("ALT_ID"))
{
String idTitle = Z.dictionary.getTitle(con, "ALT_ID");
String problemTitle = Z.dictionary.getTitle(con, "PROBLEM");
SesameMessageFormat smf = new SesameMessageFormat(con, session);
smf.clear();
smf.append("This ");
smf.appendString(problemTitle);
// put in original problem#
smf.append(" ");
smf.appendString(alt_id);
smf.append(" has been cloned. The new ");
smf.appendString(idTitle);
smf.append(" is ");
smf.appendString(new_alt_id);
smf.append("\n");
smf.append("\n");
String s = smf.getFormattedMessage();
msg.put("cloned_msg", s);
}
return msg;
}