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
248 changes: 144 additions & 104 deletions admin/admin-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,37 @@
<version>${kernel.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.10.0</version>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.10.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.2</version>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.2</version>
</dependency>

<dependency>
<groupId>org.springframework.batch.extensions</groupId>
<artifactId>spring-batch-excel</artifactId>
<version>0.1.0</version>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.17.1</version>
</dependency>

<dependency>
<!--
https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-xml -->
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.15.0</version>
</dependency>

<dependency>
<groupId>org.springframework.batch.extensions</groupId>
<artifactId>spring-batch-excel</artifactId>
<version>0.1.0</version>
</dependency>

<dependency>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-authcodeflowproxy-api</artifactId>
<version>${kernel.version}</version>
Expand All @@ -87,25 +101,49 @@
<version>${spring-cloud-config.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-batch</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-batch</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>

<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
<groupId>io.mosip.biometric.util</groupId>
<artifactId>biometrics-util</artifactId>
<version>1.2.0.2</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.13.Final</version>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.2.2</version>
</dependency>

<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -127,7 +165,7 @@
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-idvalidator-rid</artifactId>
<version>${kernel.version}</version>
</dependency>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
Expand Down Expand Up @@ -233,86 +271,88 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>openapi-doc-generate-profile</id>
<dependencies>
<dependency>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-auth-adapter</artifactId>
<version>${kernel-auth-adapter.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
<version>4.1.72.Final</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<configuration>
<executable>true</executable>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
<configuration>
<folders>
<folder>src/test/resources</folder>
</folders>
<profiles>
<profile>test</profile>
</profiles>
<arguments>
<argument>--server.port=8090</argument>
<argument>--server.servlet.context-path=/app/generic</argument>
</arguments>
<profiles>
<profile>
<id>openapi-doc-generate-profile</id>
<dependencies>
<dependency>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-auth-adapter</artifactId>
<version>${kernel-auth-adapter.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
<version>4.1.72.Final</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<configuration>
<executable>true</executable>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
<configuration>
<folders>
<folder>src/test/resources</folder>
</folders>
<profiles>
<profile>test</profile>
</profiles>
<arguments>
<argument>--server.port=8090</argument>
<argument>
--server.servlet.context-path=/app/generic</argument>
</arguments>

</configuration>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
<execution>
<goals>
<goal>build-info</goal>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-maven-plugin</artifactId>
<version>0.2</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<apiDocsUrl>http://localhost:8090/app/generic/v3/api-docs/Admin%20Service</apiDocsUrl>
<outputFileName>${artifactId}-openapi.json</outputFileName>
<outputDir>${project.build.directory}</outputDir>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</configuration>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
<execution>
<goals>
<goal>build-info</goal>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-maven-plugin</artifactId>
<version>0.2</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<apiDocsUrl>
http://localhost:8090/app/generic/v3/api-docs/Admin%20Service</apiDocsUrl>
<outputFileName>${artifactId}-openapi.json</outputFileName>
<outputDir>${project.build.directory}</outputDir>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package io.mosip.admin.constant;

public enum ApplicantDetailErrorCode {

UNABLE_TO_RETRIEVE_RID_DETAILS("ADM-AVD-001", "A technical error occurred while retrieving the data, please try again after some time."),
RID_INVALID("ADM-AVD-002","RID is invalid"),
RID_NOT_FOUND("ADM-AVD-003","The card for this request ID is not generated. Please check the status of the ID."),
DATA_NOT_FOUND("ADM-AVD-004","Applicant Photo Not Found"),
DIGITAL_CARD_RID_NOT_FOUND("ADM-AVD-005", "Digital card not found for the RID, please try after few days"),
DIGITAL_CARD_NOT_ACKNOWLEDGED("ADM-AVD-006", "Please acknowledge the details before downloading digital card"),
REQ_ID_NOT_FOUND("ADM-AVD-007","Request id not found"),

LIMIT_EXCEEDED("ADM-AVD-008","Your daily search limit has exceeded. Please try searching again tomorrow."),

DATA_SHARE_EXPIRED_EXCEPTION("ADM-AVD-008", "Data share usuage expired");

private final String errorCode;
private final String errorMessage;

private ApplicantDetailErrorCode(final String errorCode, final String errorMessage) {
this.errorCode = errorCode;
this.errorMessage = errorMessage;
}

public String getErrorCode() {
return errorCode;
}

public String getErrorMessage() {
return errorMessage;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

public enum LostRidErrorCode {

UNABLE_TO_RETRIEVE_LOSTRID("ADMN-LRID-001", "Unable ro find the lost rid..");
UNABLE_TO_RETRIEVE_LOSTRID("ADMN-LRID-001", "Unable to find the lost rid.."),

UNABLE_TO_RETRIEVE_LOSTRID_DATA("ADMN-LRID-002", "Unable to find the lost rid data"),

UNABLE_TO_RETRIEVE_APPLICANT_PHOTO("ADMN-LRID-003", "Unable to retrieve applicantPhoto");


private final String errorCode;
private final String errorMessage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import io.mosip.admin.dto.ErrorDTO;
import io.mosip.admin.dto.LostRidDetailsDto;
import io.mosip.admin.dto.LostRidExtnDto;
import io.mosip.admin.dto.LostRidResponseDto;
import io.mosip.admin.dto.SearchInfo;
Expand All @@ -24,22 +28,32 @@ public class AdminController {

@Autowired
AdminService adminService;

@Autowired
AuditUtil auditUtil;

@PreAuthorize("hasAnyRole(@authorizedRoles.getPostlostRid())")
@PostMapping("/lostRid")
private ResponseWrapper<LostRidExtnDto> lostRid(@RequestBody RequestWrapper<SearchInfo> searchInfo) {
auditUtil.setAuditRequestDto(EventEnum.LOST_RID_API_CALLED,null);
public ResponseWrapper<LostRidExtnDto> lostRid(@RequestBody RequestWrapper<SearchInfo> searchInfo) {
auditUtil.setAuditRequestDto(EventEnum.LOST_RID_API_CALLED, null);
LostRidResponseDto lostRidResponseDto = adminService.lostRid(searchInfo.getRequest());
auditUtil.setAuditRequestDto(EventEnum.LOST_RID_SUCCESS,null);
auditUtil.setAuditRequestDto(EventEnum.LOST_RID_SUCCESS, null);
return buildLostRidResponse(lostRidResponseDto);
}


@GetMapping("/lostRid/details/{rid}")
public ResponseWrapper<LostRidDetailsDto> getLostRidDetails(@PathVariable("rid") String rid) {
auditUtil.setAuditRequestDto(EventEnum.LOST_RID_API_CALLED, null);
ResponseWrapper<LostRidDetailsDto> responseWrapper = new ResponseWrapper<>();
responseWrapper.setResponse(adminService.getLostRidDetails(rid));
auditUtil.setAuditRequestDto(EventEnum.LOST_RID_SUCCESS, null);
return responseWrapper;
}

private ResponseWrapper<LostRidExtnDto> buildLostRidResponse(LostRidResponseDto lostRidResponseDto) {
ResponseWrapper<LostRidExtnDto> responseWrapper = new ResponseWrapper<>();
LostRidExtnDto lostRidExtnDto = new LostRidExtnDto();
List<ServiceError> sr=new ArrayList<>();
List<ServiceError> sr = new ArrayList<>();
if (!lostRidResponseDto.getErrors().isEmpty()) {
for (ErrorDTO ed : lostRidResponseDto.getErrors()) {
ServiceError se = new ServiceError();
Expand Down
Loading
Loading