Вы находитесь на странице: 1из 17

import PS_PT:Integration:INotificationHandler; class ETS_EX_NONROWSET_ASYNC implements PS_PT:Integration:INotificationHandler method ETS_EX_NONROWSET_ASYNC(); method OnNotify(&_MSG As Message); end-class; /* constructor */ method ETS_EX_NONROWSET_ASYNC

end-method; method OnNotify /+ &_MSG as Message +/ /+ Extends/implements PS_PT:Integration:INotificationHandler.OnNotify +/ /* Variable Declaration */ Local Message &MSG; Local XmlDoc &xmldoc; Local XmlNode &xmlnode_root, &xmlnode; Local integer &i, &j, &k, &RET; Local File &ERRORFILE, &LOGFILE; Local string &CRLF = Char(13) | Char(10); Local string &DATA; Local array of XmlNode &EMPLID, &OPRID, &EMAIL_ADDR, &GUIDID; Local SQL &SQL1; Local Record &REC1; Local integer &MAIL_FLAGS, &ERROR_COUNT; Local string &MAIL_TO, &MAIL_CC, &MAIL_BCC, &MAIL_SUBJECT, &MAIL_TEXT, &MAIL_CONTENT, &MAIL_TITLES; Local string &MAIL_FILES, &MAIL_FROM, &MAIL_SEP, &MAIL_REPLY_TO, &MAIL_SENDER; &MSG = &_MSG; &xmldoc = &MSG.GetXmlDoc(); &xmlnode_root = &xmldoc.DocumentElement; &SQL1 = CreateSQL("%Insert(:1)"); &REC1 = CreateRecord(Record.ETS_OIM_DATA); &ERRORFILE = GetFile("D:\Office\Interfaces\MyJob\Interface D XML's & Output\Sample2Logfile.err", "W", %FilePath_Absolute); &LOGFILE = GetFile("D:\Office\Interfaces\MyJob\Interface D XML's & Output\Logfile.err", "W", %FilePath_Absolute); /* Get Elements By Tagname */ &EMPLID = &xmlnode_root.GetElementsByTagName("EMPLID"); &OPRID = &xmlnode_root.GetElementsByTagName("OPRID"); &EMAIL_ADDR = &xmlnode_root.GetElementsByTagName("EMAIL_ADDR"); &GUIDID = &xmlnode_root.GetElementsByTagName("ETS_GUID_ID");

&ERROR_COUNT = 0; For &i = 1 To &EMPLID.Len SQLExec("SELECT COUNT(EMPLID) FROM PS_PERSON WHERE EMPLID=:1", &EMPLID [&i].NodeValue, &k); If &k < 1 Then &ERRORFILE.WriteLine(&CRLF); &ERRORFILE.WriteLine(MsgGetExplainText(30200, 800, " Message Not Found ", &EMPLID [&i].NodeValue)); &ERROR_COUNT = &ERROR_COUNT + 1; Else SQLExec("SELECT COUNT(OPRID) FROM PSOPRDEFN WHERE OPRID=:1", &OPRID [&i].NodeValue, &k); If &k < 1 Then SQLExec("SELECT COUNT(GUID_ID) FROM PS_ETS_OIM_DATA WHERE GUID_ID=:1", &GUIDID [&i].NodeValue, &k); If &k <> 0 Then &ERRORFILE.WriteLine(&CRLF); &ERRORFILE.WriteLine(MsgGetExplainText(30200, 801, " Message Not Found ", &GUIDID [&i].NodeValue)); &ERROR_COUNT = &ERROR_COUNT + 1; Break; End-If; SQLExec("SELECT COUNT(EMAIL_ADDR) FROM PS_EMAIL_ADDRESSES WHERE EMIL_ADDR=:1", &EMAIL_ADDR [&i].NodeValue, &k); If &k <> 0 Then &ERRORFILE.WriteLine(&CRLF); &ERRORFILE.WriteLine(MsgGetExplainText(30200, 802, " Message Not Found ", &EMAIL_ADDR [&i].NodeValue)); &ERROR_COUNT = &ERROR_COUNT + 1; Break; End-If; /* update */ /* Insert */ &REC1.EMPLID.Value = &EMPLID [&i].NodeValue; &REC1.GUID.Value = &GUIDID [&i].NodeValue; &SQL1.Execute(&REC1);

