Skip to content

Commit 0910a9b

Browse files
vishwab1vanitha18225Amoghdrtechie
authored
Move code from Release 3.4.0 to main (#282)
* Fix the issue in fetching the value for fields (#257) * fix: Add jsonProperty to map with the request body to fix the issue in getting the value for income, education and occupation * fix: remove commented code * Update version in pom.xml to 3.4.0 * Update pom.xml * Add ServerAuthorization key in allow headers (#275) * fix: add serverAuthorization * fix: add console * fix: correct the spelling * Nd/vs/token bengen issue (#280) * fix: add useragent as java to skip the token * fix: add logger * fix: add logger --------- Co-authored-by: Vanitha S <116701245+vanitha1822@users.noreply.github.com> Co-authored-by: Amoghavarsh <93114621+5Amogh@users.noreply.github.com> Co-authored-by: Mithun James <drtechie@users.noreply.github.com>
1 parent 43a5470 commit 0910a9b

4 files changed

Lines changed: 47 additions & 21 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.iemr.common-API</groupId>
88
<artifactId>common-api</artifactId>
9-
<version>3.2.1</version>
9+
<version>3.4.0</version>
1010
<packaging>war</packaging>
1111

1212
<name>Common-API</name>

src/main/java/com/iemr/common/model/beneficiary/BeneficiaryModel.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
import com.fasterxml.jackson.annotation.JsonFormat;
3737
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
38+
import com.fasterxml.jackson.annotation.JsonProperty;
3839
import com.google.gson.JsonObject;
3940
import com.google.gson.annotations.Expose;
4041
import com.iemr.common.model.user.TitleModel;
@@ -211,16 +212,19 @@ public class BeneficiaryModel implements Comparable<BeneficiaryModel> {
211212
@Expose
212213
private Integer occupationId;
213214
@Expose
215+
@JsonProperty("occupationOther")
214216
private String occupationName;
215217
@Expose
216218
private String occupation;
217219
@Expose
220+
@JsonProperty("incomeName")
218221
private String incomeStatus;
219222
@Expose
220223
private BigInteger religionId;
221224
@Expose
222225
private String religion;
223226
@Expose
227+
@JsonProperty("educationQualificationName")
224228
private String education;
225229
@Expose
226230
private Integer providerServiceMapID;

src/main/java/com/iemr/common/service/beneficiary/RegisterBenificiaryServiceImpl.java

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import org.springframework.scheduling.annotation.Async;
3838
import org.springframework.stereotype.Service;
3939

40-
import com.fasterxml.jackson.databind.ObjectMapper;
4140
import com.google.gson.Gson;
4241
import com.iemr.common.data.beneficiary.Beneficiary;
4342
import com.iemr.common.data.mctshistory.MctsOutboundCallDetail;
@@ -112,7 +111,6 @@ private void updateBeneficiaryID(String beneficiaryID, Long beneficiaryRegID) {
112111
@Override
113112
public Integer updateBenificiary(BeneficiaryModel benificiaryDetails, String auth) throws IEMRException {
114113
Integer updatedRows = 0;
115-
116114
IdentityEditDTO identityEditDTO = identityBenEditMapper.BenToIdentityEditMapper(benificiaryDetails);
117115
setDemographicDetails(identityEditDTO,benificiaryDetails);
118116

@@ -122,11 +120,9 @@ public Integer updateBenificiary(BeneficiaryModel benificiaryDetails, String aut
122120
benificiaryDetails.getCreatedBy()));
123121
}
124122
identityEditDTO.setDob(benificiaryDetails.getDOB());
125-
// identityEditDTO.setOtherFields(benificiaryDetails.getOtherFields());
126-
// String jsoninput=new Gson().toJson(identityEditDTO);
127123
updatedRows = identityBeneficiaryService.editIdentityEditDTO(identityEditDTO, auth,
128124
benificiaryDetails.getIs1097());
129-
125+
130126
return updatedRows;
131127
}
132128

@@ -140,11 +136,22 @@ else if(null != benificiaryDetails.getI_bendemographics().getReligion())
140136
identityEditDTO.setReligion(benificiaryDetails.getI_bendemographics().getReligion());
141137
else
142138
identityEditDTO.setReligion(benificiaryDetails.getI_bendemographics().getReligionName());
143-
if(null != benificiaryDetails.getOccupation())
144-
identityEditDTO.setOccupationName(benificiaryDetails.getOccupation());
145-
else
146-
identityEditDTO.setOccupationName(benificiaryDetails.getI_bendemographics().getOccupation());
147-
identityEditDTO.setEducation(benificiaryDetails.getI_bendemographics().getEducationName());
139+
140+
if (null != benificiaryDetails.getOccupation()) {
141+
identityEditDTO.setOccupationName(benificiaryDetails.getOccupation());
142+
} else if (null != benificiaryDetails.getI_bendemographics() &&
143+
null != benificiaryDetails.getI_bendemographics().getOccupation()) {
144+
identityEditDTO.setOccupationName(benificiaryDetails.getI_bendemographics().getOccupation());
145+
} else {
146+
identityEditDTO.setOccupationName(benificiaryDetails.getOccupationName());
147+
}
148+
149+
if (null != benificiaryDetails.getEducation()) {
150+
identityEditDTO.setEducation(benificiaryDetails.getEducation());
151+
} else if (null != benificiaryDetails.getI_bendemographics() &&
152+
null != benificiaryDetails.getI_bendemographics().getEducationName()) {
153+
identityEditDTO.setEducation(benificiaryDetails.getI_bendemographics().getEducationName());
154+
}
148155
if(null != benificiaryDetails.getIncomeStatus())
149156
identityEditDTO.setIncomeStatus(benificiaryDetails.getIncomeStatus());
150157
else
@@ -206,12 +213,25 @@ else if(null != beneficiaryModel.getI_bendemographics().getReligion())
206213
identityDTO.setReligion(beneficiaryModel.getI_bendemographics().getReligion());
207214
else
208215
identityDTO.setReligion(beneficiaryModel.getI_bendemographics().getReligionName());
209-
if(null != beneficiaryModel.getOccupation())
210-
identityDTO.setOccupationName(beneficiaryModel.getOccupation());
211-
else
212-
identityDTO.setOccupationName(beneficiaryModel.getI_bendemographics().getOccupation());
213-
if(null != beneficiaryModel.getI_bendemographics().getEducationName())
214-
identityDTO.setEducation(beneficiaryModel.getI_bendemographics().getEducationName());
216+
217+
if (null != beneficiaryModel.getOccupation()) {
218+
identityDTO.setOccupationName(beneficiaryModel.getOccupation());
219+
} else if (null != beneficiaryModel.getI_bendemographics() &&
220+
null != beneficiaryModel.getI_bendemographics().getOccupation()) {
221+
identityDTO.setOccupationName(beneficiaryModel.getI_bendemographics().getOccupation());
222+
} else {
223+
identityDTO.setOccupationName(beneficiaryModel.getOccupationName());
224+
}
225+
226+
if (null != beneficiaryModel.getEducation()) {
227+
identityDTO.setEducation(beneficiaryModel.getEducation());
228+
} else if (null != beneficiaryModel.getI_bendemographics() &&
229+
null != beneficiaryModel.getI_bendemographics().getEducationName()) {
230+
identityDTO.setEducation(beneficiaryModel.getI_bendemographics().getEducationName());
231+
}
232+
233+
234+
215235
if(null != beneficiaryModel.getIncomeStatus())
216236
identityDTO.setIncomeStatus(beneficiaryModel.getIncomeStatus());
217237
else

src/main/java/com/iemr/common/utils/JwtUserIdValidationFilter.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.iemr.common.utils;
22

33
import java.io.IOException;
4+
import java.util.Arrays;
45

56
import org.slf4j.Logger;
67
import org.slf4j.LoggerFactory;
@@ -15,7 +16,6 @@
1516
import jakarta.servlet.http.Cookie;
1617
import jakarta.servlet.http.HttpServletRequest;
1718
import jakarta.servlet.http.HttpServletResponse;
18-
import java.util.Arrays;
1919

2020
public class JwtUserIdValidationFilter implements Filter {
2121

@@ -39,11 +39,11 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo
3939

4040
logger.debug("Incoming Origin: {}", origin);
4141
logger.debug("Allowed Origins Configured: {}", allowedOrigins);
42-
42+
logger.info("Add server authorization header to response");
4343
if (origin != null && isOriginAllowed(origin)) {
4444
response.setHeader("Access-Control-Allow-Origin", origin);
4545
response.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
46-
response.setHeader("Access-Control-Allow-Headers", "Authorization, Content-Type, Accept, Jwttoken");
46+
response.setHeader("Access-Control-Allow-Headers", "Authorization, Content-Type, Accept, Jwttoken, serverAuthorization, ServerAuthorization, serverauthorization, Serverauthorization");
4747
response.setHeader("Access-Control-Allow-Credentials", "true");
4848
} else {
4949
logger.warn("Origin [{}] is NOT allowed. CORS headers NOT added.", origin);
@@ -150,7 +150,9 @@ private boolean isMobileClient(String userAgent) {
150150
if (userAgent == null)
151151
return false;
152152
userAgent = userAgent.toLowerCase();
153-
return userAgent.contains("okhttp"); // iOS (custom clients)
153+
logger.info(userAgent);
154+
// return userAgent.contains("okhttp"); // iOS (custom clients)
155+
return userAgent.contains("okhttp") || userAgent.contains("java/"); // iOS (custom clients)
154156
}
155157

156158
private boolean shouldSkipAuthentication(String path, String contextPath) {

0 commit comments

Comments
 (0)