Class training.operation.OpeFilePerson extends Ens.BusinessOperation
{
Parameter ADAPTER = "EnsLib.File.OutboundAdapter";
Parameter INVOCATION = "Queue";
/* write on log file wrong person records */
Method writeMessage(
pRequest As MyData.Message,
Output pResponse As Ens.StringResponse)
As %Status
{
$$$LOGINFO("called Writer")
set ..Adapter.FilePath="C:\InterSystems\test\ftp"
set st=..Adapter.PutLine("person.log",message)
Quit $$$OK
}
/* write on log file wrong person records */
Method logWrongPerson(
pRequest As training.healthcare.message.MsgPerson,
Output pResponse As Ens.StringResponse)
As %Status
{
$$$LOGINFO("called OpeFilePerson")
set ..Adapter.FilePath="C:\InterSystems\test\errorparh"
set message="some information are missing from record: " _
pRequest.sso _ ", " _
pRequest.name _ ", " _
pRequest.surname
set st=..Adapter.PutLine("Person.log",message)
Quit $$$OK
}
/* write in xml format the list of active/inactive/requested Persons */
Method writeSSOList(
pRequest As Ens.StringRequest,
Output pResponse As Ens.StringResponse)
As %Status
{
set ..Adapter.FilePath="C:\InterSystems\test\ftp"
set status=pRequest.StringValue
if status="ACTIVE" set fileName="ActiveSSO.xml"
if status="INACTIVE" set fileName="InactiveSSO.xml"
if status="REQUESTED" set fileName="RequestedSSO.xml"
set st=..Adapter.PutLine(fileName,"<Persons>")
set rs=
##class(training.healthcare.data.TabPerson).selectPersons("",status)
while rs.Next(){
set st=..Adapter.PutLine(fileName,"<Person>")
for i=1:1:rs.GetColumnCount() {
set st=..Adapter.PutLine(fileName,
"<"_ rs.GetColumnName(i)_">" _
rs.GetData(i)_"</"_ rs.GetColumnName(i)_">")
}
set st=..Adapter.PutLine(fileName,"<Person>")
}
set st=..Adapter.PutLine(fileName,"<Persons>")
set pResponse=##class(Ens.StringResponse).%New()
set pResponse.StringValue="done"
quit $$$OK
}
XData MessageMap
{
<MapItems>
<MapItem MessageType="training.healthcare.message.MsgPerson">
<Method>logWrongPerson</Method>
</MapItem>
<MapItem MessageType="Ens.StringRequest">
<Method>writeSSOList</Method>
</MapItem>
</MapItems>
}
}