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
11 changes: 11 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
Expand All @@ -7,7 +12,13 @@ org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.processAnnotations=enabled
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# --- Stage 1: Build the application using Maven ---
FROM maven:3.9.6-eclipse-temurin-17 AS build

WORKDIR /app

COPY . .

# Build the application while caching Maven dependencies to speed up future builds
RUN --mount=type=cache,target=/root/.m2 \
mvn clean package -DENV_VAR=docker -DskipTests -Dgit.skip=true

# --- Stage 2: Run the application with a minimal JRE image ---
FROM eclipse-temurin:17-jre

WORKDIR /app

# Copy the built WAR file from the build stage
COPY --from=build /app/target/*.war app.war

EXPOSE 8080

ENTRYPOINT ["java", "-jar", "app.war"]
13 changes: 12 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,18 @@
</webResources>
</configuration>
</plugin>

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
Expand Down
4 changes: 3 additions & 1 deletion src/main/environment/104_ci.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ secondary.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
common-url=@env.COMMON_API_BASE_URL@

### Redis IP
spring.redis.host=localhost
spring.redis.host=@env.REDIS_HOST@

#ELK logging file name
logging.path=logs/
Expand All @@ -26,3 +26,5 @@ springdoc.swagger-ui.enabled=@env.SWAGGER_DOC_ENABLED@

sendSMSUrl= @env.COMMON_API_BASE_URL@sms/sendSMS
sendEmailGeneralUrl = @env.COMMON_API_BASE_URL@emailController/sendEmailGeneral

cors.allowed-origins=@env.CORS_ALLOWED_ORIGINS@
28 changes: 28 additions & 0 deletions src/main/environment/104_docker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# local env
# DB Connections
## Primary db
spring.datasource.url=${DATABASE_URL}
spring.datasource.username=${DATABASE_USERNAME}
spring.datasource.password=${DATABASE_PASSWORD}
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

secondary.datasource.username=${REPORTING_DATABASE_USERNAME}
secondary.datasource.password=${REPORTING_DATABASE_PASSWORD}
secondary.datasource.url=${REPORTING_DATABASE_URL}
secondary.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

# Common Config
common-url=${COMMON_API_BASE_URL}

### Redis IP
spring.redis.host=${REDIS_HOST}

#ELK logging file name
logging.file.name=${HELPLINE104_API_LOGGING_FILE_NAME}
jwt.secret=${JWT_SECRET_KEY}
springdoc.api-docs.enabled=${SWAGGER_DOC_ENABLED}
springdoc.swagger-ui.enabled=${SWAGGER_DOC_ENABLED}


sendSMSUrl= ${COMMON_API_BASE_URL}sms/sendSMS
sendEmailGeneralUrl = ${COMMON_API_BASE_URL}emailController/sendEmailGeneral
4 changes: 3 additions & 1 deletion src/main/environment/104_example.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ spring.redis.host=localhost
jwt.secret=my-32-character-ultra-secure-and-ultra-long-secret
#If both properties are set, only logging.file.name takes effect.
logging.path=logs/
logging.file.name=logs/helpline104-api.log
logging.file.name=logs/helpline104-api.log

cors.allowed-origins=http://localhost:*
28 changes: 28 additions & 0 deletions src/main/java/com/iemr/helpline104/config/CorsConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.iemr.helpline104.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.util.Arrays;
import org.springframework.beans.factory.annotation.Value;

@Configuration
public class CorsConfig implements WebMvcConfigurer {

@Value("${cors.allowed-origins}")
private String allowedOrigins;

@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOriginPatterns(
Arrays.stream(allowedOrigins.split(","))
.map(String::trim)
.toArray(String[]::new))
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
.allowedHeaders("Content-Type", "Authorization")
.exposedHeaders("Authorization")
.allowCredentials(true)
.maxAge(3600);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

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


@RequestMapping(value = "/beneficiary")
@RestController
public class IMRMMRController {
Expand All @@ -54,7 +53,6 @@ public class IMRMMRController {
@Autowired
private IMRMMRService imrmmrService;

@CrossOrigin()
@Operation(summary = "Save IMR MMR")
@PostMapping(value = "/saveIMRMMR", headers = "Authorization", produces = {
"application/json" })
Expand All @@ -78,7 +76,6 @@ public String saveIMRMMR(@RequestBody String request,
return response.toString();
}

@CrossOrigin()
@Operation(summary = "Fetch support services")
@GetMapping(value = "/fetchimrmmrmasters", produces = MediaType.APPLICATION_JSON, headers = "Authorization")
public String fetchSupportServices() {
Expand All @@ -105,7 +102,6 @@ public String fetchSupportServices() {
return response.toString();
}

@CrossOrigin()
@Operation(summary = "Feedback request")
@PostMapping(value = "/getIMRMMRList", produces = MediaType.APPLICATION_JSON, headers = "Authorization")
public String feedbackReuest(@RequestBody String request) {
Expand All @@ -123,7 +119,6 @@ public String feedbackReuest(@RequestBody String request) {
return response.toString();
}

@CrossOrigin()
@Operation(summary = "Update IMR MMR complaint")
@PostMapping(value = "/update/ImrMmrComplaint", produces = MediaType.APPLICATION_JSON, headers = "Authorization")
public String updateImrMmrComplaint(@RequestBody String request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public class BalVivahController {
@Autowired
private BalVivahComplaintService balVivahComplaintService;

@CrossOrigin()
@Operation(summary = "Save bal vivah complaint")
@PostMapping(value = "/saveBalVivahComplaint", produces = MediaType.APPLICATION_JSON, headers = "Authorization")
public String balVivahComplaint(@RequestBody String request, HttpServletRequest httpRequest) {
Expand All @@ -60,7 +59,6 @@ public String balVivahComplaint(@RequestBody String request, HttpServletRequest
return output.toString();
}

@CrossOrigin()
@Operation(summary = "Get bal vivah list")
@PostMapping(value = "/getBalVivahList", produces = MediaType.APPLICATION_JSON, headers = "Authorization")
public String feedbackReuest(@RequestBody String request) {
Expand All @@ -79,7 +77,6 @@ public String feedbackReuest(@RequestBody String request) {
return response.toString();
}

@CrossOrigin()
@Operation(summary = "Update bal vivah complaint")
@PostMapping(value = "/update/BalVivahComplaint", produces = MediaType.APPLICATION_JSON, headers = "Authorization")
public String updateBalVivahComplaint(@RequestBody String request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public void setBeneficiaryCallService(BeneficiaryCallService beneficiaryCallServ
this.beneficiaryCallService = beneficiaryCallService;
}

@CrossOrigin()
@Operation(summary = "Stores callerID to the specific beneficiary who are on call")
@PostMapping(value = "/startCall", headers = "Authorization")
public String startCall(
Expand All @@ -85,37 +84,34 @@ public String startCall(
return output.toString();
}

@CrossOrigin()
@Operation(summary = "Update beneficiary reg id to the caller id")
@PostMapping(value = "update/beneficiaryCallID", headers = "Authorization")
public String updateBeneficiaryIDInCall(
@Parameter(description = "{\"callID\":\"integer\", \"beneficiaryRegID\":\"long\"}") @RequestBody String beneficiaryCall) {
OutputResponse output = new OutputResponse();
Integer startedCall = null;
try {
BeneficiaryCall beneficiarycall = inputMapper.gson().fromJson(beneficiaryCall, BeneficiaryCall.class);
@Parameter(description = "{\"callID\":\"integer\", \"beneficiaryRegID\":\"long\"}") @RequestBody String beneficiaryCall) {

OutputResponse output = new OutputResponse();
Integer startedCall = null;
try {
BeneficiaryCall beneficiarycall = inputMapper.gson().fromJson(beneficiaryCall, BeneficiaryCall.class);
if (null != beneficiarycall.getBeneficiaryRegID()) {
startedCall = beneficiaryCallService.updateBeneficiaryIDInCall(beneficiarycall.getBenCallID(),
beneficiarycall.getBeneficiaryRegID());
output.setResponse(startedCall.toString());
}else {
} else {
output.setResponse("Update skipped : BeneficiaryRegID is null");
}
logger.info("updateBeneficiaryIDInCall was called successfully");
} catch (Exception e) {
logger.error("updateBeneficiaryIDInCall failed with error " + e.getMessage(), e);
output.setError(e);
logger.info("updateBeneficiaryIDInCall was called successfully");
} catch (Exception e) {
logger.error("updateBeneficiaryIDInCall failed with error " + e.getMessage(), e);
output.setError(e);

}
}

logger.info("updateBeneficiaryIDInCall completed");
logger.info("updateBeneficiaryIDInCall completed");

return output.toString();
return output.toString();
}


@CrossOrigin
@Operation(summary = "Fetch services available in the 104 helpline")
@PostMapping(value = "/get/services", headers = "Authorization")
public String getServices(
Expand All @@ -138,7 +134,6 @@ public String getServices(
return output.toString();
}

@CrossOrigin()
@Operation(summary = "Set service history")
@PostMapping(value = "set/callHistory", produces = MediaType.APPLICATION_JSON, headers = "Authorization")
public String setServiceHistory(@RequestBody String request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ public class BloodComponentController {
@Autowired
private BloodComponentService bloodComponentService;

@CrossOrigin
@Operation(summary = "Save blood component details")
@PostMapping(value = "/save/bloodComponentDetails", produces = MediaType.APPLICATION_JSON_VALUE, headers = "Authorization")
public String saveBloodComponentDetails(
@Parameter(description = "{\"component\":\"String\",\"componentDesc\":\"String\",\"deleted\":\"boolean\",\"createdBy\":\"String\"}") @RequestBody String request) {
@Parameter(description = "{\"component\":\"String\",\"componentDesc\":\"String\",\"deleted\":\"boolean\",\"createdBy\":\"String\"}") @RequestBody String request) {
OutputResponse output = new OutputResponse();
try {
M_Component m_component = inputMapper.gson().fromJson(request, M_Component.class);
Expand All @@ -67,11 +66,10 @@ public String saveBloodComponentDetails(
return output.toString();
}

@CrossOrigin
@Operation(summary = "Fetch blood component details")
@PostMapping(value = "/get/bloodComponentDetails", produces = MediaType.APPLICATION_JSON_VALUE, headers = "Authorization")
public String getBloodComponentDetails(
@Parameter(description = "{\"componentID\":\"Integer\"}") @RequestBody String request) {
@Parameter(description = "{\"componentID\":\"Integer\"}") @RequestBody String request) {

OutputResponse output = new OutputResponse();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public class BloodRequestController {
@Autowired
private BloodComponentTypeService componentTypeService;

@CrossOrigin
@Operation(summary = "Save blood request details")
@PostMapping(value = "/save/bloodRequestDetails", produces = MediaType.APPLICATION_JSON_VALUE, headers = "Authorization")
public String saveBloodRequestDetails(@RequestBody String request) {
Expand All @@ -77,7 +76,6 @@ public String saveBloodRequestDetails(@RequestBody String request) {
return output.toString();
}

@CrossOrigin
@Operation(summary = "Get blood request details")
@PostMapping(value = "/get/bloodRequestDetails", produces = MediaType.APPLICATION_JSON_VALUE, headers = "Authorization")
public String getbloodRequestDetails(
Expand All @@ -102,7 +100,6 @@ public String getbloodRequestDetails(
return output.toString();
}

@CrossOrigin
@Operation(summary = "Get blood component types")
@PostMapping(value = "/get/bloodComponentTypes", produces = MediaType.APPLICATION_JSON_VALUE, headers = "Authorization")
public String getBloodComponentTypes() {
Expand All @@ -120,7 +117,6 @@ public String getBloodComponentTypes() {
return output.toString();
}

@CrossOrigin
@Operation(summary = "Get blood groups")
@PostMapping(value = "/get/bloodGroups", produces = MediaType.APPLICATION_JSON_VALUE, headers = "Authorization")
public String getBloodGroups() {
Expand All @@ -138,7 +134,6 @@ public String getBloodGroups() {
return output.toString();
}

@CrossOrigin
@Operation(summary = "Get blood bank URL")
@PostMapping(value = "/get/bloodBankURL", headers = "Authorization")
public String getBloodBankURL(
Expand All @@ -163,7 +158,6 @@ public String getBloodBankURL(
return output.toString();
}

@CrossOrigin
@Operation(summary = "Save blood bank URL")
@PostMapping(value = "/save/bloodBankURL", headers = "Authorization")
public String saveBloodBankURL(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public class CallQAMappingController {
@Autowired
public CallqamappingService callqamappingService;

@CrossOrigin
@Operation(summary = "Save call qa mapping")
@PostMapping(value = "/save/callqamapping", produces = MediaType.APPLICATION_JSON_VALUE, headers = "Authorization")
public String saveCallqamapping(@RequestBody String request) {
Expand All @@ -69,7 +68,6 @@ public String saveCallqamapping(@RequestBody String request) {
return output.toString();
}

@CrossOrigin
@Operation(summary = "Fetch questions and answers given by beneficiary")
@PostMapping(value = "/get/CDIqamapping", headers = "Authorization")
public String getCDIqamapping(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public class Helpline104BeneficiaryHistoryController {
@Autowired
private H104BenHistoryService h104BenHistoryService;

@CrossOrigin
@Operation(summary = "Retrieves case record")
@PostMapping(value = "/getBenCaseSheet", headers = "Authorization")
public String getBenCaseSheet(
Expand All @@ -70,7 +69,6 @@ public String getBenCaseSheet(
return output.toString();
}

@CrossOrigin
@Operation(summary = "Stores case record")
@PostMapping(value = "/save/benCaseSheet", headers = "Authorization")
public String saveBenCaseSheet(
Expand Down Expand Up @@ -101,7 +99,6 @@ public String saveBenCaseSheet(
return output.toString();
}

@CrossOrigin
@Operation(summary = "Retrieves present case record")
@PostMapping(value = "/getPresentCaseSheet", headers = "Authorization")
public String getPresentCaseSheet(
Expand Down
Loading
Loading