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

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


   }

   protected static String[][] getExtAttribNVPairs(SharkConnection sc, WfActivity act)
      throws Exception {
      XPDLBrowser xpdlb = Shark.getInstance().getXPDLBrowser();
      AdminMisc am = Shark.getInstance().getAdminMisc();
      WMEntity ent = am.getActivityDefinitionInfo(sc.getSessionHandle(), act.container()
         .key(), act.key());

      return WMEntityUtilities.getExtAttribNVPairs(sc.getSessionHandle(), xpdlb, ent);
   }
View Full Code Here


                pmi.set_query_expression(sql);
            }
            WfProcessMgr[] processMgrs = pmi.get_next_n_sequence(0);
            Shark shark = Shark.getInstance();
            WMSessionHandle sessionHandle = sc.getSessionHandle();
            AdminMisc admin = shark.getAdminMisc();
            PackageAdministration pa = getSharkPackageAdmin(sessionHandle);
            for (int i = 0; i < processMgrs.length; i++) {
                WfProcessMgr pm = processMgrs[i];
                WMEntity ent = admin.getProcessDefinitionInfoByUniqueProcessDefinitionName(sessionHandle, processMgrs[i].name());

                WorkflowProcess wp = new WorkflowProcess();

                //find package name
                String packageVersion = (version != null && !version.isEmpty()) ? version : pa.getCurrentPackageVersion(sessionHandle, ent.getPkgId());
View Full Code Here

            sc = connect();

            Shark shark = Shark.getInstance();
            WMSessionHandle sessionHandle = sc.getSessionHandle();
            AdminMisc admin = shark.getAdminMisc();
            PackageAdministration pa = getSharkPackageAdmin(sessionHandle);

            WfProcessMgr pm = sc.getProcessMgr(processDefId);
            WMEntity ent = admin.getProcessDefinitionInfoByUniqueProcessDefinitionName(sessionHandle, processDefId);

            if (pm != null && ent != null) {
                wp = new WorkflowProcess();
                wp.setId(pm.name());
                wp.setPackageId(MiscUtilities.getProcessMgrPkgId(pm.name()));
View Full Code Here

        try {

            sc = connect();

            Shark shark = Shark.getInstance();
            AdminMisc admin = shark.getAdminMisc();
            WMSessionHandle sessionHandle = sc.getSessionHandle();
            getSharkPackageAdmin(sessionHandle); // invoke this to clear xpdl cache

            WMEntity ent = admin.getProcessDefinitionInfoByUniqueProcessDefinitionName(sessionHandle, processDefId);
            XPDLBrowser xpdlBrowser = shark.getXPDLBrowser();
            WMEntity[] activities = WMEntityUtilities.getAllActivities(sessionHandle, xpdlBrowser, ent);
            for (int i = 0; i < activities.length; i++) {
                WMEntity entity = activities[i];
                WorkflowActivity wa = new WorkflowActivity();
View Full Code Here

        try {
            sc = connect();

            Shark shark = Shark.getInstance();
            XPDLBrowser xpdlBrowser = shark.getXPDLBrowser();
            AdminMisc admin = shark.getAdminMisc();
            WMSessionHandle sessionHandle = sc.getSessionHandle();
            PackageAdministration pa = getSharkPackageAdmin(sessionHandle);

            // get package participants
            WMEntity ent = admin.getProcessDefinitionInfoByUniqueProcessDefinitionName(sessionHandle, processDefId);
            WMEntity packageEntity = pa.getPackageEntity(sessionHandle, ent.getPkgId(), ent.getPkgVer());
            WMEntity[] pParticipants = WMEntityUtilities.getAllParticipants(sessionHandle, xpdlBrowser, packageEntity);
            Map<String, WorkflowParticipant> tempParticipantMap = new SequencedHashMap();
            for (int i = 0; i < pParticipants.length; i++) {
                WMEntity entity = pParticipants[i];
View Full Code Here

        try {

            sc = connect();

            Shark shark = Shark.getInstance();
            AdminMisc admin = shark.getAdminMisc();
            WMSessionHandle sessionHandle = sc.getSessionHandle();
            PackageAdministration pa = getSharkPackageAdmin(sessionHandle);
            WMEntity processEntity = admin.getProcessDefinitionInfoByUniqueProcessDefinitionName(sessionHandle, processDefId);
            WMEntity packageEntity = pa.getPackageEntity(sessionHandle, processEntity.getPkgId(), processEntity.getPkgVer());
            XPDLBrowser xpdlBrowser = shark.getXPDLBrowser();

            // get package variables
            WMFilter vfilter = new WMFilter("Type", WMFilter.EQ, "DataField");
View Full Code Here

        try {

            sc = connect();

            Shark shark = Shark.getInstance();
            AdminMisc admin = shark.getAdminMisc();
            WMSessionHandle sessionHandle = sc.getSessionHandle();
            WMEntity processEntity = admin.getProcessDefinitionInfoByUniqueProcessDefinitionName(sessionHandle, processDefId);
            XPDLBrowser xpdlBrowser = shark.getXPDLBrowser();
            WMEntity[] applications = WMEntityUtilities.getAllApplications(sessionHandle, xpdlBrowser, processEntity);
            for (int i = 0; i < applications.length; i++) {
                WMEntity entity = applications[i];
                WorkflowTool wa = new WorkflowTool();
View Full Code Here

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

                workflowActivity.setId(wfActivity.key());
                WMEntity entity = admin.getActivityDefinitionInfo(sessionHandle, wfActivity.container().key(), wfActivity.key());
                workflowActivity.setActivityDefId(entity.getId());

                WfProcess process = wfActivity.container();
                WfProcessMgr manager = process.manager();
View Full Code Here


            double limit = -1;

            //get process limit
            AdminMisc admin = shark.getAdminMisc();
            WMEntity processLimitEnt = admin.getProcessDefinitionInfo(sessionHandle, processInstanceId);


            filter = new WMFilter();
            filter.setFilterType(XPDLBrowser.SIMPLE_TYPE_XPDL);
            filter.setAttributeName("Type");
            filter.setFilterString("ProcessHeader");

            WMEntityIterator processLimitEntityIterator = xpdl.listEntities(sessionHandle, processLimitEnt, filter, true);
            WMEntity[] processLimitEntityList = null;
            if (processLimitEntityIterator != null) {
                processLimitEntityList = processLimitEntityIterator.getArray();
            }

            if (processLimitEntityList != null) {
                WMEntity processLimitEntity = processLimitEntityList[0];

                filter.setFilterType(XPDLBrowser.SIMPLE_TYPE_XPDL);
                filter.setAttributeName("Name");
                filter.setFilterString("Limit");

                WMAttributeIterator procAttributeIterator = xpdl.listAttributes(sessionHandle, processLimitEntity, filter, true);
                WMAttribute[] procAttributeList = null;
                if (procAttributeIterator != null) {
                    procAttributeList = procAttributeIterator.getArray();
                }

                if (procAttributeList[0].getValue() != null && !procAttributeList[0].getValue().equals("")) {
                    try {
                        limit = Double.parseDouble((String) procAttributeList[0].getValue());
                    } catch (Exception e) {}
                }
            }

            String durationUnit = "";
            if (limit != -1) {
                //get duration unit
                filter = new WMFilter();
                filter.setFilterType(XPDLBrowser.SIMPLE_TYPE_XPDL);
                filter.setAttributeName("Type");
                filter.setFilterString("ProcessHeader");

                WMEntity processDurationEnt = admin.getProcessDefinitionInfo(sessionHandle, processInstanceId);
                WMEntityIterator processDurationEntityIterator = xpdl.listEntities(sessionHandle, processDurationEnt, filter, true);
                WMEntity[] processDurationEntityList = null;
                if (processDurationEntityIterator != null) {
                    processDurationEntityList = processDurationEntityIterator.getArray();
                }

                if (processDurationEntityList != null) {
                    WMEntity entity = processDurationEntityList[0];

                    filter = new WMFilter();
                    filter.setFilterType(XPDLBrowser.SIMPLE_TYPE_XPDL);
                    filter.setAttributeName("Name");
                    filter.setFilterString("DurationUnit");

                    WMAttributeIterator procAttributeIterator = xpdl.listAttributes(sessionHandle, entity, filter, true);
                    WMAttribute[] procAttributeList = null;
                    if (procAttributeIterator != null) {
                        procAttributeList = procAttributeIterator.getArray();
                    }

                    if (procAttributeList != null) {
                        durationUnit = (String) procAttributeList[0].getValue();
                    }
                }
            }

            Calendar startedTimeCal = Calendar.getInstance();

            if (wfProcessArray != null && wfProcessArray.length > 0) {

                long startedTime = admin.getProcessStartedTime(sessionHandle, processInstanceId);

                startedTimeCal.setTimeInMillis(startedTime);

                wfProcess.setStartedTime(startedTimeCal.getTime());

                if (limit != -1) {
                    if (!durationUnit.equals("")) {
                        long limitInSecond = 0;
                        if (durationUnit.equals("D")) {
                            limitInSecond = Math.round(limit * 24 * 60 * 60);
                            wfProcess.setLimit(limit + " day");
                        } else if (durationUnit.equals("h")) {
                            limitInSecond = Math.round(limit * 60 * 60);
                            wfProcess.setLimit(limit + " hour(s)");
                        } else if (durationUnit.equals("m")) {
                            limitInSecond = Math.round(limit * 60);
                            wfProcess.setLimit(limit + " minute(s)");
                        } else if (durationUnit.equals("s")) {
                            limitInSecond = Math.round(limit);
                            wfProcess.setLimit(limit + " second(s)");
                        }

                        wfProcess.setDue(getDueDateProceedByPlugin(processInstanceId, "", limitInSecond, startedTimeCal.getTime(), startedTimeCal.getTime()));
                    }
                }
            }

            Date currentDate = new Date();

            if (wfProcessArray[0].state().equals(SharkConstants.STATE_CLOSED_COMPLETED)) {
                Calendar completionCal = Calendar.getInstance();
                Calendar dueCal = Calendar.getInstance();

                long finishTime = admin.getProcessFinishTime(sessionHandle, processInstanceId);

                completionCal.setTimeInMillis(finishTime);
                wfProcess.setFinishTime(completionCal.getTime());
                //completion minus due if completion date is after due date, vice versa otherwise
                if (wfProcess.getDue() != null && wfProcess.getFinishTime().after(wfProcess.getDue())) {
View Full Code Here

TOP

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

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.