End-If; End-If; End-For;

&ERRORFILE.Close();

/* Mail Sending to the Distribution List */ &MAIL_FLAGS = 0; &MAIL_TO = MsgGetText(30200, 11, " Message not found "); &MAIL_CC = MsgGetText(30200, 12, " Message not found "); &MAIL_BCC = MsgGetText(30200, 13, " Message not found "); &MAIL_SUBJECT = MsgGetText(30200, 14, " Message not found "); &MAIL_TEXT = MsgGetExplainText(30200, 15, " Message not found ", &ERROR_COUNT); &MAIL_CONTENT = "Content-type: text/html; charset=utf8"; &MAIL_FILES = &ERRORFILE.Name; &MAIL_TITLES = " Error Report File "; &RET = SendMail(&MAIL_FLAGS, &MAIL_TO, &MAIL_CC, &MAIL_BCC, &MAIL_SUBJECT, &MAIL_TEXT, &MAIL_FILES, &MAIL_TITLES, &MAIL_FROM, &MAIL_SEP, &MAIL_CONTENT, &MAIL_REPLY_TO, &MAIL_SENDER); /* Writing the Mail Sent Status in Log file */ If Not (&RET = 0) Then &LOGFILE.WriteLine(" No Mail Installer Installed --- Return Status from Mail " | &RET); Else &LOGFILE.WriteLine(" Mail Successfully Sent With No Errors To Corporate Employess and T&L Contractors " | &RET); End-If; &MAIL_FLAGS = 0; &MAIL_TO = MsgGetText(30200, 21, " Message not found "); &MAIL_CC = MsgGetText(30200, 22, " Message not found "); &MAIL_BCC = MsgGetText(30200, 23, " Message not found "); &MAIL_SUBJECT = MsgGetText(30200, 24, " Message not found "); &MAIL_TEXT = MsgGetExplainText(30200, 25, " Message not found ", &ERROR_COUNT); &MAIL_CONTENT = "Content-type: text/html; charset=utf8"; &MAIL_FILES = &ERRORFILE.Name; &MAIL_TITLES = " Error Report File "; &RET = SendMail(&MAIL_FLAGS, &MAIL_TO, &MAIL_CC, &MAIL_BCC, &MAIL_SUBJECT, &MAIL_TEXT, &MAIL_FILES, &MAIL_TITLES, &MAIL_FROM, &MAIL_SEP, &MAIL_CONTENT, &MAIL_REPLY_TO, &MAIL_SENDER); rem Writing the Mail Sent Status in Log file ; If Not (&RET = 0) Then &LOGFILE.WriteLine(" No Mail Installer Installed --- Return Status from Mail " | &RET); Else &LOGFILE.WriteLine(" Mail Successfully Sent With No Errors To Raters " | &RET);

End-If; &LOGFILE.Close(); end-method;

USER_SAVEAS /* ===> This is a dynamically generated PeopleCode template to be used only as a helper to the application developer. You need to replace all references to '[*]' OR default values with references to PeopleCode variables and/or a Rec.Fields. */ Local File &fileLog; Local ApiObject &oSession, &oEtsUserCreateCi; Function errorHandler() Local ApiObject &oPSMessageCollection, &oPSMessage; Local number &i; Local String &sErrMsgSetNum, &sErrMsgNum, &sErrMsgText, &sErrType;

&oPSMessageCollection = &oSession.PSMessages; For &i = 1 To &oPSMessageCollection.Count &oPSMessage = &oPSMessageCollection.Item(&i); &sErrMsgSetNum = &oPSMessage.MessageSetNumber; &sErrMsgNum = &oPSMessage.MessageNumber; &sErrMsgText = &oPSMessage.Text; &fileLog.WriteLine(&sErrType | " (" | &sErrMsgSetNum | "," | &sErrMsgNum | ") - " | &sErrMsgText);

