Application Classes in Peoplesoft - Reference sheet

Application Classes in Peoplesoft – Reference sheet / Points remember

 

  • Importing packages or classes

<Pacakge name>:<Subpacakge name>:<…>:<Class name or wild card>

 

  • Class Extensions represents the “is-a” relationship.

      When a class extends another class, it’s called a subclass of that class.

 

  • No Multiple inheritances or Concept of interface in Application classes.

 

  • Instance variables in the class are accessible in all the objects of that class.

 

  • Application programs generally pass parameters by value, which is not the same as for existing functions.

 

  • Parameter passing with object data types is by reference.

 

  • When the objects are passed to method and it reassign the object with new object it will not reflected in the calling method.

 

  • Application Programs use the out specifier to pass a parameter by reference.

Method increment (&Value as number out); rem passed by reference.

 

  • Create is the key word used to create the class object.

            Local MyObjectClass &o1 = Create MyobjectClass (‘A’);

            Local MyObjectClass &o1 = Create Test: Examples: MyobjectClass (‘A’);

 

  • If parameter in a method is having out specifier then parameter should be a variable and cannot be constant.

 

  • A class that extends another class must have constructor, and in the constructor it must initialize its super class.

          To initialize a superobject, an instance of the superclass is assigned to the keyword %Super in the constructor for the subclass.

 

Class Example extends ExampleBase

    Method Example ();

           End-class;

               

           Method Example         

              %Super = create ExampleBase ();

              &BaseStrin = &currentBaseString;

             &Slashstring = &BaseString;                

          End-Method;

 

  • Before the constructor runs, the instance variables for the class are set by default takes on their declared types.

 

  • An application class doesn’t have destructors, that is, a method called just before an object is destroyed. The People code runtime environment generally cleans up any held resources.

 

  • When application class properties and instance variables are used as the argument to functions or methods, they are always passed by value, never by reference.

 

  • %This is can be used to self reference. This is to refer the same object.

 

  • %Super = %This – this should never be done it will go to an infinite loop.

 

  • Import Fruit:* - imports all the classes in the application package.

 

  • Import statements are validated when you save the Peoplecode.

 

  • Peoplesoft recommends that you use read-write or ready only properties instead of creating methods name GetXxx and SetXxx.

 

  • Getter and Setter syntax

Get Propertyname

 ---

End-get;

 

  • External Functions Declarations are allowed in application classes, in the global and component variable declarations, after the class declaration (after the end-class) and before the method definition.

 

  • %Super is only required to access superclass members that are hidden by overriding members in the current time.

 

  • Downcasting is the process of determining if an object is of a particular subclass type. If the object has that subtype (either the object is of that subtype, or is a subtype of it), a reference to the subject is returned, otherwise Null is returned. In either case, the type of the resulting value is compatible with the name subclass type.

 

  • Class Fruit

          Property number fruitcount;

End-class;

           

           Class Banana extends Fruit

              Property number BananaCount;

          End-Class; 

 

      Local Banana &MyBanana = Create Banana ();

     Local Fruit &MyFruit = &MyBanana;   /* Okay, Banana is a subtype of Fruit */

    Local number &num = & MyBanana.BananaCount;

  

         &MyBanana = &MyFruit as Banana;   /* &MyFruit is currently a Banana at runtime */

        &Num = (&MyFruit as Banana).BananaCount; /* same as &MyBanana.BananaCount */

        &MyFruit = Create Fruit ();

   &MyBanana = &MyFruit as Banana; /* Assigns Null - &Myfruit isn’t a Banana */

 

  • /* */ and /**  */ comments are allowed. Comments enclosed in  /** -- */ are potentially be used to generate API documentation.

 

  • Method header comments are uses some tags which helps in API documentation

Some of the tags are

·        @Parameter N

·        @exception name

·        @return type

Class header comments contains tags

·        @version X (value of version)

·        @author  name

 

Example

 

/**

 * Class header comments

* @Version 1.0

* @author Ganesh

*/

 

Import PWWPack: ExampleBase

 

Class Example extends ExampleBase

   Method Example ();                                     /*Constructor*/

   Method NumToStr (&Num As number) Returns string ();

   Method AppendSlash ();

   Property number SlashCount get;                   /*Get properties */

   Property number ImportantDayofWeek get set; /*Get and set properties */

   Property string Slashstring readonly;   /* values can be assigned in constructor */

   Property date ImporantDate;

Private

   Method NextDayofWeek (&Dow As number) returns date;

   Constant &Sunday = 1;              /*Constants */

   Instance string &Basestring;      /* Instance variables are like static variable */

End-class;                                                                                                           

 

Declare function getusername Peoplecode FUNCLIB_PP.STRING_FUNCTIONS FieldFormula;

 

/**

* Method header comments example

* @param Dow is a number parameter

* @exception it throws Invalid day exception if the number is negative.

* @return   it is returns the date as of that week.

*/

Method NextDayofWeek  (&Dow)

      ---------

    ---------

End-method;

 

/* get block */

 

Get SlashCount

  Return (Slashcount);

End-get;

 

 

- Posted by Ganesh

 

 

 

1 comments:

  1. Mayra said,

    Currently attempt generates an Excel file from an engine application, I ejcutao only two lines of code:
    &oWorkApp = CreateObject("COM", "Excel.Application");
    &oWorkApp.DisplayAlerts = "False";
    I get the error:

    Error de automatización OLE en Excel.Application.DisplayAlerts: ObjectSetProperty: No se puede asignar la propiedad DisplayAlerts de la clase Application.. (180,161) REPRIES.MAIN.GBL.default.1900-01-01.Step01.OnExecute PCPC:396 Statement:5
    Please tell me that I need to run my process

    on June 24, 2015 at 10:37 AM