Forum Stats

  • 3,816,002 Users
  • 2,259,128 Discussions
  • 7,893,362 Comments

Discussions

BPM getTaskDisplayURL workflow version issue

Jack Issac
Jack Issac Member Posts: 78 Blue Ribbon
edited Dec 13, 2016 8:02AM in SOA & Process Management

Hi,

I'm using JDev 11.1.1.9

I prepared custom worklist for webcenter portal and I'm getting tasks of user with bpm api.

For a bpm application, I deployed 2 different version to soa server. They have different URI for their UI project, like following URI:

/workflow/v0.2b/PersonelBPM_ADF/faces/adf.task-flow?_id=PersonelHT_TaskFlow&_document=WEB-INF/PersonelHT_TaskFlow.xml

/workflow/v0.1b/PersonelBPM_ADF/faces/adf.task-flow?_id=PersonelHT_TaskFlow&_document=WEB-INF/PersonelHT_TaskFlow.xml

Also I'm showing task to user in a inline popup using modal-dialog-task-flow. For show task to user, I'm getting display url following code,

                    Map parameters = new HashMap();

                    parameters.put(Constants.BPM_WORKLIST_TASK_ID,

                                   task.getSystemAttributes().getTaskId());

                    parameters.put(Constants.BPM_WORKLIST_CONTEXT,

                                   getWfCtx().getToken());

                   parameters.put(Constants. BPM_PARENT_URL,

                                   ProjectUtils.getSOAUrl() + "/worklist");

                    //--

                    //---------------------------------

                    String taskURL =

                        WorklistUtil.getTaskDisplayURL(getWfSvcClient(),

                                                       getWfCtx(), task, null,

                                                       "worklist", parameters);

This code is giving to me task url; but it's not giving right task url for different version of applications.

Example, I started the process separately. 1 process in 0.1 version, 1 process in 0.2 version.

When I get tasks url, they are same workflow URI for all process in this application; but I'm expecting like following urls:

For 0.1b version:

http://<hostname>:<port>/workflow/v0.1b/PersonelBPM_ADF/faces/adf.task-flow?_id=PersonelHT_TaskFlow&_document=WEB-INF/PersonelHT_TaskFlow.xml/...............................

For 0.2b version:

http://<hostname>:<port>/workflow/v0.2b/PersonelBPM_ADF/faces/adf.task-flow?_id=PersonelHT_TaskFlow&_document=WEB-INF/PersonelHT_TaskFlow.xml/...............................

Also I checked URI of soa composite in Enterprise Manager, they have different URI.

Thanks,

Jack.

Best Answer

  • BSRT
    BSRT Member Posts: 8
    edited Dec 13, 2016 5:42AM Answer ✓

    Hi Jack,

    I had a same problem. I solved like this,

        String taskDefID = task.getSystemAttributes().getTaskDefinitionId();

        String getBPMProjectNameFromTaskDefID(String taskDefID) {

            try {

                //Example Def ID

                //soa_partition/ProjectName!CompositeVersion/UI_ProjectName

                //default/BPMProject!0.1/BPMProjectUI

                  

                String projectNameWithVersion =

                    taskDefID.substring(taskDefID.indexOf("/") + 1,

                                        taskDefID.lastIndexOf("/"));

                String version =

                    projectNameWithVersion.substring(0, projectNameWithVersion.indexOf("!"));

                return version;

            } catch (Exception ex) {

                ex.printStackTrace();

                return "";

            }

        }

        private String getTaskURIFromTaskDisplayURL(String taskDisplayURL) {

            try {

                String workflowSubString =

                    taskDisplayURL.substring(taskDisplayURL.lastIndexOf("workflow"));

                String[] splittedworkflowSubString =

                    workflowSubString.split("/", 3);

                String taskURI = splittedworkflowSubString[2];

                System.out.println("Task URI : " + taskURI);

                return taskURI;

            } catch (Exception ex) {

                ex.printStackTrace();

                return "";

            }

        }

        private String reGenerateTaskDisplayURLByCompositeVersion(String taskURI,

                                                                  String compositeVersion) {

            try {

                String workflowURL = ProjectUtils.getWorkflowUrl();

                String reGeneratedWorkflowURLWithCompositeVersion =

                    workflowURL + "/" + "v" + compositeVersion + "/" + taskURI;

                return reGeneratedWorkflowURLWithCompositeVersion;

            } catch (Exception ex) {

                ex.printStackTrace();

                return "";

            }

        }

    I solved like this; because task.getSca().getCompositeVersion(), retuned null everytime.

    But for use these functions,

    All your bpm project URI have to like /workflow/v.1.1/.....

    Thanks.

Answers

  • Jack Issac
    Jack Issac Member Posts: 78 Blue Ribbon
    edited Nov 26, 2016 1:13PM

    Hi,

    Is there any advice?

    Is this a bug or my mistake?

    Doesn't anybody knows?

    Thanks,

    Jack.

  • BSRT
    BSRT Member Posts: 8
    edited Dec 13, 2016 5:42AM Answer ✓

    Hi Jack,

    I had a same problem. I solved like this,

        String taskDefID = task.getSystemAttributes().getTaskDefinitionId();

        String getBPMProjectNameFromTaskDefID(String taskDefID) {

            try {

                //Example Def ID

                //soa_partition/ProjectName!CompositeVersion/UI_ProjectName

                //default/BPMProject!0.1/BPMProjectUI

                  

                String projectNameWithVersion =

                    taskDefID.substring(taskDefID.indexOf("/") + 1,

                                        taskDefID.lastIndexOf("/"));

                String version =

                    projectNameWithVersion.substring(0, projectNameWithVersion.indexOf("!"));

                return version;

            } catch (Exception ex) {

                ex.printStackTrace();

                return "";

            }

        }

        private String getTaskURIFromTaskDisplayURL(String taskDisplayURL) {

            try {

                String workflowSubString =

                    taskDisplayURL.substring(taskDisplayURL.lastIndexOf("workflow"));

                String[] splittedworkflowSubString =

                    workflowSubString.split("/", 3);

                String taskURI = splittedworkflowSubString[2];

                System.out.println("Task URI : " + taskURI);

                return taskURI;

            } catch (Exception ex) {

                ex.printStackTrace();

                return "";

            }

        }

        private String reGenerateTaskDisplayURLByCompositeVersion(String taskURI,

                                                                  String compositeVersion) {

            try {

                String workflowURL = ProjectUtils.getWorkflowUrl();

                String reGeneratedWorkflowURLWithCompositeVersion =

                    workflowURL + "/" + "v" + compositeVersion + "/" + taskURI;

                return reGeneratedWorkflowURLWithCompositeVersion;

            } catch (Exception ex) {

                ex.printStackTrace();

                return "";

            }

        }

    I solved like this; because task.getSca().getCompositeVersion(), retuned null everytime.

    But for use these functions,

    All your bpm project URI have to like /workflow/v.1.1/.....

    Thanks.

  • Jack Issac
    Jack Issac Member Posts: 78 Blue Ribbon
    edited Dec 13, 2016 8:02AM

    Hi @BSRT

    Thanks for your answer.

    Yes, I did all uri as you say and I used your functions.

    it's working fine now.

    Thanks much.

    Jack.

This discussion has been closed.