AccessionRelatedController.java
/*
* Copyright 2020 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gringlobal.api.v2.impl;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.gringlobal.api.model.AccessionInvNameDTO;
import org.gringlobal.api.model.AccessionIprDTO;
import org.gringlobal.api.model.AccessionPedigreeDTO;
import org.gringlobal.api.model.AccessionQuarantineDTO;
import org.gringlobal.api.model.AccessionSourceDTO;
import org.gringlobal.api.model.AccessionSourceMapDTO;
import org.gringlobal.api.v1.ApiBaseController;
import org.gringlobal.api.v2.CRUDController;
import org.gringlobal.api.v2.FilteredCRUDController;
import org.gringlobal.api.v2.facade.AccessionInvNameApiService;
import org.gringlobal.api.v2.facade.AccessionIprApiService;
import org.gringlobal.api.v2.facade.AccessionPedigreeApiService;
import org.gringlobal.api.v2.facade.AccessionQuarantineApiService;
import org.gringlobal.api.v2.facade.AccessionSourceApiService;
import org.gringlobal.api.v2.facade.AccessionSourceMapApiService;
import org.gringlobal.model.AccessionInvName;
import org.gringlobal.model.AccessionIpr;
import org.gringlobal.model.AccessionPedigree;
import org.gringlobal.model.AccessionQuarantine;
import org.gringlobal.model.AccessionSource;
import org.gringlobal.model.AccessionSourceMap;
import org.gringlobal.service.filter.AccessionInvNameFilter;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController("accessionRelatedApi2")
@RequestMapping(AccessionRelatedController.API_URL)
@PreAuthorize("isAuthenticated()")
@Tag(name = "Accession")
public class AccessionRelatedController extends ApiBaseController {
/** The Constant API_URL. */
public static final String API_URL = AccessionController.API_URL;
@RestController("accessionInvNameApi2")
@RequestMapping(AccessionInvNameController.API_URL)
@PreAuthorize("isAuthenticated()")
@Tag(name = "Accession")
public static class AccessionInvNameController extends FilteredCRUDController<AccessionInvNameDTO, AccessionInvName, AccessionInvNameApiService, AccessionInvNameFilter> {
/** The Constant API_URL. */
public static final String API_URL = AccessionRelatedController.API_URL + "/name";
@Override
@Operation(operationId = "createAccessionInvName", description = "Create AccessionInvName", summary = "Create")
public AccessionInvNameDTO create(@RequestBody AccessionInvNameDTO entity) {
return super.create(entity);
}
@Override
@Operation(operationId = "updateAccessionInvName", description = "Update an existing record", summary = "Update")
public AccessionInvNameDTO update(@RequestBody AccessionInvNameDTO entity) {
return super.update(entity);
}
@Override
@Operation(operationId = "getAccessionInvName", description = "Get record by ID", summary = "Get")
public AccessionInvNameDTO get(@PathVariable("id") final long id) {
return super.get(id);
}
@Override
@Operation(operationId = "deleteAccessionInvName", description = "Delete existing record by ID", summary = "Delete")
public AccessionInvNameDTO remove(@PathVariable long id) {
return super.remove(id);
}
}
@RestController("accessionIprApi2")
@RequestMapping(AccessionIprController.API_URL)
@PreAuthorize("isAuthenticated()")
@Tag(name = "Accession")
@Validated
public static class AccessionIprController extends CRUDController<AccessionIprDTO, AccessionIpr, AccessionIprApiService> {
/** The Constant API_URL. */
public static final String API_URL = AccessionRelatedController.API_URL + "/ipr";
@Override
@Operation(operationId = "createAccessionIpr", description = "Create AccessionIpr", summary = "Create")
public AccessionIprDTO create(@RequestBody AccessionIprDTO entity) {
return super.create(entity);
}
@Override
@Operation(operationId = "updateAccessionIpr", description = "Update an existing record", summary = "Update")
public AccessionIprDTO update(@RequestBody AccessionIprDTO entity) {
return super.update(entity);
}
@Override
@Operation(operationId = "getAccessionIpr", description = "Get record by ID", summary = "Get")
public AccessionIprDTO get(@PathVariable long id) {
return super.get(id);
}
@Override
@Operation(operationId = "deleteAccessionIpr", description = "Delete existing record by ID", summary = "Delete")
public AccessionIprDTO remove(@PathVariable long id) {
return super.remove(id);
}
}
@RestController("accessionPedigreeApi2")
@RequestMapping(AccessionPedigreeController.API_URL)
@PreAuthorize("isAuthenticated()")
@Tag(name = "Accession")
public static class AccessionPedigreeController extends CRUDController<AccessionPedigreeDTO, AccessionPedigree, AccessionPedigreeApiService> {
/** The Constant API_URL. */
public static final String API_URL = AccessionRelatedController.API_URL + "/pedigree";
@Override
@Operation(operationId = "createAccessionPedigree", description = "Create AccessionPedigree", summary = "Create")
public AccessionPedigreeDTO create(@RequestBody AccessionPedigreeDTO entity) {
return super.create(entity);
}
@Override
@Operation(operationId = "updateAccessionPedigree", description = "Update an existing record", summary = "Update")
public AccessionPedigreeDTO update(@RequestBody AccessionPedigreeDTO entity) {
return super.update(entity);
}
@Override
@Operation(operationId = "getAccessionPedigree", description = "Get record by ID", summary = "Get")
public AccessionPedigreeDTO get(@PathVariable long id) {
return super.get(id);
}
@Override
@Operation(operationId = "deleteAccessionPedigree", description = "Delete existing record by ID", summary = "Delete")
public AccessionPedigreeDTO remove(@PathVariable long id) {
return super.remove(id);
}
}
@RestController("accessionSourceApi2")
@RequestMapping(AccessionSourceController.API_URL)
@PreAuthorize("isAuthenticated()")
@Tag(name = "Accession")
public static class AccessionSourceController extends CRUDController<AccessionSourceDTO, AccessionSource, AccessionSourceApiService> {
/** The Constant API_URL. */
public static final String API_URL = AccessionRelatedController.API_URL + "/source";
@Override
@Operation(operationId = "createAccessionSource", description = "Create AccessionSource", summary = "Create")
public AccessionSourceDTO create(@RequestBody AccessionSourceDTO entity) {
return super.create(entity);
}
@Override
@Operation(operationId = "updateAccessionSource", description = "Update an existing record", summary = "Update")
public AccessionSourceDTO update(@RequestBody AccessionSourceDTO entity) {
return super.update(entity);
}
@Override
@Operation(operationId = "getAccessionSource", description = "Get record by ID", summary = "Get")
public AccessionSourceDTO get(@PathVariable long id) {
return super.get(id);
}
@Override
@Operation(operationId = "deleteAccessionSource", description = "Delete existing record by ID", summary = "Delete")
public AccessionSourceDTO remove(@PathVariable long id) {
return super.remove(id);
}
}
@RestController("accessionSourceMapApi2")
@RequestMapping(AccessionSourceMapController.API_URL)
@PreAuthorize("isAuthenticated()")
@Tag(name = "Accession")
public static class AccessionSourceMapController extends CRUDController<AccessionSourceMapDTO, AccessionSourceMap, AccessionSourceMapApiService> {
/** The Constant API_URL. */
public static final String API_URL = AccessionSourceController.API_URL + "/cooperator-map";
}
@RestController("accessionQuarantineApi2")
@RequestMapping(AccessionQuarantineController.API_URL)
@PreAuthorize("isAuthenticated()")
@Tag(name = "Accession")
public static class AccessionQuarantineController extends CRUDController<AccessionQuarantineDTO, AccessionQuarantine, AccessionQuarantineApiService> {
/** The Constant API_URL. */
public static final String API_URL = AccessionRelatedController.API_URL + "/quarantine";
@Override
@Operation(operationId = "createAccessionQuarantine", description = "Create AccessionQuarantine", summary = "Create")
public AccessionQuarantineDTO create(@RequestBody AccessionQuarantineDTO entity) {
return super.create(entity);
}
@Override
@Operation(operationId = "updateAccessionQuarantine", description = "Update an existing record", summary = "Update")
public AccessionQuarantineDTO update(@RequestBody AccessionQuarantineDTO entity) {
return super.update(entity);
}
@Override
@Operation(operationId = "getAccessionQuarantine", description = "Get record by ID", summary = "Get")
public AccessionQuarantineDTO get(@PathVariable long id) {
return super.get(id);
}
@Override
@Operation(operationId = "deleteAccessionQuarantine", description = "Delete existing record by ID", summary = "Delete")
public AccessionQuarantineDTO remove(@PathVariable long id) {
return super.remove(id);
}
}
}