Purpose

This is used to preprocess the clone operation after the Clone button is pressed, and before the ExtraView internal cloning process starts.

Applies To

Edit screen buttons

Signature

public boolean ucPreClone(
      ProblemFormParam values,        //contains values of form params
      HttpServletRequest request,     // the servlet request
      HttpServletResponse response,   // the servlet response
      Connection con,                 // the database connection
      SesameSession session)          // session object

Notes

You may change any of the values in the values passed into the method.

Example

public boolean ucPreClone(
      ProblemFormParam values,        //contains values of form params
      HttpServletRequest request,     // the servlet request
      HttpServletResponse response,   // the servlet response
      Connection con,                 // the database connection
      SesameSession session) throws Exception  // session object
{
    // check to see if we have the value for the area and project for this clone.
    // if not, send the area/project prompts like in the preAdd display
    if (pfp.containsKey("uc_pre_add_indicator") &&
            "true".equals(pfp.getString("uc_pre_add_indicator")))
    {
        // get the area and project as specified by the user...
        ProblemFormParam npfp = new ProblemFormParam(pfp);
        session.setAttribute("CLONEE_PFP", npfp);
        
        if (session.getAttribute("CLONING_PFP") instanceof ProblemFormParam) {
            pfp.clear(); // discard preclone form parameters...
            pfp.putAll( (ProblemFormParam) session.getAttribute("CLONING_PFP"));
            return true;
        }
    }
    session.setAttribute("CLONING_PFP", new ProblemFormParam(pfp));
    return this.addMenuForClone(pfp, request, response, dbconn, session);
}