Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
eea002b
fix: add clinical staff information
vanitha1822 Jul 14, 2026
5b6bcf0
fix: pom version
vanitha1822 Jul 14, 2026
1624318
Merge pull request #173 from PSMRI/nd/vs/clinical_staff
vishwab1 Aug 10, 2026
c5b72c8
feat(stoptb): add Nikshay ID Generator CSV export/import
vishwab1 Aug 18, 2026
de0b7bc
fix(stoptb): store Nikshay ID on tb_suspected, match import rows by p…
vishwab1 Aug 18, 2026
e3f38d6
fix(stoptb): rewrite export query against verified real schema
vishwab1 Aug 18, 2026
a73cb62
fix(stoptb): fix CSV streaming response (No converter for [...Lambda.…
vishwab1 Aug 18, 2026
605ce78
fix(stoptb): allow REGISTRAR role on Nikshay export/import endpoints
vishwab1 Aug 18, 2026
3389f68
fix(stoptb): remove @PreAuthorize role gate on Nikshay export/import
vishwab1 Aug 18, 2026
5c30cd8
fix(stoptb): write CSV synchronously instead of via StreamingResponse…
vishwab1 Aug 18, 2026
79d8422
fix(stoptb): read phone/address from the columns actually populated
vishwab1 Aug 19, 2026
c3faa90
fix(stoptb): import phone matching missed PreferredPhoneNum too
vishwab1 Aug 19, 2026
71ddd40
feat(stoptb): use benRegId directly when present, fall back to phone+…
vishwab1 Aug 19, 2026
8597bba
fix: add the endpoints and schema for downsync from central to local
vanitha1822 Aug 20, 2026
9815769
fix: downsync implementation
vanitha1822 Aug 24, 2026
1090c4b
fix: build issue
vanitha1822 Aug 24, 2026
eaf2edd
fix: lastmoddate updation
vanitha1822 Aug 25, 2026
40686bd
fix: update the response of downsync
vanitha1822 Aug 27, 2026
c8c5cb7
fix: update the continuous call on check sync progress
vanitha1822 Aug 27, 2026
2f35483
fix: column name issue for stoptb tables
vanitha1822 Aug 27, 2026
7b2213b
fix: issue in stoptb tables
vanitha1822 Aug 27, 2026
a9e7768
fix: add central id
vanitha1822 Sep 1, 2026
c01a97b
fix: FK Mapping issue
vanitha1822 Sep 1, 2026
6dfae61
fix: downsync issue
vanitha1822 Sep 1, 2026
9e25ef6
fix: FK issue in i_ beneficiarymapping table
vanitha1822 Sep 1, 2026
8988062
fix: include U for downsync again
vanitha1822 Sep 1, 2026
7c68c8b
fix: revert central id for m_beneficiaryregidmapping
vanitha1822 Sep 1, 2026
822a04d
fix: conflict section
vanitha1822 Sep 1, 2026
f983c85
fix: manage conflicts and add F flag for resync
vanitha1822 Sep 1, 2026
21c488c
fix: pom version update
vanitha1822 Sep 2, 2026
944f6f7
fix: add the condition to block the download from different van
vanitha1822 Sep 2, 2026
fd55819
fix: resolve foreign key violation
vanitha1822 Sep 2, 2026
4215eb8
fix: retry failed records
vanitha1822 Sep 2, 2026
0924990
fix: update 'F' flag
vanitha1822 Sep 2, 2026
0f6837b
fix: sonarqube comments
vanitha1822 Sep 4, 2026
f3b9f56
Merge remote-tracking branch 'origin/release-3.9.0' into nd/vs/stoptb…
vanitha1822 Sep 4, 2026
b7005a3
fix: resolve sonarcube comments
vanitha1822 Sep 4, 2026
1b8d1dd
Merge pull request #181 from PSMRI/mmu-3.8.2-nikshay-generation
SauravBizbRolly Sep 7, 2026
ab87e18
fix: issue in m_beneficiaryregidmapping table
vanitha1822 Sep 9, 2026
92e6ccb
Merge remote-tracking branch 'origin/release-3.8.4' into vb/3.8.4-3.9.0
vishwab1 Sep 10, 2026
a02ab91
Merge pull request #179 from PSMRI/nd/vs/stoptb_downsync
vishwab1 Sep 10, 2026
4f56d8a
Merge pull request #182 from PSMRI/vb/3.8.4-3.9.0
snehar-nd Sep 10, 2026
03da110
Adding api's for syncing diagnostic documents to s3
sehjotsinghunthinkable Sep 11, 2026
0782c44
fix: add the endpoints and schema for downsync from central to local
vanitha1822 Aug 20, 2026
ad2ccaa
fix: downsync implementation
vanitha1822 Aug 24, 2026
b0ca63f
fix: build issue
vanitha1822 Aug 24, 2026
e9ddd75
fix: lastmoddate updation
vanitha1822 Aug 25, 2026
2c957c9
fix: update the response of downsync
vanitha1822 Aug 27, 2026
d0438c1
fix: update the continuous call on check sync progress
vanitha1822 Aug 27, 2026
6eb9221
fix: column name issue for stoptb tables
vanitha1822 Aug 27, 2026
af58fa0
fix: issue in stoptb tables
vanitha1822 Aug 27, 2026
c4a4142
fix: add central id
vanitha1822 Sep 1, 2026
0e957e3
fix: FK Mapping issue
vanitha1822 Sep 1, 2026
48c98e8
fix: downsync issue
vanitha1822 Sep 1, 2026
4c11d31
fix: FK issue in i_ beneficiarymapping table
vanitha1822 Sep 1, 2026
e267058
fix: include U for downsync again
vanitha1822 Sep 1, 2026
7dc70ef
fix: revert central id for m_beneficiaryregidmapping
vanitha1822 Sep 1, 2026
5442526
fix: conflict section
vanitha1822 Sep 1, 2026
1b65b93
fix: manage conflicts and add F flag for resync
vanitha1822 Sep 1, 2026
a4c35a9
fix: pom version update
vanitha1822 Sep 2, 2026
ae5a424
fix: add the condition to block the download from different van
vanitha1822 Sep 2, 2026
2fedd6d
fix: resolve foreign key violation
vanitha1822 Sep 2, 2026
ddf96cd
fix: retry failed records
vanitha1822 Sep 2, 2026
f1c5078
fix: update 'F' flag
vanitha1822 Sep 2, 2026
8009ccc
fix: sonarqube comments
vanitha1822 Sep 4, 2026
df18a20
fix: add clinical staff information
vanitha1822 Jul 14, 2026
3fc6583
fix: pom version
vanitha1822 Jul 14, 2026
f757174
fix: resolve sonarcube comments
vanitha1822 Sep 4, 2026
4c62154
fix: issue in m_beneficiaryregidmapping table
vanitha1822 Sep 9, 2026
80304ef
Adding api's for syncing diagnostic documents to s3
sehjotsinghunthinkable Sep 11, 2026
24ae8ec
Merge branch 'release-3.9.0' into feature/diagnostic-document-sync
sehjotsinghunthinkable Sep 11, 2026
5d1182a
Adding api's for syncing diagnostic documents to s3
sehjotsinghunthinkable Sep 11, 2026
a5f2999
feat(stoptb): record whether AMRIT caused each Nikshay ID to be created
Sep 11, 2026
b68a401
chore(stoptb): remove added code comments
Sep 11, 2026
7668f80
Merge pull request #185 from PSMRI/sn/3.9.0
vishwab1 Sep 11, 2026
3254e12
fix(stoptb): store Nikshay ID on i_beneficiarydetails, not tb_suspected
vishwab1 Sep 14, 2026
71f68ea
Merge pull request #187 from PSMRI/vb/nikshay-beneficiarydetails-fix
SauravBizbRolly Sep 14, 2026
e6e770c
Dropping duplicate columns in table tb_stoptb_general_examination
sehjotsinghunthinkable Sep 15, 2026
71f3f63
Merge 3.4.2 with 3.9.0 (#193)
vanitha1822 Sep 22, 2026
0747e05
Adding s3 dependency
sehjotsinghunthinkable Sep 29, 2026
98e3c88
Making improvements given by coderabbit
sehjotsinghunthinkable Sep 30, 2026
af5fe14
Merge pull request #195 from sehjotsinghunthinkable/feature/diagnosti…
vishwab1 Oct 1, 2026
5af9ca3
Made changes in pom release
sehjotsinghunthinkable Oct 1, 2026
859a296
Merge pull request #196 from sehjotsinghunthinkable/feature/diagnosti…
vishwab1 Oct 1, 2026
acc420f
Use vanID instead of villageId in diagnostic document S3 path (#197)
vishwab1 Oct 6, 2026
b89287d
Vb/diagnostic document sync response (#198)
vishwab1 Oct 6, 2026
777713f
fix: update the file extension
vanitha1822 Oct 6, 2026
655d4d8
Merge pull request #199 from PSMRI/nd/vs/file_extension
vishwab1 Oct 7, 2026
6c09902
feat(STOP-457): automatic BenID download for StopTB laptops
vishwab1 Oct 14, 2026
738ed2f
fix(STOP-457): harden automatic BenID download for many laptops
vishwab1 Oct 14, 2026
b1887cb
chore: set MMU-API version to 3.12.0
vishwab1 Oct 14, 2026
d1a0ca9
Merge pull request #200 from PSMRI/vb/3.12.0-stop457-benid
vishwab1 Oct 14, 2026
bbe70ed
StopTB camp laptop data sync – = sync, inventory upload fixes and mas…
vishwab1 Oct 21, 2026
6b28dbc
fix(downsync): create worklist rows for down-synced beneficiaries (#203)
vishwab1 Oct 23, 2026
0226455
Merge latest main into release-3.12.0
sehjotsinghunthinkable Nov 2, 2026
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
9 changes: 7 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.iemr.mmu</groupId>
<artifactId>mmu-api</artifactId>
<version>3.9.0</version>
<version>3.12.0</version>
<packaging>war</packaging>

<name>MMU-API</name>
Expand Down Expand Up @@ -294,7 +294,12 @@
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<!-- CSV parsing for the Nikshay results-file import (quoted/embedded-comma fields) -->
<!-- AWS SDK v2 - S3 client, used for diagnostic document sync -->
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
<version>2.25.60</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
Expand Down
19 changes: 18 additions & 1 deletion src/main/environment/common_ci.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ spring.datasource.username=@env.DATABASE_USERNAME@
spring.datasource.password=@env.DATABASE_PASSWORD@
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

## S3 storage for diagnostic documents pushed from a van
aws.s3.access-key=@env.AWS_S3_ACCESS_KEY@
aws.s3.secret-key=@env.AWS_S3_SECRET_KEY@
aws.s3.region=@env.AWS_S3_REGION@
diagnostic.documents.s3.bucket=@env.DIAGNOSTIC_DOCUMENTS_S3_BUCKET@

## Carestream URLs, local
carestreamOrderCreateURL=@env.COMMON_API@carestream/createOrder

Expand All @@ -28,6 +34,11 @@ dataSyncUploadUrl=@env.MMU_CENTRAL_SERVER@dataSync/van-to-server
## Data download API, central
dataSyncDownloadUrl=@env.MMU_CENTRAL_SERVER@dataSync/server-to-van

## Diagnostic document push (this server -> further central server)
diagnosticDocumentUploadUrl=@env.MMU_CENTRAL_SERVER@dataSync/diagnostic-documents
diagnosticDocument.push.batchSize=@env.DIAGNOSTIC_DOCUMENT_PUSH_BATCH_SIZE@
diagnostic.documents.storage-root=@env.DIAGNOSTIC_DOCUMENTS_STORAGE_ROOT@

## TC specialist slot booking, # not required
tcSpecialistSlotBook=@env.TM_API@schedule/bookSlot

Expand Down Expand Up @@ -95,4 +106,10 @@ logging.file.name=@env.MMU_API_LOGGING_FILE_NAME@
springdoc.api-docs.enabled=@env.SWAGGER_DOC_ENABLED@
springdoc.swagger-ui.enabled=@env.SWAGGER_DOC_ENABLED@

cors.allowed-origins=@env.CORS_ALLOWED_ORIGINS@
cors.allowed-origins=@env.CORS_ALLOWED_ORIGINS@

## BenID auto top-up URLs (feature stays off: stoptb.* not set for these builds)
benCheckUrlLocal=@env.IDENTITY_API_BASE_URL@id/checkAvailablBenIDLocalServer
centralLoginUrl=@env.COMMON_API_OPEN_SYNC@user/userAuthenticate
centralRefreshTokenUrl=@env.COMMON_API_OPEN_SYNC@user/refreshToken
centralSessionUrl=@env.COMMON_API_OPEN_SYNC@user/getLoginResponse
27 changes: 26 additions & 1 deletion src/main/environment/common_docker.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ spring.datasource.username=${DATABASE_USERNAME}
spring.datasource.password=${DATABASE_PASSWORD}
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

## S3 storage for diagnostic documents pushed from a van
aws.s3.access-key=${AWS_S3_ACCESS_KEY:}
aws.s3.secret-key=${AWS_S3_SECRET_KEY:}
aws.s3.region=${AWS_S3_REGION:ap-south-1}
diagnostic.documents.s3.bucket=${DIAGNOSTIC_DOCUMENTS_S3_BUCKET:}

## Carestream URLs, local
carestreamOrderCreateURL=${COMMON_API}carestream/createOrder

Expand All @@ -28,6 +34,11 @@ dataSyncUploadUrl=${MMU_CENTRAL_SERVER}dataSync/van-to-server
## Data download API, central
dataSyncDownloadUrl=${MMU_CENTRAL_SERVER}dataSync/server-to-van

## Diagnostic document push (this server -> further central server)
diagnosticDocumentUploadUrl=${MMU_CENTRAL_SERVER}dataSync/diagnostic-documents
diagnosticDocument.push.batchSize=${DIAGNOSTIC_DOCUMENT_PUSH_BATCH_SIZE:3}
diagnostic.documents.storage-root=${DIAGNOSTIC_DOCUMENTS_STORAGE_ROOT}

## TC specialist slot booking, # not required
tcSpecialistSlotBook=${TM_API}schedule/bookSlot

Expand Down Expand Up @@ -93,4 +104,18 @@ logging.path=logs
logging.file.name=${MMU_API_LOGGING_FILE_NAME}

springdoc.api-docs.enabled=${SWAGGER_DOC_ENABLED}
springdoc.swagger-ui.enabled=${SWAGGER_DOC_ENABLED}
springdoc.swagger-ui.enabled=${SWAGGER_DOC_ENABLED}

## BenID auto top-up (StopTB laptops only; off unless STOPTB_ENFORCE_VANID=true and STOPTB_VAN_ID>0)
benCheckUrlLocal=${IDENTITY_API_BASE_URL}id/checkAvailablBenIDLocalServer
centralLoginUrl=${COMMON_API_OPEN_SYNC}user/userAuthenticate
centralRefreshTokenUrl=${COMMON_API_OPEN_SYNC}user/refreshToken
centralSessionUrl=${COMMON_API_OPEN_SYNC}user/getLoginResponse
stoptb.enforce.vanid=${STOPTB_ENFORCE_VANID:false}
stoptb.van.id=${STOPTB_VAN_ID:0}
benid.pool.lowerLimit=${BENID_POOL_LOWER_LIMIT:2000}
benid.pool.batchSize=${BENID_POOL_BATCH_SIZE:1000}
benid.pool.bootstrapSize=${BENID_POOL_BOOTSTRAP_SIZE:10000}
benid.token.dir=${BENID_TOKEN_DIR:/opt/amrit/data}
benid.autoTopUp.initialDelayMs=${BENID_AUTO_TOPUP_INITIAL_DELAY_MS:120000}
benid.autoTopUp.checkIntervalMs=${BENID_AUTO_TOPUP_CHECK_INTERVAL_MS:300000}
40 changes: 39 additions & 1 deletion src/main/environment/common_example.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ spring.datasource.username=<Enter your AMRIT DB username>
spring.datasource.password=<Enter your AMRIT DB password>
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

## S3 storage for diagnostic documents pushed from a van (POST /dataSync/diagnostic-documents)
aws.s3.access-key=<Enter your AWS access key here>
aws.s3.secret-key=<Enter your AWS secret key here>
aws.s3.region=ap-south-1
diagnostic.documents.s3.bucket=<Enter your private bucket name here>

## Carestream URLs, local
#carestreamOrderCreateURL =http://localhost:1040/carestream/createOrder
carestreamOrderCreateURL =http://localhost:8083/carestream/createOrder
Expand Down Expand Up @@ -44,6 +50,10 @@ dataSyncUploadUrl=http://10.208.122.38:8080/mmu-api/dataSync/van-to-server
#dataSyncDownloadUrl=http://localhost:82/dataSync/server-to-van
dataSyncDownloadUrl=http://10.208.122.38:8080/mmu-api/dataSync/server-to-van

diagnosticDocumentUploadUrl=http://localhost:8087/mmu-api/dataSync/diagnostic-documents
diagnosticDocument.push.batchSize=3
diagnostic.documents.storage-root=<Enter your diagnostic documents storage root path here>

## TC specialist slot booking, # not required
#tcSpecialistSlotBook=http://localhost:8080/schedule/bookSlot
tcSpecialistSlotBook=http://10.208.122.38:8080/tm-api/schedule/bookSlot
Expand Down Expand Up @@ -110,4 +120,32 @@ logging.path=logs/
logging.file.name=logs/mmu-api.log


cors.allowed-origins=http://localhost:*
cors.allowed-origins=http://localhost:*

## BenID auto top-up (StopTB laptops only)
benCheckUrlLocal=http://localhost:8094/id/checkAvailablBenIDLocalServer
centralLoginUrl=https://uatstoptb.piramalswasthya.org/common-api/user/userAuthenticate
centralRefreshTokenUrl=https://uatstoptb.piramalswasthya.org/common-api/user/refreshToken
centralSessionUrl=https://uatstoptb.piramalswasthya.org/common-api/user/getLoginResponse
stoptb.enforce.vanid=false
stoptb.van.id=0
benid.pool.lowerLimit=2000
benid.pool.batchSize=1000
benid.pool.bootstrapSize=10000
benid.token.dir=/opt/amrit/data
benid.autoTopUp.initialDelayMs=120000
benid.autoTopUp.checkIntervalMs=300000

## Automatic Data Sync (StopTB laptops only; needs the BenID central connection above). Off by default: manual sync only.
sync.autoUpload.enabled=false
sync.autoUpload.intervalMs=1800000
sync.autoMasterDownload.enabled=false
sync.autoMasterDownload.intervalMs=21600000
# automatic master download fetches only inventory masters (items, stores, item->store mapping); false = all masters
sync.autoMasterDownload.inventoryOnly=true
sync.autoInventoryDownload.enabled=false

## Central upload: replace van IDs in link columns (BenVisitID, PrescriptionID) by central IDs.
## Off by default (other MMU servers unchanged); on for the StopTB central.
## Env alternative: DATASYNC_TRANSLATEVANLINKS=true
dataSync.translateVanLinks=false
2 changes: 2 additions & 0 deletions src/main/java/com/iemr/mmu/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.scheduling.annotation.EnableScheduling;

import com.iemr.mmu.data.login.Users;
import com.iemr.mmu.utils.IEMRApplBeans;

@SpringBootApplication
@EnableScheduling
public class Application {

public static void main(String[] args) {
Expand Down
53 changes: 53 additions & 0 deletions src/main/java/com/iemr/mmu/config/S3ClientConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.iemr.mmu.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.presigner.S3Presigner;

/***
* @purpose S3 client beans used to store diagnostic documents pushed from a van. Built
* once and shared, rather than re-built per request.
*/
@Configuration
public class S3ClientConfig {

@Value("${aws.s3.access-key}")
private String accessKey;

@Value("${aws.s3.secret-key}")
private String secretKey;

@Value("${aws.s3.region}")
private String region;

/*
* Only the central server talks to S3; a van (camp laptop) runs the same war but never
* calls it, so it must be able to start without AWS keys. AwsBasicCredentials rejects blank
* keys at construction time, so fall back to the SDK default chain, which is resolved lazily
* on the first S3 call rather than at startup.
*/
private AwsCredentialsProvider credentialsProvider() {
if (accessKey == null || accessKey.isBlank() || secretKey == null || secretKey.isBlank()) {
return DefaultCredentialsProvider.create();
}
return StaticCredentialsProvider.create(AwsBasicCredentials.create(accessKey, secretKey));
}

@Bean
public S3Client diagnosticDocumentS3Client() {
return S3Client.builder().region(Region.of(region)).credentialsProvider(credentialsProvider()).build();
}

@Bean
public S3Presigner diagnosticDocumentS3Presigner() {
return S3Presigner.builder().region(Region.of(region)).credentialsProvider(credentialsProvider()).build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
* AMRIT – Accessible Medical Records via Integrated Technology
* Integrated EHR (Electronic Health Records) Solution
*
* Copyright (C) "Piramal Swasthya Management and Research Institute"
*
* This file is part of AMRIT.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
package com.iemr.mmu.controller.benid;

import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.iemr.mmu.service.benid.BenIdAutoTopUpService;
import com.iemr.mmu.service.benid.CentralAuthService;
import com.iemr.mmu.utils.response.OutputResponse;

import io.swagger.v3.oas.annotations.Operation;

@RestController
@RequestMapping(value = "/centralAuth", headers = "Authorization", produces = "application/json")
public class CentralAuthController {

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

@Autowired

Check warning on line 46 in src/main/java/com/iemr/mmu/controller/benid/CentralAuthController.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this field injection and use constructor injection instead.

See more on https://sonarcloud.io/project/issues?id=PSMRI_MMU-API&issues=AaGbtoGH16tNjAHyzeJO&open=AaGbtoGH16tNjAHyzeJO&pullRequest=205
private CentralAuthService centralAuthService;

@Autowired
private BenIdAutoTopUpService benIdAutoTopUpService;

@Operation(summary = "Automatic BenID top-up and central connection status")
@GetMapping(value = "/status")
public String status() {
OutputResponse response = new OutputResponse();
try {
response.setResponse(benIdAutoTopUpService.status().toString());
} catch (Exception e) {
logger.error("Error reading BenID auto top-up status: " + e.getMessage());

Check warning on line 59 in src/main/java/com/iemr/mmu/controller/benid/CentralAuthController.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_MMU-API&issues=AaGbtoGH16tNjAHyzeJQ&open=AaGbtoGH16tNjAHyzeJQ&pullRequest=205
response.setError(e);
}
return response.toString();
}

/**
* Called by MMU-UI right after a successful login. Returns immediately; the
* central login and any top-up happen in the background.
*/
@Operation(summary = "Connect this laptop to central with the user's login (one time)")
@PostMapping(value = "/capture", consumes = "application/json")
public String capture(@RequestBody String requestOBJ) {
OutputResponse response = new OutputResponse();
try {
if (!centralAuthService.isEnabled()) {
response.setResponse("disabled");
return response.toString();
}
JSONObject obj = new JSONObject(requestOBJ);
String userName = obj.optString("userName", null);
String password = obj.optString("password", null);
boolean force = obj.optBoolean("reconnect", false);
benIdAutoTopUpService.runInBackground(() -> {
if (centralAuthService.capture(userName, password, force)) {
benIdAutoTopUpService.triggerNow();
}
});
response.setResponse("accepted");
} catch (Exception e) {
logger.error("Error in central capture: " + e.getMessage());

Check warning on line 89 in src/main/java/com/iemr/mmu/controller/benid/CentralAuthController.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_MMU-API&issues=AaGbtoGH16tNjAHyzeJR&open=AaGbtoGH16tNjAHyzeJR&pullRequest=205
response.setError(e);
}
return response.toString();
}
}
Loading
Loading