| 1 | package fr.sii.ogham.spring.sms; | |
| 2 | ||
| 3 | import org.springframework.boot.context.properties.NestedConfigurationProperty; | |
| 4 | ||
| 5 | import com.cloudhopper.commons.charset.Charset; | |
| 6 | import com.cloudhopper.commons.charset.CharsetUtil; | |
| 7 | import com.cloudhopper.commons.gsm.DataCoding; | |
| 8 | ||
| 9 | import fr.sii.ogham.sms.sender.impl.cloudhopper.preparator.DataCodingProvider; | |
| 10 | ||
| 11 | public class DataCodingSchemeProperties { | |
| 12 | /** | |
| 13 | * Use the same Data Coding Scheme value for all messages if set. | |
| 14 | */ | |
| 15 | private Byte value; | |
| 16 | @NestedConfigurationProperty | |
| 17 | private AutoProperties auto = new AutoProperties(); | |
| 18 | ||
| 19 | public static class AutoProperties { | |
| 20 | /** | |
| 21 | * Enable/disable automatic mode based on SMPP interface version. | |
| 22 | * | |
| 23 | * <p> | |
| 24 | * {@link DataCodingProvider} implementation is selected based on SMPP | |
| 25 | * interface version. SMPP v3.3 Data Coding Scheme values are defined in | |
| 26 | * <a href= | |
| 27 | * "https://en.wikipedia.org/wiki/Data_Coding_Scheme#SMS_Data_Coding_Scheme">SMS | |
| 28 | * Data Coding Scheme</a>. SMPP 3.4 introduced a new list of data_coding | |
| 29 | * values (<a href= | |
| 30 | * "https://en.wikipedia.org/wiki/Short_Message_Peer-to-Peer#PDU_body">PDU | |
| 31 | * body</a>). | |
| 32 | * </p> | |
| 33 | * | |
| 34 | * <strong>SMPP v3.3</strong> | |
| 35 | * <p> | |
| 36 | * The text message is encoded using {@link Charset}. According to that | |
| 37 | * charset, the Data Coding Scheme is determined using the | |
| 38 | * <strong>General Data Coding group</strong> table. Therefore, a simple | |
| 39 | * mapping is applied: | |
| 40 | * <ul> | |
| 41 | * <li>{@link CharsetUtil#NAME_GSM7} {@literal ->} | |
| 42 | * {@link DataCoding#CHAR_ENC_DEFAULT}</li> | |
| 43 | * <li>{@link CharsetUtil#NAME_PACKED_GSM} {@literal ->} | |
| 44 | * {@link DataCoding#CHAR_ENC_DEFAULT}</li> | |
| 45 | * <li>{@link CharsetUtil#NAME_GSM} {@literal ->} | |
| 46 | * {@link DataCoding#CHAR_ENC_8BIT}</li> | |
| 47 | * <li>{@link CharsetUtil#NAME_GSM8} {@literal ->} | |
| 48 | * {@link DataCoding#CHAR_ENC_8BIT}</li> | |
| 49 | * <li>{@link CharsetUtil#NAME_UCS_2} {@literal ->} | |
| 50 | * {@link DataCoding#CHAR_ENC_UCS2}</li> | |
| 51 | * </ul> | |
| 52 | * | |
| 53 | * | |
| 54 | * <strong>SMPP v3.4+</strong> | |
| 55 | * <p> | |
| 56 | * The text message is encoded using {@link Charset}. According to that | |
| 57 | * charset, the Data Coding Scheme is determined using only the | |
| 58 | * <strong>Alphabet</strong> table. Therefore, a simple mapping is | |
| 59 | * applied: | |
| 60 | * <ul> | |
| 61 | * <li>{@link CharsetUtil#NAME_GSM7} {@literal ->} | |
| 62 | * {@link DataCoding#CHAR_ENC_DEFAULT}</li> | |
| 63 | * <li>{@link CharsetUtil#NAME_PACKED_GSM} {@literal ->} | |
| 64 | * {@link DataCoding#CHAR_ENC_DEFAULT}</li> | |
| 65 | * <li>{@link CharsetUtil#NAME_GSM} {@literal ->} | |
| 66 | * {@link DataCoding#CHAR_ENC_8BIT}</li> | |
| 67 | * <li>{@link CharsetUtil#NAME_GSM8} {@literal ->} | |
| 68 | * {@link DataCoding#CHAR_ENC_8BIT}</li> | |
| 69 | * <li>{@link CharsetUtil#NAME_ISO_8859_1} {@literal ->} | |
| 70 | * {@link DataCoding#CHAR_ENC_LATIN1}</li> | |
| 71 | * <li>{@link CharsetUtil#NAME_UCS_2} {@literal ->} | |
| 72 | * {@link DataCoding#CHAR_ENC_UCS2}</li> | |
| 73 | * </ul> | |
| 74 | * | |
| 75 | * Default: <i>true</i> | |
| 76 | */ | |
| 77 | private Boolean enable; | |
| 78 | ||
| 79 | public Boolean getEnable() { | |
| 80 |
3
1. getEnable : replaced Boolean return with True for fr/sii/ogham/spring/sms/DataCodingSchemeProperties$AutoProperties::getEnable → SURVIVED 2. getEnable : replaced Boolean return with False for fr/sii/ogham/spring/sms/DataCodingSchemeProperties$AutoProperties::getEnable → KILLED 3. getEnable : replaced Boolean return with False for fr/sii/ogham/spring/sms/DataCodingSchemeProperties$AutoProperties::getEnable → KILLED |
return enable; |
| 81 | } | |
| 82 | ||
| 83 | public void setEnable(Boolean enable) { | |
| 84 | this.enable = enable; | |
| 85 | } | |
| 86 | } | |
| 87 | ||
| 88 | public Byte getValue() { | |
| 89 |
1
1. getValue : replaced return value with null for fr/sii/ogham/spring/sms/DataCodingSchemeProperties::getValue → SURVIVED |
return value; |
| 90 | } | |
| 91 | ||
| 92 | public void setValue(Byte value) { | |
| 93 | this.value = value; | |
| 94 | } | |
| 95 | ||
| 96 | public AutoProperties getAuto() { | |
| 97 |
2
1. getAuto : replaced return value with null for fr/sii/ogham/spring/sms/DataCodingSchemeProperties::getAuto → KILLED 2. getAuto : replaced return value with null for fr/sii/ogham/spring/sms/DataCodingSchemeProperties::getAuto → KILLED |
return auto; |
| 98 | } | |
| 99 | ||
| 100 | public void setAuto(AutoProperties auto) { | |
| 101 | this.auto = auto; | |
| 102 | } | |
| 103 | ||
| 104 | } | |
Mutations | ||
| 80 |
1.1 2.2 3.3 |
|
| 89 |
1.1 |
|
| 97 |
1.1 2.2 |