Tuesday, December 4, 2012

Calling java.util and java.lang.System packages in PeopleSoft




This is a basic program which would call the packages java.util.* and java.lang.System packages in peoplesoft PeopleCode using GetJavaClass function:



Local string &userhome = GetJavaClass("java.lang.System").getProperty("user.home");

Local string &lng = GetJavaClass("java.lang.System").getProperty("user.language");

Local string &username = GetJavaClass("java.lang.System").getProperty("user.name");


Local string &osname = GetJavaClass("java.lang.System").getProperty("os.name");


Local string &osversion = GetJavaClass("java.lang.System").getProperty("os.version");

Local string &timezone = GetJavaClass("java.util.TimeZone").getDefault().getDisplayName();

Local string &country = GetJavaClass("java.lang.System").getProperty("user.country");


MessageBox(0, "", 0, 0, "The os name and version is " | ": " | &osname | "-" | &osversion);

MessageBox(0, "", 0, 0, "The user home-path is " | ": " | &userhome);

MessageBox(0, "", 0, 0, "The default language is " | ": " | &lng);

MessageBox(0, "", 0, 0, "The default user is " | ": " | &username);

MessageBox(0, "", 0, 0, "The default timezone is " | ": " | &timezone);

MessageBox(0, "", 0, 0, "The default country is " | ": " | &country);



The following would produce the output:



PeopleTools 8.50 - Application Engine
Copyright (c) 1988-2012 PeopleSoft, Inc.
All Rights Reserved


The os name and version is : Windows 2003-5.2 (0,0)
 Message Set Number: 0
 Message Number: 0
 Message Reason: The os name and version is : Windows 2003-5.2 (0,0) (0,0)

The user home-path is : C:\Documents and Settings\Administrator (0,0)
 Message Set Number: 0
 Message Number: 0
 Message Reason: The user home-path is : C:\Documents and Settings\Administrator (0,0) (0,0)

The default language is : en (0,0)
 Message Set Number: 0
 Message Number: 0
 Message Reason: The default language is : en (0,0) (0,0)

The default user is : Administrator (0,0)
 Message Set Number: 0
 Message Number: 0
 Message Reason: The default user is : Administrator (0,0) (0,0)

The default timezone is : GMT+05:30 (0,0)
 Message Set Number: 0
 Message Number: 0
 Message Reason: The default timezone is : GMT+05:30 (0,0) (0,0)

The default country is : US (0,0)
 Message Set Number: 0
 Message Number: 0
 Message Reason: The default country is : US (0,0) (0,0)
Application Engine program TST_APPENGIN ended normally


2 comments:

FloppySnail said...

Thanks a lot for this lines.

peterparker - Servant of BHAGWAN PARASHURAMA said...

@FloppySnail:

Thanks a lot for your time to read this and comment :)