Skip to content

Commit

Permalink
BS-232 SmsMessageFilter now treats startDate and endDate as simple St…
Browse files Browse the repository at this point in the history
…rings to avoid parsing problems
  • Loading branch information
hrosa committed Jun 7, 2018
1 parent ade56c2 commit 972c96c
Showing 1 changed file with 14 additions and 14 deletions.
Expand Up @@ -41,8 +41,8 @@ public class SmsMessageFilter {
private List<String> accountSidSet; // if not-null we need the cdrs that belong to several accounts
private String recipient;
private String sender;
private Date startTime; // to initialize it pass string arguments with yyyy-MM-dd format
private Date endTime;
private String startTime; // to initialize it pass string arguments with yyyy-MM-dd format
private String endTime;
private String body;
private Integer limit;
private Integer offset;
Expand Down Expand Up @@ -77,14 +77,14 @@ public SmsMessageFilter(String accountSid, List<String> accountSidSet, String re
this.limit = limit;
this.offset = offset;
if (startTime != null) {
Date date = DATE_FORMAT.parse(startTime);
this.startTime = date;
//Date date = DATE_FORMAT.parse(startTime);
this.startTime = startTime;
} else
this.startTime = null;

if (endTime != null) {
Date date = DATE_FORMAT.parse(endTime);
this.endTime = date;
//Date date = DATE_FORMAT.parse(endTime);
this.endTime = endTime;
} else {
this.endTime = null;
}
Expand All @@ -111,11 +111,11 @@ public String getSender() {
return sender;
}

public Date getStartTime() {
public String getStartTime() {
return startTime;
}

public Date getEndTime() {
public String getEndTime() {
return endTime;
}

Expand Down Expand Up @@ -175,16 +175,16 @@ public Builder sender(String sender) {
return this;
}

public Builder startTime(String startTime) throws ParseException {
if (startTime != null && !startTime.isEmpty()) {
this.filter.startTime = DATE_FORMAT.parse(startTime);
public Builder startTime(Date startTime) {
if (startTime != null) {
this.filter.startTime = DATE_FORMAT.format(startTime);
}
return this;
}

public Builder endTime(String endTime) throws ParseException {
if (endTime != null && !endTime.isEmpty()) {
this.filter.endTime = DATE_FORMAT.parse(endTime);
public Builder endTime(Date endTime) {
if (endTime != null) {
this.filter.endTime = DATE_FORMAT.format(endTime);
}
return this;
}
Expand Down

0 comments on commit 972c96c

Please sign in to comment.