End-For; rem ***** Delete the Messages from the collection *****; &oPSMessageCollection.DeleteAll(); End-Function;

try rem ***** Set the Log File *****; &fileLog = GetFile("C:\DOCUME~1\kkotu\LOCALS~1\Temp\ETS_USER_CREATE_CI.log", "w", "a", %FilePath_Absolute); &fileLog.WriteLine("Begin"); rem ***** Get current PeopleSoft Session *****; &oSession = %Session;

rem ***** Set the PeopleSoft Session Error Message Mode *****; rem ***** 0 - None *****; rem ***** 1 - PSMessage Collection only (default) *****; rem ***** 2 - Message Box only *****; rem ***** 3 - Both collection and message box *****; &oSession.PSMessagesMode = 1;

rem ***** Get the Component Interface *****; &oEtsUserCreateCi = &oSession.GetCompIntfc(CompIntfc.ETS_USER_CREATE_CI); If &oEtsUserCreateCi = Null Then errorHandler();

throw CreateException(0, 0, "GetCompIntfc failed"); End-If;

rem ***** Set the Component Interface Mode *****; &oEtsUserCreateCi.InteractiveMode = False; &oEtsUserCreateCi.GetHistoryItems = True; &oEtsUserCreateCi.EditHistoryItems = False;

rem ***** Set Component Interface Get/Create Keys *****;

&oEtsUserCreateCi.OPRID = "PS";

rem ***** Execute Get *****; If Not &oEtsUserCreateCi.Get() Then rem ***** No rows exist for the specified keys.*****; errorHandler(); throw CreateException(0, 0, "Get failed"); End-If;

rem ***** Begin: Get/Set Component Interface Properties *****; rem ***** Get/Set Level 0 Field Properties *****;

&oEtsUserCreateCi.OPRID = [*];

&oEtsUserCreateCi.OPERPSWD = [*]; &oEtsUserCreateCi.OPRDEFNDESC = [*]; &oEtsUserCreateCi.OPERPSWDCONF = [*]; &oEtsUserCreateCi.COPY_IDTYPES = [*];

rem ***** Execute Save *****; If Not &oEtsUserCreateCi.Save() Then; errorHandler(); throw CreateException(0, 0, "Save failed"); End-If;

rem ***** Execute Cancel *****; rem If Not &oEtsUserCreateCi.Cancel() Then; rem rem errorHandler(); throw CreateException(0, 0, "Cancel failed");

rem End-If;

catch exception &ex rem Handle the exception; &fileLog.WriteLine(&ex.ToString()); end-try; &fileLog.WriteLine("End"); &fileLog.Close();

USERMAINT CI /* ===> This is a dynamically generated PeopleCode template to be used only as a helper to the application developer. You need to replace all references to '[*]' OR default values with references to PeopleCode variables and/or a Rec.Fields. */

Local File &fileLog; Local ApiObject &oSession, &oEtsUserCretCi; Local ApiObject &oPsopraliasCollection, &oPsopralias; Local ApiObject &oPsopraliasfieldCollection, &oPsopraliasfield; Local ApiObject &oPsoptionsCollection, &oPsoptions; Local ApiObject &oPsroleuserVwCollection, &oPsroleuserVw; Local ApiObject &oRunCntlldapCollection, &oRunCntlldap; Local ApiObject &oPsuserotherVwCollection, &oPsuserotherVw;

Local ApiObject &oPSMessageCollection, &oPSMessage; Local number &i; Local String &sErrMsgSetNum, &sErrMsgNum, &sErrMsgText, &sErrType;

try rem ***** Get current PeopleSoft Session *****;

&oSession = %Session;

rem ***** Set the PeopleSoft Session Error Message Mode *****; rem ***** 0 - None *****; rem ***** 1 - PSMessage Collection only (default) *****; rem ***** 2 - Message Box only *****; rem ***** 3 - Both collection and message box *****; &oSession.PSMessagesMode = 1;

rem ***** Get the Component Interface *****;

