2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2021 Bell Canada
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.so.adapters.catalogdb.rest;
23 import io.swagger.v3.oas.annotations.OpenAPIDefinition;
24 import io.swagger.v3.oas.annotations.Operation;
25 import io.swagger.v3.oas.annotations.info.Info;
26 import io.swagger.v3.oas.annotations.media.ArraySchema;
27 import io.swagger.v3.oas.annotations.media.Content;
28 import io.swagger.v3.oas.annotations.media.Schema;
29 import io.swagger.v3.oas.annotations.responses.ApiResponse;
30 import java.util.List;
31 import javax.ws.rs.GET;
32 import javax.ws.rs.Path;
33 import javax.ws.rs.PathParam;
34 import javax.ws.rs.Produces;
35 import javax.ws.rs.core.MediaType;
36 import org.onap.so.db.catalog.beans.BuildingBlockRollback;
37 import org.onap.so.db.catalog.data.repository.BuildingBlockRollbackRepository;
38 import org.springframework.beans.factory.annotation.Autowired;
39 import org.springframework.stereotype.Component;
40 import org.springframework.transaction.annotation.Transactional;
43 @OpenAPIDefinition(info = @Info(title = "/v1", description = "model"))
44 @Path("/v1/buildingBlockRollback")
46 public class BuildingBlockRollbackRestImpl {
49 private BuildingBlockRollbackRepository bbRollbackRepo;
53 @Produces({MediaType.APPLICATION_JSON})
54 @Transactional(readOnly = true)
55 public BuildingBlockRollback findService(@PathParam("id") Integer id) {
56 return bbRollbackRepo.findOneById(id);
60 @Operation(description = "Look up BuildingBlock Rollback List", responses = @ApiResponse(
61 content = @Content(array = @ArraySchema(schema = @Schema(implementation = BuildingBlockRollback.class)))))
62 @Produces({MediaType.APPLICATION_JSON})
63 @Transactional(readOnly = true)
64 public List<BuildingBlockRollback> getBBRollbackList() {
65 return bbRollbackRepo.findAll();