Skip to content

Commit 55ef629

Browse files
AS-3017: Override CodeTableEndpoints.
1 parent 98f2f41 commit 55ef629

File tree

2 files changed

+85
-1
lines changed

2 files changed

+85
-1
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
package ca.bc.gov.farms.api.rest.v1.endpoints;
2+
3+
import javax.ws.rs.Consumes;
4+
import javax.ws.rs.GET;
5+
import javax.ws.rs.PUT;
6+
import javax.ws.rs.Path;
7+
import javax.ws.rs.PathParam;
8+
import javax.ws.rs.Produces;
9+
import javax.ws.rs.QueryParam;
10+
import javax.ws.rs.core.MediaType;
11+
import javax.ws.rs.core.Response;
12+
13+
import ca.bc.gov.nrs.common.wfone.rest.resource.CodeTableRsrc;
14+
import ca.bc.gov.nrs.common.wfone.rest.resource.HeaderConstants;
15+
import ca.bc.gov.nrs.common.wfone.rest.resource.MessageListRsrc;
16+
import ca.bc.gov.nrs.wfone.common.rest.endpoints.BaseEndpoints;
17+
import io.swagger.v3.oas.annotations.Operation;
18+
import io.swagger.v3.oas.annotations.Parameter;
19+
import io.swagger.v3.oas.annotations.Parameters;
20+
import io.swagger.v3.oas.annotations.enums.ParameterIn;
21+
import io.swagger.v3.oas.annotations.extensions.Extension;
22+
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
23+
import io.swagger.v3.oas.annotations.headers.Header;
24+
import io.swagger.v3.oas.annotations.media.Content;
25+
import io.swagger.v3.oas.annotations.media.Schema;
26+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
27+
import io.swagger.v3.oas.annotations.responses.ApiResponses;
28+
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
29+
30+
@Path("/codeTables/{codeTableName}")
31+
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
32+
public interface CodeTableEndpoints extends BaseEndpoints {
33+
34+
@Operation(operationId = "Get CodeTable resource by code table name.", summary = "Get CodeTable resource by code table name.", security = @SecurityRequirement(name = "Webade-OAUTH2", scopes = {
35+
"GETTOPLEVEL" }), extensions = {
36+
@Extension(properties = {
37+
@ExtensionProperty(name = "auth-type", value = "#{wso2.x-auth-type.app_and_app_user}"),
38+
@ExtensionProperty(name = "throttling-tier", value = "Unlimited") }) })
39+
@Parameters({
40+
@Parameter(name = HeaderConstants.REQUEST_ID_HEADER, description = HeaderConstants.REQUEST_ID_HEADER_DESCRIPTION, required = false, schema = @Schema(implementation = String.class), in = ParameterIn.HEADER),
41+
@Parameter(name = HeaderConstants.VERSION_HEADER, description = HeaderConstants.VERSION_HEADER_DESCRIPTION, required = false, schema = @Schema(implementation = Integer.class), in = ParameterIn.HEADER),
42+
@Parameter(name = HeaderConstants.CACHE_CONTROL_HEADER, description = HeaderConstants.CACHE_CONTROL_DESCRIPTION, required = false, schema = @Schema(implementation = String.class), in = ParameterIn.HEADER),
43+
@Parameter(name = HeaderConstants.PRAGMA_HEADER, description = HeaderConstants.PRAGMA_HEADER_DESCRIPTION, required = false, schema = @Schema(implementation = String.class), in = ParameterIn.HEADER),
44+
@Parameter(name = HeaderConstants.AUTHORIZATION_HEADER, description = HeaderConstants.AUTHORIZATION_HEADER_DESCRIPTION, required = false, schema = @Schema(implementation = String.class), in = ParameterIn.HEADER)
45+
})
46+
@ApiResponses(value = {
47+
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CodeTableRsrc.class)), headers = @Header(name = HeaderConstants.ETAG_HEADER, schema = @Schema(implementation = String.class), description = HeaderConstants.ETAG_DESCRIPTION)),
48+
@ApiResponse(responseCode = "403", description = "Forbidden"),
49+
@ApiResponse(responseCode = "404", description = "Not Found"),
50+
@ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(schema = @Schema(implementation = MessageListRsrc.class))) })
51+
@GET
52+
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
53+
public Response getCodeTable(
54+
@Parameter(description = "The identifier of the CodeTable resource.") @PathParam("codeTableName") String codeTableName,
55+
@Parameter(description = "Return the results as of the effectiveAsOfDate.") @QueryParam("effectiveAsOfDate") String effectiveAsOfDate);
56+
57+
@Operation(operationId = "Update CodeTable resource by code table name.", summary = "Update CodeTable by code table name.", security = @SecurityRequirement(name = "Webade-OAUTH2", scopes = {
58+
"GETTOPLEVEL" }), extensions = {
59+
@Extension(properties = {
60+
@ExtensionProperty(name = "auth-type", value = "#{wso2.x-auth-type.app_and_app_user}"),
61+
@ExtensionProperty(name = "throttling-tier", value = "Unlimited") }) })
62+
@Parameters({
63+
@Parameter(name = HeaderConstants.REQUEST_ID_HEADER, description = HeaderConstants.REQUEST_ID_HEADER_DESCRIPTION, required = false, schema = @Schema(implementation = String.class), in = ParameterIn.HEADER),
64+
@Parameter(name = HeaderConstants.VERSION_HEADER, description = HeaderConstants.VERSION_HEADER_DESCRIPTION, required = false, schema = @Schema(implementation = Integer.class), in = ParameterIn.HEADER),
65+
@Parameter(name = HeaderConstants.CACHE_CONTROL_HEADER, description = HeaderConstants.CACHE_CONTROL_DESCRIPTION, required = false, schema = @Schema(implementation = String.class), in = ParameterIn.HEADER),
66+
@Parameter(name = HeaderConstants.PRAGMA_HEADER, description = HeaderConstants.PRAGMA_HEADER_DESCRIPTION, required = false, schema = @Schema(implementation = String.class), in = ParameterIn.HEADER),
67+
@Parameter(name = HeaderConstants.AUTHORIZATION_HEADER, description = HeaderConstants.AUTHORIZATION_HEADER_DESCRIPTION, required = false, schema = @Schema(implementation = String.class), in = ParameterIn.HEADER),
68+
@Parameter(name = HeaderConstants.IF_MATCH_HEADER, description = HeaderConstants.IF_MATCH_DESCRIPTION, required = true, schema = @Schema(implementation = String.class), in = ParameterIn.HEADER)
69+
})
70+
@ApiResponses(value = {
71+
@ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CodeTableRsrc.class)), headers = @Header(name = HeaderConstants.ETAG_HEADER, schema = @Schema(implementation = String.class), description = HeaderConstants.ETAG_DESCRIPTION)),
72+
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(schema = @Schema(implementation = MessageListRsrc.class))),
73+
@ApiResponse(responseCode = "403", description = "Forbidden"),
74+
@ApiResponse(responseCode = "404", description = "Not Found"),
75+
@ApiResponse(responseCode = "409", description = "Conflict"),
76+
@ApiResponse(responseCode = "412", description = "Precondition Failed"),
77+
@ApiResponse(responseCode = "500", description = "Internal Server Error", content = @Content(schema = @Schema(implementation = MessageListRsrc.class))) })
78+
@PUT
79+
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
80+
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
81+
public Response updateCodeTable(
82+
@Parameter(description = "The identifier of the CodeTable resource.") @PathParam("codeTableName") String codeTableName,
83+
@Parameter(name = "codeTable", description = "The CodeTable resource containing the new values.", required = true) CodeTableRsrc codeTable);
84+
}

farms-api/farms-api-rest-endpoints/src/main/java/ca/bc/gov/farms/api/rest/v1/endpoints/impl/CodeTableEndpointsImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
import org.slf4j.LoggerFactory;
1313
import org.springframework.beans.factory.annotation.Autowired;
1414

15+
import ca.bc.gov.farms.api.rest.v1.endpoints.CodeTableEndpoints;
1516
import ca.bc.gov.farms.service.api.v1.code.CodeService;
1617
import ca.bc.gov.nrs.common.wfone.rest.resource.CodeTableRsrc;
1718
import ca.bc.gov.nrs.common.wfone.rest.resource.MessageListRsrc;
18-
import ca.bc.gov.nrs.wfone.common.api.rest.code.endpoints.CodeTableEndpoints;
1919
import ca.bc.gov.nrs.wfone.common.api.rest.code.parameters.EffectiveAsOfParameter;
2020
import ca.bc.gov.nrs.wfone.common.api.rest.code.parameters.validation.CodeParameterValidator;
2121
import ca.bc.gov.nrs.wfone.common.model.Message;

0 commit comments

Comments
 (0)