Package org.enhydra.shark.api.common

Examples of org.enhydra.shark.api.common.ActivityFilterBuilder


            sc = connect();

            Shark shark = Shark.getInstance();
            WfActivityIterator ai = sc.get_iterator_activity();
            ActivityFilterBuilder aieb = shark.getActivityFilterBuilder();
            WMSessionHandle sessionHandle = sc.getSessionHandle();
            AdminMisc admin = shark.getAdminMisc();

            WMFilter filter = new WMFilter();

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

            if (sort != null && sort.trim().length() > 0) {
                if (desc == null) {
                    desc = false;
                }
                if (sort.equals("id")) {
                    filter = aieb.setOrderById(sessionHandle, filter, !desc);
                } else {
                    filter = aieb.setOrderByName(sessionHandle, filter, !desc);
                }
            }

            if (start == null) {
                start = 0;
            }

            if (rows == null) {
                rows = 10;
            }

            filter = aieb.setStartPosition(sessionHandle, filter, start);
            String strSize = String.valueOf(activitySize);
            Integer size = Integer.parseInt(strSize.substring(strSize.length() - 1, strSize.length()));
            if ((start + rows) <= activitySize || Integer.parseInt(strSize) < rows) {
                filter = aieb.setLimit(sessionHandle, filter, rows);
            } else {
                filter = aieb.setLimit(sessionHandle, filter, size);
            }

            ai.set_query_expression(aieb.toIteratorExpression(sessionHandle, filter));
            WfActivity[] wfActivityList = ai.get_next_n_sequence(0);

            for (int i = 0; i < wfActivityList.length; ++i) {
                WfActivity wfActivity = wfActivityList[i];
                WorkflowActivity workflowActivity = getActivityById(wfActivity.key());
View Full Code Here


            sc = connect();

            Shark shark = Shark.getInstance();
            WfActivityIterator ai = sc.get_iterator_activity();
            ActivityFilterBuilder aieb = shark.getActivityFilterBuilder();
            WMSessionHandle sessionHandle = sc.getSessionHandle();

            WMFilter filter = new WMFilter();

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

            ai.set_query_expression(aieb.toIteratorExpression(sessionHandle, filter));
            size = ai.how_many();


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

            sc = connect();

            Shark shark = Shark.getInstance();
            AdminMisc admin = shark.getAdminMisc();
            WfActivityIterator ai = sc.get_iterator_activity();
            ActivityFilterBuilder aieb = shark.getActivityFilterBuilder();
            WMSessionHandle sessionHandle = sc.getSessionHandle();

            WMFilter filter = new WMFilter();

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

            ai.set_query_expression(aieb.toIteratorExpression(sessionHandle, filter));
            WfActivity[] wfActivityList = ai.get_next_n_sequence(0);

            if (wfActivityList.length > 0) {
                WfActivity wfActivity = wfActivityList[0];
View Full Code Here

            sc = connect();

            WfActivityIterator ai = sc.get_iterator_activity();
            Shark shark = Shark.getInstance();
            ActivityFilterBuilder aieb = shark.getActivityFilterBuilder();
            WMSessionHandle sessionHandle = sc.getSessionHandle();
            WMFilter filter = aieb.addIdEquals(sessionHandle, activityId);
            ai.set_query_expression(aieb.toIteratorExpression(sessionHandle, filter));
            WfActivity[] acts = ai.get_next_n_sequence(0);

            if (acts.length > 0) {
                Map varMap = acts[0].process_context();
                LogUtil.debug(getClass().getName(), "varMap: " + varMap);
View Full Code Here

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

            WfActivityIterator ai = sc.get_iterator_activity();
            ActivityFilterBuilder aieb = shark.getActivityFilterBuilder();

            WMFilter filter = new WMFilter();

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

            ai.set_query_expression(aieb.toIteratorExpression(sessionHandle, filter));
            WfActivity[] wfActivityArray = ai.get_next_n_sequence(0);

            if (wfActivityArray.length == 0) {
                return null;
            }
View Full Code Here

            sc = connect();

            Shark shark = Shark.getInstance();
            WfActivityIterator ai = sc.get_iterator_activity();
            ActivityFilterBuilder aieb = shark.getActivityFilterBuilder();
            WMSessionHandle sessionHandle = sc.getSessionHandle();

            WMFilter filter = new WMFilter();

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

            ai.set_query_expression(aieb.toIteratorExpression(sessionHandle, filter));
            WfActivity[] wfActivityList = ai.get_next_n_sequence(0);


            if (wfActivityList.length > 0) {
                WfActivity wfActivity = wfActivityList[0];
View Full Code Here

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

            ActivityFilterBuilder aieb = shark.getActivityFilterBuilder();
            WMFilter filter = aieb.addIdEquals(sessionHandle, activityInstanceId);

            ea.reevaluateAssignmentsWithFiltering(sessionHandle, filter, true);


        } catch (Exception ex) {
View Full Code Here

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

            ActivityFilterBuilder aieb = shark.getActivityFilterBuilder();
            WMFilter filter = aieb.addHasAssignmentForUser(sessionHandle, username, 0);
            WMFilter filter2 = aieb.addStateEquals(sessionHandle, "open.not_running.not_started");
            WMFilter filter3 = aieb.addStateEquals(sessionHandle, "open.not_running.suspended");
            WMFilter filter4 = aieb.or(sessionHandle, filter2, filter3);
            filter = aieb.and(sessionHandle, filter, filter4);

            ea.reevaluateAssignmentsWithFiltering(sessionHandle, filter, true);


        } catch (Exception ex) {
View Full Code Here

        try {
            sc = connect();

            Shark shark = Shark.getInstance();
            WfActivityIterator ai = sc.get_iterator_activity();
            ActivityFilterBuilder aieb = shark.getActivityFilterBuilder();
            WMSessionHandle sessionHandle = sc.getSessionHandle();

            WMFilter filter = new WMFilter();
            if (activityDefId != null && activityDefId.trim().length() > 0) {
                filter = aieb.addDefinitionIdEquals(sessionHandle, activityDefId);
            }

            WMFilter filter2 = new WMFilter();
            if (processId != null && processId.trim().length() > 0) {
                filter2 = aieb.addProcessIdEquals(sessionHandle, processId);
            }

            ai.set_query_expression(aieb.toIteratorExpression(sessionHandle, aieb.and(sessionHandle, filter, filter2)));
            WfActivity[] wfActivityList = ai.get_next_n_sequence(0);

            if (wfActivityList.length > 0) {
                for (WfActivity wfActivity : wfActivityList) {
                    String actState = wfActivity.state();
View Full Code Here

            }

            sc = connect();

            WfActivityIterator ai;
            ActivityFilterBuilder aieb;
            WMFilter filter;
            WfActivity[] wfActivityArray;

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

            // get required activity def to start
            AdminMisc admin = shark.getAdminMisc();
            WMEntity procEntity = admin.getProcessDefinitionInfo(sessionHandle, processId);
            XPDLBrowser xpdlBrowser = shark.getXPDLBrowser();
            WMEntity[] entities = WMEntityUtilities.getOverallActivities(sessionHandle, xpdlBrowser, procEntity);
            WMEntity activityDef = null;
            for (WMEntity ent : entities) {
                if (ent.getId().equals(activityDefId) && "Activity".equals(ent.getType())) {
                    activityDef = ent;
                    break;
                }
            }
            LogUtil.debug(getClass().getName(), "Get required activity definition to start for " + activityDefId + ": " + activityDef);
            if (activityDef == null) {
                return false;
            }

            if (abortRunningActivities) {
                LogUtil.debug(getClass().getName(), "aborting running activities for " + processId);
                // get running activities for process
                ai = sc.get_iterator_activity();
                aieb = shark.getActivityFilterBuilder();
                filter = new WMFilter();
                filter = aieb.addProcessIdEquals(sessionHandle, processId);
                filter = aieb.and(sessionHandle, filter, aieb.addStateStartsWith(sessionHandle, SharkConstants.STATEPREFIX_OPEN));
                ai.set_query_expression(aieb.toIteratorExpression(sessionHandle, filter));
                wfActivityArray = ai.get_next_n_sequence(0);

                // abort running activities
                for (WfActivity wfAct : wfActivityArray) {
                    String actState = wfAct.state();
View Full Code Here

TOP

Related Classes of org.enhydra.shark.api.common.ActivityFilterBuilder

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.