If no record is found for the inputted data, the response will look like below:
3. In ‘Search’ button component tap event, a few checks are done using IF conditions.
After that, 'Create Record' is used and the response is stored in App variable.
This app variable contains similar structure for success case. 'Open Page' will open the 'Message View' page.
4. List Item in the 'Message View' will be repeated based on the number of occurrence of records in MessageProcessLog. This page also contains a text "No records found for the selected criteria" which will be populated if no record is found.
5. On component tap event of list item, the current item is stored to another app variable. 'Open Page' opens the 'Detailed View' page.
6. Container in 'Detailed View' page will be repeated based on the number of occurrences of Message.
import com.sap.gateway.ip.core.customdev.util.Message
def Message processData(Message message) {
def body = message.getBody(String)
def input = new JsonSlurper().parseText(body)
def status = input.data.status
def iflowname = input.data.iflowname
def startDate = input.data.startDate.take(10) + 'T00:00:00.000'
def endDate = input.data.endDate.take(10) + 'T00:00:00.000'
StringBuffer str = new StringBuffer();
str.append("LogStart ge datetime'" + startDate + "'")
str.append(" and LogEnd le datetime'" + endDate + "'")
if (!iflowname.equalsIgnoreCase('all'))
str.append(" and IntegrationFlowName eq '" + iflowname + "'")
if (!status.equalsIgnoreCase('all'))
str.append(" and Status eq '" + status + "'")
def queryFilter = str.toString()
message.setProperty("queryFilter", queryFilter)
return message
import com.sap.gateway.ip.core.customdev.util.Message
import groovy.xml.MarkupBuilder
import groovy.xml.XmlUtil
def Message processData(Message message) {
def body = message.getBody(String)
def input = new XmlSlurper().parseText(body)
Writer writer = new StringWriter()
def xmlMarkup = new MarkupBuilder(writer)
xmlMarkup.MessageProcessingLogs {
def list = input.MessageProcessingLog.IntegrationFlowName.collect().unique()
list.each { this_item ->
def statusList = []
input.MessageProcessingLog.IntegrationFlowName.each { this_flow ->
if (this_flow == this_item) {
statusList.push(this_flow.parent().Status)
}
}
def groups = statusList.groupBy { it }
statusList.unique().each { this_status ->
groups.each { key, value ->
if (key == this_status) {
MessageProcessingLog {
IntegrationFlowName(this_item)
Status(this_status)
Count(value.size())
Messages {
input.MessageProcessingLog.IntegrationFlowName.each { this_iflow ->
if (this_iflow == this_item && this_iflow.parent().Status == this_status) {
Message {
MessageGuid(this_iflow.parent().MessageGuid)
ApplicationMessageType(this_iflow.parent().ApplicationMessageType)
ApplicationMessageId(this_iflow.parent().ApplicationMessageId)
LogStart(this_iflow.parent().LogStart)
LogEnd(this_iflow.parent().LogEnd)
CorrelationId(this_iflow.parent().CorrelationId)
}
}
}
}
}
}
}
}
}
}
message.setBody(XmlUtil.serialize(writer.toString()))
return message
}
<AssignMessage async="false" continueOnError="false"
enabled="true" xmlns='http://www.sap.com/apimgmt'>
<Add>
<Headers>
<Header name="Access-Control-Allow-Origin">*</Header>
<Header name="Access-Control-Allow-Headers">setcookie, origin, accept, maxdataserviceversion, x-csrf-token,
apikey, dataserviceversion, accept-language, x-httpmethod,content-type,X-Requested-With</Header>
<Header name="Access-Control-MaxAge">3628800</Header>
<Header name="Access-Control-Allow-Methods">GET,
PUT, POST, DELETE</Header>
<Header name="Access-Control-ExposeHeaders">set-cookie, x-csrf-token, x-http-method</Header>
</Headers>
</Add>
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<AssignTo createNew="false"
type="response">response</AssignTo>
</AssignMessage>
<!--Specify in the APIKey element where to look for the variable containing the api key-->
<VerifyAPIKey async='true' continueOnError='false' enabled='true'
xmlns='http://www.sap.com/apimgmt'>
<APIKey ref='request.header.apikey'/>
</VerifyAPIKey>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
8 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 | |
4 | |
3 |