Fix per il rilascio su DBCFX_RU_362

This commit is contained in:
vincenzofariello
2024-05-17 17:01:32 +02:00
parent 315a207283
commit 6be9579fc0
8 changed files with 851 additions and 56 deletions

View File

@@ -1072,12 +1072,11 @@ public class DBSSFormatController extends FormatController {
dbssDonorOut.setSistComp(richiesta.getCrmCompetenza()); dbssDonorOut.setSistComp(richiesta.getCrmCompetenza());
dbssDonorOut.setDataOrdine(richiesta.getDataRicezione()); dbssDonorOut.setDataOrdine(richiesta.getDataRicezione());
dbssDonorOut.setCognomeCliente(richiesta.getCognomeCliente()); dbssDonorOut.setCognomeCliente(richiesta.getCognomeCliente());
dbssDonorOut.setIdOperatoreDonor("TLC");
dbssDonorOut.setIdOperatoreDonating("TLC");
String aggiuntivi = ""; String aggiuntivi = "";
if (!Func.isNull(richiesta.getDn())) {
aggiuntivi += richiesta.getDn() + ";";
}
if (!Func.isNull(richiesta.getDn2())) aggiuntivi += richiesta.getDn2() + ";"; if (!Func.isNull(richiesta.getDn2())) aggiuntivi += richiesta.getDn2() + ";";
if (!Func.isNull(richiesta.getDn3())) aggiuntivi += richiesta.getDn3() + ";"; if (!Func.isNull(richiesta.getDn3())) aggiuntivi += richiesta.getDn3() + ";";
if (!Func.isNull(richiesta.getDn4())) aggiuntivi += richiesta.getDn4() + ";"; if (!Func.isNull(richiesta.getDn4())) aggiuntivi += richiesta.getDn4() + ";";
@@ -1423,6 +1422,8 @@ public class DBSSFormatController extends FormatController {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(dbssDonorOut.getDataOrdine()); calendar.setTime(dbssDonorOut.getDataOrdine());
int charValueIndex = 0; //usato come indice per l'array CharacteristicValueType
if (operation.equals(DBSSMap.EVENTO_ESITO_VERIFICA_COD_SESSIONE)) { if (operation.equals(DBSSMap.EVENTO_ESITO_VERIFICA_COD_SESSIONE)) {
request.setOperationType(OP_TYPE_CHECKFASE3); request.setOperationType(OP_TYPE_CHECKFASE3);
} else { } else {
@@ -1430,9 +1431,20 @@ public class DBSSFormatController extends FormatController {
} }
request.setInteractionDate(calendar); request.setInteractionDate(calendar);
CharacteristicValueType[] characteristics = new CharacteristicValueType[13]; CharacteristicValueType[] characteristics = new CharacteristicValueType[11];
if (!Func.isNull(dbssDonorOut.getAggiuntivi())) {
characteristics = new CharacteristicValueType[12];
}
if (operation.equals(DBSSMap.EVENTO_ESITO_VERIFICA_COD_SESSIONE)) { if (operation.equals(DBSSMap.EVENTO_ESITO_VERIFICA_COD_SESSIONE)) {
characteristics = new CharacteristicValueType[15];
if (!Func.isNull(dbssDonorOut.getAggiuntivi())) {
characteristics = new CharacteristicValueType[14];
}
else {
characteristics = new CharacteristicValueType[13];
}
} }
CharacteristicValueType reqType = new CharacteristicValueType(); CharacteristicValueType reqType = new CharacteristicValueType();
@@ -1440,91 +1452,95 @@ public class DBSSFormatController extends FormatController {
reqName.setName("RequestType"); reqName.setName("RequestType");
reqType.setCharacteristicSpecification(reqName); reqType.setCharacteristicSpecification(reqName);
reqType.setValue(dbssDonorOut.getAmbito()); reqType.setValue(dbssDonorOut.getAmbito());
characteristics[0] = reqType; characteristics[charValueIndex++] = reqType;
CharacteristicValueType reqId = new CharacteristicValueType(); CharacteristicValueType reqId = new CharacteristicValueType();
CharacteristicSpecificationType reqIdName = new CharacteristicSpecificationType(); CharacteristicSpecificationType reqIdName = new CharacteristicSpecificationType();
reqIdName.setName("RequestId"); reqIdName.setName("RequestId");
reqId.setCharacteristicSpecification(reqIdName); reqId.setCharacteristicSpecification(reqIdName);
reqId.setValue(dbssDonorOut.getCodiceSessione()); reqId.setValue(dbssDonorOut.getCodiceSessione());
characteristics[1] = reqId; characteristics[charValueIndex++] = reqId;
CharacteristicValueType externalId = new CharacteristicValueType(); CharacteristicValueType externalId = new CharacteristicValueType();
CharacteristicSpecificationType externalIdName = new CharacteristicSpecificationType(); CharacteristicSpecificationType externalIdName = new CharacteristicSpecificationType();
externalIdName.setName("ExternalID"); externalIdName.setName("ExternalID");
externalId.setCharacteristicSpecification(externalIdName); externalId.setCharacteristicSpecification(externalIdName);
externalId.setValue(dbssDonorOut.getCodiceOrdineOlo()); externalId.setValue(dbssDonorOut.getCodiceOrdineOlo());
characteristics[2] = externalId; characteristics[charValueIndex++] = externalId;
CharacteristicValueType dnType = new CharacteristicValueType(); CharacteristicValueType dnType = new CharacteristicValueType();
CharacteristicSpecificationType dnName = new CharacteristicSpecificationType(); CharacteristicSpecificationType dnName = new CharacteristicSpecificationType();
dnName.setName("ServiceNumber"); dnName.setName("ServiceNumber");
dnType.setCharacteristicSpecification(dnName); dnType.setCharacteristicSpecification(dnName);
dnType.setValue(dbssDonorOut.getDirectoryNumber()); dnType.setValue(dbssDonorOut.getDirectoryNumber());
characteristics[3] = dnType; characteristics[charValueIndex++] = dnType;
/*
CharacteristicValueType noteType = new CharacteristicValueType(); CharacteristicValueType noteType = new CharacteristicValueType();
CharacteristicSpecificationType noteName = new CharacteristicSpecificationType(); CharacteristicSpecificationType noteName = new CharacteristicSpecificationType();
noteName.setName("Comments"); noteName.setName("Comments");
noteType.setCharacteristicSpecification(noteName); noteType.setCharacteristicSpecification(noteName);
noteType.setValue(dbssDonorOut.getNote()); noteType.setValue(dbssDonorOut.getNote());
characteristics[4] = noteType; characteristics[charValueIndex++] = noteType;
*/
CharacteristicValueType donorType = new CharacteristicValueType(); CharacteristicValueType donorType = new CharacteristicValueType();
CharacteristicSpecificationType donorName = new CharacteristicSpecificationType(); CharacteristicSpecificationType donorName = new CharacteristicSpecificationType();
donorName.setName("DonorCode"); donorName.setName("DonorCode");
donorType.setCharacteristicSpecification(donorName); donorType.setCharacteristicSpecification(donorName);
donorType.setValue(dbssDonorOut.getIdOperatoreDonor()); donorType.setValue(dbssDonorOut.getIdOperatoreDonor());
characteristics[5] = donorType; characteristics[charValueIndex++] = donorType;
CharacteristicValueType additionalType = new CharacteristicValueType(); if (!Func.isNull(dbssDonorOut.getAggiuntivi())) {
CharacteristicSpecificationType additionalName = new CharacteristicSpecificationType(); CharacteristicValueType additionalType = new CharacteristicValueType();
additionalName.setName("AdditionalServiceNumber"); CharacteristicSpecificationType additionalName = new CharacteristicSpecificationType();
additionalType.setCharacteristicSpecification(additionalName); additionalName.setName("AdditionalServiceNumber");
additionalType.setValue(dbssDonorOut.getAggiuntivi()); additionalType.setCharacteristicSpecification(additionalName);
characteristics[6] = additionalType; additionalType.setValue(dbssDonorOut.getAggiuntivi());
characteristics[charValueIndex++] = additionalType;
}
CharacteristicValueType isnpType = new CharacteristicValueType(); CharacteristicValueType isnpType = new CharacteristicValueType();
CharacteristicSpecificationType isnpName = new CharacteristicSpecificationType(); CharacteristicSpecificationType isnpName = new CharacteristicSpecificationType();
isnpName.setName("isNP"); isnpName.setName("isNP");
isnpType.setCharacteristicSpecification(isnpName); isnpType.setCharacteristicSpecification(isnpName);
isnpType.setValue(dbssDonorOut.getFlagNp()); isnpType.setValue(dbssDonorOut.getFlagNp());
characteristics[7] = isnpType; characteristics[charValueIndex++] = isnpType;
CharacteristicValueType oloCodeType = new CharacteristicValueType(); CharacteristicValueType oloCodeType = new CharacteristicValueType();
CharacteristicSpecificationType oloCodeName = new CharacteristicSpecificationType(); CharacteristicSpecificationType oloCodeName = new CharacteristicSpecificationType();
oloCodeName.setName("OLOCode"); oloCodeName.setName("OLOCode");
oloCodeType.setCharacteristicSpecification(oloCodeName); oloCodeType.setCharacteristicSpecification(oloCodeName);
oloCodeType.setValue(dbssDonorOut.getCow()); oloCodeType.setValue(dbssDonorOut.getIdOperatoreDonating());
characteristics[8] = oloCodeType; characteristics[charValueIndex++] = oloCodeType;
CharacteristicValueType cosCodeType = new CharacteristicValueType(); CharacteristicValueType cosCodeType = new CharacteristicValueType();
CharacteristicSpecificationType cosCodeName = new CharacteristicSpecificationType(); CharacteristicSpecificationType cosCodeName = new CharacteristicSpecificationType();
cosCodeName.setName("COSCode"); cosCodeName.setName("COSCode");
cosCodeType.setCharacteristicSpecification(cosCodeName); cosCodeType.setCharacteristicSpecification(cosCodeName);
cosCodeType.setValue(dbssDonorOut.getCodiceSegreto()); cosCodeType.setValue(dbssDonorOut.getCodiceSegreto());
characteristics[9] = cosCodeType; characteristics[charValueIndex++] = cosCodeType;
CharacteristicValueType corCodeType = new CharacteristicValueType(); CharacteristicValueType corCodeType = new CharacteristicValueType();
CharacteristicSpecificationType corCodeName = new CharacteristicSpecificationType(); CharacteristicSpecificationType corCodeName = new CharacteristicSpecificationType();
corCodeName.setName("CORCode"); corCodeName.setName("CORCode");
corCodeType.setCharacteristicSpecification(corCodeName); corCodeType.setCharacteristicSpecification(corCodeName);
corCodeType.setValue(dbssDonorOut.getCor()); corCodeType.setValue(dbssDonorOut.getCor());
characteristics[10] = corCodeType; characteristics[charValueIndex++] = corCodeType;
CharacteristicValueType oloRecType = new CharacteristicValueType(); CharacteristicValueType oloRecType = new CharacteristicValueType();
CharacteristicSpecificationType oloRecName = new CharacteristicSpecificationType(); CharacteristicSpecificationType oloRecName = new CharacteristicSpecificationType();
oloRecName.setName("RepientOLOCode"); oloRecName.setName("RepientOLOCode");
oloRecType.setCharacteristicSpecification(oloRecName); oloRecType.setCharacteristicSpecification(oloRecName);
oloRecType.setValue(dbssDonorOut.getCodiceOloRecipient()); oloRecType.setValue(dbssDonorOut.getCodiceOloRecipient());
characteristics[11] = oloRecType; characteristics[charValueIndex++] = oloRecType;
CharacteristicValueType cognomeClienteType = new CharacteristicValueType(); CharacteristicValueType cognomeClienteType = new CharacteristicValueType();
CharacteristicSpecificationType cognomeClienteName = new CharacteristicSpecificationType(); CharacteristicSpecificationType cognomeClienteName = new CharacteristicSpecificationType();
cognomeClienteName.setName("FamilyName"); cognomeClienteName.setName("COWCode");
cognomeClienteType.setCharacteristicSpecification(cognomeClienteName); cognomeClienteType.setCharacteristicSpecification(cognomeClienteName);
cognomeClienteType.setValue(dbssDonorOut.getCognomeCliente()); cognomeClienteType.setValue(dbssDonorOut.getCow());
characteristics[12] = cognomeClienteType; characteristics[charValueIndex++] = cognomeClienteType;
if (operation.equals(DBSSMap.EVENTO_ESITO_VERIFICA_COD_SESSIONE)) { if (operation.equals(DBSSMap.EVENTO_ESITO_VERIFICA_COD_SESSIONE)) {
GnpNowD82RichiesteOutDAO nowDonorOutDAO = new GnpNowD82RichiesteOutDAO(); GnpNowD82RichiesteOutDAO nowDonorOutDAO = new GnpNowD82RichiesteOutDAO();
@@ -1536,14 +1552,14 @@ public class DBSSFormatController extends FormatController {
phase3ResultName.setName("Phase3Result"); phase3ResultName.setName("Phase3Result");
phase3Result.setCharacteristicSpecification(phase3ResultName); phase3Result.setCharacteristicSpecification(phase3ResultName);
phase3Result.setValue(nowDonorOut.getEsito()); phase3Result.setValue(nowDonorOut.getEsito());
characteristics[13] = phase3Result; characteristics[charValueIndex++] = phase3Result;
CharacteristicValueType phase3ResultD = new CharacteristicValueType(); CharacteristicValueType phase3ResultD = new CharacteristicValueType();
CharacteristicSpecificationType phase3ResultDName = new CharacteristicSpecificationType(); CharacteristicSpecificationType phase3ResultDName = new CharacteristicSpecificationType();
phase3ResultDName.setName("Phase3ResultDescription"); phase3ResultDName.setName("Phase3ResultDescription");
phase3ResultD.setCharacteristicSpecification(phase3ResultDName); phase3ResultD.setCharacteristicSpecification(phase3ResultDName);
phase3ResultD.setValue(nowDonorOut.getMotivazione()); phase3ResultD.setValue(nowDonorOut.getMotivazione());
characteristics[14] = phase3ResultD; characteristics[charValueIndex++] = phase3ResultD;
} }
} }

View File

@@ -111,7 +111,10 @@ public class SmsFormatController
return dao103.findById(idRichiesta).getPiattaformaProvenienza(); return dao103.findById(idRichiesta).getPiattaformaProvenienza();
} else { } else {
GnpRichiesteNpg103DAO dao = new GnpRichiesteNpg103DAO(); GnpRichiesteNpg103DAO dao = new GnpRichiesteNpg103DAO();
return dao.findById(idRichiesta).getPiattaformaProvenienza(); if (dao.findById(idRichiesta) != null) {
return dao.findById(idRichiesta).getPiattaformaProvenienza();
}
else return null;
} }
} }

