1 | |
package org.codeforamerica.open311.facade.data; |
2 | |
|
3 | |
import java.io.Serializable; |
4 | |
import java.net.URL; |
5 | |
import java.util.Date; |
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
public class ServiceRequest implements Serializable { |
14 | |
private static final long serialVersionUID = -3276480125287251085L; |
15 | |
private String serviceRequestId; |
16 | |
private Status status; |
17 | |
private String statusNotes; |
18 | |
private String serviceName; |
19 | |
private String serviceCode; |
20 | |
private String description; |
21 | |
private String agencyResponsible; |
22 | |
private String serviceNotice; |
23 | |
private Date requestedDatetime; |
24 | |
private Date updatedDatetime; |
25 | |
private Date expectedDatetime; |
26 | |
private String address; |
27 | |
private Long addressId; |
28 | |
private Integer zipCode; |
29 | |
private Float latitude; |
30 | |
private Float longitude; |
31 | |
private URL mediaUrl; |
32 | |
|
33 | |
public ServiceRequest(String serviceRequestId, Status status, |
34 | |
String statusNotes, String serviceName, String serviceCode, |
35 | |
String description, String agencyResponsible, String serviceNotice, |
36 | |
Date requestedDatetime, Date updatedDatetime, |
37 | |
Date expectedDatetime, String address, Long addressId, |
38 | |
Integer zipCode, Float latitude, Float longitude, URL mediaUrl) { |
39 | 13 | super(); |
40 | 13 | this.serviceRequestId = serviceRequestId; |
41 | 13 | this.status = status; |
42 | 13 | this.statusNotes = statusNotes; |
43 | 13 | this.serviceName = serviceName; |
44 | 13 | this.serviceCode = serviceCode; |
45 | 13 | this.description = description; |
46 | 13 | this.agencyResponsible = agencyResponsible; |
47 | 13 | this.serviceNotice = serviceNotice; |
48 | 13 | this.requestedDatetime = requestedDatetime; |
49 | 13 | this.updatedDatetime = updatedDatetime; |
50 | 13 | this.expectedDatetime = expectedDatetime; |
51 | 13 | this.address = address; |
52 | 13 | this.addressId = addressId; |
53 | 13 | this.zipCode = zipCode; |
54 | 13 | this.latitude = latitude; |
55 | 13 | this.longitude = longitude; |
56 | 13 | this.mediaUrl = mediaUrl; |
57 | 13 | } |
58 | |
|
59 | |
public String getServiceRequestId() { |
60 | 4 | return serviceRequestId; |
61 | |
} |
62 | |
|
63 | |
public Status getStatus() { |
64 | 4 | return status; |
65 | |
} |
66 | |
|
67 | |
public String getStatusNotes() { |
68 | 4 | return statusNotes; |
69 | |
} |
70 | |
|
71 | |
public String getServiceName() { |
72 | 4 | return serviceName; |
73 | |
} |
74 | |
|
75 | |
public String getServiceCode() { |
76 | 6 | return serviceCode; |
77 | |
} |
78 | |
|
79 | |
public String getDescription() { |
80 | 6 | return description; |
81 | |
} |
82 | |
|
83 | |
public String getAgencyResponsible() { |
84 | 4 | return agencyResponsible; |
85 | |
} |
86 | |
|
87 | |
public String getServiceNotice() { |
88 | 4 | return serviceNotice; |
89 | |
} |
90 | |
|
91 | |
public Date getRequestedDatetime() { |
92 | 4 | return requestedDatetime; |
93 | |
} |
94 | |
|
95 | |
public Date getUpdatedDatetime() { |
96 | 4 | return updatedDatetime; |
97 | |
} |
98 | |
|
99 | |
public Date getExpectedDatetime() { |
100 | 4 | return expectedDatetime; |
101 | |
} |
102 | |
|
103 | |
public String getAddress() { |
104 | 4 | return address; |
105 | |
} |
106 | |
|
107 | |
public Long getAddressId() { |
108 | 4 | return addressId; |
109 | |
} |
110 | |
|
111 | |
public Integer getZipCode() { |
112 | 4 | return zipCode; |
113 | |
} |
114 | |
|
115 | |
public Float getLatitude() { |
116 | 4 | return latitude; |
117 | |
} |
118 | |
|
119 | |
public Float getLongitude() { |
120 | 4 | return longitude; |
121 | |
} |
122 | |
|
123 | |
public URL getMediaUrl() { |
124 | 4 | return mediaUrl; |
125 | |
} |
126 | |
|
127 | |
public String toString() { |
128 | 1 | return "[" + this.serviceRequestId + "] " + this.description + " (" |
129 | |
+ this.status + ")"; |
130 | |
} |
131 | |
|
132 | 4 | public static enum Status { |
133 | 1 | OPEN, CLOSED; |
134 | |
|
135 | |
public static Status getFromString(String status) { |
136 | 22 | status = status.toLowerCase(); |
137 | 22 | if (status.equals("open")) { |
138 | 10 | return OPEN; |
139 | |
} |
140 | 12 | if (status.equals("closed")) { |
141 | 10 | return CLOSED; |
142 | |
} |
143 | 2 | return null; |
144 | |
} |
145 | |
|
146 | |
public String toString() { |
147 | 2 | return this.name().toLowerCase(); |
148 | |
} |
149 | |
} |
150 | |
} |