Skip to content

Commit

Permalink
issue #252: Saving MT GT and TT into a database
Browse files Browse the repository at this point in the history
  • Loading branch information
olenara committed Sep 27, 2017
1 parent 18a9536 commit 5d97c60
Showing 1 changed file with 53 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,16 @@ public class SmsExtraData {
public static final String MPROC_NOTES = "mprocNotes";
public static final String ORIGINATION_TYPE = "originationType";
public static final String RECEIPT_LOCAL_MESSAGEID = "receiptLocalMessageId";

//timestamps used for DetailedCDR
public static final String TIMESTAMP_A = "timestampA";
public static final String TIMESTAMP_B = "timestampB";
public static final String TIMESTAMP_C = "timestampC";


// global title and translation type for MT message
public static final String MT_GT = "mtGt";
public static final String MT_TT = "mtTt";

public static final String ZERO_STRING = null;

Expand All @@ -48,9 +55,12 @@ public class SmsExtraData {
private long timestampB;
private long timestampC;

private String mtGt;
private int mtTt;

public boolean isEmpty() {
if (this.mprocNotes != null || this.originationType != null || this.receiptLocalMessageId != null
|| this.timestampA != 0 || this.timestampB != 0 || this.timestampC != 0 )
|| this.timestampA != 0 || this.timestampB != 0 || this.timestampC != 0 || this.mtGt != null || this.mtTt != 0)
return false;
else
return true;
Expand All @@ -63,6 +73,8 @@ public void clear() {
timestampA = 0;
timestampB = 0;
timestampC = 0;
mtGt = null;
mtTt = 0;
}

public String getMprocNotes() {
Expand Down Expand Up @@ -109,9 +121,25 @@ public long getTimestampC() {
return timestampC;
}

public void setTimestampC(long timestampC) {
this.timestampC = timestampC;
}
public void setTimestampC(long timestampC) {
this.timestampC = timestampC;
}

public void setMtGt(String mtGt) {
this.mtGt = mtGt;
}

public String getMtGt() {
return mtGt;
}

public void setMtTt(int mtTt) {
this.mtTt = mtTt;
}

public int getMtTt() {
return mtTt;
}

@Override
public String toString() {
Expand Down Expand Up @@ -148,6 +176,17 @@ public String toString() {
sb.append(timestampC);
sb.append(", ");
}
if (mtGt != null) {
sb.append("mtGt=");
sb.append(mtGt);
sb.append(", ");
}

if (mtTt != 0) {
sb.append("mtTt");
sb.append(mtTt);
sb.append(", ");
}
sb.append("]");

return sb.toString();
Expand All @@ -168,7 +207,10 @@ public void read(javolution.xml.XMLFormat.InputElement xml, SmsExtraData extraDa
}

extraData.mprocNotes = xml.get(MPROC_NOTES, String.class);
extraData.receiptLocalMessageId = xml.get(RECEIPT_LOCAL_MESSAGEID, Long.class);
extraData.receiptLocalMessageId = xml.get(RECEIPT_LOCAL_MESSAGEID, Long.class);

extraData.mtGt = xml.get(MT_GT, String.class);
extraData.mtTt = xml.get(MT_TT, Integer.class);
}

@Override
Expand All @@ -183,6 +225,12 @@ public void write(SmsExtraData extraData, javolution.xml.XMLFormat.OutputElement
if (extraData.receiptLocalMessageId != null) {
xml.add(extraData.receiptLocalMessageId, RECEIPT_LOCAL_MESSAGEID, Long.class);
}
if (extraData.mtGt != null) {
xml.add(extraData.mtGt, MT_GT, String.class);
}
if (extraData.mtTt != 0) {
xml.add(extraData.mtTt, MT_TT, Integer.class);
}
}
};

Expand Down

0 comments on commit 5d97c60

Please sign in to comment.