Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
Expand Down Expand Up @@ -113,7 +114,10 @@

private static HttpUtils httpUtils = new HttpUtils();

private String common_url = ConfigProperties.getPropertyByName("common-url");
@Value("${common-url}")
private String common_url;

Check warning on line 118 in src/main/java/com/iemr/admin/service/employeemaster/EmployeeMasterServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this field "common_url" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ3zz73vt1CZC8okOQko&open=AZ3zz73vt1CZC8okOQko&pullRequest=131

// private String common_url = ConfigProperties.getPropertyByName("common-url");

Check warning on line 120 in src/main/java/com/iemr/admin/service/employeemaster/EmployeeMasterServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This block of commented-out lines of code should be removed.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ3zz73vt1CZC8okOQkp&open=AZ3zz73vt1CZC8okOQkp&pullRequest=131

private final String COMMON_BASE_URL = "common-url";

Expand Down Expand Up @@ -470,7 +474,7 @@
ObjectMapper objectMapper = new ObjectMapper();
Set<String> resultSet = new HashSet<String>();
HttpEntity<Object> request = RestTemplateUtil.createRequestEntity(campaignName, authToken);
String url = configProperties.getPropertyByName("common-url") + configProperties.getPropertyByName("create-feedback");
String url = common_url +"/" + configProperties.getPropertyByName("create-feedback");

Check warning on line 477 in src/main/java/com/iemr/admin/service/employeemaster/EmployeeMasterServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Change this instance-reference to a static reference.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ3zz73vt1CZC8okOQkq&open=AZ3zz73vt1CZC8okOQkq&pullRequest=131

