Skip to content
Closed
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
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 @@
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,11 @@
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");
// String dmsPath = ConfigProperties.getPropertyByName("km-base-path");

Check warning on line 753 in src/main/java/com/iemr/common/service/feedback/FeedbackServiceImpl.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=AZ1mYwx4qzjtoCksQwgz&open=AZ1mYwx4qzjtoCksQwgz&pullRequest=388
// 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 @@

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,10 @@
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");
// String dmsPath = ConfigProperties.getPropertyByName("km-base-path");

Check warning on line 432 in src/main/java/com/iemr/common/service/notification/NotificationServiceImpl.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=AZ1mYw1yqzjtoCksQwg_&open=AZ1mYw1yqzjtoCksQwg_&pullRequest=388
// 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,16 @@
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");
// String dmsPath = ConfigProperties.getPropertyByName("km-base-path");

Check warning on line 120 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=AZ1mYw2OqzjtoCksQwhA&open=AZ1mYw2OqzjtoCksQwhA&pullRequest=388
// 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 128 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=AZ1mYw2OqzjtoCksQwhB&open=AZ1mYw2OqzjtoCksQwhB&pullRequest=388
// 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,13 +189,13 @@
{
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");
// String dmsPath = ConfigProperties.getPropertyByName("km-base-path");

Check warning on line 192 in src/main/java/com/iemr/common/service/services/CommonServiceImpl.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=AZ1mYw1PqzjtoCksQwg4&open=AZ1mYw1PqzjtoCksQwg4&pullRequest=388
// 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;

logger.info("file url="+fileUIDAsURI);

Check warning on line 198 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=AZ1mYw1PqzjtoCksQwg0&open=AZ1mYw1PqzjtoCksQwg0&pullRequest=388

Check warning on line 198 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=AZ1mYw1PqzjtoCksQwg5&open=AZ1mYw1PqzjtoCksQwg5&pullRequest=388
return fileUIDAsURI;
}

Expand Down Expand Up @@ -233,12 +245,17 @@
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 dmsPath = ConfigProperties.getPropertyByName("km-base-path");

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

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

See more on https://sonarcloud.io/project/issues?id=PSMRI_Common-API&issues=AZ1mYw1PqzjtoCksQwg6&open=AZ1mYw1PqzjtoCksQwg6&pullRequest=388
// 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 254 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=AZ1mYw1PqzjtoCksQwg7&open=AZ1mYw1PqzjtoCksQwg7&pullRequest=388

Check warning on line 254 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=AZ1mYw1PqzjtoCksQwg1&open=AZ1mYw1PqzjtoCksQwg1&pullRequest=388
logger.info("file path="+subCategory.getSubCatFilePath());

Check warning on line 255 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=AZ1mYw1PqzjtoCksQwg8&open=AZ1mYw1PqzjtoCksQwg8&pullRequest=388
logger.info("dms Path="+dmsPath);

Check warning on line 256 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=AZ1mYw1PqzjtoCksQwg2&open=AZ1mYw1PqzjtoCksQwg2&pullRequest=388

Check warning on line 256 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=AZ1mYw1PqzjtoCksQwg9&open=AZ1mYw1PqzjtoCksQwg9&pullRequest=388
logger.info("subcatfilePath="+subCatFilePath);

Check warning on line 257 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=AZ1mYw1PqzjtoCksQwg3&open=AZ1mYw1PqzjtoCksQwg3&pullRequest=388

Check warning on line 257 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=AZ1mYw1PqzjtoCksQwg-&open=AZ1mYw1PqzjtoCksQwg-&pullRequest=388

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=AZ1mYw27qzjtoCksQwhC&open=AZ1mYw27qzjtoCksQwhC&pullRequest=388
// KMService kmService = new OpenKMServiceImpl();
// return kmService;
// }

@Bean
public Validator getVaidator()
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);
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