Implement 'Update Service by importing Tosca Template'-story
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / servlets / ServiceUploadServlet.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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=========================================================
19  */
20 package org.openecomp.sdc.be.servlets;
21
22 import com.jcabi.aspects.Loggable;
23 import io.swagger.v3.oas.annotations.tags.Tag;
24 import lombok.AllArgsConstructor;
25 import lombok.Getter;
26 import org.openecomp.sdc.be.components.impl.ComponentInstanceBusinessLogic;
27 import org.openecomp.sdc.be.components.impl.ResourceImportManager;
28 import org.openecomp.sdc.be.impl.ComponentsUtils;
29 import org.openecomp.sdc.be.impl.ServletUtils;
30
31 import javax.inject.Singleton;
32 import javax.ws.rs.Path;
33
34 /**
35  * Root service (exposed at "/" path)
36  */
37
38 //upload Service model by Shiyong1989@hotmail.com
39 @Loggable(prepend = true, value = Loggable.DEBUG, trim = false)
40 @Path("/v1/catalog/uploadservice")
41 @Tag(name = "SDCE-2 APIs")
42 @Singleton
43 public class ServiceUploadServlet extends AbstractValidationsServlet {
44
45     public static final String NORMATIVE_TYPE_SERVICE = "multipart";
46     public static final String CSAR_TYPE_SERVICE = "csar";
47     public static final String USER_TYPE_SERVICE = "user-service";
48     public static final String USER_TYPE_SERVICE_UI_IMPORT = "user-servcie-ui-import";
49
50     public ServiceUploadServlet(ComponentInstanceBusinessLogic componentInstanceBL,
51                                 ComponentsUtils componentsUtils, ServletUtils servletUtils, ResourceImportManager resourceImportManager) {
52         super(componentInstanceBL, componentsUtils, servletUtils, resourceImportManager);
53     }
54
55     @AllArgsConstructor
56     @Getter
57     public enum ServiceAuthorityTypeEnum {
58         NORMATIVE_TYPE_BE(NORMATIVE_TYPE_SERVICE, true, false),
59         USER_TYPE_BE(USER_TYPE_SERVICE, true, true),
60         USER_TYPE_UI(USER_TYPE_SERVICE_UI_IMPORT, false, true),
61         CSAR_TYPE_BE(CSAR_TYPE_SERVICE, true, true);
62         private final String urlPath;
63         private final boolean isBackEndImport;
64         private final boolean isUserTypeService;
65
66     }
67 }