Package org.enhydra.shark.api.client.wfservice

Examples of org.enhydra.shark.api.client.wfservice.SharkConnection


     * Reevaluate assignments for an activity based on an activity instance ID.
     * @param activityInstanceId
     */
    public void reevaluateAssignmentsForActivity(String activityInstanceId) {

        SharkConnection sc = null;

        try {

            sc = connect();

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

            ActivityFilterBuilder aieb = shark.getActivityFilterBuilder();
            WMFilter filter = aieb.addIdEquals(sessionHandle, activityInstanceId);
View Full Code Here


            }
        }
    }

    public void reevaluateAssignmentsForUser(String username) {
        SharkConnection sc = null;

        try {

            sc = connect();

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

            ActivityFilterBuilder aieb = shark.getActivityFilterBuilder();
            WMFilter filter = aieb.addHasAssignmentForUser(sessionHandle, username, 0);
View Full Code Here

     * Reevaluate assignments for a process based on an process instance ID.
     * @param procInstanceId
     */
    public void reevaluateAssignmentsForProcess(String procInstanceId) {

        SharkConnection sc = null;

        try {

            sc = connect();

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

            ProcessFilterBuilder pieb = shark.getProcessFilterBuilder();
            WMFilter filter = pieb.addIdEquals(sessionHandle, procInstanceId);
View Full Code Here

     * Reevaluate assignments for an array of processes based on the process instance IDs.
     * @param procInstanceId
     */
    public void reevaluateAssignmentsForProcesses(String[] procInstanceId) {

        SharkConnection sc = null;

        try {

            sc = connect();

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

            ea.reevaluateAssignmentsForProcesses(sessionHandle, procInstanceId, true);


View Full Code Here

     * Deletes a process instance.
     * @param procInstanceId
     */
    public void removeProcessInstance(String procInstanceId) {

        SharkConnection sc = null;

        try {

            sc = connect();

            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));

View Full Code Here

     * @param processId
     * @return
     */
    public boolean processAbort(String processId) {

        SharkConnection sc = null;
        boolean aborted = false;

        try {

            sc = connect();

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

            wapi.abortProcessInstance(sessionHandle, processId);
            aborted = true;

            // audit trail for aborted activity instances
View Full Code Here

     * @return
     */
    public WorkflowProcessResult processStart(String processDefId, String processId, Map<String, String> variables, String startProcUsername, String parentProcessId, boolean startManually) {
        processDefId = getConvertedLatestProcessDefId(processDefId);

        SharkConnection sc = null;

        WorkflowProcessResult result = new WorkflowProcessResult();
        WorkflowProcess processStarted = new WorkflowProcess();
        Collection<WorkflowActivity> activitiesStarted = new ArrayList<WorkflowActivity>();
        String processInstanceId = "";
        try {

            if (startProcUsername != null && startProcUsername.trim().length() > 0) {
                sc = connect(startProcUsername);
            } else {
                sc = connect();
            }

            // start process
            WfProcessMgr mgr = sc.getProcessMgr(processDefId);
            WfProcess wfProcess = null;

            if (processId != null && processId.trim().length() > 0) {
                wfProcess = sc.getProcess(processId);
                processInstanceId = processId;
            } else {
                wfProcess = mgr.create_process(null);
                processInstanceId = wfProcess.key();
            }

            if (variables != null) {
                //set workflow variables if the key is found
                Set<String> keys = variables.keySet();
                if (keys != null && keys.size() > 0) {
                    Map contextSignature = wfProcess.manager().context_signature();
                    for (String key : keys) {
                        Object value = variables.get(key);

                        String signature = (String) contextSignature.get(key);
                        if (signature != null && signature.trim().length() > 0) {
                            if (signature.equals("java.lang.Long")) {
                                value = Long.parseLong((String) value);
                            } else if (signature.equals("java.lang.Boolean")) {
                                value = Long.parseLong((String) value);
                            } else if (signature.equals("java.lang.Double")) {
                                value = Double.parseDouble((String) value);
                            }
                        }

                        this.processVariable(processInstanceId, key, value);
                    }
                }
            }

            //process linking
            if (parentProcessId != null && parentProcessId.trim().length() > 0) {
                internalAddWorkflowProcessLink(parentProcessId, processInstanceId);
            }

            if (!startManually) {
                wfProcess.start();
            }

            // set started process in result
            processStarted.setId(processDefId);
            processStarted.setInstanceId(processInstanceId);
            result.setProcess(processStarted);

            //redirect to assignment view accordingly
            if (wfProcess != null && !startManually) {
                Shark shark = Shark.getInstance();
                AdminMisc admin = shark.getAdminMisc();
                WMSessionHandle sessionHandle = sc.getSessionHandle();

                XPDLBrowser xpdl = shark.getXPDLBrowser();
                WfActivity[] activityList = wfProcess.get_sequence_step(0);
                WorkflowActivity activity = getNextActivity(sessionHandle, mgr, admin, xpdl, wfProcess.key(), activityList);
               
View Full Code Here

        if (activityId == null || activityId.trim().length() == 0) {
            return false;
        }

        SharkConnection sc = null;

        try {
            sc = connect();

            WfAssignment wfa = getSharkAssignment(sc, activityId);
View Full Code Here

     * @param activityId
     * @return null if the assignment does not exist.
     */
    public WorkflowAssignment getAssignment(String activityId) {

        SharkConnection sc = null;
        WorkflowAssignment ass = null;

        try {

            sc = connect();

            WfAssignment wfa = getSharkAssignment(sc, activityId);
            if (wfa != null) {
                WfActivity activity = wfa.activity();
                WfResource assignee = wfa.assignee();
                WfProcess process = activity.container();
                WfProcessMgr manager = process.manager();
                ass = new WorkflowAssignment();
                ass.setAccepted(wfa.get_accepted_status());
                ass.setActivityId(activity.key());
                ass.setActivityName(activity.name());
                ass.setAssigneeId(assignee.resource_key());
                ass.setAssigneeName(assignee.resource_name());
                ass.setDescription(activity.description());
                ass.setPriority(new Short(activity.priority()).toString());
                ass.setProcessId(process.key());
                ass.setProcessName(process.name());
                ass.setProcessVersion(manager.version());
                ass.setProcessDefId(manager.name());
                WorkflowActivity wfActivity = getRunningActivityInfo(activityId);
                ass.setDateCreated(wfActivity.getCreatedTime());
                ass.setDueDate(wfActivity.getDue());

                ass.setAssigneeList(getAssignmentResourceIds(ass.getProcessDefId(), ass.getProcessId(), ass.getActivityId()));

                if (WorkflowUtil.containsHashVariable(ass.getActivityName())) {
                    Collection<WorkflowVariable> variableList = JSPClientUtilities.getVariableData(sc, activity, false);
                    ass.setProcessVariableList((List<WorkflowVariable>) variableList);

                    //process activity name variable
                    ass.setActivityName(WorkflowUtil.processVariable(ass.getActivityName(), null, ass));
                }

                Shark shark = Shark.getInstance();
                AdminMisc admin = shark.getAdminMisc();
                WMSessionHandle sessionHandle = sc.getSessionHandle();
                WMEntity ent = admin.getActivityDefinitionInfo(sessionHandle, process.key(), activity.key());
                ass.setActivityDefId(ent.getId());
                ass.setProcessRequesterId(getUserByProcessIdAndActivityDefId(ass.getProcessDefId(), ass.getProcessId(), WorkflowUtil.ACTIVITY_DEF_ID_RUN_PROCESS));

                WfRequester requester = process.requester();
View Full Code Here

     * @param processId
     * @return null if the assignment does not exist.
     */
    public WorkflowAssignment getAssignmentByProcess(String processId) {

        SharkConnection sc = null;
        WorkflowAssignment ass = null;

        if (processId != null && !processId.trim().isEmpty()) {
            try {

                sc = connect();

                WfProcess wfProcess = sc.getProcess(processId);
                if (wfProcess != null) {
                    Shark shark = Shark.getInstance();
                    AdminMisc admin = shark.getAdminMisc();
                    WMSessionHandle sessionHandle = sc.getSessionHandle();
                    XPDLBrowser xpdl = shark.getXPDLBrowser();

                    WfActivity[] activityList = wfProcess.get_sequence_step(0);
                    WorkflowActivity activity = getNextActivity(sessionHandle, wfProcess.manager(), admin, xpdl, wfProcess.key(), activityList);
                    if (activity != null) {
View Full Code Here

TOP

Related Classes of org.enhydra.shark.api.client.wfservice.SharkConnection

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.