cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Java API-execute BPMN Simulation

jrad
Contributor

Hello,

I found a problem when executing BPMN Simulation using Java API.

I followed this example in VB:

http://community.mega.com/t5/custom/page/page-id/mega-kb-solution?sid=50120000000mr1AAAQ

Following is my code to run simulation:

"

MegaObject mgScenario= mgRoot.getCollection("~nf2MJYrpq400[Hypothesis]").get("myScenario"); mgScenario.callMethod("Simulate");

"

However this code doesn't run simulation.

Any help will be kindly appreciated.

Thank you.

Lamia

6 Replies

Hello again, Can you tell me please which version of MEGA you are using? Thank you for your help.

Hello,

 

Thank you for your reply.

I did exactly the same on this object:

 

MegaObject mgScenario= mgRoot.getCollection("~nf2MJYrpq400[Hypothesis]").get("myScenario"); 

 

System.out.println(mgScenario.toString());
System.out.println(mgScenario.getID());
System.out.println(mgScenario.getMethodID("Simulate"));
System.out.println(mgScenario.getProp("Name"));
mgScenario.invokeMethod("Simulate");

 

It prints me all strings and it invoke the methode without exceptions. but the methode does not really run.

It prints all time the same output for different input.

 

On your side,did the result change after executing this code to different input?

 

Thank you four your help.

 

Lamia

 

 

ki6i
Trusted Contributor

Hi again,

 

For me that works completely fine aka. it prints me all strings and it runs the method withour exceptions

 

        MegaCollection websCollection = megaRoot
                .getCollection(Hypothesis.ID, sort);
        for (MegaObject mo : websCollection) {
            System.out.println(mo.toString());
            System.out.println(mo.getID());
            System.out.println(mo.getMethodID("Simulate"));
            System.out.println(mo.getProp("Name"));
            mo.invokeMethod("Simulate");
        }

Hello,

 

I tried to execute simulation with CallFunction,since Simulate is a function, but it doesn't work.

I tried also to add argument  like this:

 

"mgScenario.callMethod("Simulate", true);" 

 

But simulation did not run.

 

Any idea?

 

Thanks!

 

Lamia

 

 

Hello,

 

I don't have error when running this code. But the simulation doesn't run. Infact, ,simulation results doesn't change even when I change the input parameters. However, for this inputs, when I run simulation manually, the output change.

 

Thank you for your help

 

ki6i
Trusted Contributor

What error are you getting when you run it?