Understanding Standard Methods

A method is a definition that performs a specific function on a component interface at runtime. Each standard method is added by default when the component interface is created and is available in PeopleCode and other programming languages. Like properties, methods are saved as part of a component interface definition. Two main types of methods are available: standard methods and user-defined methods.

Standard Methods Description, Programming Syntax

Cancel

Backs out of the current component interface, canceling any changes made since the last save. This is equivalent to clicking the Return to Search button online. Returns True on success, and False on failure.

Use these interfaces to call with other programming languages.

  • Java: boolean cancel()

  • C++: BOOL <CI_NAME>_Cancel(HPSAPI_<CI_NAME> hObj)

Create

Creates a new instance of a component interface. This is equivalent to creating a new record in Add mode online. Returns True on success, and False on failure.

Use these interfaces to call with other programming languages.

  • Java: boolean create()

  • C++: BOOL <CI_NAME>_Create(HPSAPI_<CI_NAME> hObj)

Find

Performs a partial key search for a particular instance of a component interface, using the search keys at level 0. Returns a collection of component interface instances which match the search criteria. If no component interface instances match the search criteria, the count on the collection is zero.

Use these interfaces to call with other programming languages.

  • Java: <CI_NAME>Collection find()

  • C++: HPSAPI_<CI_NAME>COLLECTION <CI_NAME>_Find(HPSAPI_<CI_NAME> hObj)

Get

Retrieves a particular instance of a component interface. This is equivalent to opening a record in Update/Display or Correction mode when online with a PeopleSoft application. Returns True on success, and False on failure.

Use these interfaces to call with other programming languages.

  • Java: boolean get()

  • C++: BOOL <CI_NAME>_Save(HPSAPI_<CI_NAME> hObj)

Save

Saves an instance of a component interface. This is equivalent to clicking the Save button in the online system. Returns True on success, and False on failure. You should cancel after a save.

Use these interfaces to call with other programming languages.

  • Java: boolean save()

  • C++: BOOL <CI_NAME>_Save(HPSAPI_<CI_NAME> hObj)

GetPropertyByName

Returns the value of a property that is specified by name. This function typically is used only in applications that cannot get the names of the component interface properties until runtime.

Use these interfaces to call with other programming languages.

  • Java: Object getPropertyByName(String str)

  • C++: HPSAPI_OBJECT <CiCollectionItem>_GetPropertyByName(HPSAPI_<CI_COLLECTION_ITEM> hColItem, LPTSTR Name)

SetPropertyByName

Sets the value of a property that is specified by name. This function typically is used only in applications that cannot set the names of the component interface properties until runtime.

Use these interfaces to call with other programming languages.

  • Java: long setPropertyByName(String str, Object o)

  • C++: PSI32 <CiCollectionItem>_SetPropertyByName(HPSAPI_<CI_ COLLECTION_ITEM> hColItem, LPTSTR name, HPSAPI_OBJECT Value)

GetPropertyInfoByName

(In PeopleCode, CompIntfPropInfoCollection)

Returns specific information, such as length, about the definition of a property that is specified by name. This function typically is used only in applications that cannot get the names of component interface properties until runtime or by applications that need to provide a dynamic list of values that would normally be found in prompt tables.

Use these interfaces to call with other programming languages.

  • Java: IcompIntfcPropertyInfo getPropertyInfoByName(String name)

  • C++: HPSAPI_COMPINTFCPROPERTYINFO<CiPropOrItem>_GetPropertyInfoByName(HPSAPI_<CIPROPORITEM> hPropOrItem, LPTSTR name)

    where CiPropOrItem is the name of either a property or an item in a collection.

By default, each component interface is created with four standard methods—Cancel, Find, Get, and Save. Additionally, the Create standard method is generated if Create keys have been added to the component interface.

Example for GetPropertyInfoByName

The GetPropertyInfoByName method returns an object containing the property information. Here is a Java example that calls GetPropertyInfoByName:

IcompIntfcPropertyInfo oCompIntfcPropertyInfo
oCompIntfcPropertyInfo = oCI.getPropertyInfoByName(tempName);
System.out.println(oCompIntfcPropertyInfo.getName());
if (!oCompIntfcPropertyInfo.getIsCollection()) {
  System.out.println("\t Format = " + oCompIntfcPropertyInfo.getFormat());
    System.out.println("\t Type = " + oCompIntfcPropertyInfo.getType());
}
System.out.println("\t Is Required = " + oCompIntfcPropertyInfo.
   getRequired());
System.out.println("\t Is Collection? = " + oCompIntfcPropertyInfo.
   getIsCollection ());
System.out.println("\t Is Read Only? = " + oCompIntfcPropertyInfo.
   getIsReadOnly());
System.out.println("\t Is Get Key? = " + oCompIntfcPropertyInfo.getKey());
System.out.println("\t Label Long = " + oCompIntfcPropertyInfo.
   getLabelLong());
System.out.println("\t Label Short = " + oCompIntfcPropertyInfo.
   getLabelShort());
System.out.println("\t Length = " + oCompIntfcPropertyInfo.getLength());
System.out.println("\t Name = " + oCompIntfcPropertyInfo.getName());
System.out.println("\t Is Xlat? = " + oCompIntfcPropertyInfo.getXlat());
System.out.println("\t Is Yesno? = " + oCompIntfcPropertyInfo.
   getYesno());

Note:

When creating a new component interface, you must save the component interface before the standard methods are created. PeopleSoft Application Designer adds the standard methods upon the first save of a new component interface.