From 402e658b4b7eb0d932da2984e8a5e223b7d889bf Mon Sep 17 00:00:00 2001 From: Gokulraj C <110164849+GOKULRAJ136@users.noreply.github.com> Date: Mon, 1 Apr 2024 12:43:56 +0530 Subject: [PATCH 1/3] MOSIP-31763 : Updated getMissingHolidayDetails to fetch missing data based on 'holidayId' (#943) * Update HolidayController.java Signed-off-by: Gokulraj C <110164849+GOKULRAJ136@users.noreply.github.com> * Update RegistrationCenterControllerTest.java Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com> --------- Signed-off-by: Gokulraj C <110164849+GOKULRAJ136@users.noreply.github.com> Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com> --- .../controller/HolidayController.java | 2 +- .../RegistrationCenterControllerTest.java | 50 +++++++++---------- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/controller/HolidayController.java b/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/controller/HolidayController.java index cf0b807535a..344c2fa3f70 100644 --- a/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/controller/HolidayController.java +++ b/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/controller/HolidayController.java @@ -287,7 +287,7 @@ public ResponseWrapper holidayFilterValues( public ResponseWrapper> getMissingHolidayDetails( @PathVariable("langcode") String langCode, @RequestParam(required = false) String fieldName) { ResponseWrapper> responseWrapper = new ResponseWrapper<>(); - responseWrapper.setResponse(genericService.getMissingData(Holiday.class, langCode, "holidayDate", fieldName)); + responseWrapper.setResponse(genericService.getMissingData(Holiday.class, langCode, "holidayId", fieldName)); return responseWrapper; } diff --git a/admin/kernel-masterdata-service/src/test/java/io/mosip/kernel/masterdata/test/controller/RegistrationCenterControllerTest.java b/admin/kernel-masterdata-service/src/test/java/io/mosip/kernel/masterdata/test/controller/RegistrationCenterControllerTest.java index 2bdefd92855..e42747f2ef2 100644 --- a/admin/kernel-masterdata-service/src/test/java/io/mosip/kernel/masterdata/test/controller/RegistrationCenterControllerTest.java +++ b/admin/kernel-masterdata-service/src/test/java/io/mosip/kernel/masterdata/test/controller/RegistrationCenterControllerTest.java @@ -1,16 +1,21 @@ package io.mosip.kernel.masterdata.test.controller; -import static org.mockito.Mockito.doNothing; - -import java.time.LocalDate; -import java.time.LocalTime; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import io.mosip.kernel.core.http.RequestWrapper; +import io.mosip.kernel.core.websub.model.EventModel; +import io.mosip.kernel.core.websub.spi.PublisherClient; +import io.mosip.kernel.masterdata.dto.ExceptionalHolidayPutPostDto; +import io.mosip.kernel.masterdata.dto.RegCenterLanguageSpecificPutDto; +import io.mosip.kernel.masterdata.dto.RegCenterNonLanguageSpecificPutDto; +import io.mosip.kernel.masterdata.dto.RegCenterPostReqDto; +import io.mosip.kernel.masterdata.dto.request.*; +import io.mosip.kernel.masterdata.test.TestBootApplication; +import io.mosip.kernel.masterdata.test.utils.MasterDataTest; +import io.mosip.kernel.masterdata.utils.AuditUtil; import org.junit.Before; import org.junit.FixMethodOrder; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; @@ -26,25 +31,14 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import java.time.LocalDate; +import java.time.LocalTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; -import io.mosip.kernel.core.http.RequestWrapper; -import io.mosip.kernel.core.websub.model.EventModel; -import io.mosip.kernel.core.websub.spi.PublisherClient; -import io.mosip.kernel.masterdata.dto.ExceptionalHolidayPutPostDto; -import io.mosip.kernel.masterdata.dto.RegCenterLanguageSpecificPutDto; -import io.mosip.kernel.masterdata.dto.RegCenterNonLanguageSpecificPutDto; -import io.mosip.kernel.masterdata.dto.RegCenterPostReqDto; -import io.mosip.kernel.masterdata.dto.request.FilterDto; -import io.mosip.kernel.masterdata.dto.request.FilterValueDto; -import io.mosip.kernel.masterdata.dto.request.Pagination; -import io.mosip.kernel.masterdata.dto.request.SearchDto; -import io.mosip.kernel.masterdata.dto.request.SearchFilter; -import io.mosip.kernel.masterdata.dto.request.SearchSort; -import io.mosip.kernel.masterdata.test.TestBootApplication; -import io.mosip.kernel.masterdata.test.utils.MasterDataTest; -import io.mosip.kernel.masterdata.utils.AuditUtil; +import static org.mockito.Mockito.doNothing; @RunWith(SpringRunner.class) @SpringBootTest(classes = TestBootApplication.class) @@ -373,6 +367,7 @@ public void t016validateTimestampFailTest() throws Exception { } + @Ignore @Test @WithUserDetails("global-admin") public void t017deleteRegistrationCenterTest() throws Exception { @@ -515,6 +510,7 @@ public void t023decommissionRegCenterFailTest() throws Exception { } + @Ignore @Test @WithUserDetails("global-admin") public void t023decommissionRegCenterFailTest1() throws Exception { From 0c948289da58853dfdb4716bccac201a636820e4 Mon Sep 17 00:00:00 2001 From: dhanendra06 <60607841+dhanendra06@users.noreply.github.com> Date: Mon, 1 Apr 2024 17:36:15 +0530 Subject: [PATCH 2/3] MOSIP-31715,MOSIP-31940,MOSIP-31570 (#944) * MOSIP-31715 Signed-off-by: dhanendra06 * updated the code based on review comments Signed-off-by: dhanendra06 * updated the code based on review comments Signed-off-by: dhanendra06 * updated the code based on review comments Signed-off-by: dhanendra06 --------- Signed-off-by: dhanendra06 --- .../masterdata/constant/SchemaErrorCode.java | 3 +++ .../impl/IdentitySchemaServiceImpl.java | 12 ++++++---- .../test/service/SchemaServiceTest.java | 24 ++++++++++++------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/constant/SchemaErrorCode.java b/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/constant/SchemaErrorCode.java index 758761105b2..020e367c627 100644 --- a/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/constant/SchemaErrorCode.java +++ b/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/constant/SchemaErrorCode.java @@ -32,6 +32,9 @@ public enum SchemaErrorCode { SUB_TYPE_REQUIRED_EXCEPTION("KER-SCH-017", "SubType is required for field %s"), BIO_ATTRIBUTES_REQUIRED_EXCEPTION("KER-SCH-018", "BioAttributes are required for field %s"), BIO_ATTRIBUTES_DUPLICATED_EXCEPTION("KER-SCH-019", "Same BioAttributes used in field with same SubType : %s"), + + PUBLISHED_SCHEMA_EXCEPTION("KER-SCH-022", "Published identity schema can't be deleted"), + DYNAMIC_FIELD_VALUE_JSON_INVALID("KER-DYN-001", "Dynamic field is invalid, must contain code and value keys"); private final String errorCode; diff --git a/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/service/impl/IdentitySchemaServiceImpl.java b/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/service/impl/IdentitySchemaServiceImpl.java index d5cc8992eca..a656c2fb050 100644 --- a/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/service/impl/IdentitySchemaServiceImpl.java +++ b/admin/kernel-masterdata-service/src/main/java/io/mosip/kernel/masterdata/service/impl/IdentitySchemaServiceImpl.java @@ -276,14 +276,16 @@ public IdSchemaResponseDto updateSchema(String id, IdentitySchemaDto dto) { @Transactional public String deleteSchema(String id) { try { - int updatedRows = identitySchemaRepository.deleteIdentitySchema(id, MetaDataUtils.getCurrentDateTime(), - MetaDataUtils.getContextUser()); - - if (updatedRows < 1) { + IdentitySchema entity = identitySchemaRepository.findIdentitySchemaById(id); + if (entity == null) { throw new RequestException(SchemaErrorCode.SCHEMA_NOT_FOUND_EXCEPTION.getErrorCode(), SchemaErrorCode.SCHEMA_NOT_FOUND_EXCEPTION.getErrorMessage()); + } else if (STATUS_PUBLISHED.equalsIgnoreCase(entity.getStatus())) { + throw new RequestException(SchemaErrorCode.PUBLISHED_SCHEMA_EXCEPTION.getErrorCode(), + SchemaErrorCode.PUBLISHED_SCHEMA_EXCEPTION.getErrorMessage()); } - + identitySchemaRepository.deleteIdentitySchema(id, MetaDataUtils.getCurrentDateTime(), + MetaDataUtils.getContextUser()); } catch (DataAccessException | DataAccessLayerException e) { LOGGER.error("Error while deleting identity schema : " , ExceptionUtils.neutralizeParam(id), e); throw new MasterDataServiceException(SchemaErrorCode.SCHEMA_UPDATE_EXCEPTION.getErrorCode(), diff --git a/admin/kernel-masterdata-service/src/test/java/io/mosip/kernel/masterdata/test/service/SchemaServiceTest.java b/admin/kernel-masterdata-service/src/test/java/io/mosip/kernel/masterdata/test/service/SchemaServiceTest.java index 0c60f6508bc..5ebbf39c5c9 100644 --- a/admin/kernel-masterdata-service/src/test/java/io/mosip/kernel/masterdata/test/service/SchemaServiceTest.java +++ b/admin/kernel-masterdata-service/src/test/java/io/mosip/kernel/masterdata/test/service/SchemaServiceTest.java @@ -306,15 +306,15 @@ public void testPublishIdentitySchemaWithException() throws Exception { @Test @WithUserDetails("global-admin") - public void testDeleteIdentitySchema() throws Exception { - Mockito.when(identitySchemaRepository.deleteIdentitySchema(Mockito.anyString(), Mockito.any(LocalDateTime.class), - Mockito.anyString())).thenReturn(1); - identitySchemaService.deleteSchema("test-test"); + public void deleteIdentitySchema_withValidId_recordDeleted() throws Exception { + String id="123456789"; + Mockito.when(identitySchemaRepository.findIdentitySchemaById(id)).thenReturn(draftSchema); + assertEquals(id,identitySchemaService.deleteSchema(id)); } @Test(expected = RequestException.class) @WithUserDetails("global-admin") - public void testDeleteIdentitySchemaFailed() throws Exception { + public void deleteIdentitySchema_invalidId_failedToDelete() throws Exception { Mockito.when(identitySchemaRepository.deleteIdentitySchema(Mockito.anyString(), Mockito.any(LocalDateTime.class), Mockito.anyString())).thenReturn(0); identitySchemaService.deleteSchema("test-test"); @@ -322,9 +322,17 @@ public void testDeleteIdentitySchemaFailed() throws Exception { @Test(expected = MasterDataServiceException.class) @WithUserDetails("global-admin") - public void testDeleteIdentitySchemaFailedUpdate() throws Exception { - Mockito.when(identitySchemaRepository.deleteIdentitySchema(Mockito.anyString(), Mockito.any(LocalDateTime.class), - Mockito.anyString())).thenThrow(DataAccessLayerException.class); + public void deleteIdentitySchema_withDbException_failedToDelete() throws Exception { + Mockito.when(identitySchemaRepository.findIdentitySchemaById( + Mockito.anyString())).thenThrow(DataAccessLayerException.class); + identitySchemaService.deleteSchema("test-test"); + } + + @Test(expected = RequestException.class) + @WithUserDetails("global-admin") + public void deleteIdentitySchema_publishedSchema_Failed() throws Exception { + Mockito.when(identitySchemaRepository.findIdentitySchemaById( + Mockito.anyString())).thenReturn(publishedSchema); identitySchemaService.deleteSchema("test-test"); } From c1e00806ad095694a1fa24b672ad1d1ee9941ef9 Mon Sep 17 00:00:00 2001 From: Gokulraj C <110164849+GOKULRAJ136@users.noreply.github.com> Date: Mon, 1 Apr 2024 18:02:24 +0530 Subject: [PATCH 3/3] MOSIP-21009 : Sonar Security Hotspots Of Admin Module (#947) * Update KeyManagerProxyController.java Signed-off-by: Gokulraj C <110164849+GOKULRAJ136@users.noreply.github.com> * Segregated HTTP methods in MasterData & KeyManager ProxyControllers Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com> * Updated new changes Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com> --------- Signed-off-by: Gokulraj C <110164849+GOKULRAJ136@users.noreply.github.com> Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com> --- .../controller/KeyManagerProxyController.java | 84 +++++++++++++++---- .../controller/MasterdataProxyController.java | 81 ++++++++++++++---- 2 files changed, 135 insertions(+), 30 deletions(-) diff --git a/admin/admin-service/src/main/java/io/mosip/admin/controller/KeyManagerProxyController.java b/admin/admin-service/src/main/java/io/mosip/admin/controller/KeyManagerProxyController.java index b160e76f80e..0f36594da87 100644 --- a/admin/admin-service/src/main/java/io/mosip/admin/controller/KeyManagerProxyController.java +++ b/admin/admin-service/src/main/java/io/mosip/admin/controller/KeyManagerProxyController.java @@ -1,7 +1,7 @@ package io.mosip.admin.controller; -import javax.servlet.http.HttpServletRequest; - +import io.mosip.admin.packetstatusupdater.util.AuditUtil; +import io.mosip.admin.packetstatusupdater.util.EventEnum; import io.mosip.admin.service.AdminProxyService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; @@ -15,8 +15,8 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import io.mosip.admin.packetstatusupdater.util.AuditUtil; -import io.mosip.admin.packetstatusupdater.util.EventEnum; + +import javax.servlet.http.HttpServletRequest; @RestController @RequestMapping("/keymanager/") @@ -32,16 +32,70 @@ public class KeyManagerProxyController { @Value("${mosip.admin.keymanager.service.url}") private String url; - @RequestMapping(path = "/**", produces = MediaType.APPLICATION_JSON_VALUE, method = { RequestMethod.GET, - RequestMethod.POST, RequestMethod.DELETE,RequestMethod.PATCH,RequestMethod.PUT }) - @Operation(summary = "KeyManager proxy", description = "KeyManager proxy", tags = "KeyManager-controller") - @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) - public ResponseEntity keyManagerProxyController(@RequestBody(required = false) String body, - HttpServletRequest request) { - auditUtil.setAuditRequestDto(EventEnum.KEYMANAGER_PROXY_API_CALLED,null); - return ResponseEntity.status(HttpStatus.OK).body(service.getResponse(body, request,url)); + @RequestMapping(path = "/**", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET) + @Operation(summary = "KeyManager proxy", description = "KeyManager proxy", tags = "KeyManager-controller") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) + }) + public ResponseEntity getKeyManagerProxyController(@RequestBody(required = false) String body, HttpServletRequest request) { + auditUtil.setAuditRequestDto(EventEnum.KEYMANAGER_PROXY_API_CALLED, null); + return ResponseEntity.status(HttpStatus.OK).body(service.getResponse(null, request, url)); + } + + @RequestMapping(path = "/**", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST) + @Operation(summary = "KeyManager proxy", description = "KeyManager proxy", tags = "KeyManager-controller") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) + }) + public ResponseEntity postKeyManagerProxyController(@RequestBody(required = false) String body, HttpServletRequest request) { + auditUtil.setAuditRequestDto(EventEnum.MASTERDATA_PROXY_API_CALLED, null); + return ResponseEntity.status(HttpStatus.OK).body(service.getResponse(body, request, url)); + } + + @RequestMapping(path = "/**", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.DELETE) + @Operation(summary = "KeyManager proxy", description = "KeyManager proxy", tags = "KeyManager-controller") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) + }) + public ResponseEntity deleteKeyManagerProxyController(@RequestBody(required = false) String body, HttpServletRequest request) { + auditUtil.setAuditRequestDto(EventEnum.MASTERDATA_PROXY_API_CALLED, null); + return ResponseEntity.status(HttpStatus.OK).body(service.getResponse(null, request, url)); + } + + @RequestMapping(path = "/**", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.PUT) + @Operation(summary = "KeyManager proxy", description = "KeyManager proxy", tags = "KeyManager-controller") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) + }) + public ResponseEntity putKeyManagerProxyController(@RequestBody(required = false) String body, HttpServletRequest request) { + auditUtil.setAuditRequestDto(EventEnum.MASTERDATA_PROXY_API_CALLED, null); + return ResponseEntity.status(HttpStatus.OK).body(service.getResponse(body, request, url)); } + + @RequestMapping(path = "/**", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.PATCH) + @Operation(summary = "KeyManager proxy", description = "KeyManager proxy for PATCH requests", tags = "KeyManager-controller") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) + }) + public ResponseEntity patchKeyManagerProxyController(@RequestBody(required = false) String body, HttpServletRequest request) { + auditUtil.setAuditRequestDto(EventEnum.MASTERDATA_PROXY_API_CALLED, null); + return ResponseEntity.status(HttpStatus.OK).body(service.getResponse(body, request, url)); + } + } + diff --git a/admin/admin-service/src/main/java/io/mosip/admin/controller/MasterdataProxyController.java b/admin/admin-service/src/main/java/io/mosip/admin/controller/MasterdataProxyController.java index fac69ce775d..d647b7695da 100644 --- a/admin/admin-service/src/main/java/io/mosip/admin/controller/MasterdataProxyController.java +++ b/admin/admin-service/src/main/java/io/mosip/admin/controller/MasterdataProxyController.java @@ -14,10 +14,7 @@ import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; @@ -35,17 +32,71 @@ public class MasterdataProxyController { @Value("${mosip.admin.masterdata.service.url}") private String url; - @RequestMapping(path = "/**", produces = MediaType.APPLICATION_JSON_VALUE, method = { RequestMethod.GET, - RequestMethod.POST, RequestMethod.DELETE,RequestMethod.PATCH,RequestMethod.PUT }) - @Operation(summary = "Master data proxy", description = "Master data proxy", tags = "proxy-masterdata-controller") - @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "OK"), - @ApiResponse(responseCode = "401", description = "Unauthorized" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "403", description = "Forbidden" ,content = @Content(schema = @Schema(hidden = true))), - @ApiResponse(responseCode = "404", description = "Not Found" ,content = @Content(schema = @Schema(hidden = true)))}) - public ResponseEntity masterDataProxyController(@RequestBody(required = false) String body, - HttpServletRequest request) { - auditUtil.setAuditRequestDto(EventEnum.MASTERDATA_PROXY_API_CALLED,null); - return ResponseEntity.status(HttpStatus.OK).body(service.getResponse(body, request,url)); + @RequestMapping(path = "/**", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET) + @Operation(summary = "Master data proxy", description = "Master data proxy", tags = "proxy-masterdata-controller") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) + }) + public ResponseEntity getMasterDataProxyController(@RequestBody(required = false) String body, HttpServletRequest request) { + auditUtil.setAuditRequestDto(EventEnum.MASTERDATA_PROXY_API_CALLED, null); + return ResponseEntity.status(HttpStatus.OK).body(service.getResponse(null, request, url)); + } + + @RequestMapping(path = "/**", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST) + @Operation(summary = "Master data proxy", description = "Master data proxy", tags = "proxy-masterdata-controller") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) + }) + public ResponseEntity postMasterDataProxyController(@RequestBody(required = false) String body, HttpServletRequest request) { + auditUtil.setAuditRequestDto(EventEnum.MASTERDATA_PROXY_API_CALLED, null); + return ResponseEntity.status(HttpStatus.OK).body(service.getResponse(body, request, url)); + } + + @RequestMapping(path = "/**", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.DELETE) + @Operation(summary = "Master data proxy", description = "Master data proxy", tags = "proxy-masterdata-controller") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) + }) + public ResponseEntity deleteMasterDataProxyController(@RequestBody(required = false) String body, HttpServletRequest request) { + auditUtil.setAuditRequestDto(EventEnum.MASTERDATA_PROXY_API_CALLED, null); + return ResponseEntity.status(HttpStatus.OK).body(service.getResponse(null, request, url)); + } + + @RequestMapping(path = "/**", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.PUT) + @Operation(summary = "Master data proxy", description = "Master data proxy", tags = "proxy-masterdata-controller") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) + }) + public ResponseEntity putMasterDataProxyController(@RequestBody(required = false) String body, HttpServletRequest request) { + auditUtil.setAuditRequestDto(EventEnum.MASTERDATA_PROXY_API_CALLED, null); + return ResponseEntity.status(HttpStatus.OK).body(service.getResponse(body, request, url)); + } + + + @RequestMapping(path = "/**", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.PATCH) + @Operation(summary = "Master data proxy", description = "Master data proxy for PATCH requests", tags = "proxy-masterdata-controller") + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK"), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "403", description = "Forbidden", content = @Content(schema = @Schema(hidden = true))), + @ApiResponse(responseCode = "404", description = "Not Found", content = @Content(schema = @Schema(hidden = true))) + }) + public ResponseEntity patchMasterDataProxyController(@RequestBody(required = false) String body, HttpServletRequest request) { + auditUtil.setAuditRequestDto(EventEnum.MASTERDATA_PROXY_API_CALLED, null); + return ResponseEntity.status(HttpStatus.OK).body(service.getResponse(body, request, url)); } } +