ResponseEntity<String> responseStr = restTemplate.exchange(url, HttpMethod.POST, request, String.class);
OutputResponse response = objectMapper.readValue(responseStr.getBody(), OutputResponse.class);
Expand Down Expand Up @@ -713,7 +717,8 @@
logger.info("EmployeeMasterServiceImpl.createUserInCallCentre - start");
if (ENABLE_CTI_USER_CREATION) {
String UserCreateAPIURL = "";
String ctiServer = configProperties.getPropertyByName("common-url");
// String ctiServer = configProperties.getPropertyByName("common-url");

Check warning on line 720 in src/main/java/com/iemr/admin/service/employeemaster/EmployeeMasterServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This block of commented-out lines of code should be removed.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ3zz73vt1CZC8okOQkr&open=AZ3zz73vt1CZC8okOQkr&pullRequest=131
String ctiServer=common_url;
UserCreateAPIURL = ctiServer + configProperties.getPropertyByName("create-update-users-url");
HashMap<String, Object> headers = new HashMap<String, Object>();
JSONObject request = new JSONObject();
Expand Down Expand Up @@ -747,7 +752,8 @@

if (ENABLE_CTI_USER_CREATION) {
String UserCreateAPIURL = "";
String ctiServer = configProperties.getPropertyByName("common-url");
// String ctiServer = configProperties.getPropertyByName("common-url");

Check warning on line 755 in src/main/java/com/iemr/admin/service/employeemaster/EmployeeMasterServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This block of commented-out lines of code should be removed.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ3zz73vt1CZC8okOQks&open=AZ3zz73vt1CZC8okOQks&pullRequest=131
String ctiServer=common_url;
UserCreateAPIURL = ctiServer + configProperties.getPropertyByName("create-update-users-url");
HashMap<String, Object> headers = new HashMap<String, Object>();
JSONObject request = new JSONObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

Expand All @@ -34,15 +35,31 @@
import com.iemr.admin.utils.mapper.InputMapper;
import com.iemr.admin.utils.response.OutputResponse;

import jakarta.annotation.PostConstruct;

@Service
public class EncryptUserPassword123 {
private static HttpUtils utils = new HttpUtils();
private static String commonBaseURL = ConfigProperties.getPropertyByName("common-url");
private static String encryptPasswordURL = commonBaseURL
+ ConfigProperties.getPropertyByName("encrypt-password-url");
// private static String commonBaseURL =
// ConfigProperties.getPropertyByName("common-url");

Check warning on line 44 in src/main/java/com/iemr/admin/service/provideronboard/EncryptUserPassword123.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This block of commented-out lines of code should be removed.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ3zz71Nt1CZC8okOQkl&open=AZ3zz71Nt1CZC8okOQkl&pullRequest=131

@Value("${common-url}")
private String commonBaseURL;

// private String encryptPasswordURL = commonBaseURL + "/"
// + ConfigProperties.getPropertyByName("encrypt-password-url");

Check warning on line 50 in src/main/java/com/iemr/admin/service/provideronboard/EncryptUserPassword123.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This block of commented-out lines of code should be removed.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ3zz71Nt1CZC8okOQkm&open=AZ3zz71Nt1CZC8okOQkm&pullRequest=131

private Logger logger = LoggerFactory.getLogger(this.getClass().getName());

private String encryptPasswordURL;

@PostConstruct
public void init() {
encryptPasswordURL = commonBaseURL + "/" +
ConfigProperties.getPropertyByName("encrypt-password-url");
logger.info("commonBaseURL=" + encryptPasswordURL);

Check warning on line 60 in src/main/java/com/iemr/admin/service/provideronboard/EncryptUserPassword123.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use the built-in formatting to construct this argument.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ3zz71Nt1CZC8okOQkk&open=AZ3zz71Nt1CZC8okOQkk&pullRequest=131

Check warning on line 60 in src/main/java/com/iemr/admin/service/provideronboard/EncryptUserPassword123.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Format specifiers should be used instead of string concatenation.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ3zz71Nt1CZC8okOQkn&open=AZ3zz71Nt1CZC8okOQkn&pullRequest=131
}

@Async
public OutputResponse encryptUserCredentials(M_User data) {
JSONObject request = new JSONObject();
Expand Down
26 changes: 23 additions & 3 deletions src/main/java/com/iemr/admin/service/user/EncryptUserPassword.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

Expand All @@ -33,15 +34,34 @@
import com.iemr.admin.utils.mapper.InputMapper;
import com.iemr.admin.utils.response.OutputResponse;

import jakarta.annotation.PostConstruct;

@Service
public class EncryptUserPassword {
private static HttpUtils utils = new HttpUtils();
private static String commonBaseURL = ConfigProperties.getPropertyByName("common-url");
private static String encryptPasswordURL = commonBaseURL
+ ConfigProperties.getPropertyByName("encrypt-password-url");

@Value("${common-url}")
private String commonBaseURL;

// @Value("${encrypt-password-url}")
// private String encryptPasswordEndpoint;

Check warning on line 47 in src/main/java/com/iemr/admin/service/user/EncryptUserPassword.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This block of commented-out lines of code should be removed.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ3zz74Et1CZC8okOQku&open=AZ3zz74Et1CZC8okOQku&pullRequest=131

// private static String commonBaseURL =
// ConfigProperties.getPropertyByName("common-url");

Check warning on line 50 in src/main/java/com/iemr/admin/service/user/EncryptUserPassword.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This block of commented-out lines of code should be removed.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ3zz74Et1CZC8okOQkv&open=AZ3zz74Et1CZC8okOQkv&pullRequest=131
// private String encryptPasswordURL = commonBaseURL + "/" +
// ConfigProperties.getPropertyByName("encrypt-password-url");

private Logger logger = LoggerFactory.getLogger(this.getClass().getName());

private String encryptPasswordURL;

@PostConstruct
public void init() {
encryptPasswordURL = commonBaseURL + "/" +
ConfigProperties.getPropertyByName("encrypt-password-url");
logger.info("commonBaseURL" + encryptPasswordURL);

Check warning on line 62 in src/main/java/com/iemr/admin/service/user/EncryptUserPassword.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use the built-in formatting to construct this argument.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ3zz74Et1CZC8okOQkt&open=AZ3zz74Et1CZC8okOQkt&pullRequest=131

Check warning on line 62 in src/main/java/com/iemr/admin/service/user/EncryptUserPassword.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Format specifiers should be used instead of string concatenation.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ3zz74Et1CZC8okOQkw&open=AZ3zz74Et1CZC8okOQkw&pullRequest=131
}

@Async
public OutputResponse encryptUserCredentials(M_User1 data) {
JSONObject request = new JSONObject();
Expand Down
24 changes: 20 additions & 4 deletions src/main/java/com/iemr/admin/utils/config/ConfigProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,27 @@
public static String getPropertyByName(String propertyName) {
String result = null;
try {
if (properties == null) {
initalizeProperties();
// if (properties == null) {

Check warning on line 121 in src/main/java/com/iemr/admin/utils/config/ConfigProperties.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

This block of commented-out lines of code should be removed.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AZ3zz74bt1CZC8okOQkx&open=AZ3zz74bt1CZC8okOQkx&pullRequest=131
// initalizeProperties();
// }
// // result = environment.getProperty(propertyName);
// result = properties.getProperty(propertyName);

if (environment != null)
{
result = environment.getProperty(propertyName);
}
if (result == null)
{
if (properties == null)
{
initalizeProperties();
}
result = properties.getProperty(propertyName).trim();
} else
{
result = result.trim();
}
// result = environment.getProperty(propertyName);
result = properties.getProperty(propertyName);
} catch (Exception e) {
logger.error(propertyName + " retrival failed.", e);
}
Expand Down
Loading