Monday, 21 October 2013

Call a method from your WDK component

If you want to handle some business logic asynchronously, the best way can be implement a method. Here is a code snippet which explains how you can call a java method from your wdk code.

In below code we are creating a workflow object.




private void executeMethodCall() {

            try {
                 
                  IDfSession dfSession=getDfSession();
                  StringBuffer strBufQry = new StringBuffer();
                  strBufQry.append("Execute do_method WITH  METHOD='NewMethod',");
                  strBufQry.append(" arguments='-workflowName ");
                  strBufQry.append(m_strWorkflow);
                  strBufQry.append(" -docId ");
                  strBufQry.append(m_strObjectId);
                  strBufQry.append(" -docbase ");
                  strBufQry.append(dfSession.getDocbaseName());
                  strBufQry.append(" -user_name ");
                  strBufQry.append(dfSession.getServerConfig().getString(                       "r_install_owner"));
                  strBufQry.append(" -workItemId ");
                  strBufQry.append(m_strWorkItemId);
                  strBufQry.append("'");
                  IDfQuery dfQuery = new DfQuery();
                  dfQuery.setDQL(strBufQry.toString());
                  dfQuery.execute(getDfSession(), IDfQuery.DF_EXEC_QUERY);

                  MessageService.addMessage(this, "MSG_DOCUMENT_SENT");
            } catch (DfException e) {
                  e.printStackTrace();
            }

      }

No comments:

Post a Comment