&oEtsUserCretCi = &oSession.GetCompIntfc(CompIntfc.ETS_USER_CRET_CI);

If &oEtsUserCretCi = Null Then

&oPSMessageCollection = &oSession.PSMessages; For &i = 1 To &oPSMessageCollection.Count &oPSMessage = &oPSMessageCollection.Item(&i); &sErrMsgSetNum = &oPSMessage.MessageSetNumber; &sErrMsgNum = &oPSMessage.MessageNumber; &sErrMsgText = &oPSMessage.Text; &fileLog.WriteLine(&sErrType | " (" | &sErrMsgSetNum | "," | &sErrMsgNum | ") - " | &sErrMsgText); End-For;

rem ***** Delete the Messages from the collection *****;

&oPSMessageCollection.DeleteAll();

throw CreateException(0, 0, "GetCompIntfc failed");

End-If;

rem ***** Set the Component Interface Mode *****;

&oEtsUserCretCi.InteractiveMode = False; &oEtsUserCretCi.GetHistoryItems = True; &oEtsUserCretCi.EditHistoryItems = False;

rem ***** Set Component Interface Get/Create Keys *****;

&oEtsUserCretCi.OPRID = [*];

rem ***** Execute Get *****; rem If Not &oEtsUserCretCi.Get() Then rem ***** No rows exist for the specified keys.*****; rem errorHandler(); throw CreateException(0, 0, "Get failed"); End-If;

rem ***** Execute Create ******; If Not &oEtsUserCretCi.Create() Then; rem ***** Unable to Create Component Interface for the Add keys provided. *****;

errorHandler(); throw CreateException(0, 0, "Create failed"); End-If;

rem ***** Begin: Get/Set Component Interface Properties *****; rem ***** Get/Set Level 0 Field Properties *****;

&oEtsUserCretCi.OPRCLASS = [*];

&oEtsUserCretCi.ROWSECCLASS = [*];

&oEtsUserCretCi.OPERPSWD = [*];

&oEtsUserCretCi.SYMBOLICID = [*];

&oEtsUserCretCi.LANGUAGE_CD = [*];

&oEtsUserCretCi.CURRENCY_CD = [*];

&oEtsUserCretCi.ACCTLOCK = [*];

&oEtsUserCretCi.PRCSPRFLCLS = [*];

&oEtsUserCretCi.DEFAULTNAVHP = [*];

&oEtsUserCretCi.EXPENT = [*];

&oEtsUserCretCi.USERIDALIAS = [*];

&oEtsUserCretCi.PTALLOWSWITCHUSER = [*];

&oEtsUserCretCi.OPERPSWDCONF = [*];

&oEtsUserCretCi.ROLEUSER_REASSIGN = [*];

&oEtsUserCretCi.ROLEUSER_ASSIGN_SW = [*];

&oEtsUserCretCi.NO_SYMBID_WARN = [*];

&oEtsUserCretCi.PSWDEXPIRED = [*];

&oEtsUserCretCi.MPDEFAULMP = [*];

&oEtsUserCretCi.SERVERNAME = [*];

&oEtsUserCretCi.WORKLIST_USER_SW = [*];

&oEtsUserCretCi.EMAIL_USER_SW = [*];

&oEtsUserCretCi.ROLEUSER_ALT = [*];

&oEtsUserCretCi.ROLEUSER_SUPR = [*];

&oEtsUserCretCi.EFFDT_FROM = [*];

&oEtsUserCretCi.EFFDT_TO = [*];

&oPsopralias.OPRALIASTYPE = [*];

&oPsopraliasfield.ATTRVALUE = [*];

&oPsoptions.FROM_QUERY_RULE = [*];

&oPsoptions.FROM_DIR_RULE = [*];

&oPsroleuserVw.ROLENAME_1 = [*];

rem ***** Set/Get PSOPRALIAS Collection Field Properties -- Parent: PS_ROOT Collection *****;

&oPsopraliasCollection = &oEtsUserCretCi.PSOPRALIAS;

Local integer &i134;

For &i134 = 1 To &oPsopraliasCollection.Count;

