<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: getProcessElement() not found when migrating to Ivy 6</title><link>https://answers.axonivy.com/questions/1592/getprocesselement-not-found-when-migrating-to-ivy-6</link><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;While testing migration of various projects to Ivy 6.0, I encountered a problem with a method that does not exist anymore.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  /** 
   * Find the current process name. 
   * 
   * @return fully qualified process name 
   * @throws Exception 
   */ 
    public static String getName() throws Exception {
        return SecurityManagerFactory.getSecurityManager().executeAsSystem(new Callable&amp;lt;String&amp;gt;() {
            public String call() {
                IProcess process = ProcessNavigationUtil.getProcess(MetaData.getProcessElement());

                if (process != null) 
                    return process.getPath();

                return null;
            }
        });
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the previous code, the method &lt;strong&gt;MetaData.getProcessElement()&lt;/strong&gt; is not found. By looking in Ivy 5.1.7, it was implemented as:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  public static ZObject getProcessElement()
  {
    return (ZObject)IvyThreadContext.getIvyThreadLocalValue("processElement");
  }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now the method has been removed, and a new method &lt;strong&gt;getProcessElementId()&lt;/strong&gt; was added, but with a new signature:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  public static PID getProcessElementId()
  {
    return (PID)IvyThreadContext.getIvyThreadLocalValue("processElement");
  }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I didn't found this change in the migration documentation. Can I know the reason for removing the previous method and what are the alternative in order to get the current process name? Thanks.&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/1592/getprocesselement-not-found-when-migrating-to-ivy-6" rel="self"></atom:link><language>en</language><lastBuildDate>Mon, 14 Dec 2015 15:40:36 -0500</lastBuildDate><item><title>Answer by Reguel Wermelinger</title><link>https://answers.axonivy.com/questions/1592/getprocesselement-not-found-when-migrating-to-ivy-6/1593</link><description>&lt;p&gt;This is internal API which was never meant to be used by project implementors, thats why nothing is mentioned in the migration notes.&lt;/p&gt;
&lt;p&gt;If you really need the name of the process resource you can use this API.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;String pid = MetaData.getProcessElementId()
DiCore.getGlobalInjector().getInstance(IProcessManager.class).findProcess(pid ).getName();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt; of course this new API is internal as well. the API can change in the future! &lt;/strong&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Mon, 14 Dec 2015 15:40:36 -0500</pubDate><guid>https://answers.axonivy.com/questions/1592/getprocesselement-not-found-when-migrating-to-ivy-6/1593</guid></item></channel></rss>