ucAddPreInsert

Purpose

This allows additional error reporting by returning an error message.

Applies To

Add Issue screen

Signature

public String ucAddPreInsert (	
       Problem pProblem, 	// the problem or case
       ArrayList pReleases, 	// the list of releases
       ArrayList pModules,	// the list of modules
       ArrayList pUdfs, 	// the list of UDF's
       SesameSession session,	// current session
       ProblemFormParam pfp)     // values of from the form

Notes

This is called during the Add process before any updates are performed, and allows a final manipulation of parameters prior to attempting the add operation.

Example

This example shows how ucAddPreInsert is called before any updates to a record are made. Based upon the customer requirements, if the record is in the "Test Case" or "Test Plan" area and project, the issue is not saved upon the add operation, and an error message is displayed.

public String ucAddPreInsert (	
       Problem pProblem, 	// the problem or case
       ArrayList pReleases, 	// the list of releases
       ArrayList pModules,	// the list of modules
       ArrayList pUdfs, 	// the list of UDF's
       SesameSession session,	// current session
       ProblemFormParam pfp)     // values of from the form
{
    String errText = rules.ucAddPreInsert(item,
		                          releases, 
		                          modules, 
		                          udfs, 
		                          session, 
		                          values);
    if (errText != null) { return errText; }
		
    // If we are in the test case area or test plan project,
    //  do not allow issue to be saved
    if (A_TEST_CASES.equals(values.get("AREA")) && (A_TEST_CASES + "|" +
            A_TEST_PLAN_PROJECT_ID).equals(values.get("PROJECT")))
    {
        return Z.m.msg(session, "You cannot save a test plan as an issue. " +
            "Use this screen to generate a test plan from test cases you select.");
    }
		
    return null;
}