&oPsopralias = &oPsopraliasCollection.Item(&i134);

rem &fileLog.WriteLine("&oPsopralias.OPRALIASTYPE = " | &oPsopralias.OPRALIASTYPE);

rem ***** Set/Get PSOPRALIASFIELD Collection Field Properties -- Parent: PSOPRALIAS Collection *****;

&oPsopraliasfieldCollection = &oEtsUserCretCi.PSOPRALIASFIELD;

Local integer &i236; For &i236 = 1 To &oPsopraliasfieldCollection.Count;

&oPsopraliasfield = &oPsopraliasfieldCollection.Item(&i236);

&fileLog.WriteLine("&oPsopraliasfield.ATTRVALUE = " | &oPsopraliasfield.ATTRVALUE);

End-For;

End-For;

rem ***** Set/Get PSOPTIONS Collection Field Properties -- Parent: PS_ROOT Collection *****;

&oPsoptionsCollection = &oEtsUserCretCi.PSOPTIONS; Local integer &i140;

For &i140 = 1 To &oPsoptionsCollection.Count;

&oPsoptions = &oPsoptionsCollection.Item(&i140);

&fileLog.WriteLine("&oPsoptions.FROM_QUERY_RULE = " | &oPsoptions.FROM_QUERY_RULE);

&fileLog.WriteLine("&oPsoptions.FROM_DIR_RULE = " | &oPsoptions.FROM_DIR_RULE);

End-For;

rem ***** Set/Get PSROLEUSER_VW Collection Field Properties -- Parent: PS_ROOT Collection *****;

&oPsroleuserVwCollection = &oEtsUserCretCi.PSROLEUSER_VW;

Local integer &i145;

For &i145 = 1 To &oPsroleuserVwCollection.Count;

&oPsroleuserVw = &oPsroleuserVwCollection.Item(&i145);

&fileLog.WriteLine("&oPsroleuserVw.ROLENAME_1 = " | &oPsroleuserVw.ROLENAME_1);

End-For;

rem ***** Set/Get RUN_CNTLLDAP Collection Field Properties -- Parent: PS_ROOT Collection *****;

&oRunCntlldapCollection = &oEtsUserCretCi.RUN_CNTLLDAP;

Local integer &i148;

For &i148 = 1 To &oRunCntlldapCollection.Count;

&oRunCntlldap = &oRunCntlldapCollection.Item(&i148);

&fileLog.WriteLine("&oRunCntlldap.PROCESS_INSTANCE = " | &oRunCntlldap.PROCESS_INSTANCE); &fileLog.WriteLine("&oRunCntlldap.RUN_CNTL_ID = " | &oRunCntlldap.RUN_CNTL_ID); rem &oRunCntlldap.RUN_CNTL_ID = [*]; rem &oRunCntlldap.LDAPMAPNAME = [*]; &fileLog.WriteLine("&oRunCntlldap.LDAPMAPNAME = " | &oRunCntlldap.LDAPMAPNAME); rem &oRunCntlldap.LDAPMAPNAME = [*]; End-For;

rem ***** Set/Get PSUSEROTHER_VW Collection Field Properties -- Parent: PS_ROOT Collection *****;

&oPsuserotherVwCollection = &oEtsUserCretCi.PSUSEROTHER_VW; Local integer &i152; For &i152 = 1 To &oPsuserotherVwCollection.Count; &oPsuserotherVw = &oPsuserotherVwCollection.Item(&i152); End-For; rem ***** End: Get/Set Component Interface Properties *****;

rem ***** Execute Save *****; If Not &oEtsUserCretCi.Save() Then;

errorHandler(); throw CreateException(0, 0, "Save failed"); End-If;

rem ***** Execute Cancel *****; rem If Not &oEtsUserCretCi.Cancel() Then; rem rem errorHandler(); throw CreateException(0, 0, "Cancel failed");

rem End-If;

catch exception &ex rem Handle the exception; &fileLog.WriteLine(&ex.ToString()); end-try; &fileLog.WriteLine("End"); &fileLog.Close();

Вам также может понравиться