Let’s say we have 2 application package.
1. UserID and
2. Notification.
Here Notification application package uses dynamic changing application package say based on setup.
For our example we are using UserID application package as setup driven application package and it has UserID as Class.
Structure of UserID application package.
class UserID
method GetOpridsByApplicationPack() Returns array of string;
property array of string oprid_arr;
end-class;
method UserID
end-method;
method GetOpridsByApplicationPack
/+ Returns Array of String +/
%This.oprid_arr = CreateArrayRept("", 0);
Local string &SupervisorId, &ReportsTo;
%This.oprid_arr.push('PS'); /* Logic to populate data in array. */
Return %This.oprid_arr;
end-method;
Below is “Notification” application package structure.
In this application package we are using CreateObject to access “GetOpridsByApplicationPack” method of UserID class of UserID application package .
We are passing Package name and Class Name while calling so they are variable for us. (In this case its UserID and UserID).
class NotificationManager
method GetOpridsByApplicationPack(&PkgRoot As string, &Appcls_Path As string) Returns array of string;
end-class;
method NotificationManager
end-method;
method GetOpridsByApplicationPack
/+ &PkgRoot as String, +/
/+ &Appcls_Path as String +/
/+ Returns Array of String +/
Local array of string &aryOpridTo;
Local string &Classname;
Local object &u;
&aryOpridTo = CreateArrayRept(" ", 0);
&Classname = &PkgRoot | ":" | &Appcls_Path;
&u = CreateObject(&Classname);
ObjectDoMethod(&u, "GetOpridsByApplicationPack");
&aryOpridTo = &u.oprid_arr;
Return &aryOpridTo;
end-method;
0 comments:
Post a Comment