<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Reload Process Model programmatically?</title><link>https://answers.axonivy.com/questions/3880/reload-process-model-programmatically</link><description>&lt;p&gt;Hi IvyTeam,&lt;/p&gt;
&lt;p&gt;I sometime manually replace the deployed classes by the new one. Is there anyway to tell Ivy Engine reload the Process Model contains these classes? Just like when we deploy new Process Model Version.&lt;/p&gt;
&lt;p&gt;FYI: I'm using Ivy Engine for my local development, everytime I build the modules, I need to copy the iar to deploy folder (or use Admin Tool to deploy), It's really take time, I want to automate it.&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/3880/reload-process-model-programmatically" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 09 Jul 2019 11:22:26 -0400</lastBuildDate><item><title>Answer by Reto Weiss</title><link>https://answers.axonivy.com/questions/3880/reload-process-model-programmatically/3881</link><description>&lt;p&gt;Hi Vinh&lt;/p&gt;
&lt;p&gt;You can try the following code that uses heavily internal unsupported API (non public):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import ch.ivyteam.ivy.deployment.restricted.configuration.JavaConfigurationSynchronizer;
import ch.ivyteam.ivy.application.ActivityOperationState;
import ch.ivyteam.ivy.java.JavaConfigurationNavigationUtil;
import ch.ivyteam.ivy.application.IProcessModelVersion;

IProcessModelVersion pmv = ivy.wf.getApplication().findProcessModelVersion("Test$1");

pmv.deactivate();
while (pmv.getActivityOperationState() != ActivityOperationState.INACTIVE)
{
    Thread.sleep(200);
}

JavaConfigurationNavigationUtil.getJavaConfiguration(pmv).getClassLoaderHolder().updateRepositories();

pmv.activate();
while (pmv.getActivityOperationState() != ActivityOperationState.ACTIVE)
{
    Thread.sleep(200);  
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Also you have to timeout if pmv cannot be deactivated or activated.&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Reto Weiss, Axon.ivy Support&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reto Weiss</dc:creator><pubDate>Tue, 09 Jul 2019 11:22:26 -0400</pubDate><guid>https://answers.axonivy.com/questions/3880/reload-process-model-programmatically/3881</guid></item></channel></rss>