Fix RU_360: aggiornato mapping di request servizio REST AMDS (sendMT)
This commit is contained in:
@@ -1542,7 +1542,7 @@ public class Resources {
|
||||
|
||||
/**
|
||||
*
|
||||
* Ritorna la propriet<EFBFBD> SMS_SOURCE
|
||||
* Ritorna la proprieta' SMS_SOURCE
|
||||
* @return String
|
||||
*/
|
||||
public static String getSMS_SOURCE() {
|
||||
@@ -1550,11 +1550,22 @@ public class Resources {
|
||||
init();
|
||||
String ret = Trim(props.getProperty("SMS_SOURCE"));
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*Ritorna la propriet<65> SMS_MESSAGE
|
||||
*
|
||||
* Ritorna la proprieta' SMS_SERVICE_NUMBER
|
||||
* @return String
|
||||
*/
|
||||
public static String getSMS_SERVICE_NUMBER() {
|
||||
if (props == null)
|
||||
init();
|
||||
String ret = Trim(props.getProperty("SMS_SERVICE_NUMBER"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
*Ritorna la proprieta' SMS_MESSAGE
|
||||
*
|
||||
* @return String
|
||||
*/
|
||||
@@ -1566,7 +1577,7 @@ public class Resources {
|
||||
}
|
||||
|
||||
/**
|
||||
* Ritorna la propriet<EFBFBD> SMS_ACTIVE
|
||||
* Ritorna la proprieta' SMS_ACTIVE
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean getSMS_ACTIVE() {
|
||||
@@ -1578,13 +1589,13 @@ public class Resources {
|
||||
|
||||
/**
|
||||
* Abilitazione della cancellazione dei file _VER
|
||||
* @return boolean - true se <EFBFBD> abilitata
|
||||
* @return boolean - true se è abilitata
|
||||
*/
|
||||
public static boolean getCANCELLAZIONE_FILES(){
|
||||
if (props==null)
|
||||
init();
|
||||
String ret = Trim(props.getProperty("CANCELLAZIONE_FILES"));
|
||||
//C.P. 03/02/2003 se <EFBFBD> nullo ritorno yes
|
||||
//C.P. 03/02/2003 se è nullo ritorno yes
|
||||
return (ret==null?true:(ret.equalsIgnoreCase("yes")));
|
||||
}
|
||||
|
||||
@@ -1971,7 +1982,7 @@ public class Resources {
|
||||
|
||||
/**
|
||||
* aggiunta per X1 2013
|
||||
* Ritorna la propriet<EFBFBD> SMS_MESSAGE_C_DEL35
|
||||
* Ritorna la proprieta' SMS_MESSAGE_C_DEL35
|
||||
* @return String
|
||||
*/
|
||||
public static String getSMS_MESSAGE_C_DEL35() {
|
||||
@@ -1984,7 +1995,7 @@ public class Resources {
|
||||
|
||||
/**
|
||||
* aggiunta per X1 2013
|
||||
* Ritorna la propriet<EFBFBD> SMS_MESSAGE_B_DEL35
|
||||
* Ritorna la proprieta' SMS_MESSAGE_B_DEL35
|
||||
* @return String
|
||||
*/
|
||||
public static String getSMS_MESSAGE_B_DEL35() {
|
||||
@@ -2073,7 +2084,7 @@ public class Resources {
|
||||
|
||||
/**
|
||||
* aggiunta per X1 2013
|
||||
* Ritorna la propriet<EFBFBD> BACKUP_PITAGORA_EMPTY
|
||||
* Ritorna la proprieta' BACKUP_PITAGORA_EMPTY
|
||||
* @return String
|
||||
*/
|
||||
public static String getBACKUP_PITAGORA_EMPTY() {
|
||||
@@ -2086,7 +2097,7 @@ public class Resources {
|
||||
|
||||
/**
|
||||
* aggiunta per X3 2013
|
||||
* Ritorna la propriet<EFBFBD> TYPE_XSD_CRMWS
|
||||
* Ritorna la proprieta' TYPE_XSD_CRMWS
|
||||
* @return String
|
||||
*/
|
||||
public static String getTYPE_XSD_CRMWS() {
|
||||
@@ -2099,7 +2110,7 @@ public class Resources {
|
||||
|
||||
/**
|
||||
* aggiunta per X3 2013
|
||||
* Ritorna true se la propriet<EFBFBD> TYPE_XSD_CRMWS e' pari ad old
|
||||
* Ritorna true se la proprieta' TYPE_XSD_CRMWS e' pari ad old
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean isOldTYPE_XSD_CRMWS(){
|
||||
|
||||
@@ -53,6 +53,9 @@ public class NotifyMessage {
|
||||
@SerializedName("messageType")
|
||||
private String messageType = null;
|
||||
|
||||
@SerializedName("sender")
|
||||
private String sender = null;
|
||||
|
||||
@SerializedName("smsMessageList")
|
||||
private SmsMessage[] smsMessageList;
|
||||
|
||||
@@ -164,6 +167,18 @@ public class NotifyMessage {
|
||||
this.messageType = messageType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Sender
|
||||
* @return sender
|
||||
**/
|
||||
public String getSender() {
|
||||
return sender;
|
||||
}
|
||||
|
||||
public void setSender(String sender) {
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
@@ -182,6 +197,7 @@ public class NotifyMessage {
|
||||
|
||||
sb.append(" sourceNumber: ").append(toIndentedString(sourceNumber)).append("\n");
|
||||
sb.append(" destinationNumber: ").append(toIndentedString(destinationNumber)).append("\n");
|
||||
sb.append(" sender: ").append(toIndentedString(sender)).append("\n");
|
||||
sb.append(" content: ").append(toIndentedString(content)).append("\n");
|
||||
sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n");
|
||||
sb.append("}");
|
||||
|
||||
@@ -32,6 +32,9 @@ public class SmsSendRequest {
|
||||
@SerializedName("serviceNumber")
|
||||
private String serviceNumber = null;
|
||||
|
||||
@SerializedName("sender")
|
||||
private String sender = null;
|
||||
|
||||
@SerializedName("smsMessageList")
|
||||
private SmsMessage[] smsMessageList = new SmsMessage[1];
|
||||
|
||||
@@ -40,10 +43,10 @@ public class SmsSendRequest {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get serviceNumber
|
||||
* @return serviceNumber
|
||||
**/
|
||||
**/
|
||||
public String getServiceNumber() {
|
||||
return serviceNumber;
|
||||
}
|
||||
@@ -52,6 +55,25 @@ public class SmsSendRequest {
|
||||
this.serviceNumber = serviceNumber;
|
||||
}
|
||||
|
||||
|
||||
public SmsSendRequest sender(String sender) {
|
||||
this.sender = sender;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sender
|
||||
* @return sender
|
||||
**/
|
||||
public String getSender() {
|
||||
return sender;
|
||||
}
|
||||
|
||||
public void setSender(String sender) {
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
|
||||
public SmsSendRequest smsMessageList(SmsMessage[] smsMessageList) {
|
||||
this.smsMessageList = smsMessageList;
|
||||
return this;
|
||||
|
||||
@@ -151,7 +151,7 @@ public class WSRestHandler {
|
||||
try {
|
||||
SSLContext sslContext = WSUtils.createSSLContext("SSL"); //verificare WSUtils
|
||||
SSLConnectionSocketFactory scf = new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE);
|
||||
// client = HttpClients.custom().useSystemProperties().build();
|
||||
// client = HttpClients.custom().useSystemProperties().build();
|
||||
client = HttpClients.custom().useSystemProperties().setSSLSocketFactory(scf).build();
|
||||
HttpGet get = new HttpGet(url);
|
||||
get.setHeaders(headers);
|
||||
@@ -192,11 +192,15 @@ public class WSRestHandler {
|
||||
return createPostRequest(new Gson(), report);
|
||||
}
|
||||
|
||||
public String createNotifyMessage(String sourceNumber, String destinationNumber, String content, Date timestamp) {
|
||||
public String createNotifyMessage(String serviceNumber, String sender, String destinationNumber, String content) {
|
||||
NotifyMessage message = new NotifyMessage();
|
||||
message.setServiceNumber(sourceNumber);
|
||||
SmsMessage[] smsMessageList = new SmsMessage[1];
|
||||
message.setSmsMessageList(smsMessageList);
|
||||
message.setServiceNumber(serviceNumber);
|
||||
message.setSender(sender);
|
||||
message.setDestinationNumber("+39" + destinationNumber);
|
||||
message.setContent(content);
|
||||
message.setArchive("N");
|
||||
message.setDrNotify("N");
|
||||
message.setMessageType("Text");
|
||||
return createPostRequest(new Gson(), message);
|
||||
}
|
||||
|
||||
@@ -317,21 +321,21 @@ public class WSRestHandler {
|
||||
Object[] parametri = {smsOut.getDn(), DateUtils.toString(smsOut.getDataMax(), "dd/MM/yyyy")};
|
||||
sms.setContent(MessageFormat.format(messageSMS, parametri));
|
||||
}
|
||||
|
||||
sms.setDestinationNumber(smsOut.getRecapitoAlternativo());
|
||||
request.setServiceNumber(Resources.getSMS_SOURCE());
|
||||
request.setSender(Resources.getSMS_SOURCE());
|
||||
request.setServiceNumber(Resources.getSMS_SERVICE_NUMBER());
|
||||
|
||||
log.write("9999", "request.getServiceNumber() = " + request.getServiceNumber());
|
||||
log.write("9999", "request.getSender() = " + request.getSender());
|
||||
log.write("9999", "sms.getDestinationNumber() = " + sms.getDestinationNumber());
|
||||
log.write("9999", "sms.getServiceNumber() = " + sms.getContent());
|
||||
log.write("9999", "sms.getContent() = " + sms.getContent());
|
||||
|
||||
String smsString = createSmsMessageStr(sms.getDestinationNumber(), sms.getContent());
|
||||
log.write("9999", "log smsString :" + smsString);
|
||||
String smsMessageString = createNotifyMessage(request.getServiceNumber(), request.getSender(), sms.getDestinationNumber(), sms.getContent());
|
||||
|
||||
String smsMessageString = createNotifyMessage(request.getServiceNumber(), sms.getDestinationNumber(), sms.getContent(), smsOut.getDataInvio());
|
||||
String newString = smsMessageString.replace("[null]", "[" + smsString + "]");
|
||||
try {
|
||||
log.write("9999", "invio JSON verso SDP/AMDS :" + newString);
|
||||
String restPost = restPost(Resources.getAMDS_REST_URL(), null, newString, log);
|
||||
log.write("9999", "invio JSON verso SDP/AMDS :" + smsMessageString);
|
||||
String restPost = restPost(Resources.getAMDS_REST_URL(), null, smsMessageString, log);
|
||||
//logga la response
|
||||
log.write("9999", "postSmsOut [AMDS]: CHIAMATA SERVIZIO REST inviata, response: " + restPost);
|
||||
}catch (Exception e) {
|
||||
@@ -340,14 +344,4 @@ public class WSRestHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private String createSmsMessageStr(String destinationNumber, String content) {
|
||||
NotifyMessage message = new NotifyMessage();
|
||||
message.setDestinationNumber("+39" + destinationNumber);
|
||||
message.setContent(content);
|
||||
message.setArchive("N");
|
||||
message.setDrNotify("N");
|
||||
message.setMessageType("Text");
|
||||
Gson gson = new Gson();
|
||||
return createPostRequest(gson, message);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user