Questions asked by Genzer Hawkerhttps://answers.axonivy.com/questions/asked-by/157/genzer-hawker/?type=rssQuestions asked by <a href="/users/157/genzer-hawker" >Genzer Hawker</a>enMon, 03 Jun 2019 09:22:49 -0400Consuming Rest in Plugin Projecthttps://answers.axonivy.com/questions/3834/consuming-rest-in-plugin-project<p>Currently, I face the difficulties that there are some lacking libraries when I consuming rest API in Ivy plugin I follow this instruction : <a href="https://answers.axonivy.com/questions/2477/how-to-register-my-code-that-runs-on-every-engine-startup">https://answers.axonivy.com/questions/2477/how-to-register-my-code-that-runs-on-every-engine-startup</a> When user logs in, logs out or gets time-out, I want to call rest service to do some stuff: <img alt="alt text" src="https://answers.axonivy.com/upfiles/call_rest.png"></p> <p>But I get an error like this when calling rest service in the plugin: <img alt="alt text" src="https://answers.axonivy.com/upfiles/error_FGhNT7s.png"></p> <p>Currently, I just add some dependencies like this picture into the plugin but it doesn't work <img alt="alt text" src="https://answers.axonivy.com/upfiles/hint.png"></p> <p>Do you have any hint or any suggestion for this problem? Thanks in advance :)</p>Genzer HawkerMon, 03 Jun 2019 09:22:49 -0400https://answers.axonivy.com/questions/3834/consuming-rest-in-plugin-projectrestSupport for @FacesComponent within an Axon.ivy project without putting jars into ivy/WEB-INF/lib?https://answers.axonivy.com/questions/3488/support-for-facescomponent-within-an-axon-ivy-project-without-putting-jars-into-ivy-web-inf-lib<p>Hi Ivy Team</p> <p>According to the Release Notes of Axon.ivy Engine</p> <pre><code>Changes in 5.0 (since product release 4.3.0.39578, 7.5.2012) * Issue #23896 (Feature): Support implementing JSF Converter in Xpert.ivy projects Update Release 5.1.8.50190 (22.10.2015) + 24770 Feature Respect @FacesValidator annotation Changes in 6.0.0.50515 (since product release 5.1.0.46949, 12.9.2014) 24.11.2015 - Faces validator support </code></pre> <p>So <code>@FacesConverter</code> and <code>@FacesValidator</code> are supported in project-scoped since v5.x and v6.0.</p> <p>Is it possible to create custom <code>@FacesComponent</code> in project-scope as well without the need of making JAR files and put it in <code>ivy/WEB-INF/lib</code>? on the latest version v7.0.x?</p>Genzer HawkerTue, 23 Oct 2018 00:06:34 -0400https://answers.axonivy.com/questions/3488/support-for-facescomponent-within-an-axon-ivy-project-without-putting-jars-into-ivy-web-inf-libjsffaces-config.xmlHow can I use JAX-RS ContainerRequestFilter/ResponseFilter for my JAX-RS resources.https://answers.axonivy.com/questions/3412/how-can-i-use-jax-rs-containerrequestfilter-responsefilter-for-my-jax-rs-resources<p>Hi,</p> <p>I want to implement my own <code>ContainerRequestFilter</code> and <code>ContainerResponseFilter</code> for my JAX-RS resources in my Axon.ivy projects. Typically, I would create an implementation of the filter:</p> <pre><code>import java.util.logging.*; @Provider public class MyRequestFilter implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext requestContext) throws IOException { Logger.getLogger("Test").log(Level.WARNING, "LOOK MA! IT WORKS"); } } </code></pre> <p>I assume that Jersey will register my filter and it will works. However, I got </p> <pre><code>javax.servlet.ServletException: java.lang.IllegalStateException: Request scope has been already shut down. at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489) at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228) ... Caused by: java.lang.IllegalStateException: Request scope has been already shut down. at jersey.repackaged.com.google.common.base.Preconditions.checkState(Preconditions.java:173) at org.glassfish.jersey.process.internal.RequestScope.retrieveCurrent(RequestScope.java:239) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:314) at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473) ... 46 more </code></pre> <p>..when I call my resources.</p> <p>Is it possible (at all) to use <code>ContainerRequestFilter/ResponseFilter</code> (and <code>Feature</code>, <code>DynamicFeature</code>) in an Axon.ivy project? And without introducing JAR files into <code>webapps/ivy/WEB-INF/lib/</code>?</p> <p>Thanks</p>Genzer HawkerMon, 10 Sep 2018 02:24:40 -0400https://answers.axonivy.com/questions/3412/how-can-i-use-jax-rs-containerrequestfilter-responsefilter-for-my-jax-rs-resourcesjax-rsjerseyrestIs it possible to access Ivy's RESTful API from an HtmlDialog or within the same session?https://answers.axonivy.com/questions/2462/is-it-possible-to-access-ivy-s-restful-api-from-an-htmldialog-or-within-the-same-session<p>Hi Ivy Team</p> <p>I have a HtmlDialog containing several links to our RESTful API (implemented using Axon.ivy). However, every time the user accesses to the API, the browser requires authentication even though the user has already logged in.</p> <p>I'm aware of the <code>javax.annotation.security.PermitAll/DenyAll</code> (-- which seems to be the only annotations supported?) but I want to keep the Basic authentication intact.</p> <p>Say the page could be like this:</p> <pre><code>&lt; !-- The HelloWorld dialog --&gt; &lt; h:html&gt; &lt; h:body&gt; &lt; h:outputLink value="/ivy/api/designer/helloworld" target="_blank"&gt; Click to see Hello World &lt; /h:outputLink&gt; &lt; h:outputLink value="/ivy/file/designer/session/some_file_already_created.txt" target="_blank"&gt; Get content of file &lt; /h:outputLink&gt; &lt; h:/body&gt; &lt; /h:html&gt; </code></pre> <p>The first link will require authentication whereas the second works normally.</p> <p>Is there a possible way to overcome this?</p>Genzer HawkerWed, 22 Feb 2017 08:26:22 -0500https://answers.axonivy.com/questions/2462/is-it-possible-to-access-ivy-s-restful-api-from-an-htmldialog-or-within-the-same-sessionsecurityrestWhy do we have to use Screen Name to login?https://answers.axonivy.com/questions/2305/why-do-we-have-to-use-screen-name-to-login<p>Hi Administrators</p> <p>I was surprised today that I cannot login using my email as I usually did. I had requested temporary access several times because I thought something wrong with my password.</p> <p>It turned out that I was wrong when using my email as the username. Using my <strong>Screen Name</strong> (the one I expected to serve only for displaying on the screen), I was able to login normally.</p> <p>My questions:</p> <ul> <li>Could we enable logging using just our emails?</li> <li>Can we somehow update the login screen label to "Your Screen Name" instead of <em>local user name</em>? It's quite confusing because I don't know what my <em>local user name</em> is.</li> </ul> <p>Thanks for your time</p>Genzer HawkerTue, 20 Dec 2016 05:10:25 -0500https://answers.axonivy.com/questions/2305/why-do-we-have-to-use-screen-name-to-loginloginmetaJAX-RS method returns StreamingOutput fails with "Access to ivy environment outside a process request thread is not possible"https://answers.axonivy.com/questions/2072/jax-rs-method-returns-streamingoutput-fails-with-access-to-ivy-environment-outside-a-process-request-thread-is-not-possible<p>Hi Ivy team</p> <p>I want to build a JAX-RS API returning response in a streaming manner (chunked transfer encoding). The code looks like below:</p> <pre><code>@Path("{applicationName}/streams") public class StreamingResponseRestSResource { @GET public Response getStreamingResponse() { // This works by keeping a reference then pass it to the anonymous class. // It may NOT work in all situations. final Logger logger = Ivy.log(); StreamingOutput streamingOutput = new StreamingOutput() { @Override public void write(OutputStream output) throws IOException, WebApplicationException { PrintWriter out = new PrintWriter(new BufferedWriter( new OutputStreamWriter(output)), true); Ivy.log().error("HHH - BREAK HERE"); logger.error("HHH - It works with passed reference of Logger"); IntStream.range(0, 100_000) .forEach(c -&gt; out.println("HHH - Count up to " + c)); } }; return Response.ok(streamingOutput).build(); } } </code></pre> <p>Full code here: <a href="http://pastebin.com/tEAMGFB3">http://pastebin.com/tEAMGFB3</a></p> <p>If I do</p> <p><code>curl -i -u Developer:Developer <a href="http://localhost:8081/ivy/api/designer/streams">http://localhost:8081/ivy/api/designer/streams</a></code></p> <p>the response would be:</p> <p><code>{ "errorId": "1578A42A15718503", "errorMessage": "Access to ivy environment outside a process request thread is not possible.\nCurrent thread: Thread[http-nio-8081-exec-14,5,main]", "statusCode": 500 }</code></p> <p>If I comment out the line ...</p> <p><code>Ivy.log().error("HHH - BREAK HERE");</code></p> <p>...the error disappears.</p> <p>Is there anyway to fix the access to <code>Ivy</code> with <code>StreamingOutput</code> implementation?</p>Genzer HawkerMon, 03 Oct 2016 14:50:20 -0400https://answers.axonivy.com/questions/2072/jax-rs-method-returns-streamingoutput-fails-with-access-to-ivy-environment-outside-a-process-request-thread-is-not-possibleivyrestDifferent behaviour in TaskState in Task Switch Event (Gateway) and User Taskhttps://answers.axonivy.com/questions/1927/different-behaviour-in-taskstate-in-task-switch-event-gateway-and-user-task<p>Hi Ivy Team</p> <p>According to the published document, the <em>User Task</em> is specified</p> <blockquote> <p>The User Task element calls a User Dialog in a new Task. Thus, it combines the behavior of a Task Switch Event and a User Dialog.</p> </blockquote> <p>Given the following process:</p> <p><img alt="alt text" src="https://s31.postimg.org/nm1tuumgr/different_behavior_of_task_state_between_user_ta.png"></p> <p>If I run <code>StartTaskSwitchEvent</code>, a new task will be created. If I run the task, the <code>MainDialog</code> will be opened. At this point, the <code>TaskState</code> of the <code>ITask</code> is already <code>RESUMED</code>.</p> <p>However, if I run <code>StartUserTask</code>, a new task will be created. If I run the task, the <code>MainDialog</code> will be opened. The strange thing is, the <code>TaskState</code> is still <code>SUSPENDED</code>. Only if I exit the <code>MainDialog</code> and reach the next step (<code>SecondDialog</code>), its state is updated to <code>RESUMED</code>.</p> <p>Could you explain this behavior?</p> <p>P.S: Tested on Axon.ivy Designer 6.2.0.</p>Genzer HawkerTue, 02 Aug 2016 12:45:42 -0400https://answers.axonivy.com/questions/1927/different-behaviour-in-taskstate-in-task-switch-event-gateway-and-user-tasktaskuser-tasktask-stateIs there any possible way to switch SYSTEM session to another regular user's session in a ProgramStart execution?https://answers.axonivy.com/questions/1780/is-there-any-possible-way-to-switch-system-session-to-another-regular-user-s-session-in-a-programstart-execution<p>In our project, we use <code>ProgramStart</code> to implement <code>cron</code> jobs. The executions will always be carried on by the SYSTEM user using only one <code>ISession(id = 0)</code>.</p> <p>The problem is, we heavily store plenty of <em>Context Information</em> (authentication token, user-session-specific data, etc) into <code>ISession.setAttribute()</code>. It works well on normal situation with logged-in Ivy user. However, because in background jobs, there is only one session, each execution will interfere with each others, trying to <code>set</code> and <code>get</code> the <em>Context Information</em>.</p> <p>In addition, this happens the same with <code>Signals</code> since execution of those also delegated to <code>SYSTEM</code>.</p> <p>I've tried to call <code>ivy.session.login()</code> but it threw exception since Axon.ivy refuse to allow logging out of <code>SYSTEM</code> user.</p> <p>My question is: Is there any possible way to switch from SYSTEM sessions to regular normal user's session?</p> <p>Thanks</p>Genzer HawkerFri, 27 May 2016 07:54:55 -0400https://answers.axonivy.com/questions/1780/is-there-any-possible-way-to-switch-system-session-to-another-regular-user-s-session-in-a-programstart-executionbackground-jobsignalssessionsystemWhy there are two guava JARs in Axon.ivy engine's lib/shared?https://answers.axonivy.com/questions/1762/why-there-are-two-guava-jars-in-axon-ivy-engine-s-lib-shared<p>Hi Ivy team</p> <p>Our team are about to use Guava in our project. The version we use is 19.0. When we test on Axon.ivy Designer, everything works just fine. However, when we deploy on engine, it get exception at runtime:</p> <p><code>Caused by: java.lang.NoSuchMethodError: com.google.common.collect.Range.closed(Ljava/lang/Comparable;Ljava/lang/Comparable;)Lcom/google/common/collect/Range;</code></p> <p>After digging around, we discovered that there are 2 jars of guava in Axon.ivy engine's <code>lib/shared</code> directory: <code>guava-16.0.1.jar</code> and <code>guava-11.0.2.jar</code>. At runtime, somehow Axon.ivy Engine chooses to load <code>guava-11.0.2.jar</code> and ignore the other jar.</p> <p>My questions are:</p> <ul> <li>Why there two jars of two different version?</li> <li>Is there anyway we can use <code>guava-19.0</code> without overriding Axon.ivy engine's <code>lib/shared</code>?</li> </ul>Genzer HawkerTue, 10 May 2016 12:47:55 -0400https://answers.axonivy.com/questions/1762/why-there-are-two-guava-jars-in-axon-ivy-engine-s-lib-sharedjarlibraryconflictInconveniences when using inner classes in Ivy Scripthttps://answers.axonivy.com/questions/1756/inconveniences-when-using-inner-classes-in-ivy-script<p>Suppose I have two classes, each of them provides <code>Builder</code> API.</p> <pre><code>// This is in Ivy Script import example.Person.Builder; Builder errorPersonBuilder = new Person.Builder(); // this line generates a compilation error saying class Person.Builder not found. Builder workingPersonBuilder = new Builder(); // this works. </code></pre> <p>It is still OK if there is only one <code>Builder</code> inside the context. As soon as there is another:</p> <pre><code>// This is in Ivy Script import example.Person.Builder; import example.Company.Builder; // compilation error of collision, there are two classes named Builder. Builder workingPersonBuilder = new Builder(); // this works, see above. Builder anotherBuilder = new Builder(); // which builder? </code></pre> <p>If Ivy Script could supports the same as normal Java, we could do:</p> <pre><code>import example.Person.Builder; import example.Company.Builder; Person.Builder personBuilder = new Person.Builder(); Company.Builder companyBuilder = new Company.Builder(); </code></pre> <p>Should this be supported in Ivy Script?</p>Genzer HawkerFri, 29 Apr 2016 07:13:17 -0400https://answers.axonivy.com/questions/1756/inconveniences-when-using-inner-classes-in-ivy-scriptinner-classivyscriptWhy does Axon.ivy persist an ICase when `setAdditionalProperty` is invoked even if there is no TaskSwitch element?https://answers.axonivy.com/questions/1755/why-does-axon-ivy-persist-an-icase-when-setadditionalproperty-is-invoked-even-if-there-is-no-taskswitch-element<p>There written in the <a href="http://developer.axonivy.com/doc/latest/DesignerGuideHtml/ivy.concepts.html#ivy-wf-states">public document</a>:</p> <blockquote> <p>Normally, a case is started non persistent. This means it is stored in memory only. As soon as the process hits a task switch the case and its tasks will be made persistent by storing them to the system database.</p> </blockquote> <p>I just found out that you can make an ICase persisted without any TaskSwitch element in the process by setting an <code>additionalProperty</code>.</p> <p>As soon as the line of code is evaluated:</p> <pre><code>ivy.case.setAdditionalProperty("anything-will-do", "some-value"); </code></pre> <p>The <code>ICase</code> will be persisted <em>immediately</em>.</p> <p>Is this a non-public behaviour or a bug in the API?</p> <p>P.S: there is a demo project to demonstrate this behaviour at <a href="https://www.mediafire.com/?hxi3z0v27dhjxh4">https://www.mediafire.com/?hxi3z0v27dhjxh4</a></p>Genzer HawkerFri, 29 Apr 2016 05:40:29 -0400https://answers.axonivy.com/questions/1755/why-does-axon-ivy-persist-an-icase-when-setadditionalproperty-is-invoked-even-if-there-is-no-taskswitch-elementcaseadditional-propertypersistenceworkflowConfigure SystemTaskFailureBehaviour for system-wide or application-widehttps://answers.axonivy.com/questions/1715/configure-systemtaskfailurebehaviour-for-system-wide-or-application-wide<p>Hi Ivy team</p> <p>According to the public javadoc of <a href="http://developer.axonivy.com/doc/latest/publicApi/ch/ivyteam/ivy/workflow/SystemTaskFailureBehaviour.html">SystemTaskFailureBehaviour</a></p> <blockquote> <p>The following example shows how to set the behaviour:</p> </blockquote> <pre><code>ivy.response.setParameter("ch.ivyteam.ivy.workflow.SystemTaskFailureBehaviour", SystemTaskFailureBehaviour.FAIL_TASK_DO_NOT_RETRY); If the behaviour is not set in the system task process the default behaviour is SystemTaskFailureBehaviour.FAIL_TASK_DO_RETRY. </code></pre> <p>However, the snippet above only applies for a particular process by setting parameters of the <code>ivy.response</code>. </p> <p>Is there anyway that I can set <code>SystemTaskFailureBehaviour.FAIL_TASK_DO_NOT_RETRY</code> as default per application (or system)?</p> <p>Regards</p>Genzer HawkerMon, 04 Apr 2016 08:15:34 -0400https://answers.axonivy.com/questions/1715/configure-systemtaskfailurebehaviour-for-system-wide-or-application-widesystem-taskapitaskVisualVM's Memory Sampler is inactive for Axon.ivy Engine running as WIndows Servicehttps://answers.axonivy.com/questions/1516/visualvm-s-memory-sampler-is-inactive-for-axon-ivy-engine-running-as-windows-service<p>We have an Axon.ivy Engine running as a Window Service. The version of the Axon.ivy we are using is 5.1.4.48243. We intentionally installed JDK 1.7.0_60 in order to use the VisualVM to monitor and investigate some memory issue. The Axon.ivy Engine is configured with JMX port.</p> <p>We are able to view the Axon.ivy Enigne application in the VisualVM but the Memory Sampler is rendered inactive and the notification given to us is:</p> <p><code>Memory sampling: Not available. Cannot connect to target application. Make sure the application is running on a supported JDK 6 or JDK 7.</code></p> <p>If we run the Axon.ivy Engine as a non-service, everything works.</p> <p>We looked into the Axon.ivy Engine and discovered that it included a JRE inside which was also 1.7.0_60. We tried to configure the argument <code>ivy.dir.jre</code> to the JDK's <code>jre</code> but it still didn't work.</p> <p>We also discovered that the file <code>jre/bin/server/jvm.dll</code> in the JDK and the Axon.ivy Engine's JRE were different (using SHA-1 checksume) despite everything looks the same on the surface.</p> <p>The questions are:</p> <ul> <li>Is it possible to use Memory Sampler on VisualVM to the Axon.ivy Engine running as a Windows Service? How?</li> <li>Why we cannot start the Axon.ivy Engine when we change the argument <code>ivy.dir.jre</code>?</li> </ul> <p>Thanks</p> <p><strong>UPDATE</strong></p> <p>I managed to find a way to start both Axon.ivy Engine service and VisualVM both under Local System account using <a href="http://stackoverflow.com/questions/77528/how-do-you-run-cmd-exe-under-the-local-system-account">PSTools</a>. However, the result is still the same, the Memory Sampler is still inactive.</p> <p><img alt="VisualVM and Axon.ivy Engine service are both started under Local System account" src="http://s27.postimg.org/byxe5nb0j/visual_vm_and_axonivy_service_both_started_as_sy.png"> <img alt="Axon.ivy Engine JVM details" src="http://s27.postimg.org/8qswsloqr/axon_ivy_engine_jvm_details.png"> <img alt="VisualVM JVM details" src="http://s27.postimg.org/o22pt7m2r/visual_vm_jvm_details.png"></p>Genzer HawkerFri, 16 Oct 2015 11:06:17 -0400https://answers.axonivy.com/questions/1516/visualvm-s-memory-sampler-is-inactive-for-axon-ivy-engine-running-as-windows-serviceaxon.ivyenginevisualvmjdkWhy does Axon.ivy issue a lot of warning message of "Entity manager will be closed now."https://answers.axonivy.com/questions/1416/why-does-axon-ivy-issue-a-lot-of-warning-message-of-entity-manager-will-be-closed-now<p>Ever since we upgrade into Axon.ivy 5.1.x, there are a lot of WARN in the log files:</p> <pre><code>16:47:08 WARN [runtimelog.alag_bpmp.alag_integration.persistence] [pool-2-thread-302] [requestId=171088, request=, executionContext=SYSTEM] Open entity manager 'org.hibernate.ejb.EntityManagerImpl@3442bb05' detected. Entity manager will be closed now. </code></pre> <p>Could you explain under what circumstance Axon.ivy write this WARN message? What does it mean?</p> <p>P.S: In our project, we use JPA <code>EntityManager</code> to maintain transaction by obtaining it from <code>IIvyEntityManager</code>.</p> <p>Thanks</p>Genzer HawkerWed, 29 Jul 2015 04:11:44 -0400https://answers.axonivy.com/questions/1416/why-does-axon-ivy-issue-a-lot-of-warning-message-of-entity-manager-will-be-closed-nowloggingentity-manager`TaskQuery.and(TaskQuery)` and `CaseQuery.and(CaseQuery)` doesn't work with `additionalProperty()`.https://answers.axonivy.com/questions/1337/taskquery-and-taskquery-and-casequery-and-casequery-doesn-t-work-with-additionalproperty<p>On our project, we extensively uses the API <code>TaskQuery</code> and <code>CaseQuery</code> in order to find <code>ITask</code> and <code>ICase</code> respectively. We also make use of the <code>additionalProperty</code> of both <code>ITask</code> and <code>ICase</code> in order to store custom fields.</p> <p>However, we later found out that the method <code>and(TaskQuery</code> and <code>or(TaskQuery)</code> doesn't work with the criteria <code>additionalProperty</code>.</p> <p>Consider the below snippet of code:</p> <pre><code>public List&lt;ITask&gt; findTask() { Ivy.wf().getTaskQueryExecutor() .getResults(TaskQuery.create().where() .state().isEqual(SUSPENDED) .and(hasCustomField())); } private static TaskQuery hasCustomField() { return TaskQuery.create().where().additionalProperty("custom").isLike("customized_value"); } </code></pre> <p>Runing the code will result as an exception:</p> <pre><code>java.sql.SQLException: Column not found: ADDITIONALPROPERTYFORTASK.NAME in statement [SELECT IWA_TASKQUERY.TASKID ....... FROM IWA_TaskQuery WHERE (IWA_TASKQUERY.APPLICATIONID = ? AND (IWA_TASKQUERY."STATE" = ? AND ((ADDITIONALPROPERTYFORTASK.NAME = ? OR ADDITIONALPROPERTYFORTASK.NAME IS NULL) AND ADDITIONALPROPERTYFORTASK."VALUE" LIKE ?))) ORDER BY IWA_TASKQUERY.TASKID ASC] </code></pre> <p>While this works:</p> <pre><code>public List&lt;ITask&gt; findTask() { Ivy.wf().getTaskQueryExecutor() .getResults(TaskQuery.create().where() .state().isEqual(SUSPENDED) .and().additionalProperty("custom").isLike("customized_value"); } </code></pre> <p>Please note that only the criterion <code>additionalPropety()</code> has this problem, the other criteria don't.</p> <p>Digging a little deeper, I found that the queries produced are different:</p> <p>The former (the problematic one) produces:</p> <pre><code>SELECT * FROM IWA_Task WHERE (Column(IWA_TaskQuery.State) = 4 &amp;amp;&amp;amp; ((Column(AdditionalPropertyForTask.Name) = custom || Column(AdditionalPropertyForTask.Name) IS NULL) &amp;amp;&amp;amp; Column(AdditionalPropertyForTask.Value) LIKE customized_value)) </code></pre> <p>...whereas the latter produces (correctly):</p> <pre><code>SELECT * FROM IWA_Task LEFT JOIN IWA_TaskAdditionalProperty ON Column(IWA_TaskQuery.TaskId) = Column(IWA_TaskAdditionalProperty.TaskId) LEFT JOIN IWA_AdditionalProperty ON Column(IWA_TaskAdditionalProperty.AdditionalPropertyId) = Column(IWA_AdditionalProperty.AdditionalPropertyId) WHERE (Column(IWA_TaskQuery.State) = 4 &amp;&amp; (Column(AdditionalPropertyForTask.Name) = custom || Column(AdditionalPropertyForTask.Name) IS NULL) &amp;&amp; Column(AdditionalPropertyForTask.Value) LIKE customized_value) </code></pre> <p>This problem occurs both on <code>TaskQuery</code> and <code>CaseQuery</code> and on Axon.ivy 5.1.x (<code>additionalProperty()</code> has been introduced since 5.1.x).</p> <p>I think this is probrably a bug in Axon.ivy query API. While there is a work-around (don't use <code>and(TaskQuery</code> with <code>additionalProperty()</code>), I think it is not good to have inconsistency in the API. I hope this would be fixed soon.</p> <p>I have created a demo project which can reproduce the problem on Axon.ivy. Download it at <a href="https://app.box.com/s/9wxc8iqqrfmqotljiutqdwlvvoem55dh">box.net</a>.</p>Genzer HawkerWed, 27 May 2015 09:04:31 -0400https://answers.axonivy.com/questions/1337/taskquery-and-taskquery-and-casequery-and-casequery-doesn-t-work-with-additionalpropertyadditional-propertycase-querybugtask-queryLucene versions conflict when migrating from Xpert.ivy v4 to Axon.ivy v5https://answers.axonivy.com/questions/1256/lucene-versions-conflict-when-migrating-from-xpert-ivy-v4-to-axon-ivy-v5<p>Our project have encountered an urgent situation in which we have to migrate all modules into Axon.ivy v5.1.4. The migration have some serious trouble with Lucene.</p> <p>Our project uses Lucene v3.6.0 and we have the <code>lucene-core-v3.6.0.jar</code> in our <code>buildpath</code>. After migrating into Axon.ivy 5.1.4, the project cannot built anymore since we get strange complilation error:</p> <pre><code>Errors occurred during the build. Errors running builder 'Ivy Web Service Process Class Builder' on project 'test'. Bad return type Exception Details: Location: ch/test/lucene/LuceneManager.analyzer()Lorg/apache/lucene/analysis/Analyzer; @10: areturn Reason: Type 'org/apache/lucene/analysis/standard/StandardAnalyzer' (current frame, stack[0]) is not assignable to 'org/apache/lucene/analysis/Analyzer' (from method signature) Current Frame: bci: @10 flags: { } locals: { } stack: { 'org/apache/lucene/analysis/standard/StandardAnalyzer' } Bytecode: 0000000: bb00 f459 b200 28b7 00f6 b0 </code></pre> <p>We found out that the Axon.ivy has upgraded Lucene to v4.5.1 which contains a lots of incompatible changes compared to Lucene v3.6.0. <strong>The problem is we could not find a way to force the Axon.ivy build the project with <code>lucene-core-v3.6.0.jar</code> instead of the built-in <code>lucene-core-v4.5.1.jar</code></strong></p> <h1>UPDATE</h1> <p>We later tried to upgrade our implementation into Lucene 4.5.1 but got several other problems:</p> <p>(1) Axon.ivy issues warnings about we are trying to access Lucene API.</p> <p>(2) Start the project in Axon.ivy Designer will encounter <code>ClassNotFoundException</code>: </p> <pre><code>Caused by: java.lang.NoClassDefFoundError: org/apache/lucene/analysis/Analyzer at ch.soreco.alag.ria.service.taskindex.LucenceHandler.startLuceneInstance(LucenceHandler.java:6) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at ch.ivyteam.ivy.scripting.internal.types.IvyJavaMethod.invokeImpl(IvyJavaMethod.java:73) ... 35 more Caused by: java.lang.ClassNotFoundException: org.apache.lucene.analysis.Analyzer at ch.ivyteam.ivy.java.internal.IvyProjectClassLoader.loadClass(IvyProjectClassLoader.java:243) at java.lang.ClassLoader.loadClass(Unknown Source) ... 41 more </code></pre> <p>.. even if all the jars are shipped with Axon.ivy.</p> <p>(3) If we try to include the jars file into our projects (in the classpath), the build will halt with the <code>Bad Return Type</code> error above.</p> <h1>QUESTIONS</h1> <ul> <li>How could we force the Axon.ivy to build our projects using the <code>lucene-core-v3.6.0</code> instead of the <code>lucene-core-v4.5.1</code> shipped with Axon.ivy?</li> <li>Why do we get strange problems when building the projects with built-in Lucene library of Axon.ivy v5.1.4?</li> </ul> <h1>SAMPLE PROJECTS</h1> <p>I attach in this email the two sample projects which illustrate the problems we are facing. We tested the two with AxonIvyDesigner5.1.4.48243_Windows_x64:</p> <ul> <li><a href="https://app.box.com/s/ggaz5cuiip9g6wb1bdq2l1js7xxi2emx"><code>use_built_in_lucene.iar</code></a>: This project illustrates the problem which we cannot built the project if it uses Lucene's classes.</li> <li><a href="https://app.box.com/s/j8gkpnxnmr9oydyelxy446ej7urqb6d9"><code>use_external_lucene.iar</code></a>: This project illustrates the problem which we purposely include the Lucene's jar files but the project still fails.</li> </ul> <h1>UPDATE 2 (extend the answer)</h1> <p>The solution from Reguel Wermelinger which suggest to repack all the classes in <code>lucene-core-v3.6.0.jar</code> in different package name works.</p> <p>1- Download <a href="https://code.google.com/p/jarjar/downloads/list">JarJar</a> (hosted on Google Code, if you read this after 25.01.2016, please search it on GitHub).</p> <p>2 - Put the file <code>lucene-core-v3.6.0.jar</code> at the same directory at JarJar.</p> <p>3 - Create a text file, namely <code>rules.txt</code>, contains one line</p> <pre><code>rule org.apache.lucene.** org.apache.lucene.v3_6_0.@1 </code></pre> <p>4 - Execute the command</p> <pre><code>$ java -jar jarjar.jar rules.txt lucene-core-v3.6.0.jar lucene-core-v3.6.0-repacked.jar </code></pre> <p>5 - Done!</p> <p>You can download the already-repackged <a href="https://app.box.com/s/9efw6bxhm8gkws25gd34d44qwu30662r"><code>lucene-core-v3.6.0-repacked.jar</code></a></p> <p>Please note that this is only a work-around. The Axon.ivy still has problem if you use the Lucene v4.5.1 shipped with it.</p>Genzer HawkerMon, 13 Apr 2015 08:07:15 -0400https://answers.axonivy.com/questions/1256/lucene-versions-conflict-when-migrating-from-xpert-ivy-v4-to-axon-ivy-v5luceneivy4x-migrationivymigrationList converted from an Enum array in Ivy Script doesn't work correctlyhttps://answers.axonivy.com/questions/1224/list-converted-from-an-enum-array-in-ivy-script-doesn-t-work-correctly<p>Today I found something looks like a bug in Ivy Script.</p> <p>In Ivy Script, I want to have a <code>List</code> of all the elements of an <code>enum</code>, say <code>WorkflowPriority</code>, I simply call <code>WorkflowPriority.values()</code>. However, the instance of <code>List</code> returned by the call doesn't work correctly, especially with operation <code>contains</code> and <code>remove</code>.</p> <p>Here are the tests that I made to check:</p> <p>(This is an Ivy Script snippet)</p> <pre><code>import org.junit.Assert; import com.genzerhawherk.bugs.Lists; import ch.ivyteam.ivy.workflow.WorkflowPriority; // Below are all failed tests Assert.assertTrue(WorkflowPriority.values().contains(WorkflowPriority.HIGH)); List&lt;WorkflowPriority&gt; withGenerics = WorkflowPriority.values(); Assert.assertTrue(withGenerics.contains(WorkflowPriority.HIGH)); List fromEnums = Lists.fromEnums(WorkflowPriority.class); Assert.assertTrue(fromEnums.contains(WorkflowPriority.HIGH)); List fromEnumVarargs = Lists.enumVarArgs(WorkflowPriority.HIGH, WorkflowPriority.EXCEPTION); Assert.assertTrue(fromEnumVarargs.contains(WorkflowPriority.HIGH)); // Below are all passed tests List listComprehensive = [WorkflowPriority.HIGH]; Assert.assertTrue(listComprehensive.contains(WorkflowPriority.HIGH)); List newPriorities = new List().addAll(WorkflowPriority.values()); Assert.assertTrue(newPriorities.contains(WorkflowPriority.HIGH)); List fromList = Lists.toArray([WorkflowPriority.HIGH]); Assert.assertTrue(fromList.contains(WorkflowPriority.HIGH)); List fromVarArgs = Lists.normalVarArgs(WorkflowPriority.HIGH); Assert.assertTrue(fromVarArgs.contains(WorkflowPriority.HIGH)); List&lt;WorkflowPriority&gt; manuallyConstructed = new List&lt;WorkflowPriority&gt;(); manuallyConstructed.add(WorkflowPriority.HIGH); Assert.assertTrue(manuallyConstructed.contains(WorkflowPriority.HIGH)); </code></pre> <p><strong>The bug particularly relates to converting <code>&lt;T extends Enum&lt;T&gt;&gt; T[]</code> into a <code>List&lt;T&gt;</code></strong></p> <p>Below is the class <code>Lists</code> I use in the test</p> <pre><code>public class Lists { public static Object[] toArray(Collection&lt;?&gt; collection) { return collection.toArray(); } @SafeVarargs public static &lt;T&gt; T[] normalVarArgs(T...elements) { return Arrays.copyOf(elements, elements.length); } public static &lt;T extends Enum&lt;T&gt;&gt; T[] fromEnums(Class&lt;T&gt; enums) { return enums.getEnumConstants(); } @SafeVarargs public static &lt;T extends Enum&lt;T&gt;&gt; T[] enumVarArgs(T...enums) { return enums; } } </code></pre>Genzer HawkerThu, 12 Mar 2015 08:27:40 -0400https://answers.axonivy.com/questions/1224/list-converted-from-an-enum-array-in-ivy-script-doesn-t-work-correctlyivyscriptenumlistarrayHow to start the Ivy Server in plain Java?https://answers.axonivy.com/questions/1187/how-to-start-the-ivy-server-in-plain-java<p>There are several questions regarding how to access to Ivy environment JUnit tests but there is no elegant solution so far.</p> <p>In Ivy Designer, if I start the Ivy Server and then start run JUnit tests, the Ivy Server will be automatically stopped. I'm trying to find a way to avoid this (and not sure if there is).</p> <p>I'm trying to implement a JUnit <code>TestRunner</code> which could start the Ivy Server programmatically but as of now, I don't know the way. What I could found is:</p> <p><code>IServer server = ServerFactory.createEclipseEmbeddedTestServer(); server.start(null); &lt;-- stuck here since I don't know how to instantiate IProgressMonitor</code></p> <p>My questions are:</p> <ul> <li>Is it possible to configure and run JUnit tests in designer along with the engine?</li> <li>How can we programmatically start a server?</li> </ul> <p>Thanks &amp; Best Regards</p>Genzer HawkerMon, 02 Mar 2015 11:11:00 -0500https://answers.axonivy.com/questions/1187/how-to-start-the-ivy-server-in-plain-javaenginetestjunitivyHow we can obtain the context of the business process programmatically?https://answers.axonivy.com/questions/1185/how-we-can-obtain-the-context-of-the-business-process-programmatically<p>We want to implement a feedback feature in which the user can submit a feedback at any where. What we want to achieve is to attach the context (what is the current screen, which point in the process, etc) into the feedback.</p> <p>I found out a way to (somehow) close to what we expect:</p> <pre><code>StringBuilder fullContextBuilder = new StringBuilder(); for (IIvyThreadLocal threadlocal : IvyThreadContext.getIvyThreadLocals()) { fullContextBuilder.append(threadlocal).append("\n"); } Ivy.log().error(fullContextBuilder.toString()); </code></pre> <p>However, the <code>IIvyThreadLocal</code> and <code>IvyThreadContext</code> are not <code>@PublicAPI</code> so we could not rely on them.</p> <p>Is there a public API which can help me to obtain the context of the business process (something like what printed in the log file for an exception)?</p> <p><strong>UPDATE</strong></p> <p>(It seems I was still ambiguous about what the process context mean)</p> <p>The process context here means what is the current dialog and the context when the feedback submittet. What is the route (dialogs to dialogs) that the user has accessed before submitting the feedback.</p> <p>The idea is something similar to what is printed in the Ivy Server log file. I started to digg into the <code>Logger</code> and <code>ExceptionUtil</code> which I experimented as the snippet above.</p> <p>Thanks &amp; Regards</p>Genzer HawkerMon, 02 Mar 2015 10:56:42 -0500https://answers.axonivy.com/questions/1185/how-we-can-obtain-the-context-of-the-business-process-programmaticallyprocessapicontextTemporary (Ivy) file created by System session will not be deletedhttps://answers.axonivy.com/questions/1121/temporary-ivy-file-created-by-system-session-will-not-be-deleted<p>In the documentation of Ivy <a href="http://developer.axonivy.com/doc/latest/DesignerGuideHtml/ivy.ivyscript.html#ivy.ivyscript.reference.datatypes">File</a> (emphasis mine)</p> <blockquote> <p>A File object can be used to read/write temporary or persistent data. IvyScript Files are created in a confined area that belongs to the running application. Temporary files are created in a session-specific file area and <strong>are automatically deleted if a session ends</strong>. Temporary Files can be made persistent.</p> </blockquote> <p>If a <em>temporary</em> <code>File</code> is created, it will be located at <code>{app}/files/sessions/{sessionId}/</code>. The files then will be deleted if the session is invalidated.</p> <p>Unfortunately, this isn't true for <em>temporary</em> files created by SYSTEM user. The SYSTEM user's session is always have the <code>id</code> of <code>0</code>, hence all files created in SYSTEM user's session will be located at <code>{app}/files/sessions/0/</code>.</p> <p>It seems that Ivy Server will never invalidate SYSTEM user's session, thus all files located in the directory will by left there undeleted (same as <em>persistent</em> file).</p> <p>I don't know whether this is a known fact as a consequence of the implementation that SYSTEM user will never be invalidated or it should be considered (somehow) as a bug?</p> <p>Thanks for considering my question.</p> <p>Regards</p>Genzer HawkerFri, 16 Jan 2015 09:24:48 -0500https://answers.axonivy.com/questions/1121/temporary-ivy-file-created-by-system-session-will-not-be-deletedsessiontemporaryfileChaining checking for initialization in Ivy Scripthttps://answers.axonivy.com/questions/890/chaining-checking-for-initialization-in-ivy-script<p>In the Ivy Designer Guide, Chapter 7, section Null handling / Automatic object creation, it states</p> <p>You can to use the .# operator to suppress the automatic object creation. </p> <pre><code>if( in.#customer == null) { // object is null } if (in.#customer is initialized) { // object is not null or has been set to a non-default value } </code></pre> <p>I also discover that we can do a chain of suppresing initialization like this:</p> <pre><code>if (in.#bigDataClass.#smallerDataClass.#smallDataClass.#tinyDataClass.#fieldXyz is initialized) { // Reach here if all of the properties are initialized } else { // Reach here if any of the properties are null } </code></pre> <p>This really reduces the verbosity of the code when I want to check a deep structure of data classes. Despite its usefulness, I cannot find any (Ivy) documentation mentioning about this feature. I only discovered it by chance and have been using it until now.</p> <p>My question is whether this is an official feature but has been forgotten to mention or it is an unofficial/hidden feature and could be dropped in the future?</p> <p>Thanks &amp; Regards</p>Genzer HawkerMon, 04 Aug 2014 11:35:59 -0400https://answers.axonivy.com/questions/890/chaining-checking-for-initialization-in-ivy-scriptivyscriptauto-initializationWhy I got warning about "Discourage access to CaseQuery/TaskQuery" when I use it in Java code?https://answers.axonivy.com/questions/740/why-i-got-warning-about-discourage-access-to-casequery-taskquery-when-i-use-it-in-java-code<p>Despite being one part of Ivy API but when I try to use CaseQuery/TaskQuery inside a Java class, the compiler yeilds warnings:</p> <blockquote> <p>Discouraged access: The type CaseQuery is not accessible due to restriction on required library C:\dev\ide\xpert.ivy.alag\4.3.20.44658\plugins\ch.ivyteam.ivy.workflow_4.3.20.44658.jar</p> </blockquote> <p>It's true that we can suppress those warnings by using <code>@SuppressWarnings("restriction")</code> but I want to know the reason why they are restricted? Is there anyway we can remove it?</p> <p>P.s: I use Ivy v4.3.20</p> <p>Thanks</p>Genzer HawkerThu, 05 Jun 2014 05:12:46 -0400https://answers.axonivy.com/questions/740/why-i-got-warning-about-discourage-access-to-casequery-taskquery-when-i-use-it-in-java-codeapiworkflow