Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Comment escape char #26

Merged
merged 3 commits into from
Jul 20, 2015
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
Expand Down Expand Up @@ -31,7 +32,7 @@ public static ContactInformation[] convertToEmergencyContactInformation(JSONObje
ContactInformation ci = new ContactInformation();
ci.setPreferredName(jcontact.getString("EMERGENCY NAME"));
ci.setRelationship(jcontact.getString("RELATION"));
ci.setComments(jcontact.getString("RELATION COMMENT"));
ci.setComments(StringEscapeUtils.unescapeJson(jcontact.getString("RELATION COMMENT")));
//le emailz
try {
for(int j = 1; j <=3; j++) {
Expand Down Expand Up @@ -94,7 +95,7 @@ public static ContactInformation convertToLocalContactInformation(JSONObject jso
ca.setState(address.getString("STATE"));
ca.setPostalCode(address.getString("ZIP"));
ca.setCountry(address.getString("COUNTRY"));
ca.setComment(address.getString("ADDRESS COMMENT"));
ca.setComment(StringEscapeUtils.unescapeJson(address.getString("ADDRESS COMMENT")));
ca.setType(address.getString("ADDRESS TYPE"));
ci.getAddresses().add(ca);
}
Expand All @@ -121,7 +122,7 @@ public static JSONObject convertToJSONObject(ContactInformation[] emergencyConta
address.put("STATE", ca.getState());
address.put("ZIP", ca.getPostalCode());
address.put("COUNTRY", ca.getCountry());
address.put("ADDRESS COMMENT", ca.getComment());
address.put("ADDRESS COMMENT", ca.getComment()+" ");
address.put("ADDRESS PRIORITY", count);
DateTimeFormatter formatter = DateTimeFormat.forPattern("dd-MMM-YY");
address.put("ADDRESS DTTM", formatter.print(ci.getLastModified()));
Expand All @@ -145,7 +146,7 @@ private static JSONObject jsonifyEmergencyContact(ContactInformation eci) {
JSONObject emergencyContact = new JSONObject();
emergencyContact.put("EMERGENCY NAME", eci.getPreferredName());
emergencyContact.put("RELATION", eci.getRelationship());
emergencyContact.put("RELATION COMMENT", eci.getComments());
emergencyContact.put("RELATION COMMENT", eci.getComments()+" ");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add in a "if ends in quote then add space"? Baby concern about saving over and over will add more and more spaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had this thought too. I was on the fence and could go either way. Spaces vs computational logic. Let's do it. I'll update.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked and no longer will append unlimited spaces

//TODO: Get language from eci
//emergencyContact.put("LANGUAGE SPOKEN 1", eci.get);
//emergencyContact.put("LANGUAGE SPOKEN 2", eci.get);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
<version>3.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand Down