public void onInit(ArgumentList args) { /*-CONFIG-*/ String m = "onInit-"; try { /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "calling super()", null, null); super.onInit(args); // do we need to setclientevent(onOk)? // setClientEvent("onOk", args); m_task = getWorkflowTask(); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug( this, m + "workflowtask: " + (m_task == null ? null : m_task.getActivityId().getId()), null, null); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(ESignHelper.class)) DfLogger.debug(this, m + "getting first attachment - first get workitem", null, null); IDfWorkitem wi = (IDfWorkitem) getDfSession().getObject(m_task.getId("item_id")); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(ESignHelper.class)) DfLogger.debug(this, m + " _ GET ATTACHMENT COLLECTION", null, null); IDfCollection attachments = wi.getAttachments(); attachments.next(); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(ESignHelper.class)) DfLogger.debug(this, m + " - get r_comp_id", null, null); IDfId firstattachment = attachments.getId("r_component_id"); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(ESignHelper.class)) DfLogger.debug(this, m + " - look up doc " + firstattachment.getId(), null, null); m_primarypackage = (IDfDocument) getDfSession().getObject(firstattachment); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(ESignHelper.class)) DfLogger.debug(this, m + " - get doc's mrcsapp", null, null); m_mrcsapp = m_primarypackage.getString("mrcs_application"); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "MRCS app: " + m_mrcsapp, null, null); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug( this, m + "getting activity name and process name for config lookup", null, null); m_taskname = m_task.getActivityName(); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + " -- taskname: " + m_taskname, null, null); m_processname = ((IDfProcess) getDfSession().getObject(m_task.getProcessId())).getObjectName(); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + " -- process: " + m_processname, null, null); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "Check if signoff controls are needed", null, null); if (m_task.isSignOffRequired()) { // Obtain the resons for signing and initialize the Control /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug( this, m + "signoff is required for this task - initializing reason list dropdown", null, null); DropDownList rsnListCtrl = (DropDownList) getControl(QADocFinishWFT.REASONSELECT_CONTROL_NAME, DropDownList.class); ESignHelper.initReasonList(m_mrcsapp, rsnListCtrl); } else { // setMessage("MSG_SIGN_NOTREQUIRED"); // setValid(true); } } catch (Exception ex1) { /*-ERROR-*/ DfLogger.error(this, m + "Exception in initialization of FinishWFT", null, ex1); throw new RuntimeException("Exception in initialization of MRCS FinishWFT component", ex1); } }
public void AutoSelectSinglePath() { // TODO - can we do this for FinishWFT? /*-CONFIG-*/ String m = "AutoSelectSinglePath - "; /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug( this, m + "check for premature Finish Click and single path selection", null, null); // see if the forward paths grid was ever instantiated Datagrid forwardgrid = (Datagrid) getControl(ForwardWorkflowTask.NEXT_TASKS_GRID_CONTROL_NAME); // if not, check how many paths there would be if (null == forwardgrid) { /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug( this, m + "forwardgrid is null, so Finish clicked before selecting a path, see if we can autoselect", null, null); try { /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "get wf task", null, null); IWorkflowTask task = this.getWorkflowTask(); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug( this, m + "get forward activities for task " + task.getActivityName(), null, null); IDfList forwardAct = task.getNextForwardActivities(); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "Get count of next activities", null, null); int count = forwardAct.getCount(); if (1 == count) { /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "only one next activity, so autoselect that one", null, null); // fake it baby IDfTypedObject act = (IDfTypedObject) forwardAct.get(0); String actId = act.getString("r_object_id"); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "id of next activity: " + actId, null, null); String cboxname = "__NEXT_TASKS_CHECKBOX_CONTROL_NAME" + actId; /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug( this, m + "creating fake checkbox for that activity: " + cboxname, null, null); Checkbox cbox = (Checkbox) getControl(cboxname, Checkbox.class); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "selecting the cbox", null, null); cbox.setValue(true); // dangerous levels of hackitude here... // because the superclass has the "list of next activities" property private and immutable // from this class, I have to resort to this trickery // page == forward forces the superclass to check for selected forward paths. if it's // not forward, it just assumes the list is ready (which its not, and I // can't make it ready since it's frikking PRIVATE. thanks, DCTM /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug( this, m + "set component page to forward so that the super.onCommitChanges call works correcly", null, null); this.setComponentPage("forward"); } } catch (DfException dfe) { throw new RuntimeException("Df Error in single path autoselect", dfe); } } }