Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WFNEWS-2203 : Use ROF API field instead of comments for visible flames #1957

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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
Loading