Package org.enhydra.shark.api.client.wfmodel

Examples of org.enhydra.shark.api.client.wfmodel.WfAssignment


        SharkConnection sc = null;

        try {
            sc = connect();

            WfAssignment wfa = getSharkAssignment(sc, activityId);
            wfa.activity().complete();

        } catch (Exception ex) {
            LogUtil.error(getClass().getName(), ex, "");
        } finally {
            try {
View Full Code Here


        SharkConnection sc = null;

        try {
            sc = connect();
            WMSessionHandle sessionHandle = sc.getSessionHandle();
            WfAssignment wfa = null;
            Shark shark = Shark.getInstance();
            AssignmentFilterBuilder aieb = shark.getAssignmentFilterBuilder();

            WMFilter filter = aieb.addActivityIdEquals(sessionHandle, activityId);
            filter = aieb.and(sessionHandle, filter, aieb.addUsernameEquals(sessionHandle, replaceUser));

            // execute
            WfAssignmentIterator ai = sc.get_iterator_assignment();
            ai.set_query_expression(aieb.toIteratorExpression(sessionHandle, filter));
            WfAssignment[] wItems = ai.get_next_n_sequence(0);
            if (wItems != null && wItems.length > 0) {
                wfa = wItems[0];
            }

            WfResource res = sc.getResource(username);

            if (res == null) {
                CustomWfResourceImpl.createResource(sessionHandle, username);
                res = sc.getResource(username);
            }

            if (wfa.get_accepted_status()) {
                wfa.set_accepted_status(false);
            }

            if (wfa.assignee() == null || (wfa.assignee() != null && !res.resource_key().equals(wfa.assignee().resource_key()))) {
                wfa.set_assignee(res);
            }
           
            WorkflowUtil.addAuditTrail(this.getClass().getName(), "assignmentReassignUser", activityId);

        } catch (Exception ex) {
View Full Code Here

        SharkConnection sc = null;

        try {
            sc = connect();
            WMSessionHandle sessionHandle = sc.getSessionHandle();
            WfAssignment wfa = getWfAssignmentByActivityId(sc, activityId);
            WfResource res = sc.getResource(username);

            if (res == null) {
                CustomWfResourceImpl.createResource(sessionHandle, username);
                res = sc.getResource(username);
            }

            if (wfa.assignee() == null || (wfa.assignee() != null && !res.resource_key().equals(wfa.assignee().resource_key()))) {
                wfa.set_assignee(res);
            }

            if (!wfa.get_accepted_status()) {
                wfa.set_accepted_status(true);
            }

            wfa.activity().complete();


        } catch (Exception ex) {
            LogUtil.error(getClass().getName(), ex, "");
        } finally {
View Full Code Here

        try {

            sc = connect();

            WfAssignment a = getSharkAssignment(sc, activityId);
            if (!JSPClientUtilities.isMine(sc, a)) {
                throw new Exception("I don't own activity " + activityId);
            }

            Map _m = new HashMap();
            Object c = a.activity().process_context().get(variableName);

            if (c instanceof Long) {
                c = new Long(variableValue);
            } else if (c instanceof Boolean) {
                c = Boolean.valueOf(variableValue);
            } else if (c instanceof Double) {
                c = Double.valueOf(variableValue);
            } else {
                c = variableValue;
            }

            _m.put(variableName, c);
            a.activity().set_result(_m);

        } catch (Exception ex) {
            LogUtil.error(getClass().getName(), ex, "");
        } finally {
            try {
View Full Code Here

        try {

            sc = connect();

            WfAssignment wfa = getSharkAssignment(sc, activityId);
            variableList = JSPClientUtilities.getVariableData(sc, wfa.activity());

        } catch (Exception ex) {
            LogUtil.error(getClass().getName(), ex, "");
        } finally {
            try {
View Full Code Here

                        if (wfProcess != null) {
                            WfActivity[] wfActivityTempList = wfProcess.get_sequence_step(0);
                            return getNextActivity(sessionHandle, mgr, admin, xpdl, wfProcess.key(), wfActivityTempList);
                        }
                    } else {
                        WfAssignment ass = getSharkAssignment(connect(), activityId);
                        if (ass != null) {
                            WorkflowActivity activityStarted = new WorkflowActivity();
                            activityStarted.setId(activityId);
                            return activityStarted;
                        }
View Full Code Here

   public static void activityComplete(SharkConnection sConn, String activityId)
      throws Exception {
      try {
         if (null != activityId) {
            try {
               WfAssignment a = getAssignment(sConn, activityId);
               if (!isMine(sConn, a)){
                  assignmentAccept(sConn, a);
               }
               a.activity().complete();
            } catch (Exception e) {
               throw e;
            }
         }
      } catch (Exception e) {
View Full Code Here

      }
   }

   public static boolean isMine(SharkConnection sConn, String activityId)
      throws Exception {
      WfAssignment a = getAssignment(sConn, activityId);
      return isMine(sConn, a);
   }
View Full Code Here

   public static void variableSet(SharkConnection sConn,
                                  String activityId,
                                  String vName,
                                  String vValue) throws Exception {
      WfAssignment a = getAssignment(sConn, activityId);
      if (!isMine(sConn, a)){
         throw new Exception("I don't own activity " + activityId);
      }
     
      Map _m = new HashMap();
      Object c = a.activity().process_context().get(vName);
     
      if (c instanceof Long) {
         c = new Long(vValue);
      } else if (c instanceof Boolean) {
         c = Boolean.valueOf(vValue);
      } else if (c instanceof Double) {
         c = Double.valueOf(vValue);
      } else {
         c = vValue;
      }
     
      _m.put(vName, c);
      a.activity().set_result(_m);
   }
View Full Code Here

TOP

Related Classes of org.enhydra.shark.api.client.wfmodel.WfAssignment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.