PeopleCode
Encyclopedia
PeopleCode is an object-oriented proprietary (case-insensitive) language used to express business logic
Business logic
Business logic, or domain logic, is a non-technical term generally used to describe the functional algorithms that handle information exchange between a database and a user interface.- Scope of business logic :Business logic:...

 for PeopleSoft
PeopleSoft
PeopleSoft, Inc. was a company that provided Human Resource Management Systems , Financial Management Solutions , Supply Chain and customer relationship management software, as well as software solutions for manufacturing, enterprise performance management, and student administration to large...

 applications. In its fundamentals, PeopleCode syntax resembles other programming languages. Some aspects of the PeopleCode language, however, are specifically related to the PeopleTools
PeopleTools
PeopleTools is the proprietary software development environment that was created by the PeopleSoft Corporation.The PeopleTools consist of Application Designer, Application Engine, Data Mover, PeopleCode and various other developer tools.-Application Designer:...

 environment. However, the basic fundamentals of objects and classes are the same as in Java language. Definition name references, for example, enable you to refer to PeopleTools definitions, such as record definitions or pages, without using hard-coded string literals. Other language features, such as PeopleCode data type
Data type
In computer programming, a data type is a classification identifying one of various types of data, such as floating-point, integer, or Boolean, that determines the possible values for that type; the operations that can be done on values of that type; the meaning of the data; and the way values of...

s and metastrings, reflect the close interaction of PeopleTools and Structured Query Language (SQL). Dot notation
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...

, classes
Class (computer science)
In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior...

 and methods
Method (computer science)
In object-oriented programming, a method is a subroutine associated with a class. Methods define the behavior to be exhibited by instances of the associated class at program run time...

 in PeopleCode are similar to other object oriented languages, like Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

.

Supported Functions

PeopleCode supports the following types of functions:

Built-in: The standard set of PeopleCode functions. These can be called without being declared.

Internal: Functions that are defined (using the Function statement) within the PeopleCode program in which they are called.

External PeopleCode: PeopleCode functions defined outside the calling program. These are generally contained in record definitions that serve as function libraries.

External non-PeopleCode: Functions stored in external (C-callable) libraries.

In addition, PeopleCode supports methods. The main differences between a built-in function and a method are:

-A built-in function, in your code, is on a line by itself, and does not (generally) have any dependencies.

-You do not have to instantiate an object before you can use the function.

-A method can only be executed by an object (using dot notation).

-You must instantiate the object first.

Describing Application Class Structure

  • Import any classes that will be used by a class, including the superclass this class extends


Import PackageName:Superclassname;
  • A class is defined using the Class construct.


Class Classname [Extends SuperClassname]
[Method_declarations]
[Property_declarations]
[Private
[Method_declaration]
[Instance_decalarion]
Constant declaration
End-class;
  • The first set of declarations are the properties and methods that are part of the public, external interface.


Property datatype PropertyName [get][set];
Method MethodName ([parameter_list])
  • The private instance variables, constants, and the methods are declared following the keyword Private.


Private
Instance DataType &InstanceName;
Constant &Constant = {Number | String | True | False | Null };
  • The keyword end-class follows the declarations of properties, methods, instances, and constants.

  • After the end-class keyword and before get and set definitions or method definitions, declare any variable and functions that will be used by methods.

  • Get and set methods corresponds to properties declared with the get and set keywords.

  • Use a get method definition to execute PeopleCode that will return a value.


get Propertyname
Return &Value;
end-get
  • Use a set method definition to execute PeopleCode that will change a value.


set PropertyName

end-set;
  • Method definitions are similar to function definitions.


method Methodname
statements;
end-method;
  • A special case of a method definition is the constructor.

  • A constructor has the same name as the class and will always run when the class is instantiated.

  • A class that does not extend some other class does not need any constructor.

  • A class that does extend another class must have a constructor, and in the constructor, it must initialize its superclass.

Executing SQL in PeopleCode

  • Where a SQLExec(built-in function) only delivers a single row, using the SQL class you can retrieve and process multiple rows.

  • Instantiate a SQL object with the CreateSQL built-in function.
    • Use CreateSQL("SQLString") when you pass a text string to your SQL object.
    • Use GetSQL(SQL.sqlname) when you get the SQL from a SQL definition.


&SQL = CreateSQL("SQL Statement",[bind values]);

You can also choose to omit the values for the bind variables and supply those values later.
For Insert, Update, or Delete commands these values would be supplied using Execute method.
(If you supply all the necessary input values, the SQL is executed immediately.)

&SQL = CreateSQL("SQL Statement");
&SQL.Execute([bind_values]);
  • For a SQL object containing a Select statement, the Fetch method is used to retrieve the next row from the cursor.

External links

  • For further documentation on PeopleCode
  • http://download.oracle.com/docs/cd/E05317_01/psft/html/docset.html (Version 8.49)


  • http://download-east.oracle.com/docs/cd/B31274_01/psft/html/docset.html (Version 8.48)
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK