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
2 changes: 2 additions & 0 deletions src/main/environment/common_example.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ km-root-path=/okm:personal/users/
km-guest-user=guest
km-guest-password=guest

tempFilePath=/tmp

# CTI Config
cti-server-ip=10.208.122.99
cti-logger_base_url=http://10.208.122.99/logger
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/iemr/common/CommonApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

@SpringBootApplication
@EnableScheduling
@EnableAsync
@EnableAsync(proxyTargetClass = true)
public class CommonApplication extends SpringBootServletInitializer {

@Bean
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/iemr/common/service/cti/CTIServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

Expand Down Expand Up @@ -90,6 +91,7 @@ public class CTIServiceImpl implements CTIService {
@Autowired
private BeneficiaryCallRepository beneficiaryCallRepository;

@Lazy
@Autowired
private CTIService ctiService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,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.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

Expand Down Expand Up @@ -104,6 +105,19 @@ public class FeedbackServiceImpl implements FeedbackService {
private Logger logger = LoggerFactory.getLogger(FeedbackServiceImpl.class);
// private ExecutorService executor = Executors.newCachedThreadPool();


@Value("${km-base-path}")
private String dmsPath;

@Value("${km-guest-user}")
private String userName;

@Value("${km-guest-password}")
private String userPassword;

@Value("${km-base-protocol}")
private String dmsProtocol;

@Autowired
private T_EpidemicOutbreakRepo t_EpidemicOutbreakRepo;

Expand Down Expand Up @@ -736,10 +750,7 @@ private String getFilePath(KMFileManager kmFileManager) {
String fileUIDAsURI = null;
if (kmFileManager != null && kmFileManager.getFileUID() != null) {
String fileUID = kmFileManager.getFileUID();
String dmsPath = ConfigProperties.getPropertyByName("km-base-path");
String dmsProtocol = ConfigProperties.getPropertyByName("km-base-protocol");
String userName = ConfigProperties.getPropertyByName("km-guest-user");
String userPassword = ConfigProperties.getPassword("km-guest-user");

fileUIDAsURI = dmsProtocol + "://" + userName + ":" + userPassword + "@" + dmsPath + "/Download?uuid="
+ fileUID;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,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.stereotype.Service;

import com.fasterxml.jackson.core.JsonProcessingException;
Expand Down Expand Up @@ -70,6 +71,19 @@ public class NotificationServiceImpl implements NotificationService

private EmailService emailService;


@Value("${km-base-path}")
private String dmsPath;

@Value("${km-guest-user}")
private String userName;

@Value("${km-guest-password}")
private String userPassword;

@Value("${km-base-protocol}")
private String dmsProtocol;

@Autowired
public void setEmailService(EmailService emailService)
{
Expand Down Expand Up @@ -415,10 +429,7 @@ private String getFilePath(KMFileManager kmFileManager)
if (kmFileManager != null && kmFileManager.getFileUID() != null)
{
String fileUID = kmFileManager.getFileUID();
String dmsPath = ConfigProperties.getPropertyByName("km-base-path");
String dmsProtocol = ConfigProperties.getPropertyByName("km-base-protocol");
String userName = ConfigProperties.getPropertyByName("km-guest-user");
String userPassword = ConfigProperties.getPassword("km-guest-user");

fileUIDAsURI =
dmsProtocol + "://" + userName + ":" + userPassword + "@" + dmsPath + "/Download?uuid=" + fileUID;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,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.stereotype.Service;

import com.fasterxml.jackson.databind.DeserializationFeature;
Expand Down Expand Up @@ -59,6 +60,18 @@

private KMFileManagerService kmFileManagerService;

@Value("${km-api-base-protocol}")
private String dmsProtocol;

@Value("${km-api-base-url}")
private String dmsPath;

@Value("${km-guest-user}")
private String userName;

@Value("${km-guest-password}")
private String userPassword;

@Autowired
public void setKmFileManagerService(KMFileManagerService kmFileManagerService) {
this.kmFileManagerService = kmFileManagerService;
Expand Down Expand Up @@ -104,16 +117,13 @@
String fileUIDAsURI = null;
if (kmFileManager != null && kmFileManager.getFileUID() != null) {
String fileUID = kmFileManager.getFileUID();
String dmsPath = ConfigProperties.getPropertyByName("km-base-path");
String dmsProtocol = ConfigProperties.getPropertyByName("km-base-protocol");
String userName = ConfigProperties.getPropertyByName("km-guest-user");
String userPassword = ConfigProperties.getPassword("km-guest-user");

fileUIDAsURI = dmsProtocol + "://" + userName + ":" + userPassword + "@" + dmsPath + "/Download?uuid="
+ fileUID;
}
// return fileUIDAsURI;
String message = kmFileManager.getFileUID() ;
return message;
return fileUIDAsURI;
// String message = kmFileManager.getFileUID() ;

Check warning on line 125 in src/main/java/com/iemr/common/service/scheme/SchemeServiceImpl.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_Common-API&issues=AZ1nVjjDltuqZgjfe2NL&open=AZ1nVjjDltuqZgjfe2NL&pullRequest=389
// return message;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,19 @@
public class CommonServiceImpl implements CommonService {

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

@Value("${km-base-path}")
private String dmsPath;

@Value("${km-guest-user}")
private String userName;

@Value("${km-guest-password}")
private String userPassword;

@Value("${km-base-protocol}")
private String dmsProtocol;

private static final String FILE_PATH = "filePath";

/**
Expand Down Expand Up @@ -177,10 +189,6 @@
{
String fileUIDAsURI = null;

String dmsPath = ConfigProperties.getPropertyByName("km-base-path");
String dmsProtocol = ConfigProperties.getPropertyByName("km-base-protocol");
String userName = ConfigProperties.getPropertyByName("km-guest-user");
String userPassword = ConfigProperties.getPassword("km-guest-user");
fileUIDAsURI =
dmsProtocol + "://" + userName + ":" + userPassword + "@" + dmsPath + "/Download?uuid=" + fileUID;

Expand Down Expand Up @@ -233,12 +241,13 @@
SubCategoryDetails subCategory = subCategoriesList.get(index);
if (subCategory.getSubCatFilePath() != null && subCategory.getSubCatFilePath().length() > 0) {
String subCatFilePath = subCategory.getSubCatFilePath();
String dmsPath = ConfigProperties.getPropertyByName("km-base-path");
String dmsProtocol = ConfigProperties.getPropertyByName("km-base-protocol");
String userName = ConfigProperties.getPropertyByName("km-guest-user");
String userPassword = ConfigProperties.getPassword("km-guest-user");
String fileUIDAsURI = dmsProtocol + "://" + userName + ":" + userPassword + "@" + dmsPath
+ "/Download?uuid=" + subCategory.getSubCatFilePath();
logger.info("file url="+fileUIDAsURI);

Check warning on line 246 in src/main/java/com/iemr/common/service/services/CommonServiceImpl.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_Common-API&issues=AZ1nVjhJltuqZgjfe2NE&open=AZ1nVjhJltuqZgjfe2NE&pullRequest=389

Check warning on line 246 in src/main/java/com/iemr/common/service/services/CommonServiceImpl.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_Common-API&issues=AZ1nVjhJltuqZgjfe2NH&open=AZ1nVjhJltuqZgjfe2NH&pullRequest=389
logger.info("file path="+subCategory.getSubCatFilePath());

Check warning on line 247 in src/main/java/com/iemr/common/service/services/CommonServiceImpl.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_Common-API&issues=AZ1nVjhJltuqZgjfe2NI&open=AZ1nVjhJltuqZgjfe2NI&pullRequest=389
logger.info("dms Path="+dmsPath);

Check warning on line 248 in src/main/java/com/iemr/common/service/services/CommonServiceImpl.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_Common-API&issues=AZ1nVjhJltuqZgjfe2NJ&open=AZ1nVjhJltuqZgjfe2NJ&pullRequest=389

Check warning on line 248 in src/main/java/com/iemr/common/service/services/CommonServiceImpl.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_Common-API&issues=AZ1nVjhJltuqZgjfe2NF&open=AZ1nVjhJltuqZgjfe2NF&pullRequest=389
logger.info("subcatfilePath="+subCatFilePath);

Check warning on line 249 in src/main/java/com/iemr/common/service/services/CommonServiceImpl.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_Common-API&issues=AZ1nVjhJltuqZgjfe2NK&open=AZ1nVjhJltuqZgjfe2NK&pullRequest=389

Check warning on line 249 in src/main/java/com/iemr/common/service/services/CommonServiceImpl.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_Common-API&issues=AZ1nVjhJltuqZgjfe2NG&open=AZ1nVjhJltuqZgjfe2NG&pullRequest=389

subCategory.setSubCatFilePath(fileUIDAsURI);
subCategoriesList.get(index).setFileManger(kmFileManagerRepository
.getKMFileLists(subCategoryDetails.getProviderServiceMapID(), subCatFilePath));
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/iemr/common/utils/IEMRApplBeans.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
@Configuration
public class IEMRApplBeans
{
@Bean
public KMService getOpenKMService()
{
KMService kmService = new OpenKMServiceImpl();
return kmService;
}
// @Bean
// public KMService getOpenKMService()
// {

Check warning on line 45 in src/main/java/com/iemr/common/utils/IEMRApplBeans.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_Common-API&issues=AZ1nVjmzltuqZgjfe2NN&open=AZ1nVjmzltuqZgjfe2NN&pullRequest=389
// KMService kmService = new OpenKMServiceImpl();
// return kmService;
// }

@Bean
public Validator getVaidator()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import com.iemr.common.data.users.User;
import com.iemr.common.repository.users.IEMRUserRepositoryCustom;
import com.iemr.common.service.users.IEMRAdminUserServiceImpl;
import com.iemr.common.utils.exception.IEMRException;

import io.jsonwebtoken.Claims;
Expand All @@ -32,9 +31,6 @@ public class JwtAuthenticationUtil {
private IEMRUserRepositoryCustom iEMRUserRepositoryCustom;
private final Logger logger = LoggerFactory.getLogger(this.getClass().getName());

@Autowired
private IEMRAdminUserServiceImpl iEMRAdminUserServiceImpl;

public JwtAuthenticationUtil(CookieUtil cookieUtil, JwtUtil jwtUtil) {
this.cookieUtil = cookieUtil;
this.jwtUtil = jwtUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,44 +46,47 @@
import com.openkm.sdk4j.exception.VirusDetectedException;
import com.openkm.sdk4j.exception.WebserviceException;

import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.client.JerseyClientBuilder;
import jakarta.annotation.PostConstruct;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

@Service
public class OpenKMServiceImpl implements KMService {
// private ConfigProperties configProperties;
//
// @Autowired
// public void setConfigProperties(ConfigProperties configProperties)
// {
// this.configProperties = configProperties;
// }

private final Logger logger = LoggerFactory.getLogger(this.getClass().getName());
private static String url;
private static String username;
private static String password;
private static String kmRootPath;
private static String guestUser;
private static String guestPassword;
@Value("${km-base-url}")
private String url;

@Value("${km-username}")
private String username;

@Value("${km-password}")
private String password;

@Value("${km-root-path}")
private String kmRootPath;

@Value("${km-guest-user}")
private String guestUser;

@Value("${km-guest-password}")
private String guestPassword;

public OpenKMServiceImpl() {
}

private static OKMWebservices connector = null;
private OKMWebservices connector;

@PostConstruct
public void init() {
if (connector == null) {
url = ConfigProperties.getPropertyByName("km-base-url");
username = ConfigProperties.getPropertyByName("km-username");
password = ConfigProperties.getPropertyByName("km-password");
kmRootPath = ConfigProperties.getPropertyByName("km-root-path");
guestUser = ConfigProperties.getPropertyByName("km-guest-user");
guestPassword = ConfigProperties.getPropertyByName("km-guest-password");
connector = OpenKMConnector.initialize(url, username, password);
logger.info("KM URL=",url);

Check warning on line 86 in src/main/java/com/iemr/common/utils/km/openkm/OpenKMServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

String contains no format specifiers.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Common-API&issues=AZ1nVjkXltuqZgjfe2NM&open=AZ1nVjkXltuqZgjfe2NM&pullRequest=389
connector = OpenKMConnector.initialize(url, username, password);

}
}
}

@Override
public String getDocumentRoot() {
Expand Down
16 changes: 8 additions & 8 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ jwt.refresh.expiration=604800000


## KM Configuration
km-base-protocol=http
km-username=okmAdmin
km-password=admin
km-base-url=http://localhost:8084/OpenKM
km-base-path=localhost:8084/OpenKM
km-root-path=/okm:personal/users/
km-guest-user=guest
km-guest-password=guest
# km-base-protocol=http
# km-username=okmAdmin
# km-password=admin
# km-base-url=http://localhost:8084/OpenKM
# km-base-path=localhost:8084/OpenKM
# km-root-path=/okm:personal/users/
# km-guest-user=guest
# km-guest-password=guest

# CTI Config
cti-server-ip=10.208.122.99
Expand Down
Loading