import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import groovy.json.*;
def Message processData(Message message) {
def body = message.getBody(String.class);
def jsonSlurper = new JsonSlurper();
def list = jsonSlurper.parseText(body);
String result="";
Boolean IsOffline=false; //Boolean for sending the email or not...
String Offline = "Offline"; //Simple Constant
list.each
{ // Loop Start
result=result + "<tr><td style=\"text-align:center\">" + it.Autorizador + "</td>";
//Check for Offline Web Services
if( it.Recepcao == Offline ) {
result=result + "<td style=\"text-align:center;background-color:#FF0000\">" + it.Recepcao + "</td>";
IsOffline=true;
} else {
result=result + "<td style=\"text-align:center\">" + it.Recepcao + "</td>";
}
if( it.Retorno_Recepcao == Offline ) {
result=result + "<td style=\"text-align:center;background-color:#FF0000\">" + it.Retorno_Recepcao + "</td>";
IsOffline=true;
} else {
result=result + "<td style=\"text-align:center\">" + it.Retorno_Recepcao + "</td>";
}
if( it.Inutilizacao == Offline ) {
result=result + "<td style=\"text-align:center;background-color:#FF0000\">" + it.Inutilizacao + "</td>";
IsOffline=true;
} else {
result=result + "<td style=\"text-align:center\">" + it.Inutilizacao + "</td>";
}
if( it.Consulta_Protocolo == Offline ) {
result=result + "<td style=\"text-align:center;background-color:#FF0000\">" + it.Consulta_Protocolo + "</td>";
IsOffline=true;
} else {
result=result + "<td style=\"text-align:center\">" + it.Consulta_Protocolo + "</td>";
}
if( it.RecepcaoOS == Offline ) {
result=result + "<td style=\"text-align:center;background-color:#FF0000\">" + it.RecepcaoOS + "</td>";
IsOffline=true;
} else {
result=result + "<td style=\"text-align:center\">" + it.RecepcaoOS + "</td>";
}
if( it.Status_Servico == Offline ) {
result=result + "<td style=\"text-align:center;background-color:#FF0000\">" + it.Status_Servico + "</td>";
IsOffline=true;
} else {
result=result + "<td style=\"text-align:center\">" + it.Status_Servico + "</td>";
}
if( it.Recepcao_Evento == Offline ) {
result=result + "<td style=\"text-align:center;background-color:#FF0000\">" + it.Recepcao_Evento + "</td>";
IsOffline=true;
} else {
result=result + "<td style=\"text-align:center\">" + it.Recepcao_Evento + "</td>";
}
result=result + "</tr>";
} //Loop End
message.setProperty("MyOffline", IsOffline);
message.setBody(result);
return message;
}
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
<IMG SRC="https://avatars0.githubusercontent.com/u/46551529?s=200&v=4" ALT="some text" WIDTH=100 HEIGHT=100>
<h1>SAP® Cloud Platform Integration CT-e Monitor Alert</h1>
</head>
<body>
<p>Offline Web Services found now, check out the list:</p>
<table>
<tr>
<th>Autorizador</th>
<th>Recepção</th>
<th>Retorno Recepção</th>
<th>Inutilização</th>
<th>Consulta Protocolo</th>
<th>RecepçãoOS</th>
<th>Status Serviço</th>
<th>Recepção Evento</th>
${in.body}
</tr>
</table>
<p>Regards.</p>
<p>Your CPI Tenant.</p>
</body>
</html>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |