tag:blogger.com,1999:blog-34020393.post3388936178868622770..comments2024-03-27T10:59:38.307-07:00Comments on Jim's PeopleSoft Journal: HOWTO: Generate GUID from PeopleCodeJim Marionhttp://www.blogger.com/profile/12995110203807924786noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-34020393.post-44320429074235715232021-11-29T07:39:53.171-08:002021-11-29T07:39:53.171-08:00@John, take a look at https://github.com/coltonfis...@John, take a look at https://github.com/coltonfischer/ps-web-ide. Colton Fischer has code in there that shows how to read and write PeopleCode from the database using %Meta.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-74642901136313124812021-10-13T13:28:26.881-07:002021-10-13T13:28:26.881-07:00Hi Jim,
I am working on Automation, where I am fi...Hi Jim,<br /><br />I am working on Automation, where I am fixing Microsoft SQL server functions to Oracle SQL functions, I am able to achieve and able to change and view in SQL and PS Queries from Backend Definition record. However When I try to use the same logic in Updating the SQL functions in PeopleCode.<br />I was able to see a change in Database record but in the Application designer, I can't.<br />Is there a way we can change Peoplecode by updating a record and that could reflect in Application Designer?<br /><br />Thanks<br />Shivam<br /><br />john Rambohttps://www.blogger.com/profile/10219733514470217958noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-88252485288593336262014-10-17T07:02:33.243-07:002014-10-17T07:02:33.243-07:00@Ricky, it does sound like there is a problem with...@Ricky, it does sound like there is a problem with the JRE. The JRE used by your app server should be in $PS_HOME. I recommend reposting your question on the <a href="https://community.oracle.com/community/oracle-applications/peoplesoft_enterprise/peoplesoft_general_discussion" rel="nofollow">PeopleSoft General Discussion</a> OTN forum.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-22974787157757330462014-10-16T18:31:02.473-07:002014-10-16T18:31:02.473-07:00Hi Jim, I know this is an old post...but saw an is...Hi Jim, I know this is an old post...but saw an issue with my install...I started App and Web Servers...signed into PIA and got an error in top section of the page:<br /><br />Failed to start the Java Virtual Machine. (2,766) PT_FAV.AddToFav.OnExecute Name:getPTISSID <br /><br />The AddToFav app class has a method getPTISSID which has the this line:<br /><br />&g_sPTISSID = Hash(GetJavaClass("java.util.UIID").randomUUID().toString());<br /><br />So I'm figuring that the peoplecode is calling the java class java.util.UIID but is unable to get to the class??<br /><br />I checked the JAVA_HOME environment variable and it points to the root directory on the server where PS was installed:<br /><br />echo $JAVA_HOME<br />/usr/java/jdk1.7.0_09/jre<br /><br />Is this not correct?<br /><br />Thanks,<br />Ricky.Rickyhttps://www.blogger.com/profile/16040935040452168373noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-86247854584707050972013-05-22T17:53:23.781-07:002013-05-22T17:53:23.781-07:00Very helpful post Jim, thanks... especially that l...Very helpful post Jim, thanks... especially that line of code in your last comment. :-)Stephenhttps://www.blogger.com/profile/14204575492103539226noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-34845717686003999552013-01-28T13:10:08.284-08:002013-01-28T13:10:08.284-08:00@Brett, thanks for the update. On a positive note,...@Brett, thanks for the update. On a positive note, the Java classes required to just use the standard Java API exist in modern PeopleSoft installs, so generating a GUID is as simple as GetJavaClass("java.util.UUID").randomUUID().toString(). No extra libraries, etc.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-16109347704281860002013-01-28T13:03:49.899-08:002013-01-28T13:03:49.899-08:00Still Version 1, in case anyone comes across this ...Still Version 1, in case anyone comes across this post. Bummer.Brett Bhttps://www.blogger.com/profile/12695738994169661298noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-58914104904948739662013-01-28T12:57:49.541-08:002013-01-28T12:57:49.541-08:00@Brett, that is a good question. I have not revisi...@Brett, that is a good question. I have not revisited the alternatives since this post and related comments. My comment above contains all of the code necessary to determine the version and variant. I suggest you run that code on your server and review the results.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-65281952788600236742013-01-28T12:20:21.504-08:002013-01-28T12:20:21.504-08:00Do you know if the UuidGen hidden function is stil...Do you know if the UuidGen hidden function is still based on Variant 1? It's been a few years this this post went up, wondering if it's evolved since then.Brett Bhttps://www.blogger.com/profile/12695738994169661298noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-40756235942664779882009-08-02T22:46:03.723-07:002009-08-02T22:46:03.723-07:00@Bauke, I am always eager to motivate a fellow dev...@Bauke, I am always eager to motivate a fellow developer to learn something new. So, you read the rfc? Great job! I've read a few, mostly dealing with iCalendars, vCards, etc. I only read enough about GUID's to keep from being dangerous ;)Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-12431434553593198612009-08-02T00:54:13.887-07:002009-08-02T00:54:13.887-07:00@Jim, That's a good idea, these undocumented f...@Jim, That's a good idea, these undocumented fuctions should always be used with caution, especially when well documented alternatives are available. I learned a lot about uuid in a day, thanks.<br /><br />A few observations for curiosities sake: After reading rfc4122 I noticed the node part (last 48 bits) of the PeopleSoft uuidgen() uuid does not match my MAC-address. After changing the MAC-address in my windows VM the node part stayed the same. My linux VM with only one NIC produces 2 distinct values for the node part. Uuidgen() certainly has some odd behavior.Bauke Gehemhttps://www.blogger.com/profile/09761227759156233502noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-58908385453471326542009-08-01T12:46:04.122-07:002009-08-01T12:46:04.122-07:00@Bauke, You got me thinking some more... If a deve...@Bauke, You got me thinking some more... If a developer needs to generate a GUID, I recommend Java 1.5 or Apache Commons Id. Nevertheless, it is possible that a developer is on a pre-8.49 version of PeopleTools and cannot add additional jars to the app server's class path. In that event, a GUID created with UuidGen() and modified with PeopleCode may be a reasonable alternative, provided the GUID is for internal purposes only and is never sent to the client (browser, e-mail message, etc).<br /><br />In the use case mentioned in this blog post, the GUID is part of an IScript's URL. With this use case, I am concerned that UuidGen() GUID's would expose information about a private network on the open internet. Version 4 GUID's generated by Java do not contain MAC information.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-3076105815974110812009-08-01T09:20:06.230-07:002009-08-01T09:20:06.230-07:00@Bauke, I did some testing of my own:
Function IS...@Bauke, I did some testing of my own:<br /><br />Function IScript_HelloWorld()<br /> Local JavaObject &uuid;<br /> <br /> %Response.SetContentType("text/plain");<br /> %Response.WriteLine("PeopleCode UuidGen()");<br /> &uuid = GetJavaClass("java.util.UUID").fromString(UuidGen());<br /> %Response.WriteLine("GUID: " | &uuid.toString());<br /> %Response.WriteLine("Variant: " | &uuid.variant());<br /> %Response.WriteLine("Version: " | &uuid.version());<br /> <br /> %Response.WriteLine("");<br /> %Response.WriteLine("Java java.util.UUID");<br /> &uuid = GetJavaClass("java.util.UUID").randomUUID();<br /> %Response.WriteLine("GUID: " | &uuid.toString());<br /> %Response.WriteLine("Variant: " | &uuid.variant());<br /> %Response.WriteLine("Version: " | &uuid.version());<br /> <br />End-Function;<br /><br />Here are the results:<br /><br />PeopleCode UuidGen()<br />GUID: 30e14490-1dd2-11b2-a60c-ba71b28d2f7c<br />Variant: 2<br />Version: 1<br /><br />Java java.util.UUID<br />GUID: ec9d7c84-b6a5-411a-a0d8-ac70f30d3cf9<br />Variant: 2<br />Version: 4<br /><br /><br />Notice that UuidGen() creates a version 1 GUID. Version 1 GUID's are based on the creator's MAC address. According to <a href="http://en.wikipedia.org/wiki/Universally_Unique_Identifier#Version_1_.28MAC_address.29" rel="nofollow">this Wikipedia entry</a>, a version 1 Uuid (GUID) "reveals both the identity of the computer that generated the UUID and the time at which it did so." I've seen the UuidGen() function used in delivered PeopleCode. The use case contained several lines of PeopleCode to modify the UUID (probably to add "opacity").<br /><br />Thanks for sharing the method. Like you said, it is an option, but I'm wondering if it is an acceptable alternative if it reveals your server's MAC address.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-61060288335014392092009-07-31T23:40:44.414-07:002009-07-31T23:40:44.414-07:00I've done a little testing using an IScript.
...I've done a little testing using an IScript. <br /><br />uuidgen(): 7377431e-7e64-11de-a922-af6a6dd04438<br /><br />uuidgenbase64(): HkN3c2R+3hGpI69qbdBEOA==<br /><br />These functions are recognized by app designer's syntax highlighting.Bauke Gehemhttps://www.blogger.com/profile/09761227759156233502noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-57248886815294878382009-07-31T23:40:14.955-07:002009-07-31T23:40:14.955-07:00@Bauke, Thanks for sharing! Files in peoplecode.ja...@Bauke, Thanks for sharing! Files in peoplecode.jar are an excellent place to find undocumented methods and functions. I believe these files are auto generated, so they contain everything, documented or otherwise. I've actually seen the UuidGen function used in delivered PeopleCode, but not the base64 version. The use case for the UuidGen function had lot's of additional PeopleCode to format the GUID.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-72367533587029643842009-07-31T23:21:25.924-07:002009-07-31T23:21:25.924-07:00There are two undocumented native uuid functions: ...There are two undocumented native uuid functions: <br /><br />String UuidGen();<br />String UuidGenBase64();<br /><br />I've found them in $PS_HOME\class\peoplecode.jar\PeopleSoft\PeopleCode\Func.javaBauke Gehemhttps://www.blogger.com/profile/09761227759156233502noreply@blogger.com