Package org.enhydra.shark.api.common

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


        try {

            sc = connect();

            Shark shark = Shark.getInstance();
            AssignmentFilterBuilder aieb = shark.getAssignmentFilterBuilder();
            WMSessionHandle sessionHandle = sc.getSessionHandle();
            // filter by user
            String username = getWorkflowUserManager().getCurrentUsername();
            WMFilter filter = aieb.addUsernameEquals(sessionHandle, username);

            // filter by acceptance
            if (accepted != null && accepted.booleanValue()) {
                filter = aieb.and(sessionHandle, filter, aieb.addIsAccepted(sessionHandle));
            } else if (accepted != null && !accepted.booleanValue()) {
                WMFilter tmpFilter = aieb.and(sessionHandle, filter, aieb.addIsAccepted(sessionHandle));
                tmpFilter = aieb.not(sessionHandle, tmpFilter);
                filter = aieb.and(sessionHandle, filter, tmpFilter);
            }

            // filter by process id
            if (processDefId != null && processDefId.trim().length() > 0) {
                String processKey = MiscUtilities.getProcessMgrProcDefId(processDefId);
                String processVersion = MiscUtilities.getProcessMgrVersion(processDefId);
                filter = aieb.and(sessionHandle, filter, aieb.addProcessDefIdEquals(sessionHandle, processKey));
                filter = aieb.and(sessionHandle, filter, aieb.addPackageVersionEquals(sessionHandle, processVersion));
            }

            // set sort
            if (sort != null && sort.trim().length() > 0) {
                boolean asc = (desc == null) || !desc;
                filter = aieb.setOrderByCreatedTime(sessionHandle, filter, asc);
            }

            if (start != null) {
                filter.setStartPosition(start);
            }

            if (rows != null && rows > 0) {
                filter.setLimit(rows);
            }

            // execute
            WfAssignmentIterator ai = sc.get_iterator_assignment();
            ai.set_query_expression(aieb.toIteratorExpression(sessionHandle, filter));
            WfAssignment[] wItems = ai.get_next_n_sequence(0);
            for (int i = 0; i < wItems.length; ++i) {
                WfAssignment wfa = wItems[i];
                boolean acceptedStatus = wfa.get_accepted_status();
                WorkflowAssignment ass = new WorkflowAssignment();
View Full Code Here


        try {

            sc = connect();

            Shark shark = Shark.getInstance();
            AssignmentFilterBuilder aieb = shark.getAssignmentFilterBuilder();
            WMSessionHandle sessionHandle = sc.getSessionHandle();
            // filter by user
            String username = getWorkflowUserManager().getCurrentUsername();
            WMFilter filter = aieb.addUsernameEquals(sessionHandle, username);

            // filter by package id
            if (packageId != null && packageId.trim().length() > 0) {
                filter = aieb.and(sessionHandle, filter, aieb.addPackageIdEquals(sessionHandle, packageId));
            }

            // filter by process definition id
            if (processDefId != null && processDefId.trim().length() > 0) {
                String pkgId = MiscUtilities.getProcessMgrPkgId(processDefId);
                String processKey = MiscUtilities.getProcessMgrProcDefId(processDefId);
                //String processVersion = MiscUtilities.getProcessMgrVersion(processDefId);
                filter = aieb.and(sessionHandle, filter, aieb.addPackageIdEquals(sessionHandle, pkgId));
                filter = aieb.and(sessionHandle, filter, aieb.addProcessDefIdEquals(sessionHandle, processKey));
                //filter = aieb.and(sessionHandle, filter, aieb.addPackageVersionEquals(sessionHandle, processVersion));
            }

            // filter by process instance id
            if (processId != null && processId.trim().length() > 0) {
                filter = aieb.and(sessionHandle, filter, aieb.addProcessIdEquals(sessionHandle, processId));
            }

            // filter by activityDefId
            if (activityDefId != null && activityDefId.trim().length() > 0) {
                filter = aieb.and(sessionHandle, filter, aieb.addActivityDefIdEquals(sessionHandle, activityDefId));
            }

            // set sort
            if (sort != null && sort.trim().length() > 0) {
                boolean asc = (desc == null) || !desc;
                filter = aieb.setOrderByCreatedTime(sessionHandle, filter, asc);
            }

            if (start != null) {
                filter.setStartPosition(start);
            }

            if (rows != null && rows > 0) {
                filter.setLimit(rows);
            }
           
            // execute
            WfAssignmentIterator ai = sc.get_iterator_assignment();
            ai.set_query_expression(aieb.toIteratorExpression(sessionHandle, filter));
            WfAssignment[] wItems = ai.get_next_n_sequence(0);
            for (int i = 0; i < wItems.length; ++i) {
                WfAssignment wfa = wItems[i];
                boolean acceptedStatus = wfa.get_accepted_status();
                WorkflowAssignment ass = new WorkflowAssignment();
View Full Code Here

        try {

            sc = connect();

            Shark shark = Shark.getInstance();
            AssignmentFilterBuilder aieb = shark.getAssignmentFilterBuilder();
            WMSessionHandle sessionHandle = sc.getSessionHandle();
            // filter by user
            String username = getWorkflowUserManager().getCurrentUsername();
            WMFilter filter = aieb.addUsernameEquals(sessionHandle, username);

            // filter by processDefIds
            if (processDefIds != null && processDefIds.length > 0) {
                WMFilter idsFilter = null;
                int i = 0;
                for (String id : processDefIds) {
                    String temp[] = id.split("#");

                    WMFilter tempFilter = aieb.addPackageIdEquals(sessionHandle, temp[0]);
                    tempFilter = aieb.and(sessionHandle, tempFilter, aieb.addPackageVersionEquals(sessionHandle, temp[1]));
                    tempFilter = aieb.and(sessionHandle, tempFilter, aieb.addProcessDefIdEquals(sessionHandle, temp[2]));

                    if (i == 0) {
                        idsFilter = tempFilter;
                        i++;
                    } else {
                        idsFilter = aieb.or(sessionHandle, idsFilter, tempFilter);
                    }
                }

                filter = aieb.and(sessionHandle, filter, idsFilter);
            }

            // set sort
            if (sort != null && sort.trim().length() > 0) {
                boolean asc = (desc == null) || !desc;
                filter = aieb.setOrderByCreatedTime(sessionHandle, filter, asc);
            }

            if (start != null) {
                filter.setStartPosition(start);
            }

            if (rows != null && rows > 0) {
                filter.setLimit(rows);
            }

            // execute
            WfAssignmentIterator ai = sc.get_iterator_assignment();
            ai.set_query_expression(aieb.toIteratorExpression(sessionHandle, filter));
            WfAssignment[] wItems = ai.get_next_n_sequence(0);
            for (int i = 0; i < wItems.length; ++i) {
                WfAssignment wfa = wItems[i];
                boolean acceptedStatus = wfa.get_accepted_status();
                WorkflowAssignment ass = new WorkflowAssignment();
View Full Code Here

        try {

            sc = connect();

            Shark shark = Shark.getInstance();
            AssignmentFilterBuilder aieb = shark.getAssignmentFilterBuilder();
            WMSessionHandle sessionHandle = sc.getSessionHandle();
            // filter by user
            String username = getWorkflowUserManager().getCurrentUsername();
            WMFilter filter = aieb.addUsernameEquals(sessionHandle, username);

            // filter by processDefIds
            if (processDefIds != null && processDefIds.length > 0) {
                WMFilter idsFilter = null;
                int i = 0;
                for (String id : processDefIds) {
                    String temp[] = id.split("#");

                    WMFilter tempFilter = aieb.addPackageIdEquals(sessionHandle, temp[0]);
                    tempFilter = aieb.and(sessionHandle, tempFilter, aieb.addPackageVersionEquals(sessionHandle, temp[1]));
                    tempFilter = aieb.and(sessionHandle, tempFilter, aieb.addProcessDefIdEquals(sessionHandle, temp[2]));

                    if (i == 0) {
                        idsFilter = tempFilter;
                        i++;
                    } else {
                        idsFilter = aieb.or(sessionHandle, idsFilter, tempFilter);
                    }
                }

                filter = aieb.and(sessionHandle, filter, idsFilter);
            }

            // execute
            WfAssignmentIterator ai = sc.get_iterator_assignment();
            ai.set_query_expression(aieb.toIteratorExpression(sessionHandle, filter));

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

        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];
            }
View Full Code Here

     * @throws Exception
     */
    protected WfAssignment getSharkAssignment(SharkConnection sc, String activityId) throws Exception {

        Shark shark = Shark.getInstance();
        AssignmentFilterBuilder aieb = shark.getAssignmentFilterBuilder();
        WMSessionHandle sessionHandle = sc.getSessionHandle();
        // filter by user
        String username = getWorkflowUserManager().getCurrentUsername();
        WMFilter filter = aieb.addUsernameEquals(sessionHandle, username);

        // filter by activity id
        filter = aieb.and(sessionHandle, filter, aieb.addActivityIdEquals(sessionHandle, activityId));

        // 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) {
            return wItems[0];
        } else {
            return null;
View Full Code Here

     * @throws Exception
     */
    protected WfAssignment getSharkAssignmentByProcess(SharkConnection sc, String processId) throws Exception {

        Shark shark = Shark.getInstance();
        AssignmentFilterBuilder aieb = shark.getAssignmentFilterBuilder();
        WMSessionHandle sessionHandle = sc.getSessionHandle();
        // filter by user
        String username = getWorkflowUserManager().getCurrentUsername();
        WMFilter filter = aieb.addUsernameEquals(sessionHandle, username);

        // filter by process id
        filter = aieb.and(sessionHandle, filter, aieb.addProcessIdEquals(sessionHandle, processId));

        // 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) {
            return wItems[0];
        } else {
            return null;
View Full Code Here

     * @throws Exception
     */
    protected WfAssignment getWfAssignmentByActivityId(SharkConnection sc, String activityId) throws Exception {

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

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

        // 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) {
            return wItems[0];
        } else {
            return null;
View Full Code Here

TOP

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

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.