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 execute( IDfSessionManager sMgr, String docbase, IDfWorkitem task, IDfWorkflow workflow, IDfProcess process, String mrcsapp, Map config, Map context) { /*-CONFIG-*/ String m = "QADocFormGenerateAcrobatRenditionOnServer.execute - "; GenerateAcrobatRendition gar = new GenerateAcrobatRendition(); IDfSession session = null; try { session = sMgr.getSession(docbase); // get attachment... /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "getting ATTACHMENT collection for workitem", null, null); IDfCollection attachments = task.getAttachments(); while (attachments.next()) { /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "--NEXT ATTACHMENT--", null, null); for (int i = 0; i < attachments.getAttrCount(); i++) { /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "attr: " + attachments.getAttr(i).getName(), null, null); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug( this, m + "type: " + attachments.getAttr(i).getDataType(), null, null); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug( this, m + "repeats: " + attachments.getAttr(i).isRepeating(), null, null); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug( this, m + "val: " + attachments.getValueAt(i).asString(), null, null); } String compid = attachments.getString("r_component_id"); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "--ATTACHMENT id: " + compid, null, null); if (compid != null) { /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "--getting ATTACHMENT from docbase", null, null); IDfDocument attacheddoc = (IDfDocument) session.getObject(new DfId(compid)); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug( this, m + "--pkgdoc retrieved: " + attacheddoc.getObjectName() + " - " + attacheddoc.getObjectId().getId(), null, null); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "--getting most recent version of attachment", null, null); IDfDocument pkgdoc = (IDfDocument) session.getObjectByQualification( "dm_document where i_chronicle_id = '" + attacheddoc.getChronicleId().getId() + "'"); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug( this, m + "--most recent retrieved: " + pkgdoc.getObjectName() + " - " + pkgdoc.getObjectId().getId(), null, null); try { /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "CALLING render plugin", null, null); gar.render(session, pkgdoc, config); // need to save...this may cause deadlock errors if in a transaction? /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "saving doc changes", null, null); pkgdoc.save(); /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this)) DfLogger.debug(this, m + "doc save complete", null, null); } catch (Exception e) { /*-ERROR-*/ DfLogger.error( this, m + "error while loading or executing promotion service module", null, e); throw e; } } } } catch (Exception dfe) { /*-ERROR-*/ DfLogger.error(this, m + "ERROR in generate rendtion on server event", null, dfe); throw new RuntimeException( "Error in workflow plugin - generate rendition on server event plugin", dfe); } finally { sMgr.release(session); } }