This chapter discusses how to:
Create a component interface definition.
Use component interface keys, properties, collections, and methods.
Validate the component interface.
Set component interface security.
Test the component interface.
Understand runtime considerations.
Because each component interface refers to a single component, you must know the structure of the component for which you’re constructing a component interface. You can use an existing component within your application or create a new one for the sole purpose of constructing a component interface. Many parts of the component interface, such as the keys, are created based on settings in the referenced component.
This section discusses how to create a new component interface.
To create a new component interface:
Select Component Interface from the New dialog box.
Select the component on which this component interface will be based.
After you select the appropriate component, you see a message asking if you want the fields exposed in the selected component to become the default properties of the component interface.
Note. Not all fields on the component interface can have automatic defaults created for them.
Click Yes to confirm the default property definitions or No if you don’t want any properties initially created.
If you elect to have the property definitions automatically defaulted by the system, then all properties that appear on the pages of the underlying component are added to the component interface. Even though the system adds the default properties, you may need to move other properties into the component view for the component to work.
An untitled component interface appears, showing the Get keys and Find keys. Create keys are produced only if the underlying component is able to run in Add mode (the example preceding this procedure does not have Create keys, because the search record of the underlying component cannot run in Add mode). Application Designer generates the keys for you as you drag definitions.
The standard methods Cancel, Find, Get, and Save are automatically created. The Create method is not automatically created unless the component supports the Add mode.
Note. You can begin adding properties to a new component interface at any point. However, you cannot add any user-defined methods to the component interface until you have saved the component interface.
Save the component interface.
Once you have saved the component interface, you can further define user-defined methods.
To be able to set automatic defaults for fields in the new component interface, the system needs the properties to be of a specific field or page control type.
The fields should be of the following types:
The field should be one of the following page control types:
The field cannot be invisible and should not be the same as the immediate parent's key field.
Collections must have at least one child property that satisfies the field or page control criteria for defaulting the field. Collections with no properties are not added.
For a field on a secondary page to be selected for the default properties process, it must satisfy all the criteria for field type and page control and must be at the same level as the host page.
Additionally, the component tree that a component interface uses to order the properties lists the fields in the record based on their order in the record definition and not the order of the fields on the page. If the component tree lists the fields of a record based on the page, the properties of the component interface will reflect that order.
Like every other definition in PeopleTools, component interfaces must have unique names. The naming of component interfaces should be consistent and systematic. Also, the name should not be changed once the component interface is part of a production system—other applications depend on a consistent name with which to reference the component interface.
If you are changing the structure of a component interface such that an existing program can no longer access it correctly, create a new component interface rather than updating the existing one. There is no version property on a component interface, so if you must create a new version of a delivered component interface, adhere to a standard naming guideline to avoid confusion. A suggested naming guideline is:
LOCATION (original component interface).
LOCATION_V2 (version two of the component interface).
This applies to component interfaces built from components that are already attached to one or more menus.
To associate a component interface with a menu:
Select File, Open from the Application Designer menu to open an existing component interface.
Select File, Definition Properties from the Application Designer menu.
The Definition Properties dialog box appears.
Select the appropriate menu name on the General tab for this component interface.
Note. Associate a menu with a component interface only when there is PeopleCode in the component that uses the %Menu system variable.
You expose fields from a component in the component interface by dragging a record field or a scroll from the component view into the component interface view. However, some forethought is required before exposing a component as a component interface. You need to have a thorough understanding of the underlying component so that you expose fields that are required in the external system. For example, if the component has a field called SSN, you need to be sure that the SSN field is required before exposing it to the external system. Expose only those properties that are necessary.
The component view displays fields that are available in the component buffer at runtime. For example, if a record containing 10 fields has only 3 fields included on a page, then the component view will list only those 3 fields.
The first time that you drag a scroll from the component view to the component interface view, the system uses the following rules to determine what properties to expose:
Keys are exposed only at the highest-level collection in which they first appear.
In some cases, this is not appropriate. When an effective-dated component that has the same level-zero and level-one record is exposed through a component interface, it should be exposed the same way in which it appears on a page in the component. In this case, only one key field typically appears at level zero and the effective-date keys appear at level one. The component interface wrapper should expose the page in the same fashion—removing keys that do not appear in the level-zero scroll from the component interface top-level collection and manually adding keys that appear in level-one scroll to the second-level collection.
Typically, you do not want to expose Get keys or Create keys as properties, because these are set before a Get or Create operation and might be inadvertently changed.
Make sure that you do not delete all the properties within the collection; that would result in an empty collection. If such empty collections exist, remove them; otherwise, they appear with X in the component interface view.
If your page does not support Add mode, then you should not expose the level-zero record of the component, because it contains data that is not specific to the component interface that you are creating.
Do not expose fields that are not visible in the component view.
The component optimization code might eliminate unused fields from its buffers, which results in an error when that field is accessed by the component interface.
This section discusses how to add and delete keys.
The following table shows the three types of component interface keys:
Key Type |
Key Characteristics |
These keys automatically map to search key fields in the search record for the underlying component. You must change Get keys only if you modify the keys of the component after you create a component interface. |
|
These map to both search key fields and alternate search key fields in the search record for the underlying component. You may remove any Find keys based on alternate search key fields that you don’t want to make available for searching. |
|
If the underlying component allows the Add action, then Create keys are generated for the component interface automatically. They map to fields marked as Srch (search) in the search record for the component (or the add search record, if one is specified). |
Keys are created automatically when you create a component interface. Typically, you must manually add keys only if new search key fields are added to the underlying component after the creation of the component interface. However, you might want to modify the Find keys—either to restrict a user from searching on a particular key or to add an alternate search key that didn’t exist when the component was created.
Component interface keys are based only on the search key fields and alternate search key fields that are designated as list box items in the search record of the underlying component. When you create the component interface, the keys are automatically generated from all key fields that qualify.
Each search key field produces a Get key and a Find key.
Each search key field also produces a Create key if the underlying component allows Add mode.
Each alternate search key field produces a Find key.
Valid Conditions for Modifying Keys
The following conditions are valid for modifying keys.
You can add or delete a Find key if it’s based on an alternate search key field.
You can add any type of key based on a qualifying search key field in the component, if it isn’t already the basis of an existing key of the same type.
This is necessary only if a new search key field is added to the component after you create the component interface.
You can delete any type of key if its underlying search key field meets one of these criteria:
It is no longer defined as a search key field.
It is no longer designated as a list box item.
It has been deleted from the component.
Note. An X icon precedes a name in the component interface view if the field underlying a component interface key no longer qualifies as a key. Remove keys (or any other properties) that are marked with this symbol to ensure proper operation of the component interface.
To add a key:
Expand the search key collection (the first collection) in the component view.
Drag the key to the component interface view.
To delete a key:
Select the key in the component interface view.
Press the Del key.
This section discusses standard properties how to:
Create user-defined properties.
Delete properties.
Rename properties.
Make properties read-only.
Name component interface properties.
Standard properties do not appear in the component interface view in Application Designer. The following tables name and define the standard properties, and list the interfaces for PeopleCode, Java, C++, and Visual Basic.
This table contains the component interface properties:
The CompIntfPropInfoCollection object supports the following properties:
PropertyName |
Description |
This property returns the name of the object executing the property as a string. This property is read-only.
|
|
This property returns the Record Name associated with the object executing the property. This property is read-only.
|
|
This property returns the Field Name associated with the object executing the property. This property is read-only.
|
|
This property returns the record field LongName value as a string. If there is a component override for this value, it is not included. This property is read-only.
|
|
This property returns the record field ShortName value as a string. If there is a component override for this value, it is not included. This property is read-only.
|
|
This property returns True if the object executing the property is a data collection, False otherwise. If IsCollection is True, other field-oriented properties like Required, Type, Xlat, YesNo, Prompt and Format are undefined. If IsCollection is False, the object represents a field and all the previous properties are defined as described. This property is read-only.
|
|
This property returns the field type, as a number, of the object. See CompIntfPropInfoCollection Object Properties. This property is read-only.
|
|
This property returns the field type, as a number, of the object. This property is read-only.
|
|
This property returns the field format for the object executing the property (that is, name, phone, zip, SSN, and so on) as a number. This property is read-only. See CompIntfPropInfoCollection Object Properties.
|
|
This property returns True if the object executing the property is a key, False otherwise. This property is read-only.
|
|
This property returns True if the object executing the property is a required property, False otherwise. This property is read-only.
|
|
This property returns True if the object executing the property is associated with an XLAT table, False otherwise. This property is read-only.
|
|
This property returns True if the object executing the property is associated with the Yes/No table, False otherwise. This property is read-only.
|
|
This property returns True if the object executing the property is associated with a prompt table, False otherwise. This property is read-only.
|
|
This property returns the length of the object executing the property. This property is read-only.
|
|
This property returns the decimal position for the object executing the property. This property is read-only.
|
|
This property returns True if the property marked read-only in the component interface definition; False otherwise. This property is read-only.
|
|
This property returns True if the object executing the property is an alternate key, False otherwise. This property is read-only.
|
|
This property returns True if the object executing the property is associated with a list box, False otherwise. This property is read-only.
|
Example of PropertyInfoCollection
Here is a Java example that calls PropertyInfoCollection:
IcompIntfcPropertyInfoCollection oLO_PropInfoColl IcompIntfcPropertyInfo oLO_PropInfoItem oLO_PropInfoColl = oCI.getPropertyInfoCollection(); for (int I=0; I < oLO_PropInfoColl.getCount(); I++) { oLO_PropInfoItem = oLO_PropInfoColl.item(i); System.out.println("\t Name = " + oLO_PropInfoColl.getName()); System.out.println("\t Record Name = " + oLO_PropInfoColl.getRecordName()); System.out.println("\t Field Name = " + oLO_PropInfoColl.getFieldName()); System.out.println("\t Label Long = " + oLO_PropInfoColl.getLabelLong()); System.out.println("\t Label Short = " + oLO_PropInfoColl.getLabelShort()); System.out.println("\t IsCollection = " + oLO_PropInfoColl.getIsCollection()); System.out.println("\t Type = " + oLO_PropInfoColl.getType()); System.out.println("\t OAType = " + oLO_PropInfoColl.getOAType()); System.out.println("\t Format = " + oLO_PropInfoColl.getFormat()); System.out.println("\t Is Get Key? = " + oLO_PropInfoColl.getKey()); System.out.println("\t Is Required = " + oLO_PropInfoColl.getRequired()); System.out.println("\t Is Xlat? = " + oLO_PropInfoColl.getXlat()); System.out.println("\t Is Yesno? = " + oLO_PropInfoColl.getYesno()); System.out.println("\t Prompt = " + oLO_PropInfoColl.getPrompt()); System.out.println("\t Length = " + oLO_PropInfoColl.getLength()); System.out.println("\t DecimalPosition = " + oLO_PropInfoColl. getDecimalPosition()); System.out.println("\t Is Read Only? = " + oLO_PropInfoColl. getIsReadOnly()); System.out.println("\t Is Alt Key? = " + oLO_PropInfoColl.getAltkey()); System.out.println("\t Is ListBox item? = " + oLO_PropInfoColl. getListboxitem());
Object Adapter
The name of the property is OAType, and it holds the value of the object adapter type. Exposing this property and supplying the associated methods enables you to detect possible data type mismatches between the database and the component interface object.
Returns the object adapter type. |
|
Returns the type of the property of a particular database field. |
For example:
public static void printPropertyType(String propName, ICompIntfcPropertyInfo iPropertyInfo) { String strOAType = null; String strDBType = null; try { switch ((int)iPropertyInfo.getOAType()) { /* Object Adapter Type == 0 */ case CIPropertyTypes.PSPROPERTY_OA_TYPE_BOOL: strOAType = "BOOL"; break; /* Object Adapter Type == 1 */ case CIPropertyTypes.PSPROPERTY_OA_TYPE_NUMBER: strOAType = "INTEGER"; break; /* Object Adapter Type == 2 */ case CIPropertyTypes.PSPROPERTY_OA_TYPE_FLOAT: strOAType = "FLOAT"; break; /* Object Adapter Type == 3 */ case CIPropertyTypes.PSPROPERTY_OA_TYPE_STRING: strOAType = "STRING"; break; } switch ((int)iPropertyInfo.getType()) { /* Database Type == 0 */ case CIPropertyTypes.PSPROPERTY_DB_TYPE_CHARACTER: strDBType = "CHARACTER"; break; /* Database Type == 1 */ case CIPropertyTypes.PSPROPERTY_DB_TYPE_LONG_CHARACTER: strDBType = "LONG_CHARACTER"; break; /* Database Type == 2 */ case CIPropertyTypes.PSPROPERTY_DB_TYPE_NUMBER: strDBType = "NUMBER"; break; /* Database Type == 3 */ case CIPropertyTypes.PSPROPERTY_DB_TYPE_SIGNED_NUMBER: strDBType = "SIGNED NUMBER"; break; /* Database Type == 4 */ case CIPropertyTypes.PSPROPERTY_DB_TYPE_DATE: strDBType = "DATE"; break; /* Database Type == 5 */ case CIPropertyTypes.PSPROPERTY_DB_TYPE_TIME: strDBType = "TIME"; break; /* Database Type == 6 */ case CIPropertyTypes.PSPROPERTY_DB_TYPE_DATETIME: strDBType = "DATETIME"; break; } } catch (Exception e) { e.printStackTrace(); } System.out.println("\n" + propName + " Object Adapter Type is: " + strOAType + ", Database Type is: " + strDBType); }
Component Interface Collection Property
This table contains the component interface collection property Count.
Name |
Description, Programming Syntax |
Returns the number of items in a collection.
|
This table contains the data item property ItemNum:
Name |
Description, Programming Syntax |
Returns the position of the row within the given collection of a DataRow.
|
Note. The Component Interface classes contain information about PropertyInfo properties and related PeopleCode.
User-defined properties are those properties on the underlying component that are exposed through the component interface. User-defined properties are derived from the component to which the component interface is associated and must be added manually. They are the specific record fields that you expose to an external system with the component interface. You create user-defined properties in addition to the standard properties to enable data manipulation of the component. When you create a new component interface, if you accept the default properties, user-defined properties are created automatically for each field displayed to the user on the underlying component.
User-defined properties are the points where the component and the underlying database are exposed to the external system. This is the means that component interfaces use to add or change fields and data in the database.
To create a user-defined property, drag a record, field, or scroll from the component view to the component interface view.
It does not matter where you insert the definition in the component interface view. When the component interface is opened, the system automatically converts the field or record into a component interface property and places it in the appropriate place in the list of properties. Also, when you drag a definition from the component view into the component interface view, all “child” definitions are brought into the component interface automatically. Once these child properties are added to the component interface, you can remove each property individually, if desired.
Dragging a key from the search records, which precede the level-zero record in the page view, adds a key to all appropriate key collections (Get, Create, and Find) in the component interface. Because appropriate keys are added automatically when a component interface is first created, you typically must add keys only if the new keys are added to the underlying component after the creation of the component interface.
Select the property to be deleted.
Either press the Del key on the keyboard, or right-click the key and select Delete.
Standard Windows behavior is employed for selecting multiple properties using the Shift and Ctrl keys.
Property names are automatically generated according to the corresponding fields from the component. If these names are cryptic, you might want to rename these properties to explain them better. Renaming a property does not change the field that the property references.
Double-click the property name or right-click the property name and select Edit Name from the pop-up menu.
Enter the new property name.
Programs accessing this component interface must reference the new property name. For example, if SDK_NAME was changed to NAME, programs must use NAME instead of SDK_NAME.
Add any comments that might be helpful.
Select the Read-Only check box to make this property read-only.
If this property if for a mobile application, select a radio button that sets the persistence of the property.
Send Updates is the default behavior for a mobile property.
Any changes or additions to this property on a mobile instance are synchronized to the server.
If a mobile property is set to Do not Send Updates, this property is not synchronized up to the server, but the value is maintained on the device.
A Derived property is used only at mobile runtime. Any values set or added to this property exist only for the runtime life of the object. There is no persistence of this data on the device, so it is subsequently never uploaded to the server.
Note. Application Designer generates an error message if it detects that a component interface has properties that resolve to the
same name when creating, saving, or opening a given component interface.
For example, NAME1 and NAME_1 both resolve to the same name when PeopleSoft APIs are built. The set and get functions that are generated for the properties RTE_CNTL_TYPE1 and RTE_CNTL_TYPE_1 are:
public String getRteCntlType1()
public void setRteCntlType1(String inRteCntlType1)
This results in a compile error. To fix this condition, name the properties so that they do not resolve to the same name.
Each component interface is isolated and unaware of the other component interfaces in the system. In order to access and update information from other component interfaces, references establish relationships between component interfaces.
Create a reference property in one component interface to access data exposed in another component interface. For example, the Customer object and the component interface exposing its properties include properties such as the customer’s name, address, and telephone numbers. Another object, Contact, includes data associated with all contacts in the system. The link between a specific customer and its associated contacts is owned by the Contact record, not the Customer record.
Therefore, to access contact data, the Customer component interface needs a reference property referring to the Contact component interface. To update contact data from the Customer component interface, the reference must include a valid reference path and reference backpointer to the customer ID.
Access the Create Reference dialog box by right-clicking the property and selecting Create Reference.
The Create Reference dialog box has the following fields:
You can make any property read-only. At runtime, the value of a read-only property can be read but not updated.
To make a property read-only:
Select the property.
Select Edit, Toggle Read Only Access from the Application Designer menu.
A Y appears in the Read Only column of the component interface view corresponding to each property that you selected to be read-only.
Note. You can double-click the icon of any existing user-defined property to edit its name or comment or to toggle read-only access.
A collection is a property that points to a scroll, rather than a field, in the underlying component for a component interface. A collection groups multiple fields in a scroll. All the fields in the scroll are mapped to a property. These properties are part of the collection.
You create collections the same way you create properties—drag the scroll from the component view into the component interface view. Consider these points when creating collections:
When dragging a scroll into the component interface view, all child scrolls come with it.
This is the same behavior that you would expect when creating a property. Child properties are always added automatically when you drag a field from the component view to the component interface view. After the property or collection has been created, you can delete individual child properties or collections manually, if necessary.
When dragging a scroll into the component interface view, all record fields contained in that scroll come with it—not just those from the record that defines the scroll.
The fields from all records at that scroll level are exposed as part of the same collection.
Keys that appear in parent and child scrolls are not added to child collections.
For the component interface to function as expected, the keys must remain synchronized at all levels of the component. Having keys at lower levels makes it possible to compromise this synchronization. Therefore, lower-level keys are not introduced into the component interface and are not exposed to the user because those keys have already been set at the parent level.
When you drag a child scroll into the component interface view, parent collections are created automatically.
For example, if you drag just the level-two scroll from the component view into the component interface view, a level-zero collection and a level-one collection are created automatically in the component interface. This hierarchy of collections is necessary so that it’s possible to navigate to the child collection at runtime.
This section discusses how to:
Enable and disable standard methods.
Create user-defined methods.
The session functions and methods connect to a session on a Application server. This connection must be made before you can use the component interface methods.
Component Interface Session Functions
This table contains the component interface session function createSession:
Name |
Description, Programming Syntax |
(In PeopleCode, &session = %session) |
Returns a session object.
|
Component Interface Session Methods
This table contains the component interface session methods:
Name |
Description, Programming Syntax |
(not used in PeopleCode) |
Connects to the application server. Use these interfaces to call with other programming languages.
|
Returns a reference to a Component Interface. getCompIntfc also checks to see if the given user that is connecting has the appropriate security to access the component interface. Use these interfaces to call with other programming languages.
|
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. There are two main types of methods: standard methods and user-defined methods.
Standard Methods |
Description, Programming Syntax |
Backs out of the current component interface, canceling any changes made since the last save. 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.
|
|
Creates a new instance of a component interface. 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.
|
|
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.
|
|
Retrieves a particular instance of a component interface. 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.
|
|
Saves an instance of a component interface. Equivalent to clicking the Save button in the online system. Returns True on success, and False on failure. You should do cancel after a save. Use these interfaces to call with other programming languages.
|
|
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.
|
|
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.
|
|
(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.
|
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.
The first item in a component interface collection is always indexed as item 1 from PeopleCode and COM programs, which is consistent with other PeopleCode processing. From Java and C++ programs, this item is indexed as item 0.
Component Interface Collection Properties
This table contains the component interface collection properties:
Data Collection Method |
Action, Usage |
Returns the number of items in a collection. Use these interfaces to call with other programming languages.
|
|
(not used in PeopleCode) |
Returns the property in the collection. It takes Name as a parameter. Use these interfaces to call with other programming languages.
|
Inserts a new item. This is equivalent to clicking the Add button to insert a new row when online. It takes Index as a parameter and follows the same conventions for performing business rules (PeopleCode) as the online system. Use these interfaces to call with other programming languages.
|
|
Deletes the item that is designated by Index. This is equivalent to clicking the Delete button to delete the selected row when online. Use these interfaces to call with other programming languages.
|
|
Takes an item number as a parameter and returns a definition of the type that is stored in the specified row in the collection. For example, if the collection is a data collection, the return value is a DataRow. If the return value is a PropertyInfoCollection, then the return value is a PropertyInfo definition, and so on. Use these interfaces to call with other programming languages.
|
|
Identifies and finds a specific item, based on keys. The keys vary according to the design of the collection. Use these interfaces to call with other programming languages.
|
|
Returns the current effective DataRow in the collection. The behavior is consistent with effective date rules that are used online. This method works with effective-dated records only. Use these interfaces to call with other programming languages.
|
|
(CurrentItemNumber) |
Returns the item number of the current effective DataRow in the collection. The behavior is consistent with effective date rules that are used online. This method works with effective-dated records only. Use these interfaces to call with other programming languages.
|
Returns the DataRow that would be effective for the specified date and sequence number. This is a more general case of the GetCurrentItem function, which returns the definition that is effective at this moment. This method works with effective-dated records only. Use these interfaces to call with other programming languages.
|
|
Returns the item number of the DataRow in the collection that would be effective for the specified date and sequence number. This is a more general case of the GetCurrentItemNum function, which returns the number of the definition that is effective at this moment. This method works with effective-dated records only. Use these interfaces to call with other programming languages.
|
You can control whether standard methods are accessible at runtime.
To enable or disable standard methods:
Select File, Definition Properties from the Application Designer menu.
The Definition Properties dialog box appears.
Select the Standard Methods tab.
You can enable or disable any of the standard methods selecting the corresponding check box. Doing so determines whether the method is available at runtime when the component interface is accessed. The Create option is available only if the component interface has Create keys.
This section discusses how to create user-define methods.
To create a user-defined method:
Right-click anywhere in the component interface view.
Select View PeopleCode from the pop-up menu.
The PeopleCode editor appears. If you are using a new component interface, no PeopleCode will appear in the editor because no user-defined methods have been created.
Write the required PeopleCode functions.
PeopleCode functions that you write are stored in a single PeopleCode program that is attached to the component interface and associated with the Methods event.
Note. New user-defined methods do not appear in the list of methods until you save the component interface. Double-click the icon of any existing user-defined method to return to this PeopleCode program.
Set permissions for the methods that you created.
You must set permissions for every user-defined method. If you set permission to Full Access, at runtime that function is exposed to external systems as a method on the component interface object.
If you want a user-defined component interface to be exportable, meaning used by code that instantiates the component interface, the method PeopleCode definition must include a Doc statement. It is in the form of:
Doc <documentation for method>
where <documentation for method> describes what the method does
For example, the following method returns true if foo is positive, otherwise it returns false.
Function MyFooBar(int foo) returns boolean Doc if (foo >0) then return True; else return False; end-if; end-function;
Validation ensures that a component interface's structure is still valid. Over time, the structure of a component interface can become invalid due to component structural changes and modifications. For example, this can happen whenever a component deletes or adds a record or field. It can also happen if the keys on the component are added or removed. Properties and keys that no longer synchronize with their associated components are marked with an X icon.
Note. The validation process only determines whether the underlying component of a component interface has changed. It does not validate the PeopleCode that is associated with a component interface. To validate the PeopleCode, open the component and select Tools, Validate from the Application Designer menu.
To correct an invalid component interface, you might have to delete properties for which there are no longer appropriate fields or records. If the structure of the source component has changed, you might have to delete old properties and re-add the new properties in their appropriate locations. You may also need to rename a property or collection.
To validate a component interface:
Open the component interface in Application Designer.
Validation occurs automatically whenever you open a component interface in Application Designer.
Select Tools, Validate for Consistency from the Application Designer menu to validate an open component interface.
As you change components or other related definitions, you should validate a component interface that is already open in Application Designer.
Note. Application Designer also validates each component interface upon its creation.
If a component interface definition becomes invalid, you cannot save changes to it in Application Designer.
If a component interface definition is associated with an active Integration Broker service, you cannot delete it.
After creating a component interface, you must set security for it. Each individual method also needs to be provided security. Security for the component interface is provided through the PeopleSoft Internet Architecture pages. Component interface permissions are set at the permission list level in PeopleSoft security.
To set up component interface security:
Log in to the PeopleSoft Pure Internet Architecture through the browser, and select PeopleTools, Security, Permissions & Roles, Permission Lists.
Select the permission list for which you want to set security.
The Permission List component appears.
Access the Component Interfaces page.
Select the component interface for which you want to set security.
To add another component interface to the list, click the Add button.
Click Edit.
The Component Interface Permissions page appears, showing all of the methods (both standard and user-defined) in the component interface and their method access.
Set the access permission for each method.
Select Full Access or No Access. You must grant full access to at least one method to make the component interface available for testing and other online use.
Click OK when you’re done.
Save the page.
After setting the security for a component interface, you can test the contents and behavior using the component interface tester. You should test the component interface before using it in your external system. This proactive tool helps you discover problems with the underlying component or the component interface itself, including user defined methods. When you are testing a component interface, real data from the database is used. Therefore, if you save the information that you change by calling the Save method, the information is changed in the database.
With the component interface tester, you can:
Test the component interface in interactive mode.
Retrieve history items.
Test the standard, custom, and collection methods.
To test the component interface, you search for the component interface to test, then you test it.
Access the Component Interface Tester search dialog box:
To search for a component interface to test:
Open the component interface in Application Designer.
Select Tools, Test Component Interface from the Application Designer menu.
The Component Interface Tester search dialog box appears. This dialog box displays the keys (in the left-hand columns) for getting, creating, or finding an instance of the component interface. The right-hand columns provide a place for you to enter sample key values for testing.
Enter key values.
Double-click the column to the right of any displayed keys.
Enter the value in the right-hand column.
The data that is used for the test corresponds to the key values that you enter here. In the preceding example, we’ve entered an employee ID of 6602.
Getting Existing Records by Using Partial Keys
If you want to retrieve a partial key, click the Find button. The Find Results dialog box appears:
You then can choose the specific instance by selecting and clicking the Get Selected button. If you do not enter a partial key before clicking Find, all key values in the database are returned (subject to the maximum count of 300, just as when online). This is the same as calling the Find method through the component interface API, followed by selecting a value from the Find results, setting the Get key, and calling the Get method. After you click the Get Selected button, the Component Interface Tester dialog box appears.
After you have searched for and retrieved the component interface, the Component Interface Tester dialog box appears.
Testing the Component Interface Properties
From the Component Interface Tester dialog box, change the value of a property, double-click a value, and enter a new value. Some basic validation is done when you leave the field, which is equivalent to exiting a field using the TAB key in the online case. This validation includes system edit, FieldChange PeopleCode events, and FieldEdit PeopleCode events. Further validation may be done when the Save method is called (SaveEdit, SavePreChange, Workflow, and SavePostChange). If errors or warnings are encountered, they are displayed in the Error Message Log area at the bottom of the window. The error message log displays the same text that would appear in the PSMessages collection of the Session object if you accessed the component through the Component Interface API.
Testing Component Interface Methods
Test component interface methods by right-clicking the component interface name.
A pop-up menu appears showing the Save and Cancel standard methods and any user-defined methods that exist for the component interface. The Find, Create, and Get standard methods are not valid for an instantiated component, and therefore are not shown.
If a component interface method requires one or more parameters, a dialog box in which you can enter the parameters appears. After the method gets executed, the same dialog box appears again, displaying changes to the parameters that were caused by the method. The return value of the function appears in the title of the dialog box. If a component interface requires no parameters, you do not see the initial dialog box, but you do see the return value dialog box following the function call.
Note. Because running a component interface method can result in a change to the component interface structure, Application Designer always redraws the component interface tree in its collapsed form following a method call.
Test collection methods by right-clicking the collection name.
A pop-up menu appears, showing the standard collection methods. Select the collection method that you want to test for this component interface. After you select a collection method to test, the Enter parameters dialog box prompts you to enter an item number for the collection method that you are testing. The value that you enter for index [Number] is used to retrieve, insert, or delete an item, according to the following rules.
After you enter an index number, the result appears in the dialog box. If there is a return value, it is displayed in the title bar. Otherwise the message No value is displayed. Click OK or Cancel to dismiss the dialog box.
Collection Method Rules
This table contains the collection method rules:
Collection Method |
Purpose |
Returns the row at the specified index. Only the success or failure of this routine is of interest from inside the test component. |
|
Inserts a new row either before the index that you specify if the collection is effective-dated or following the index if it isn’t effective-dated. |
|
Deletes the row that is designated by the index number that you specified in the Enter parameters dialog box. |
|
Returns the row corresponding to the specified keys. Only the success or failure of this routine is of interest from inside the test component. |
|
This method returns the effective row in an effective-dated record. Only the success or failure of this routine is of interest from inside the test component. |
|
Returns the DataRow that would be effective for the specified date and sequence number. This is a more general case of the GetCurrentItem function, which returns the definition that is effective at this moment. This method works with effective-dated records only. |
|
Returns the item number inside the collection of the DataRow that would be effective for the specified date and sequence number. This is a more general case of the GetCurrentItemNum function, which returns the number of the definition that is effective at this moment. This method works with effective-dated records only. |
Note. Component Interface Classes contains information about collection methods.
You can get the signature for the ItemByKeys method (or any other method) when testing a component interface. This is helpful for the ItemByKeys method, because its signature is different for each component interface.
To determine ItemByKeys parameters:
Open the definition.
Select Tools, Test Component Interface.
Find or get an appropriate populated component interface.
Navigate to the appropriate collection.
Right-click, and select ItemByKeys from the pop-up menu.
A dialog box appears, showing the specific parameters and types and the order in which you should call ItemByKeys.
In the preceding example, the keys for the SDK_BUS_EXP_PER ItemByKeys method are SDK_EMPID (String) and SDK_EXP_PER_DT (String).
The Component Interface Properties Synchronization tab is used with PeopleSoft Mobile Agent. PeopleSoft Mobile Agent extends the functionality of PeopleSoft Pure Internet Architecture to disconnected mobile devices, allowing users to continue working with their PeopleSoft applications on a laptop computer or personal digital assistant (PDA) while disconnected from the internet or local network.
See Using Synchronizable Component Interfaces.
The following chapters in this PeopleBook describe how to write component interface programs in several programming languages.
Also, the PeopleTools PeopleCode Reference contains a chapter that describes the component interface classes, including detailed instructions on the life cycle of a component interface and how to implement a component interface program in PeopleCode. You can use this information to help design your component interface program in other programming languages.
See Component Interface Classes.
In many ways, accessing a component interface is functionally equivalent to working with an online component. However, there are some important differences between component interfaces and components. This section describes how those differences affect interactive operation, functionality designed for graphical interfaces, client versus server operation, and several miscellaneous situations. These considerations, unless otherwise noted, apply to all the programming languages listed in this manual.
This section discusses general considerations for component interface programs.
You cannot use WinMessage in a component that will be used to build a component interface. Use MsgGet() instead.
Email from a Component Interface
To use a component interface to send email, use TriggerBusinessEvent PeopleCode event, not SendMail.
Related Display
Related display fields are not available for use in a component interface as they are not held in the buffer context that the component interface uses.
If RowInserts have been disabled for a page, you must take care when calling inserts against the corresponding component interface. Any PeopleCode associated with push buttons used on the page to add rows will not be invoked by the component interface when an insert is done.
Note. If a component has logic that inserts rows on a RowInsert, the component interface cannot identify the change and locate the rows that were inserted by the application code. Generic interfaces such as Excel to Component Interfaces utility and the WSDLToCI will not function correctly when using this type of dynamic insert.
This section discusses scope conflicts for component interface programs.
A component interface should not call itself in any of the PeopleCode included within its component definition, because this may result in an infinite loop of the component interface. A component interface also should not call itself from a user-defined method.
Multiple Instances of a Component Interface
Because of potential memory conflicts, COM or C++ applications should not create multiple, simultaneous instances of the same component interface, either within a single procedure, or in both a “parent” and a “child” procedure.
This section discusses interactive mode considerations for component interface programs.
UNIX Server Performance
If you’re using a component interface as part of a batch process in which thousands of rows are being inserted, running in interactive mode may reduce performance enough on some UNIX servers to produce a connection failure. Prevent this by setting the InteractiveMode property to False.
If the InteractiveMode property is set to True, and if a transaction sets a property to a value that isn't allowed in a prompt edit field, the edit field value is reset back to its original value. The error is logged in the PSMessages collection; however, the Save method runs without errors. Check the value of both the Save method and the collection ErrorPending property to discover all of the errors.