Skip to content

Commit

Permalink
WFNEWS-2203 : Use ROF API field instead of comments for visible flames (
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhpalp authored Jun 13, 2024
1 parent 79c8a91 commit ccabeb0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 26 deletions.
2 changes: 1 addition & 1 deletion server/wfnews-api/wfnews-service-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>ca.bc.gov.nrs.wfim</groupId>
<artifactId>wfim-incidents-api-rest-common</artifactId>
<version>1.5.0-SNAPSHOT</version>
<version>1.9.5-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<dependency>
<groupId>ca.bc.gov.nrs.wfim</groupId>
<artifactId>wfim-incidents-api-rest-common</artifactId>
<version>1.6.1</version>
<version>1.9.5-SNAPSHOT</version>
</dependency>

</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<dependency>
<groupId>ca.bc.gov.nrs.wfim</groupId>
<artifactId>wfim-incidents-api-rest-common</artifactId>
<version>1.6.1</version>
<version>1.9.5-SNAPSHOT</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ public class RecordRoFServiceImpl implements RecordRoFService {
EmailNotificationService emailNotificationService;

private Date codeTableRefresh;
private String visibleFlameString = "Visible Flames = Yes; ";
private String noVisibleFlameString = "Visible Flames = No; ";
private String noCommentVisibleFlameString = "Visible Flames = N/C; ";
private String noCommentString = "No comments";

private Properties applicationProperties;
private RoFFormDao rofFormDao;
private RoFImageDao rofImageDao;
Expand Down Expand Up @@ -575,25 +570,18 @@ private String prepareRoF(JSONObject rofFormDataJson, ObjectMapper mapper)
rof.setSubmittedTimestamp(Date.from(submittedDateTime.atZone(ZoneId.systemDefault()).toInstant()));
}

// set default visible flame string as No Comment
String visibleFlame = noCommentVisibleFlameString;

if (rofFormDataJson.has("visibleFlame") && rofFormDataJson.optJSONArray("visibleFlame") != null) {
if (rofFormDataJson.optJSONArray("visibleFlame").isEmpty()) {
visibleFlame = noCommentVisibleFlameString;
} else if (rofFormDataJson.getJSONArray("visibleFlame").toString().replace("[", "").replace("]", "")
.replace("\"", "").equalsIgnoreCase("YES")) {
visibleFlame = visibleFlameString;
} else if (rofFormDataJson.getJSONArray("visibleFlame").toString().replace("[", "").replace("]", "")
.replace("\"", "").equalsIgnoreCase("NO")) {
visibleFlame = noVisibleFlameString;
}
}
Boolean visibleFlame = rofFormDataJson.has("visibleFlame")
&& rofFormDataJson.optJSONArray("visibleFlame") != null
&& rofFormDataJson.getJSONArray("visibleFlame").toString()
.replace("[", "").replace("]", "")
.replace("\"", "")
.equalsIgnoreCase("YES");
rof.setFlamesVisibleInd(visibleFlame);

if (rofFormDataJson.has("otherInfo") && !rofFormDataJson.optString("otherInfo", "").equals(""))
rof.setCallerReportDetails(visibleFlame + rofFormDataJson.optString("otherInfo"));
else if (rofFormDataJson.has("otherInfo") && rofFormDataJson.optString("otherInfo", "").equals(""))
rof.setCallerReportDetails(visibleFlame + noCommentString);

if (rofFormDataJson.has("otherInfo") && !rofFormDataJson.optString("otherInfo", "").isEmpty()) {
rof.setCallerReportDetails(rofFormDataJson.optString("otherInfo"));
}

logger.info(" ### START POST - Serializing and executing RoF POST...");
mapper.activateDefaultTyping(mapper.getPolymorphicTypeValidator(), ObjectMapper.DefaultTyping.JAVA_LANG_OBJECT,
Expand Down

0 comments on commit ccabeb0

Please sign in to comment.