Hi

We're facing following Issue:

Could not find a start with name '15601A89E0030024/Logout.ivp'

We tried following ways:

{ivy.html.startref('Start Processes/Home/Logout.ivp')}

{ivy.html.startref('15601A89E0030024/Logout.ivp')}

The problem is, that the Logoutprocess is in another Project which is in the required Project list of the Projects which tries to start the logout process.

How can we fix that?

Regards, Dani

asked 31.08.2016 at 12:49

dharlach's gravatar image

dharlach
(suspended)
accept rate: 0%

Any Ideas?

(05.09.2016 at 16:19) dharlach dharlach's gravatar image

Hello Dani

This is currently not possible by using public API.

Anyway I have just improved the startref-method, that it searchs in required projects too. This improvement will be available with the next version (6.4) and is tracked on issue XIVY-1322: ivy.html.startref() should also generate link for process starts in required projects

In the meanwhile you could use the below utility. Please note, that this code make use of NON-Public API and will eventually not work in further releases. Therefore, as soon the next release is avaiable, replace this code with the call to the regular public API.

package util;

import java.net.URI;

import ch.ivyteam.ivy.environment.Ivy;
import ch.ivyteam.ivy.persistence.PersistencyException;
import ch.ivyteam.ivy.project.IIvyProject;
import ch.ivyteam.ivy.request.IHttpProcessModelVersionRequest;
import ch.ivyteam.ivy.request.IHttpRequest;
import ch.ivyteam.ivy.request.RequestUriFactory;
import ch.ivyteam.ivy.security.SecurityManagerFactory;
import ch.ivyteam.ivy.workflow.IStartElement;
import ch.ivyteam.ivy.workflow.IWorkflowProcessModelVersion;

@SuppressWarnings("restriction")
public class HtmlContextUtils {
    public static String startref(final String startName) {
        try {
            IStartElement start = findStartElement(startName);
            if (start != null) {
                URI processStartUri = RequestUriFactory.createProcessStartUri((IHttpProcessModelVersionRequest) Ivy.request(), start);
                return makeUriAbsolute(processStartUri).toASCIIString();
            }
        } catch (PersistencyException ex) {
            Ivy.log().error(ex);
        }
        return "";
    }

    private static IStartElement findStartElement(final String startName) {
        return SecurityManagerFactory.getSecurityManager().executeAsSystem2(() -> {
            IIvyProject project = Ivy.request().getProject();
            IStartElement startElement = findStartElement(startName, project);
            if (startElement != null) {
                return startElement;
            }
            for (IIvyProject ivyProject : project.getRequiredProjects()) {
                startElement = findStartElement(startName, ivyProject);
                if (startElement != null) {
                    return startElement;
                }
            }
            return null;
        });
    }

    private static IStartElement findStartElement(final String startName, IIvyProject ivyProject) {
        IWorkflowProcessModelVersion wpmv = ivyProject.getWorkflowProcessModelVersion();
        IStartElement startElement = wpmv.findStartElement(startName);
        if (startElement == null) {
            startElement = wpmv.findStartElementByUserFriendlyRequestPath(startName);
        }
        return startElement;
    }

    private static URI makeUriAbsolute(URI uri) {
        if (uri.isAbsolute()) {
            return uri;
        }
        return RequestUriFactory.createServerUri((IHttpRequest) Ivy.request()).resolve(uri);
    }
}
link

answered 12.09.2016 at 15:16

Flavio%20Sadeghi's gravatar image

Flavio Sadeghi ♦♦
(suspended)
accept rate: 75%

Hi Flavio

Thanks a lot for your answer :) I'm looking forward to the new version.

Kind Regards, Daniel

(12.09.2016 at 15:19) dharlach dharlach's gravatar image

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×37

Asked: 31.08.2016 at 12:49

Seen: 2,140 times

Last updated: 12.09.2016 at 15:19