Check whether a microflow exists in Java

7
In addition to Marco's question I was wondering how I check whether the microflow exists or not? The module and microflow name are parameters in the Java action, so I want to be sure the microflow exists.
asked
2 answers
3

Before calling the Core.Execute method as mentioned in Marco's question you referred to, you can check with JAVA code if the microflow exists with the following code:

boolean exists = ModelerAPI.getMicroflows().containsKey("YourMicroflowName");

After this the variable exists will be true if the microflow is found (exist), otherwise it would be false and you can handle it in the way you want.

Note: If you call the Core.Execute method with a non-existing microflow name the Core will throw an exception (witch can be catched if you want). This isn't relevant if you'r using the check I've described above.

answered
1

Will the java action compile if you are refering to a non exisitng Microflow?

answered