generated from hmcts/spring-boot-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8dc035c
commit ab62e4f
Showing
91 changed files
with
3,451 additions
and
830 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
src/main/java/uk/gov/hmcts/opal/controllers/ApplicationFunctionController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package uk.gov.hmcts.opal.controllers; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
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.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import uk.gov.hmcts.opal.dto.search.ApplicationFunctionSearchDto; | ||
import uk.gov.hmcts.opal.entity.ApplicationFunctionEntity; | ||
import uk.gov.hmcts.opal.service.ApplicationFunctionServiceInterface; | ||
|
||
import java.util.List; | ||
|
||
import static uk.gov.hmcts.opal.util.ResponseUtil.buildResponse; | ||
|
||
|
||
@RestController | ||
@RequestMapping("/api/application-function") | ||
@Slf4j(topic = "ApplicationFunctionController") | ||
@Tag(name = "ApplicationFunction Controller") | ||
public class ApplicationFunctionController { | ||
|
||
private final ApplicationFunctionServiceInterface applicationFunctionService; | ||
|
||
public ApplicationFunctionController( | ||
@Qualifier("applicationFunctionServiceProxy") ApplicationFunctionServiceInterface applicationFunctionService) { | ||
this.applicationFunctionService = applicationFunctionService; | ||
} | ||
|
||
@GetMapping(value = "/{applicationFunctionId}") | ||
@Operation(summary = "Returns the ApplicationFunction for the given applicationFunctionId.") | ||
public ResponseEntity<ApplicationFunctionEntity> getApplicationFunctionById( | ||
@PathVariable Long applicationFunctionId) { | ||
|
||
log.info(":GET:getApplicationFunctionById: applicationFunctionId: {}", applicationFunctionId); | ||
|
||
ApplicationFunctionEntity response = applicationFunctionService.getApplicationFunction(applicationFunctionId); | ||
|
||
return buildResponse(response); | ||
} | ||
|
||
@PostMapping(value = "/search", consumes = MediaType.APPLICATION_JSON_VALUE) | ||
@Operation(summary = "Searches ApplicationFunctions based upon criteria in request body") | ||
public ResponseEntity<List<ApplicationFunctionEntity>> postApplicationFunctionsSearch( | ||
@RequestBody ApplicationFunctionSearchDto criteria) { | ||
log.info(":POST:postApplicationFunctionsSearch: query: \n{}", criteria); | ||
|
||
List<ApplicationFunctionEntity> response = applicationFunctionService.searchApplicationFunctions(criteria); | ||
|
||
return buildResponse(response); | ||
} | ||
|
||
|
||
} |
60 changes: 60 additions & 0 deletions
60
src/main/java/uk/gov/hmcts/opal/controllers/BusinessUnitUserController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package uk.gov.hmcts.opal.controllers; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
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.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import uk.gov.hmcts.opal.dto.search.BusinessUnitUserSearchDto; | ||
import uk.gov.hmcts.opal.entity.BusinessUnitUserEntity; | ||
import uk.gov.hmcts.opal.service.BusinessUnitUserServiceInterface; | ||
|
||
import java.util.List; | ||
|
||
import static uk.gov.hmcts.opal.util.ResponseUtil.buildResponse; | ||
|
||
|
||
@RestController | ||
@RequestMapping("/api/business-unit-user") | ||
@Slf4j(topic = "BusinessUnitUserController") | ||
@Tag(name = "BusinessUnitUser Controller") | ||
public class BusinessUnitUserController { | ||
|
||
private final BusinessUnitUserServiceInterface businessUnitUserService; | ||
|
||
public BusinessUnitUserController( | ||
@Qualifier("businessUnitUserServiceProxy") BusinessUnitUserServiceInterface businessUnitUserService) { | ||
this.businessUnitUserService = businessUnitUserService; | ||
} | ||
|
||
@GetMapping(value = "/{businessUnitUserId}") | ||
@Operation(summary = "Returns the BusinessUnitUser for the given businessUnitUserId.") | ||
public ResponseEntity<BusinessUnitUserEntity> getBusinessUnitUserById(@PathVariable String businessUnitUserId) { | ||
|
||
log.info(":GET:getBusinessUnitUserById: businessUnitUserId: {}", businessUnitUserId); | ||
|
||
BusinessUnitUserEntity response = businessUnitUserService.getBusinessUnitUser(businessUnitUserId); | ||
|
||
return buildResponse(response); | ||
} | ||
|
||
@PostMapping(value = "/search", consumes = MediaType.APPLICATION_JSON_VALUE) | ||
@Operation(summary = "Searches BusinessUnitUsers based upon criteria in request body") | ||
public ResponseEntity<List<BusinessUnitUserEntity>> postBusinessUnitUsersSearch( | ||
@RequestBody BusinessUnitUserSearchDto criteria) { | ||
log.info(":POST:postBusinessUnitUsersSearch: query: \n{}", criteria); | ||
|
||
List<BusinessUnitUserEntity> response = businessUnitUserService.searchBusinessUnitUsers(criteria); | ||
|
||
return buildResponse(response); | ||
} | ||
|
||
|
||
} |
58 changes: 58 additions & 0 deletions
58
src/main/java/uk/gov/hmcts/opal/controllers/TemplateController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package uk.gov.hmcts.opal.controllers; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
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.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import uk.gov.hmcts.opal.dto.search.TemplateSearchDto; | ||
import uk.gov.hmcts.opal.entity.TemplateEntity; | ||
import uk.gov.hmcts.opal.service.TemplateServiceInterface; | ||
|
||
import java.util.List; | ||
|
||
import static uk.gov.hmcts.opal.util.ResponseUtil.buildResponse; | ||
|
||
|
||
@RestController | ||
@RequestMapping("/api/template") | ||
@Slf4j(topic = "TemplateController") | ||
@Tag(name = "Template Controller") | ||
public class TemplateController { | ||
|
||
private final TemplateServiceInterface templateService; | ||
|
||
public TemplateController(@Qualifier("templateServiceProxy") TemplateServiceInterface templateService) { | ||
this.templateService = templateService; | ||
} | ||
|
||
@GetMapping(value = "/{templateId}") | ||
@Operation(summary = "Returns the Template for the given templateId.") | ||
public ResponseEntity<TemplateEntity> getTemplateById(@PathVariable Long templateId) { | ||
|
||
log.info(":GET:getTemplateById: templateId: {}", templateId); | ||
|
||
TemplateEntity response = templateService.getTemplate(templateId); | ||
|
||
return buildResponse(response); | ||
} | ||
|
||
@PostMapping(value = "/search", consumes = MediaType.APPLICATION_JSON_VALUE) | ||
@Operation(summary = "Searches Templates based upon criteria in request body") | ||
public ResponseEntity<List<TemplateEntity>> postTemplatesSearch(@RequestBody TemplateSearchDto criteria) { | ||
log.info(":POST:postTemplatesSearch: query: \n{}", criteria); | ||
|
||
List<TemplateEntity> response = templateService.searchTemplates(criteria); | ||
|
||
return buildResponse(response); | ||
} | ||
|
||
|
||
} |
63 changes: 63 additions & 0 deletions
63
src/main/java/uk/gov/hmcts/opal/controllers/TemplateMappingController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package uk.gov.hmcts.opal.controllers; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
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.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import uk.gov.hmcts.opal.dto.search.TemplateMappingSearchDto; | ||
import uk.gov.hmcts.opal.entity.TemplateMappingEntity; | ||
import uk.gov.hmcts.opal.entity.TemplateMappingEntity.MappingId; | ||
import uk.gov.hmcts.opal.service.TemplateMappingServiceInterface; | ||
|
||
import java.util.List; | ||
|
||
import static uk.gov.hmcts.opal.util.ResponseUtil.buildResponse; | ||
|
||
|
||
@RestController | ||
@RequestMapping("/api/template-mapping") | ||
@Slf4j(topic = "TemplateMappingController") | ||
@Tag(name = "TemplateMapping Controller") | ||
public class TemplateMappingController { | ||
|
||
private final TemplateMappingServiceInterface templateMappingService; | ||
|
||
public TemplateMappingController( | ||
@Qualifier("templateMappingServiceProxy") TemplateMappingServiceInterface templateMappingService) { | ||
this.templateMappingService = templateMappingService; | ||
} | ||
|
||
@GetMapping(value = "/{templateId}/{applicationFunctionId}") | ||
@Operation(summary = "Returns the TemplateMapping for the given templateMappingId.") | ||
public ResponseEntity<TemplateMappingEntity> getTemplateMappingById(@PathVariable Long templateId, | ||
@PathVariable Long applicationFunctionId) { | ||
|
||
MappingId mappingId = new MappingId(templateId, applicationFunctionId); | ||
log.info(":GET:getTemplateMappingById: mappingId: {}", mappingId); | ||
|
||
TemplateMappingEntity response = templateMappingService.getTemplateMapping(mappingId); | ||
|
||
return buildResponse(response); | ||
} | ||
|
||
@PostMapping(value = "/search", consumes = MediaType.APPLICATION_JSON_VALUE) | ||
@Operation(summary = "Searches TemplateMappings based upon criteria in request body") | ||
public ResponseEntity<List<TemplateMappingEntity>> postTemplateMappingsSearch( | ||
@RequestBody TemplateMappingSearchDto criteria) { | ||
log.info(":POST:postTemplateMappingsSearch: query: \n{}", criteria); | ||
|
||
List<TemplateMappingEntity> response = templateMappingService.searchTemplateMappings(criteria); | ||
|
||
return buildResponse(response); | ||
} | ||
|
||
|
||
} |
58 changes: 58 additions & 0 deletions
58
src/main/java/uk/gov/hmcts/opal/controllers/UserController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package uk.gov.hmcts.opal.controllers; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
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.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import uk.gov.hmcts.opal.dto.search.UserSearchDto; | ||
import uk.gov.hmcts.opal.entity.UserEntity; | ||
import uk.gov.hmcts.opal.service.UserServiceInterface; | ||
|
||
import java.util.List; | ||
|
||
import static uk.gov.hmcts.opal.util.ResponseUtil.buildResponse; | ||
|
||
|
||
@RestController | ||
@RequestMapping("/api/user") | ||
@Slf4j(topic = "UserController") | ||
@Tag(name = "User Controller") | ||
public class UserController { | ||
|
||
private final UserServiceInterface userService; | ||
|
||
public UserController(@Qualifier("userServiceProxy") UserServiceInterface userService) { | ||
this.userService = userService; | ||
} | ||
|
||
@GetMapping(value = "/{userId}") | ||
@Operation(summary = "Returns the User for the given userId.") | ||
public ResponseEntity<UserEntity> getUserById(@PathVariable String userId) { | ||
|
||
log.info(":GET:getUserById: userId: {}", userId); | ||
|
||
UserEntity response = userService.getUser(userId); | ||
|
||
return buildResponse(response); | ||
} | ||
|
||
@PostMapping(value = "/search", consumes = MediaType.APPLICATION_JSON_VALUE) | ||
@Operation(summary = "Searches Users based upon criteria in request body") | ||
public ResponseEntity<List<UserEntity>> postUsersSearch(@RequestBody UserSearchDto criteria) { | ||
log.info(":POST:postUsersSearch: query: \n{}", criteria); | ||
|
||
List<UserEntity> response = userService.searchUsers(criteria); | ||
|
||
return buildResponse(response); | ||
} | ||
|
||
|
||
} |
60 changes: 60 additions & 0 deletions
60
src/main/java/uk/gov/hmcts/opal/controllers/UserEntitlementController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package uk.gov.hmcts.opal.controllers; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
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.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import uk.gov.hmcts.opal.dto.search.UserEntitlementSearchDto; | ||
import uk.gov.hmcts.opal.entity.UserEntitlementEntity; | ||
import uk.gov.hmcts.opal.service.UserEntitlementServiceInterface; | ||
|
||
import java.util.List; | ||
|
||
import static uk.gov.hmcts.opal.util.ResponseUtil.buildResponse; | ||
|
||
|
||
@RestController | ||
@RequestMapping("/api/user-entitlement") | ||
@Slf4j(topic = "UserEntitlementController") | ||
@Tag(name = "UserEntitlement Controller") | ||
public class UserEntitlementController { | ||
|
||
private final UserEntitlementServiceInterface userEntitlementService; | ||
|
||
public UserEntitlementController( | ||
@Qualifier("userEntitlementServiceProxy") UserEntitlementServiceInterface userEntitlementService) { | ||
this.userEntitlementService = userEntitlementService; | ||
} | ||
|
||
@GetMapping(value = "/{userEntitlementId}") | ||
@Operation(summary = "Returns the UserEntitlement for the given userEntitlementId.") | ||
public ResponseEntity<UserEntitlementEntity> getUserEntitlementById(@PathVariable Long userEntitlementId) { | ||
|
||
log.info(":GET:getUserEntitlementById: userEntitlementId: {}", userEntitlementId); | ||
|
||
UserEntitlementEntity response = userEntitlementService.getUserEntitlement(userEntitlementId); | ||
|
||
return buildResponse(response); | ||
} | ||
|
||
@PostMapping(value = "/search", consumes = MediaType.APPLICATION_JSON_VALUE) | ||
@Operation(summary = "Searches UserEntitlements based upon criteria in request body") | ||
public ResponseEntity<List<UserEntitlementEntity>> postUserEntitlementsSearch( | ||
@RequestBody UserEntitlementSearchDto criteria) { | ||
log.info(":POST:postUserEntitlementsSearch: query: \n{}", criteria); | ||
|
||
List<UserEntitlementEntity> response = userEntitlementService.searchUserEntitlements(criteria); | ||
|
||
return buildResponse(response); | ||
} | ||
|
||
|
||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/uk/gov/hmcts/opal/dto/search/ApplicationFunctionSearchDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package uk.gov.hmcts.opal.dto.search; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
import uk.gov.hmcts.opal.dto.ToJsonString; | ||
|
||
@Data | ||
@Builder | ||
public class ApplicationFunctionSearchDto implements ToJsonString { | ||
|
||
private String applicationFunctionId; | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/uk/gov/hmcts/opal/dto/search/BusinessUnitUserSearchDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package uk.gov.hmcts.opal.dto.search; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
import uk.gov.hmcts.opal.dto.ToJsonString; | ||
|
||
@Data | ||
@Builder | ||
public class BusinessUnitUserSearchDto implements ToJsonString { | ||
|
||
private String businessUnitUserId; | ||
|
||
} |
Oops, something went wrong.