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

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


   public static boolean isProcessRunning(SharkConnection sc, String mgrName)
      throws Exception {
      System.err.println("#_isProcessRunning_# (" + mgrName + ")");
      try {
         WfProcessMgr pMgr = sc.getProcessMgr(mgrName);
         WfProcessIterator pit = pMgr.get_iterator_process();
         pit.set_query_expression("state.equals(\""
                                  + SharkConstants.STATE_OPEN_RUNNING + "\")");
         if (_debug_) {
            System.err.println("#_" + pit.how_many() + "_#");
            System.err.println("#_" + pit.get_next_n_sequence(0).length + "_#");
         }
         return 0 < pit.get_next_n_sequence(0).length;
      } catch (Exception e) {
         LogUtil.error(JSPClientUtilities.class.getName(), e, "");
         throw e;
      }
   }
View Full Code Here


            // delete process instances
            LogUtil.info(getClass().getName(), "Deleting running processes for " + packageId + " version " + version);
            Shark shark = Shark.getInstance();
            ExecutionAdministration ea = shark.getExecutionAdministration();
            WAPI wapi = shark.getWAPIConnection();
            WfProcessIterator wpi = sc.get_iterator_process();
            ProcessFilterBuilder fb = shark.getProcessFilterBuilder();
            WMSessionHandle sessionHandle = sc.getSessionHandle();
            WMFilter filter1 = fb.addPackageIdEquals(sessionHandle, packageId);
            WMFilter filter2 = fb.addVersionEquals(sessionHandle, version);
            WMFilter filter = fb.and(sessionHandle, filter1, filter2);
            wpi.set_query_expression(fb.toIteratorExpression(sessionHandle, filter));
            WfProcess[] procs = wpi.get_next_n_sequence(0);
            for (int i = 0; i < procs.length; i++) {
                String instanceId = procs[i].key();
                try {
                    if (procs[i].state().startsWith(SharkConstants.STATEPREFIX_OPEN)) {
                        wapi.terminateProcessInstance(sessionHandle, instanceId);
View Full Code Here

            Shark shark = Shark.getInstance();
            ExecutionAdministration ea = shark.getExecutionAdministration();
            WMSessionHandle sessionHandle = sc.getSessionHandle();
            PackageAdministration pa = getSharkPackageAdmin(sessionHandle);
            WAPI wapi = shark.getWAPIConnection();
            WfProcessIterator wpi = sc.get_iterator_process();
            ProcessFilterBuilder fb = shark.getProcessFilterBuilder();
            WMFilter filter = fb.addPackageIdEquals(sessionHandle, packageId);
            wpi.set_query_expression(fb.toIteratorExpression(sessionHandle, filter));
            WfProcess[] procs = wpi.get_next_n_sequence(0);
            for (int i = 0; i < procs.length; i++) {
                String instanceId = procs[i].key();
                if (procs[i].state().startsWith(SharkConstants.STATEPREFIX_OPEN)) {
                    wapi.terminateProcessInstance(sessionHandle, instanceId);
                    LogUtil.info(getClass().getName(), " -- Terminated open process " + instanceId);
View Full Code Here

        Collection<WorkflowProcess> runningProcessList = new ArrayList<WorkflowProcess>();
        try {

            sc = connect();

            WfProcessIterator pi = sc.get_iterator_process();

            String sharkExpression = "stateequals.(\"open.running\")";
            String sqlExpression = "State = (SELECT  oid  FROM SHKProcessStates WHERE  Name  = 'open.running')";

            if (packageId != null && packageId.trim().length() > 0) {
                sharkExpression += " && packageIdequals.(\"" + packageId + "\")";
                sqlExpression += " AND ProcessDefinition IN (SELECT  oid  FROM SHKProcessDefinitions WHERE  PackageId  = '" + packageId + "')";
            }
            if (processId != null && processId.trim().length() > 0) {
                sharkExpression += " && key.indexOf(\"" + processId + "\") != -1)";
                sqlExpression += " AND Id LIKE '%" + processId + "%'";
            }
            if (processName != null && processName.trim().length() > 0) {
                sharkExpression += " && name.indexOf(\"" + processName + "\") != -1)";
                sqlExpression += " AND Name LIKE '%" + processName + "%'";
            }
            if (version != null && version.trim().length() > 0) {
                sharkExpression += " && versionequals.(\"" + version + "\")";
                sqlExpression += " AND ProcessDefinition IN (SELECT oid FROM SHKProcessDefinitions WHERE ProcessDefinitionVersion = '" + version + "')";
            }

            if (start == null) {
                start = 0;
            }
            String queryExpression = "/*startAt " + start + " startAt*/";
            if (rows != null && rows > 0) {
                queryExpression += "/*limit " + rows + " limit*/";
            }

            String sortStr = "";
            if (sort != null && sort.trim().length() > 0) {
                sortStr += " ORDER BY " + sort;
                sortStr += (desc != null && desc.booleanValue()) ? " DESC" : "";
            }
            String query_expression = "(" + sharkExpression + ")" + " /*sql (" + sqlExpression + ") " + sortStr + " sql*/ " + queryExpression;
            pi.set_query_expression(query_expression);

            WfProcess[] wfRunningProcessList = pi.get_next_n_sequence(0);

            for (int i = 0; i < wfRunningProcessList.length; ++i) {
                WfProcess wfProcess = wfRunningProcessList[i];
                WfProcessMgr manager = wfProcess.manager();

View Full Code Here

        Collection<WorkflowProcess> runningProcessList = new ArrayList<WorkflowProcess>();
        try {

            sc = connect();

            WfProcessIterator pi = sc.get_iterator_process();

            String sharkExpression = "statenotequals.(\"open.running\")";
            String sqlExpression = "State IN (SELECT  oid  FROM SHKProcessStates WHERE  Name  <> 'open.running')";

            if (packageId != null && packageId.trim().length() > 0) {
                sharkExpression += " && packageIdequals.(\"" + packageId + "\")";
                sqlExpression += " AND ProcessDefinition IN (SELECT  oid  FROM SHKProcessDefinitions WHERE  PackageId  = '" + packageId + "')";
            }

            if (processId != null && processId.trim().length() > 0) {
                sharkExpression += " && key.indexOf(\"" + processId + "\") != -1)";
                sqlExpression += " AND Id LIKE '%" + processId + "%'";
            }

            if (processName != null && processName.trim().length() > 0) {
                sharkExpression += " && name.indexOf(\"" + processName + "\") != -1)";
                sqlExpression += " AND Name LIKE '%" + processName + "%'";
            }

            if (version != null && version.trim().length() > 0) {
                sharkExpression += " && versionequals.(\"" + version + "\")";
                sqlExpression += " AND ProcessDefinition IN (SELECT oid FROM SHKProcessDefinitions WHERE ProcessDefinitionVersion = '" + version + "')";
            }

            if (start == null) {
                start = 0;
            }
            String queryExpression = "/*startAt " + start + " startAt*/";
            if (rows != null && rows > 0) {
                queryExpression += "/*limit " + rows + " limit*/";
            }

            String sortStr = "";
            if (sort != null && sort.trim().length() > 0) {
                sortStr += " ORDER BY " + sort;
                sortStr += (desc != null && desc.booleanValue()) ? " DESC" : "";
            }

            String query_expression = "(" + sharkExpression + ")" + " /*sql (" + sqlExpression + ") " + sortStr + " sql*/ " + queryExpression;
            pi.set_query_expression(query_expression);
            WfProcess[] wfRunningProcessList = pi.get_next_n_sequence(0);

            for (int i = 0; i < wfRunningProcessList.length; ++i) {
                WfProcess wfProcess = wfRunningProcessList[i];
                WfProcessMgr manager = wfProcess.manager();

View Full Code Here

            }

            sc = connect();

            Shark shark = Shark.getInstance();
            WfProcessIterator pi = sc.get_iterator_process();
            ProcessFilterBuilder pieb = shark.getProcessFilterBuilder();
            WMSessionHandle sessionHandle = sc.getSessionHandle();

            WMFilter filter = new WMFilter();

            if (processId != null && processId.trim().length() > 0) {
                filter = pieb.addIdEquals(sessionHandle, processId);
            }

            pi.set_query_expression(pieb.toIteratorExpression(sessionHandle, filter));
            WfProcess[] wfProcessList = pi.get_next_n_sequence(0);

            if (wfProcessList.length > 0) {
                WfProcess wfProcess = wfProcessList[0];
                WfProcessMgr manager = wfProcess.manager();
View Full Code Here

            sc = connect();

            WMSessionHandle sessionHandle = sc.getSessionHandle();
            Shark shark = Shark.getInstance();

            WfProcessIterator pi = sc.get_iterator_process();
            ProcessFilterBuilder pfb = shark.getProcessFilterBuilder();

            XPDLBrowser xpdl = shark.getXPDLBrowser();

            WMFilter filter = new WMFilter();

            if (processInstanceId != null && processInstanceId.trim().length() > 0) {
                filter = pfb.addIdEquals(sessionHandle, processInstanceId);
            }

            pi.set_query_expression(pfb.toIteratorExpression(sessionHandle, filter));
            WfProcess[] wfProcessArray = pi.get_next_n_sequence(0);
            WorkflowProcess wfProcess = new WorkflowProcess();


            double limit = -1;
View Full Code Here

            }

            sc = connect();

            Shark shark = Shark.getInstance();
            WfProcessIterator pi = sc.get_iterator_process();
            ProcessFilterBuilder pfb = shark.getProcessFilterBuilder();
            WMSessionHandle sessionHandle = sc.getSessionHandle();

            WMFilter filter = new WMFilter();

            if (processInstanceId != null && processInstanceId.trim().length() > 0) {
                filter = pfb.addIdEquals(sessionHandle, processInstanceId);
            }

            pi.set_query_expression(pfb.toIteratorExpression(sessionHandle, filter));
            WfProcess[] wfProcessList = pi.get_next_n_sequence(0);


            if (wfProcessList.length > 0) {
                WfProcess wfProcess = wfProcessList[0];
                Map processContext = wfProcess.process_context();
View Full Code Here

            WMSessionHandle sessionHandle = sc.getSessionHandle();
            Shark shark = Shark.getInstance();
            ExecutionAdministration ea = shark.getExecutionAdministration();

            WfProcessIterator pi = sc.get_iterator_process();
            ProcessFilterBuilder pieb = shark.getProcessFilterBuilder();
            WMFilter filter = pieb.addIdEquals(sessionHandle, procInstanceId);

            pi.set_query_expression(pieb.toIteratorExpression(sessionHandle, filter));

            WfProcess[] wfProcessList = pi.get_next_n_sequence(0);
            WfProcess wfProcess = null;
            if (wfProcessList != null && wfProcessList.length > 0) {
                wfProcess = wfProcessList[0];
            }
View Full Code Here

        Collection<String> runningProcesseIds = new ArrayList<String>();
       
        try {
            sc = connect();
           
            WfProcessIterator pi = sc.get_iterator_process();

            String sharkExpression = "stateequals.(\"open.running\")";
            String sqlExpression = "State = (SELECT oid FROM SHKProcessStates WHERE Name = 'open.running')";

            String query_expression = "(" + sharkExpression + ")" + " /*sql (" + sqlExpression + ") sql*/ ";
            pi.set_query_expression(query_expression);

            WfProcess[] wfRunningProcessList = pi.get_next_n_sequence(0);

            for (int i = 0; i < wfRunningProcessList.length; ++i) {
                WfProcess wfProcess = wfRunningProcessList[i];

                runningProcesseIds.add(wfProcess.key());
View Full Code Here

TOP

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

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.