<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Differences of public api</title><link>https://answers.axonivy.com/questions/2334/differences-of-public-api</link><description>&lt;p&gt;Hi all&lt;/p&gt;
&lt;p&gt;There is many times that i saw similar public api from ivy then i could not distinguish between them, i believe some of my co-workers has the same feeling. In this post i need your help to make it more clear.&lt;/p&gt;
&lt;p&gt;Does they return the same result?&lt;/p&gt;
&lt;p&gt;1/ Application:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Ivy.request().getApplication()
Ivy.wf().getApplication()
Ivy.wfTask().getApplication()
Ivy.wfCase().getApplication()
Ivy.session().getWorkflowContext().getApplication()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;2/ ProcessModel&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Ivy.wfTask().getProcessModel()
Ivy.wfCase().getProcessModel()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;3/  ProcessModels&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Ivy.wfCase().getApplication().getProcessModels()
Ivy.wf().getApplication().getProcessModels()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;4/ ProcessModelVersion&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Ivy.request().getProcessModel().getProcessModelVersions()
Ivy.request().getProcessModel().getReleasedProcessModelVersion()
Ivy.request().getProject().getProcessModelVersion()
Ivy.wfTask().getProcessModelVersion()
Ivy.wfCase().getProcessModelVersion()
Ivy.request().getProcessModelVersion()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There is some more but first i stop here :)&lt;/p&gt;
&lt;p&gt;Thanks in advance&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/2334/differences-of-public-api" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 30 Dec 2016 12:55:25 -0500</lastBuildDate><item><title>Answer by Flavio Sadeghi</title><link>https://answers.axonivy.com/questions/2334/differences-of-public-api/2345</link><description>&lt;p&gt;First we have to separate between &lt;code&gt;configuration&lt;/code&gt; and &lt;code&gt;runtime&lt;/code&gt; data:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Configuration&lt;/code&gt; data are in the system database stored data, like Applications, Cases, Tasks, Users, etc. &lt;/li&gt;
&lt;li&gt;&lt;code&gt;Runtime&lt;/code&gt; data are not persistent and exists only at runtime, like the requests or sessions. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br&gt;
All API calls on the &lt;code&gt;Ivy-Bean&lt;/code&gt; returns either configuration or runtime data related to the current execution context. E.g. the current executing request or the task of the current execution process.&lt;/p&gt;
&lt;p&gt;The following APIs return runtime objects:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/environment/Ivy.html#request--"&gt;Ivy.request()&lt;/a&gt; Returns the current execution &lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/request/IProcessModelVersionRequest.html"&gt;IProcessModelVersionRequest&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/environment/Ivy.html#session--"&gt;Ivy.session()&lt;/a&gt; Returns the related &lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/workflow/IWorkflowSession.html"&gt;IWorkflowSession&lt;/a&gt; to the current request&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The following APIs return configuration objects:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/environment/Ivy.html#wf--"&gt;Ivy.wf()&lt;/a&gt; Returns the &lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/workflow/IWorkflowContext.html"&gt;IWorkflowContext&lt;/a&gt; of the current execution Application.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/environment/Ivy.html#wfTask--"&gt;Ivy.wfTask()&lt;/a&gt; Returns the &lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/workflow/ITask.html"&gt;ITask&lt;/a&gt; of the current process&lt;/li&gt;
&lt;li&gt;&lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/environment/Ivy.html#wfCase--"&gt;Ivy.wfCase()&lt;/a&gt; Returns the &lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/workflow/ICase.html"&gt;ICase&lt;/a&gt; of the current process&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Further calls on a configuration object returns always further configuration objects:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/workflow/ITask.html#getCase--"&gt;ITask.getCase()&lt;/a&gt; Returns the &lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/workflow/ICase.html"&gt;ICase&lt;/a&gt; the &lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/workflow/ITask.html"&gt;ITask&lt;/a&gt; belongs to&lt;/li&gt;
&lt;li&gt;&lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/workflow/ICase.html#getProcessModelVersion--"&gt;ICase.getProcessModelVersion()&lt;/a&gt; Returns the &lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/application/IProcessModelVersion.html"&gt;IProcessModelVersion&lt;/a&gt; the &lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/workflow/ICase.html"&gt;ICase&lt;/a&gt; belongs to&lt;/li&gt;
&lt;li&gt;&lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/workflow/ITask.html#getProcessModelVersion--"&gt;ITask.getProcessModelVersion()&lt;/a&gt; Is equivalent to &lt;code&gt;ITask.getCase().getProcessModelVersion()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/workflow/ITask.html#getProcessModel--"&gt;ITask.getProcessModel()&lt;/a&gt; is quivalent to &lt;code&gt;ITask.getCase().getProcessModelVersion().getProcessModel()&lt;/code&gt;. Basically each &lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/workflow/ITask.html"&gt;ITask&lt;/a&gt; belongs to a &lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/workflow/ICase.html"&gt;ICase&lt;/a&gt;, &lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/workflow/ICase.html"&gt;ICase&lt;/a&gt; belongs to a  &lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/application/IProcessModelVersion.html"&gt;IProcessModelVersion&lt;/a&gt;, A PMV belongs to a &lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/application/IProcessModel.html"&gt;IProcessModel&lt;/a&gt; and PM belongs to a &lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/application/IApplication.html"&gt;IApplication&lt;/a&gt;. So the following two API calls are equicalent&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Ivy.wfCase().getApplication().getProcessModels()&lt;/code&gt; returns all Process Models of the Application the current Case belongs to. As well as the call &lt;code&gt;Ivy.wfTask().getApplication().getProcessModels()&lt;/code&gt;. Because a task and a case belongs to the same pmv, pm and application.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;IProcessModelVersionRequest.getProcessModelVersion()&lt;/code&gt; Returns the &lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/application/IProcessModelVersion.html"&gt;IProcessModelVersion&lt;/a&gt; the &lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/request/IProcessModelVersionRequest.html"&gt;IProcessModelVersionRequest&lt;/a&gt; belongs to&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Ivy.request().getProcessModel().getReleasedProcessModelVersion()&lt;/code&gt;: The current &lt;a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/request/IProcessModelVersionRequest.html"&gt;IProcessModelVersionRequest&lt;/a&gt;belongs to a Process Model, this process Model has one single ‘released’ Process Model Version. This is returned here and this has not to be the same as &lt;code&gt;ivy.request.getProcessModelVersion()&lt;/code&gt;, because a Case/Task lives always in the PMV the Case was started in.
Etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Hope this information will help. Don't hesitate to ask further question as comment. I will update the answer.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Flavio Sadeghi</dc:creator><pubDate>Fri, 30 Dec 2016 12:55:25 -0500</pubDate><guid>https://answers.axonivy.com/questions/2334/differences-of-public-api/2345</guid></item></channel></rss>