View File

@@ -0,0 +1,94 @@
/*
* OpenAMDS REST API - OpenAPI 3.0
* REST API per OpenAMDS
*
* OpenAPI spec version: 1.0.11
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package it.valueteam.gnp.ws.amds.model;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
/**
* DynamicField
*/
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-05-10T08:42:45.887229576Z[GMT]")
public class DynamicField {
@SerializedName("fieldName")
private String fieldName = null;
@SerializedName("value")
private String value = null;
public DynamicField fieldName(String fieldName) {
this.fieldName = fieldName;
return this;
}
/**
* Get fieldName
* @return fieldName
**/
public String getFieldName() {
return fieldName;
}
public void setFieldName(String fieldName) {
this.fieldName = fieldName;
}
public DynamicField value(String value) {
this.value = value;
return this;
}
/**
* Get value
* @return value
**/
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DynamicField {\n");
sb.append(" fieldName: ").append(toIndentedString(fieldName)).append("\n");
sb.append(" value: ").append(toIndentedString(value)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -12,6 +12,7 @@
package it.valueteam.gnp.ws.amds.model; package it.valueteam.gnp.ws.amds.model;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.JsonAdapter;
@@ -40,15 +41,46 @@ public class NotifyMessage {
@SerializedName("timestamp") @SerializedName("timestamp")
private String timestamp = null; private String timestamp = null;
@SerializedName("serviceNumber")
private String serviceNumber = null;
@SerializedName("archive")
private String archive = null;
@SerializedName("drNotify")
private String drNotify = null;
@SerializedName("messageType")
private String messageType = null;
@SerializedName("smsMessageList")
private SmsMessage[] smsMessageList;
public String getServiceNumber() {
return serviceNumber;
}
public void setServiceNumber(String serviceNumber) {
this.serviceNumber = serviceNumber;
}
public SmsMessage[] getSmsMessageList() {
return smsMessageList;
}
public void setSmsMessageList(SmsMessage[] smsMessageList) {
this.smsMessageList = smsMessageList;
}
public NotifyMessage sourceNumber(String sourceNumber) { public NotifyMessage sourceNumber(String sourceNumber) {
this.sourceNumber = sourceNumber; this.sourceNumber = sourceNumber;
return this; return this;
} }
/** /**
* Get sourceNumber * Get sourceNumber
* @return sourceNumber * @return sourceNumber
**/ **/
public String getSourceNumber() { public String getSourceNumber() {
return sourceNumber; return sourceNumber;
} }
@@ -62,10 +94,10 @@ public class NotifyMessage {
return this; return this;
} }
/** /**
* Get destinationNumber * Get destinationNumber
* @return destinationNumber * @return destinationNumber
**/ **/
public String getDestinationNumber() { public String getDestinationNumber() {
return destinationNumber; return destinationNumber;
} }
@@ -79,10 +111,10 @@ public class NotifyMessage {
return this; return this;
} }
/** /**
* Get content * Get content
* @return content * @return content
**/ **/
public String getContent() { public String getContent() {
return content; return content;
} }
@@ -96,10 +128,10 @@ public class NotifyMessage {
return this; return this;
} }
/** /**
* Get timestamp * Get timestamp
* @return timestamp * @return timestamp
**/ **/
public String getTimestamp() { public String getTimestamp() {
return timestamp; return timestamp;
} }
@@ -108,6 +140,29 @@ public class NotifyMessage {
this.timestamp = timestamp; this.timestamp = timestamp;
} }
public String getArchive() {
return archive;
}
public void setArchive(String archive) {
this.archive = archive;
}
public String getDrNotify() {
return drNotify;
}
public void setDrNotify(String drNotify) {
this.drNotify = drNotify;
}
public String getMessageType() {
return messageType;
}
public void setMessageType(String messageType) {
this.messageType = messageType;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
@@ -124,7 +179,7 @@ public class NotifyMessage {
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("class NotifyMessage {\n"); sb.append("class NotifyMessage {\n");
sb.append(" sourceNumber: ").append(toIndentedString(sourceNumber)).append("\n"); sb.append(" sourceNumber: ").append(toIndentedString(sourceNumber)).append("\n");
sb.append(" destinationNumber: ").append(toIndentedString(destinationNumber)).append("\n"); sb.append(" destinationNumber: ").append(toIndentedString(destinationNumber)).append("\n");
sb.append(" content: ").append(toIndentedString(content)).append("\n"); sb.append(" content: ").append(toIndentedString(content)).append("\n");

View File

@@ -0,0 +1,405 @@
/*
* OpenAMDS REST API - OpenAPI 3.0
* REST API per OpenAMDS
*
* OpenAPI spec version: 1.0.11
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package it.valueteam.gnp.ws.amds.model;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import it.valueteam.gnp.ws.amds.model.SmsTemplate;
import java.io.IOException;
/**
* SmsMessage
*/
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-05-10T08:42:45.887229576Z[GMT]")
public class SmsMessage {
@SerializedName("destinationNumber")
private String destinationNumber = null;
@SerializedName("sender")
private String sender = null;
@SerializedName("content")
private String content = null;
@SerializedName("validity")
private String validity = null;
public SmsMessage(String destinationNumber, String content) {
this.destinationNumber = destinationNumber;
this.content = content;
}
/**
* Gets or Sets archive
*/
@JsonAdapter(ArchiveEnum.Adapter.class)
public enum ArchiveEnum {
@SerializedName("Y")
Y("Y"),
@SerializedName("N")
N("N");
private String value;
ArchiveEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static ArchiveEnum fromValue(String input) {
for (ArchiveEnum b : ArchiveEnum.values()) {
if (b.value.equals(input)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<ArchiveEnum> {
@Override
public void write(final JsonWriter jsonWriter, final ArchiveEnum enumeration) throws IOException {
jsonWriter.value(String.valueOf(enumeration.getValue()));
}
@Override
public ArchiveEnum read(final JsonReader jsonReader) throws IOException {
Object value = jsonReader.nextString();
return ArchiveEnum.fromValue((String)(value));
}
}
} @SerializedName("archive")
private ArchiveEnum archive = ArchiveEnum.N;
/**
* Gets or Sets drNotify
*/
@JsonAdapter(DrNotifyEnum.Adapter.class)
public enum DrNotifyEnum {
@SerializedName("Y")
Y("Y"),
@SerializedName("N")
N("N");
private String value;
DrNotifyEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static DrNotifyEnum fromValue(String input) {
for (DrNotifyEnum b : DrNotifyEnum.values()) {
if (b.value.equals(input)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<DrNotifyEnum> {
@Override
public void write(final JsonWriter jsonWriter, final DrNotifyEnum enumeration) throws IOException {
jsonWriter.value(String.valueOf(enumeration.getValue()));
}
@Override
public DrNotifyEnum read(final JsonReader jsonReader) throws IOException {
Object value = jsonReader.nextString();
return DrNotifyEnum.fromValue((String)(value));
}
}
} @SerializedName("drNotify")
private DrNotifyEnum drNotify = DrNotifyEnum.N;
@SerializedName("type")
private String type = null;
/**
* Gets or Sets messageEncoding
*/
@JsonAdapter(MessageEncodingEnum.Adapter.class)
public enum MessageEncodingEnum {
@SerializedName("Text")
TEXT("Text"),
@SerializedName("Binary")
BINARY("Binary");
private String value;
MessageEncodingEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static MessageEncodingEnum fromValue(String input) {
for (MessageEncodingEnum b : MessageEncodingEnum.values()) {
if (b.value.equals(input)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<MessageEncodingEnum> {
@Override
public void write(final JsonWriter jsonWriter, final MessageEncodingEnum enumeration) throws IOException {
jsonWriter.value(String.valueOf(enumeration.getValue()));
}
@Override
public MessageEncodingEnum read(final JsonReader jsonReader) throws IOException {
Object value = jsonReader.nextString();
return MessageEncodingEnum.fromValue((String)(value));
}
}
} @SerializedName("messageEncoding")
private MessageEncodingEnum messageEncoding = null;
@SerializedName("uid")
private String uid = null;
@SerializedName("smsTemplate")
private SmsTemplate smsTemplate = null;
public SmsMessage destinationNumber(String destinationNumber) {
this.destinationNumber = destinationNumber;
return this;
}
/**
* Get destinationNumber
* @return destinationNumber
**/
public String getDestinationNumber() {
return destinationNumber;
}
public void setDestinationNumber(String destinationNumber) {
this.destinationNumber = destinationNumber;
}
public SmsMessage 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 SmsMessage content(String content) {
this.content = content;
return this;
}
/**
* Get content
* @return content
**/
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public SmsMessage validity(String validity) {
this.validity = validity;
return this;
}
/**
* Get validity
* @return validity
**/
public String getValidity() {
return validity;
}
public void setValidity(String validity) {
this.validity = validity;
}
public SmsMessage archive(ArchiveEnum archive) {
this.archive = archive;
return this;
}
/**
* Get archive
* @return archive
**/
public ArchiveEnum getArchive() {
return archive;
}
public void setArchive(ArchiveEnum archive) {
this.archive = archive;
}
public SmsMessage drNotify(DrNotifyEnum drNotify) {
this.drNotify = drNotify;
return this;
}
/**
* Get drNotify
* @return drNotify
**/
public DrNotifyEnum getDrNotify() {
return drNotify;
}
public void setDrNotify(DrNotifyEnum drNotify) {
this.drNotify = drNotify;
}
public SmsMessage type(String type) {
this.type = type;
return this;
}
/**
* Get type
* @return type
**/
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public SmsMessage messageEncoding(MessageEncodingEnum messageEncoding) {
this.messageEncoding = messageEncoding;
return this;
}
/**
* Get messageEncoding
* @return messageEncoding
**/
public MessageEncodingEnum getMessageEncoding() {
return messageEncoding;
}
public void setMessageEncoding(MessageEncodingEnum messageEncoding) {
this.messageEncoding = messageEncoding;
}
public SmsMessage uid(String uid) {
this.uid = uid;
return this;
}
/**
* Get uid
* @return uid
**/
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public SmsMessage smsTemplate(SmsTemplate smsTemplate) {
this.smsTemplate = smsTemplate;
return this;
}
/**
* Get smsTemplate
* @return smsTemplate
**/
public SmsTemplate getSmsTemplate() {
return smsTemplate;
}
public void setSmsTemplate(SmsTemplate smsTemplate) {
this.smsTemplate = smsTemplate;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SmsMessage {\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(" validity: ").append(toIndentedString(validity)).append("\n");
sb.append(" archive: ").append(toIndentedString(archive)).append("\n");
sb.append(" drNotify: ").append(toIndentedString(drNotify)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" messageEncoding: ").append(toIndentedString(messageEncoding)).append("\n");
sb.append(" uid: ").append(toIndentedString(uid)).append("\n");
sb.append(" smsTemplate: ").append(toIndentedString(smsTemplate)).append("\n");
sb.append("}");
return sb.toString();
}
public String toJsonString(String destinationNumber, String content) {
StringBuilder sb = new StringBuilder();
sb.append("{\n");
sb.append(" destinationNumber: ").append(toIndentedString(destinationNumber)).append(",\n");
sb.append(" content: ").append(toIndentedString(content)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,99 @@
/*
* OpenAMDS REST API - OpenAPI 3.0
* REST API per OpenAMDS
*
* OpenAPI spec version: 1.0.11
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package it.valueteam.gnp.ws.amds.model;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import it.valueteam.gnp.ws.amds.model.SmsMessage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* SmsSendRequest
*/
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-05-10T08:42:45.887229576Z[GMT]")
public class SmsSendRequest {
@SerializedName("serviceNumber")
private String serviceNumber = null;
@SerializedName("smsMessageList")
private SmsMessage[] smsMessageList = new SmsMessage[1];
public SmsSendRequest serviceNumber(String serviceNumber) {
this.serviceNumber = serviceNumber;
return this;
}
/**
* Get serviceNumber
* @return serviceNumber
**/
public String getServiceNumber() {
return serviceNumber;
}
public void setServiceNumber(String serviceNumber) {
this.serviceNumber = serviceNumber;
}
public SmsSendRequest smsMessageList(SmsMessage[] smsMessageList) {
this.smsMessageList = smsMessageList;
return this;
}
public SmsSendRequest addSmsMessageListItem(SmsMessage smsMessageListItem) {
this.smsMessageList[0] = smsMessageListItem;
return this;
}
/**
* Get smsMessageList
* @return smsMessageList
**/
public SmsMessage[] getSmsMessageList() {
return smsMessageList;
}
public void setSmsMessageList(SmsMessage[] smsMessageList) {
this.smsMessageList = smsMessageList;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SmsSendRequest {\n");
sb.append(" serviceNumber: ").append(toIndentedString(serviceNumber)).append("\n");
sb.append(" smsMessageList: ").append(toIndentedString(smsMessageList)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,100 @@
/*
* OpenAMDS REST API - OpenAPI 3.0
* REST API per OpenAMDS
*
* OpenAPI spec version: 1.0.11
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package it.valueteam.gnp.ws.amds.model;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import it.valueteam.gnp.ws.amds.model.DynamicField;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* SmsTemplate
*/
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2024-05-10T08:42:45.887229576Z[GMT]")
public class SmsTemplate {
@SerializedName("id")
private String id = null;
@SerializedName("dynamicFieldList")
private List<DynamicField> dynamicFieldList = new ArrayList<DynamicField>();
public SmsTemplate id(String id) {
this.id = id;
return this;
}
/**
* Get id
* @return id
**/
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public SmsTemplate dynamicFieldList(List<DynamicField> dynamicFieldList) {
this.dynamicFieldList = dynamicFieldList;
return this;
}
public SmsTemplate addDynamicFieldListItem(DynamicField dynamicFieldListItem) {
this.dynamicFieldList.add(dynamicFieldListItem);
return this;
}
/**
* Get dynamicFieldList
* @return dynamicFieldList
**/
public List<DynamicField> getDynamicFieldList() {
return dynamicFieldList;
}
public void setDynamicFieldList(List<DynamicField> dynamicFieldList) {
this.dynamicFieldList = dynamicFieldList;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SmsTemplate {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" dynamicFieldList: ").append(toIndentedString(dynamicFieldList)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -12,11 +12,11 @@ import it.valueteam.gnp.utility.Func;
import it.valueteam.gnp.utility.Resources; import it.valueteam.gnp.utility.Resources;
import it.valueteam.gnp.ws.amds.model.DeliveryReport; import it.valueteam.gnp.ws.amds.model.DeliveryReport;
import it.valueteam.gnp.ws.amds.model.NotifyMessage; import it.valueteam.gnp.ws.amds.model.NotifyMessage;
import it.valueteam.gnp.ws.amds.model.SmsMessage;
import it.valueteam.gnp.ws.amds.model.SmsSendRequest;
import it.valueteam.gnp.ws.sdp.ErrorDTO; import it.valueteam.gnp.ws.sdp.ErrorDTO;
import it.valueteam.gnp.ws.sdp.model.*; import it.valueteam.gnp.ws.sdp.model.*;
import org.apache.http.Header; import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPost;
@@ -28,12 +28,12 @@ import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicHeader;
import tim.infobus.data.TID; import tim.infobus.data.TID;
import javax.annotation.Resource;
import javax.net.ssl.SSLContext; import javax.net.ssl.SSLContext;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.FileReader; import java.io.FileReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -194,11 +194,9 @@ public class WSRestHandler {
public String createNotifyMessage(String sourceNumber, String destinationNumber, String content, Date timestamp) { public String createNotifyMessage(String sourceNumber, String destinationNumber, String content, Date timestamp) {
NotifyMessage message = new NotifyMessage(); NotifyMessage message = new NotifyMessage();
message.setSourceNumber(sourceNumber); message.setServiceNumber(sourceNumber);
message.setDestinationNumber(destinationNumber); SmsMessage[] smsMessageList = new SmsMessage[1];
message.setContent(content); message.setSmsMessageList(smsMessageList);
message.setTimestamp(DateUtils.toString(timestamp,"yyyy-MM-dd HH:mm:ss.SSS"));
return createPostRequest(new Gson(), message); return createPostRequest(new Gson(), message);
} }
@@ -211,16 +209,19 @@ public class WSRestHandler {
CloseableHttpResponse response = null; CloseableHttpResponse response = null;
StringBuilder jsonString = new StringBuilder(); StringBuilder jsonString = new StringBuilder();
try { try {
StringEntity postingString = new StringEntity(json);
SSLContext sslContext = WSUtils.createSSLContext("SSL"); //verificare WSUtils SSLContext sslContext = WSUtils.createSSLContext("SSL"); //verificare WSUtils
SSLConnectionSocketFactory scf = new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE); SSLConnectionSocketFactory scf = new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE);
//client = HttpClients.custom().useSystemProperties().build(); //client = HttpClients.custom().useSystemProperties().build();
client = HttpClients.custom().useSystemProperties().setSSLSocketFactory(scf).build(); client = HttpClients.custom().useSystemProperties().setSSLSocketFactory(scf).build();
StringEntity postingString = new StringEntity(json);
HttpPost post = new HttpPost(url); HttpPost post = new HttpPost(url);
post.setEntity(postingString); post.setEntity(postingString);
post.setHeader("Content-type","application/json"); post.setHeader("Content-type","application/json");
post.setHeader("X-SourceSystem","DBCFX"); post.setHeader("sourceSystem","DBCFX");
post.setHeader("X-Business-ID", String.valueOf(new TID())); post.setHeader("businessId", String.valueOf(new TID()));
post.setHeader("transactionId", String.valueOf(new TID()));
response = client.execute(post); response = client.execute(post);
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
@@ -276,7 +277,8 @@ public class WSRestHandler {
//Header[] headers = setHeader("postSmsOut", log); //Header[] headers = setHeader("postSmsOut", log);
NotifyMessage sms = new NotifyMessage(); SmsSendRequest request = new SmsSendRequest();
SmsMessage sms = new SmsMessage("","");
if (smsOut.getDn() == null) { //Recipient standard if (smsOut.getDn() == null) { //Recipient standard
sms.setContent(Resources.getSMS_MESSAGE()); sms.setContent(Resources.getSMS_MESSAGE());
@@ -316,15 +318,36 @@ public class WSRestHandler {
sms.setContent(MessageFormat.format(messageSMS, parametri)); sms.setContent(MessageFormat.format(messageSMS, parametri));
} }
sms.setDestinationNumber(smsOut.getRecapitoAlternativo()); sms.setDestinationNumber(smsOut.getRecapitoAlternativo());
sms.setSourceNumber(Resources.getSMS_SOURCE()); request.setServiceNumber(Resources.getSMS_SOURCE());
String notifyMessageString = createNotifyMessage(sms.getSourceNumber(), sms.getDestinationNumber(), sms.getContent(), new Date()); log.write("9999", "request.getServiceNumber() = " + request.getServiceNumber());
log.write("9999", "sms.getDestinationNumber() = " + sms.getDestinationNumber());
log.write("9999", "sms.getServiceNumber() = " + sms.getContent());
String smsString = createSmsMessageStr(sms.getDestinationNumber(), sms.getContent());
log.write("9999", "log smsString :" + smsString);
String smsMessageString = createNotifyMessage(request.getServiceNumber(), sms.getDestinationNumber(), sms.getContent(), smsOut.getDataInvio());
String newString = smsMessageString.replace("[null]", "[" + smsString + "]");
try { try {
String restPost = restPost(Resources.getAMDS_REST_URL(), null, notifyMessageString, log); log.write("9999", "invio JSON verso SDP/AMDS :" + newString);
String restPost = restPost(Resources.getAMDS_REST_URL(), null, newString, log);
//logga la response //logga la response
log.debug(restPost); log.write("9999", "postSmsOut [AMDS]: CHIAMATA SERVIZIO REST inviata, response: " + restPost);
}catch (Exception e) { }catch (Exception e) {
log.error(e.getMessage()); log.write("9999", "postSmsOut [AMDS]: CHIAMATA SERVIZIO REST in ERRORE: " + e.getMessage());
e.printStackTrace();
} }
} }
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);
}
} }