2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.be.servlets;
23 import com.jcabi.aspects.Loggable;
24 import io.swagger.annotations.*;
25 import org.openecomp.sdc.be.components.impl.GroupTypeBusinessLogic;
26 import org.openecomp.sdc.be.mixin.GroupTypeMixin;
27 import org.openecomp.sdc.be.model.GroupTypeDefinition;
28 import org.openecomp.sdc.be.view.ResponseView;
29 import org.openecomp.sdc.common.api.Constants;
30 import org.springframework.stereotype.Controller;
33 import javax.ws.rs.core.MediaType;
34 import java.util.List;
36 @Loggable(prepend = true, value = Loggable.DEBUG, trim = false)
38 @Api(value = "group types resource")
40 @Consumes(MediaType.APPLICATION_JSON)
41 @Produces(MediaType.APPLICATION_JSON)
42 public class GroupTypesEndpoint {
44 private final GroupTypeBusinessLogic groupTypeBusinessLogic;
46 public GroupTypesEndpoint(GroupTypeBusinessLogic groupTypeBusinessLogic) {
47 this.groupTypeBusinessLogic = groupTypeBusinessLogic;
52 @ApiOperation(value = "Get group types ", httpMethod = "GET", notes = "Returns group types", response = GroupTypeDefinition.class, responseContainer = "List")
53 @ApiResponses(value = {
54 @ApiResponse(code = 200, message = "group types found"),
55 @ApiResponse(code = 400, message = "field name invalid type/length, characters; mandatory field is absent, already exists (name)"),
56 @ApiResponse(code = 403, message = "Restricted operation"),
57 @ApiResponse(code = 500, message = "Internal Error")
59 @ResponseView(mixin = {GroupTypeMixin.class})
60 public List<GroupTypeDefinition> getGroupTypes(@HeaderParam(value = Constants.USER_ID_HEADER) String userId,
61 @ApiParam(value = "An optional parameter to indicate the type of the container from where this call is executed")
62 @QueryParam("internalComponentType") String internalComponentType) {
63 return groupTypeBusinessLogic.getAllGroupTypes(userId, internalComponentType);