// implement the default configurable method - execute listed actions in workflow task
  public void execute(Map parameters, OutputStream outputstream) throws Exception {
    /*-CONFIG-*/ String m = "MrcsConfigurableMethod.execute - ";

    /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
      DfLogger.debug(this, m + "getting docbase from JSM parameters", null, null);
    String[] paramvals = (String[]) parameters.get("docbase_name");
    String docbase = paramvals[0];
    /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
      DfLogger.debug(this, m + "  ~~docbase: " + docbase, null, null);
    /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
      DfLogger.debug(this, m + "getting packageId from JSM parameters", null, null);
    paramvals =
        (String[])
            parameters.get(
                "packageId"); // OOTB docbasic promote method thinks this is workitemid...
    String packageid = paramvals[0];
    /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
      DfLogger.debug(this, m + "  ~~packageId: " + packageid, null, null);
    /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
      DfLogger.debug(this, m + "getting 'mode' from JSM parameters", null, null);
    paramvals = (String[]) parameters.get("mode");
    String mode = paramvals[0];
    /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
      DfLogger.debug(this, m + "  ~~MODE: " + mode, null, null);

    /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
      DfLogger.debug(this, m + "getting mrcs system session", null, null);
    IDfSessionManager sessionmgr = getMrcsSystemUserSessionFromFirstAttachment(parameters);
    IDfSession session = sessionmgr.getSession(docbase);
    /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
      DfLogger.debug(this, m + "session DMCL id: " + session.getDMCLSessionId(), null, null);

    // get workitem
    /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
      DfLogger.debug(this, m + "retreive workitem (the 'packageid')", null, null);
    IDfWorkitem workitem = (IDfWorkitem) session.getObject(new DfId(packageid));
    /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
      DfLogger.debug(
          this, m + "...retrieved workitem " + packageid + "? " + (workitem != null), null, null);

    // acquire if not mode 0. ?what? - it's what the docbasic thingy does
    if ("0".equals(mode)) {
      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(this, m + "mode is 0, acquiring workitem...", null, null);
      workitem.acquire();
      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(this, m + "...acquired", null, null);
    }
    try {

      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(this, m + "get attachment", null, null);
      IDfSysObject attachment = getFirstAttachment(sessionmgr, parameters);
      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(this, m + "mrcsapplication of attachment", null, null);
      String mrcsapp = attachment.getString("mrcs_application");
      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(this, m + " -- is: " + mrcsapp, null, null);

      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(this, m + "get workflow object " + workitem.getWorkflowId(), null, null);
      IDfWorkflow workflow = (IDfWorkflow) session.getObject(workitem.getWorkflowId());

      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(this, m + "get process object " + workflow.getProcessId(), null, null);
      IDfProcess process = (IDfProcess) session.getObject(workflow.getProcessId());

      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(this, m + "workflow process name and task name", null, null);
      String workflowname = process.getObjectName();
      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(this, m + "-- workflow process name: " + workflowname, null, null);
      String taskname = workitem.getActivity().getObjectName();
      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(this, m + "-- workitem activity name: " + taskname, null, null);

      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(this, m + "locate configuration of task in mrcs config", null, null);
      StateTransitionConfigFactory stconfig = StateTransitionConfigFactory.getSTConfig();

      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(this, m + "look up MRCS task definition", null, null);
      MrcsWorkflowTask mrcstask = stconfig.getMrcsWorkflowTask(mrcsapp, workflowname, taskname);

      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(
            this,
            m + "getting server plugins list (ServerPlugins key in the MethodConfiguration)",
            null,
            null);
      List actionlist = (List) mrcstask.MethodConfiguration.get("ServerPlugins");

      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(this, m + "EXEC plugins", null, null);
      if (actionlist != null) {
        Map context = new HashMap();
        for (int i = 0; i < actionlist.size(); i++) {
          /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
            DfLogger.debug(this, m + "running plugin #" + i, null, null);
          MrcsPlugin plugin = (MrcsPlugin) actionlist.get(i);
          /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
            DfLogger.debug(this, m + "-- instantiating - " + plugin.PluginClassName, null, null);
          IMrcsWorkflowServerPlugin doit =
              (IMrcsWorkflowServerPlugin) Class.forName(plugin.PluginClassName).newInstance();
          /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
            DfLogger.debug(this, m + "-- doit!", null, null);
          doit.execute(
              sessionmgr,
              docbase,
              workitem,
              workflow,
              process,
              mrcsapp,
              plugin.PluginConfiguration,
              context);
          /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
            DfLogger.debug(this, m + "-- done!", null, null);
        }
      }

    } catch (Exception e) {
      /*-ERROR-*/ DfLogger.error(this, m + "error in promoting workitem packages...", null, e);
      sessionmgr.release(session);
      throw e;
    }

    /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
      DfLogger.debug(this, m + "completing workitem...", null, null);
    workitem.complete();

    /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
      DfLogger.debug(this, m + "releasing session", null, null);
    sessionmgr.release(session);
    /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
      DfLogger.debug(this, m + "session released", null, null);
  }