PeopleCode API学习指南:导入与接口定义

3星 · 超过75%的资源 需积分: 42 31 下载量 37 浏览量 更新于2024-07-24 收藏 215KB DOCX 举报
"这篇文档是关于PeopleCode的中文API,适合初学者学习,涵盖了Import语句和Interface定义等基础知识。" 在PeopleCode编程环境中,理解并掌握Import语句和Interface的概念至关重要。首先,我们来看Import语句,它是用来引入程序中需要使用的类或包的关键字。Import语句有两种形式:导入整个包或者导入特定的类。 1. Import语句的语法如下: `Import PackageName:[PackageName:] {Classname | *};` - `PackageName` 是你想要导入的包名。 - `Classname` 是你要导入的特定类名。 - `*` 表示导入该包中的所有类。 例如: - `Import Fruit:*;` 这会导入名为Fruit的包中的所有类。 - `Import Fruit:Banana;` 这只会导入Fruit包中的Banana类。 - `Import Drinks:Fruit:Apple;` 如果Drinks包中包含Fruit子包,则这将导入Fruit子包内的Apple类。 2. 接下来是Interface(接口)的定义,它在PeopleCode中用于定义一组方法和属性,但不提供具体实现。接口可以被其他类实现或扩展,以实现多态性。 Interface的语法如下: `Interface classname [Extends|Implements Classname]` `[Method_declarations]` `[Property_declarations]` `[Protected]` `[Method_declarations]` `[Instance_declarations]` `[Constant_declaration]` `End-Interface` - `classname` 是接口的名称。 - `Extends|Implements` 指定接口继承自另一个接口或实现一个或多个接口。 - `Method_declarations` 定义接口的方法签名,但不包含实际的实现。 - `Property_declarations` 定义接口的属性,同样不包含具体的get或set操作。 - `Protected` 部分允许定义受保护的方法,这些方法仅在实现接口的类内部可见。 - `Instance_declarations` 用于声明接口实例变量。 - `Constant_declaration` 可以声明接口中的常量。 方法声明的格式是: `Method methodname([MethodParam1[,MethodParam2]][ReturnsDatatype])[abstract]` 属性声明的格式是: `Property DataType PropertyName {{[Get]|[Set]}|[abstract]|[read-only]}` 通过这些基本元素,开发者可以创建灵活且可扩展的代码结构,使得PeopleCode程序能够更有效地组织和重用代码。对于初学者来说,理解这些概念是掌握PeopleCode编程的基础。通过不断地练习和应用,可以进一步提升对PeopleCode的理解和编程能力。

解释下Peoplesoft的这段代码 Component array of array of any &tmpArray; Local Record &rec1, &rec2; &rec1 = CreateRecord(Record.HIK_IPSANRS_TBL); &rec2 = CreateRecord(Record.HIK_IPSAN_TBL); Local Rowset &rsLvl1, &rsDtl; Local number &i, &j; Local Row &row; &rsLvl1 = GetLevel0()(1).GetRowset(Scroll.WPS_STR_INF_TBL); For &i = 1 To &rsLvl1.ActiveRowCount &rsDtl = &rsLvl1(&i).GetRowset(Scroll.WPS_STR_DTL_TBL); For &j = 1 To &rsDtl.ActiveRowCount &row = &rsDtl(&j); If Not &row.IsDeleted Then If All(&row.WPS_STR_DTL_TBL.WPS_GP_AMT_ID.Value) Then &rec1 = CreateRecord(Record.WPS_IPSANRS_TBL); &rec1.WPS_GP_AMT_ID.Value = &row.WPS_STR_DTL_TBL.WPS_GP_AMT_ID.Value; &rec1.EFFDT.Value = &row.WPS_STR_DTL_TBL.EFFDT.Value; If &rec1.SelectByKey() Then &rec1.WPS_GP_AMT_ID.Value = &row.WPS_STR_DTL_TBL.WPS_GP_AMT_ID.Value; &rec1.EFFDT.Value = &row.WPS_STR_DTL_TBL.EFFDT.Value; &rec1.STATUS.Value = &rsLvl1(&i).WPS_STR_INF_TBL.STATUS.Value; &rec1.Update(); Else &rec1.WPS_GP_AMT_ID.Value = &row.WPS_STR_DTL_TBL.WPS_GP_AMT_ID.Value; &rec1.EFFDT.Value = &row.WPS_STR_DTL_TBL.EFFDT.Value; &rec1.STATUS.Value = "A"; &rec1.Insert(); End-If; &rec2 = CreateRecord(Record.WPS_IPSAN_TBL); &rec2.WPS_GP_AMT_ID.Value = &row.WPS_STR_DTL_TBL.WPS_GP_AMT_ID.Value; &rec2.EFFDT.Value = &row.WPS_STR_DTL_TBL.EFFDT.Value; &rec2.WPS_STORID.Value = &row.WPS_STR_DTL_TBL.WPS_STORID.Value; &rec2.WPS_GP_WAGECODE.Value = &row.WPS_STR_DTL_TBL.WPS_GP_WAGECODE.Value; If Not &rec2.Insert() Then &rec2.Update(); End-If; End-If; End-If; End-For; End-For;

2023-06-13 上传