Restcontroller Swagger Implementation with Embeded jar for Controller Bluprints MS
Change-Id: I0c0a33f0e29dad0d4aa703e3e381068b510e57d4
Issue-ID: CCSDK-468
Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
**/target-ide/*\r
**/target/*\r
**/logs/*\r
+**/debug-logs/*\r
**/tokens/*\r
\r
# Added for Intellij IDEA IDE\r
--- /dev/null
+<!--\r
+ ~ Copyright © 2017-2018 AT&T Intellectual Property.\r
+ ~\r
+ ~ Licensed under the Apache License, Version 2.0 (the "License");\r
+ ~ you may not use this file except in compliance with the License.\r
+ ~ You may obtain a copy of the License at\r
+ ~\r
+ ~ http://www.apache.org/licenses/LICENSE-2.0\r
+ ~\r
+ ~ Unless required by applicable law or agreed to in writing, software\r
+ ~ distributed under the License is distributed on an "AS IS" BASIS,\r
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ ~ See the License for the specific language governing permissions and\r
+ ~ limitations under the License.\r
+ -->\r
+\r
+<configuration>\r
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">\r
+ <!-- encoders are assigned the type\r
+ ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->\r
+ <encoder>\r
+ <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>\r
+ </encoder>\r
+ </appender>\r
+\r
+\r
+ <logger name="org.springframework" level="info"/>\r
+ <logger name="org.springframework.web" level="info"/>\r
+ <logger name="org.hibernate" level="error"/>\r
+ <logger name="org.onap.ccsdk.apps" level="info"/>\r
+\r
+ <root level="warn">\r
+ <appender-ref ref="STDOUT"/>\r
+ </root>\r
+\r
+</configuration>\r
# limitations under the License.
#
-info.build.artifact=@project.artifactId@
-info.build.name=@project.name@
-info.build.description=@project.description@
-info.build.version=@project.version@
-info.build.groupId=@project.groupId@
-logging.level.root=info
-
-server.contextPath=/
-server.servlet-path=/
-spring.jersey.application-path=/api/controller-blueprints/v1
-server.routingPath=/api
-
-mots.application.acronym=MOTS_ID
-platform.identifier=AJSC7_JERSEY
-#spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
-
#logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr($ threadId: {PID:- }){magenta} %clr(---){faint} %clr([ hostname: %X{hostname} serviceName: %X{serviceName} version: %X{version} transactionId: %X{transactionId} requestTimeStamp: %X{requestTimestamp} responseTimeStamp: %X{responseTimestamp} duration: %X{duration}]){yellow} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex
-#The max number of active threads in this pool
-server.tomcat.max-threads=200
-#The minimum number of threads always kept alive
-server.tomcat.min-Spare-Threads=25
-#The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minSpareThreads
-server.tomcat.max-idle-time=60000
-
-#for changing the tomcat port...
-#server.port=8081
-
-#Servlet context parameters
-server.context_parameters.p-name=value #context parameter with p-name as key and value as value.
-
-# make this true for AAF authentication and place cadi.properties into etc folder
-aaf.enabled=false
-
-# set to true to enable version proxy
-#ivp.enabled=false
-
logging.level.org.springframework.web=INFO
logging.level.org.hibernate.SQL=warn
logging.level.org.hibernate.type.descriptor.sql=debug
<artifactId>spring-boot-devtools</artifactId>\r
<optional>true</optional>\r
</dependency>\r
- <dependency>\r
- <groupId>com.h2database</groupId>\r
- <artifactId>h2</artifactId>\r
- <scope>runtime</scope>\r
- </dependency>\r
<dependency>\r
<groupId>org.springframework.boot</groupId>\r
<artifactId>spring-boot-starter-test</artifactId>\r
<dependencySet>
<outputDirectory>/opt/app/onap/lib</outputDirectory>
<excludes>
- <exclude>org.slf4j:slf4j-log4j12</exclude>
- <exclude>javax.servlet:servlet-api</exclude>
- <exclude>javax.servlet:javax.servlet-api</exclude>
- <exclude>j2ee:j2ee</exclude>
- <exclude>log4j:log4j</exclude>
- <exclude>com.sun:j2ee</exclude>
- <exclude>log4j:apache-log4j-extras</exclude>
- <exclude>org.slf4j:slf4j-simple</exclude>
</excludes>
</dependencySet>
</dependencySets>
\r
package org.onap.ccsdk.apps.controllerblueprints;\r
\r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
import org.springframework.boot.SpringApplication;\r
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;\r
import org.springframework.boot.autoconfigure.SpringBootApplication;\r
import org.springframework.context.annotation.ComponentScan;\r
+import org.springframework.web.reactive.config.EnableWebFlux;\r
\r
/**\r
- *\r
- *\r
* @author Brinda Santh\r
*/\r
@SpringBootApplication\r
+@EnableWebFlux\r
@ComponentScan(basePackages = {"org.onap.ccsdk.apps.controllerblueprints"})\r
@EnableAutoConfiguration\r
public class ControllerBluprintsApplication {\r
+ private static EELFLogger log = EELFManager.getInstance().getLogger(ControllerBluprintsApplication.class);\r
\r
public static void main(String[] args) {\r
+ log.info("****** Starting Controller Bluprints Application **************");\r
SpringApplication.run(ControllerBluprintsApplication.class, args);\r
}\r
\r
+++ /dev/null
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.apps.controllerblueprints;\r
-\r
-\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-import org.springframework.beans.factory.annotation.Value;\r
-import org.springframework.context.annotation.Configuration;\r
-/**\r
- *\r
- *\r
- * @author Brinda Santh\r
- */\r
-@Configuration\r
-public class ControllerBluprintsFilterConfiguration {\r
- private static Logger log = LoggerFactory.getLogger(JerseyConfiguration.class);\r
-\r
- @Value("${server.routingPath:#{null}}")\r
- private String routingPath;\r
-\r
-\r
-}\r
/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Copyright © 2017-2018 AT&T Intellectual Property.\r
*\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
*\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
*\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
*/\r
\r
package org.onap.ccsdk.apps.controllerblueprints;\r
* @author Brinda Santh\r
* @version 1.0\r
*/\r
-@Configuration\r
+//@Configuration\r
public class CorsConfig {\r
/**\r
* This is a CORS Implementation for different Orgin GUI to access.\r
+++ /dev/null
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.apps.controllerblueprints;\r
-\r
-\r
-import com.fasterxml.jackson.annotation.JsonInclude;\r
-import com.fasterxml.jackson.databind.DeserializationFeature;\r
-import com.fasterxml.jackson.databind.MapperFeature;\r
-import com.fasterxml.jackson.databind.ObjectMapper;\r
-import com.fasterxml.jackson.databind.SerializationFeature;\r
-import io.swagger.jaxrs.config.BeanConfig;\r
-import io.swagger.jaxrs.listing.ApiListingResource;\r
-import io.swagger.jaxrs.listing.SwaggerSerializers;\r
-import org.glassfish.jersey.server.ResourceConfig;\r
-import org.glassfish.jersey.servlet.ServletProperties;\r
-import org.onap.ccsdk.apps.controllerblueprints.service.common.ServiceExceptionMapper;\r
-import org.onap.ccsdk.apps.controllerblueprints.service.rs.ConfigModelRestImpl;\r
-import org.onap.ccsdk.apps.controllerblueprints.service.rs.ModelTypeRestImpl;\r
-import org.onap.ccsdk.apps.controllerblueprints.service.rs.ResourceDictionaryRestImpl;\r
-import org.onap.ccsdk.apps.controllerblueprints.service.rs.ServiceTemplateRestImpl;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-import org.springframework.context.annotation.Bean;\r
-import org.springframework.context.annotation.Primary;\r
-import org.springframework.stereotype.Component;\r
-\r
-import javax.ws.rs.core.MediaType;\r
-\r
-/**\r
- *\r
- *\r
- * @author Brinda Santh\r
- */\r
-@Component\r
-public class JerseyConfiguration extends ResourceConfig {\r
- private static Logger log = LoggerFactory.getLogger(JerseyConfiguration.class);\r
- /**\r
- *\r
- */\r
- @Autowired\r
- public JerseyConfiguration() {\r
- register(ConfigModelRestImpl.class);\r
- register(ModelTypeRestImpl.class);\r
- register(ResourceDictionaryRestImpl.class);\r
- register(ServiceTemplateRestImpl.class);\r
- register(ServiceExceptionMapper.class);\r
- property(ServletProperties.FILTER_FORWARD_ON_404, true);\r
- configureSwagger();\r
- }\r
-\r
- /**\r
- *\r
- * @return ObjectMapper\r
- */\r
- @Bean\r
- @Primary\r
- public ObjectMapper objectMapper() {\r
- ObjectMapper objectMapper = new ObjectMapper();\r
- objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);\r
- objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);\r
- objectMapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES);\r
- objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);\r
- objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);\r
- return objectMapper;\r
- }\r
-\r
- /**\r
- *\r
- */\r
- private void configureSwagger() {\r
- register(ApiListingResource.class);\r
- register(SwaggerSerializers.class);\r
- BeanConfig beanConfig = new BeanConfig();\r
- beanConfig.setVersion("1.0.0");\r
- beanConfig.setSchemes(new String[]{"http", "https"});\r
- beanConfig.setBasePath("/api/controller-blueprints/v1");\r
- beanConfig.setTitle("Controller Blueprints API");\r
- beanConfig.setDescription("Controller BluePrints API");\r
- beanConfig.getSwagger().addConsumes(MediaType.APPLICATION_JSON);\r
- beanConfig.getSwagger().addProduces(MediaType.APPLICATION_JSON);\r
- beanConfig.setResourcePackage("org.onap.ccsdk.apps.controllerblueprints");\r
- beanConfig.setPrettyPrint(true);\r
- beanConfig.setScan(true);\r
- }\r
-\r
-\r
-}
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package org.onap.ccsdk.apps.controllerblueprints;\r
+\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.springframework.context.annotation.Bean;\r
+import org.springframework.context.annotation.Configuration;\r
+import springfox.documentation.builders.PathSelectors;\r
+import springfox.documentation.builders.RequestHandlerSelectors;\r
+import springfox.documentation.service.ApiInfo;\r
+import springfox.documentation.service.Contact;\r
+import springfox.documentation.spi.DocumentationType;\r
+import springfox.documentation.spring.web.plugins.Docket;\r
+import springfox.documentation.swagger2.annotations.EnableSwagger2;\r
+\r
+import java.util.Arrays;\r
+import java.util.Collections;\r
+import java.util.HashSet;\r
+import java.util.Set;\r
+\r
+/**\r
+ * SwaggerConfig\r
+ *\r
+ * @author Brinda Santh 8/13/2018\r
+ */\r
+@Configuration\r
+@EnableSwagger2\r
+public class SwaggerConfig {\r
+ private static final Set<String> DEFAULT_PRODUCES_AND_CONSUMES =\r
+ new HashSet<String>(Arrays.asList("application/json",\r
+ "application/xml"));\r
+ private static Logger log = LoggerFactory.getLogger(SwaggerConfig.class);\r
+\r
+ @Bean\r
+ public Docket api() {\r
+ return new Docket(DocumentationType.SWAGGER_2)\r
+ .select()\r
+ .apis(RequestHandlerSelectors.any())\r
+ .paths(PathSelectors.any())\r
+ .build()\r
+ .apiInfo(apiInfo());\r
+ }\r
+\r
+ private ApiInfo apiInfo() {\r
+ return new ApiInfo(\r
+ "Controller Blueprints API",\r
+ "Controller blueprints API for VNF Self Service.",\r
+ "1.0.0",\r
+ "Terms of service",\r
+ new Contact("Brinda Santh", "www.onap.com", "brindasanth@onap.com"),\r
+ "Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0", Collections.emptyList());\r
+ }\r
+\r
+\r
+}\r
--- /dev/null
+/*\r
+ * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package org.onap.ccsdk.apps.controllerblueprints;\r
+\r
+import org.springframework.context.annotation.Configuration;\r
+import org.springframework.web.reactive.config.ResourceHandlerRegistry;\r
+import org.springframework.web.reactive.config.WebFluxConfigurationSupport;\r
+\r
+/**\r
+ * WebConfig\r
+ *\r
+ * @author Brinda Santh 8/13/2018\r
+ */\r
+@Configuration\r
+public class WebConfig extends WebFluxConfigurationSupport {\r
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {\r
+ registry.addResourceHandler("swagger-ui.html")\r
+ .addResourceLocations("classpath:/META-INF/resources/");\r
+\r
+ registry.addResourceHandler("/webjars/**")\r
+ .addResourceLocations("classpath:/META-INF/resources/webjars/");\r
+ }\r
+}\r
+++ /dev/null
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.apps.controllerblueprints;\r
-\r
-import org.springframework.context.annotation.Configuration;\r
-import org.springframework.web.servlet.config.annotation.EnableWebMvc;\r
-import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;\r
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;\r
-\r
-/**\r
- *\r
- * WebMvcConfiguration WebMvcConfiguration\r
- * @author Brinda Santh\r
- */\r
-@Configuration\r
-@EnableWebMvc\r
-public class WebMvcConfiguration extends WebMvcConfigurerAdapter {\r
- @Override\r
- public void addResourceHandlers(ResourceHandlerRegistry registry) {\r
- registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/swagger-ui/dist/");\r
- }\r
-\r
-}\r
\r
@Test\r
public void testConfigModel() {\r
-\r
ResponseEntity<String> entity = this.restTemplate\r
- .getForEntity("/api/controller-blueprints/v1/service/configmodel/1", String.class);\r
+ .getForEntity("/api/v1/config-model/1", String.class);\r
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);\r
}\r
}\r
# limitations under the License.\r
#\r
\r
-info.build.artifact=@project.artifactId@\r
-info.build.name=@project.name@\r
-info.build.description=@project.description@\r
-info.build.version=@project.version@\r
-info.build.groupId=@project.groupId@\r
-logging.level.root=info\r
-\r
-server.contextPath=/\r
-server.servlet-path=/\r
-spring.jersey.application-path=/api/controller-blueprints/v1\r
-server.routingPath=/api\r
-\r
-mots.application.acronym=MOTS_ID\r
-platform.identifier=AJSC7_JERSEY\r
-#spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration\r
-\r
-#logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr($ threadId: {PID:- }){magenta} %clr(---){faint} %clr([ hostname: %X{hostname} serviceName: %X{serviceName} version: %X{version} transactionId: %X{transactionId} requestTimeStamp: %X{requestTimestamp} responseTimeStamp: %X{responseTimestamp} duration: %X{duration}]){yellow} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex\r
-\r
-#The max number of active threads in this pool\r
-server.tomcat.max-threads=200\r
-#The minimum number of threads always kept alive\r
-server.tomcat.min-Spare-Threads=25\r
-#The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minSpareThreads\r
-server.tomcat.max-idle-time=60000\r
-\r
-#for changing the tomcat port...\r
-#server.port=8081\r
-\r
-#Servlet context parameters\r
-server.context_parameters.p-name=value #context parameter with p-name as key and value as value.\r
-\r
-# make this true for AAF authentication and place cadi.properties into etc folder\r
-aaf.enabled=false\r
-\r
-# set to true to enable version proxy\r
-#ivp.enabled=false\r
-\r
-logging.level.org.springframework.web=INFO\r
-logging.level.org.hibernate.SQL=warn\r
-logging.level.org.hibernate.type.descriptor.sql=debug\r
-\r
-spring.jpa.properties.hibernate.show_sql=true\r
-spring.jpa.properties.hibernate.use_sql_comments=true\r
-spring.jpa.properties.hibernate.format_sql=true\r
-\r
#Load Blueprints\r
# blueprints.load.initial-data may be overridden by ENV variables\r
blueprints.load.initial-data=true\r
\r
<logger name="org.springframework" level="info"/>\r
<logger name="org.springframework.web" level="debug"/>\r
- <logger name="org.hibernate" level="error"/>\r
+ <logger name="org.hibernate" level="info"/>\r
<logger name="org.onap.ccsdk.apps.controllerblueprints" level="info"/>\r
\r
<root level="warn">\r
<name>Controller Blueprints Core</name>\r
\r
<dependencies>\r
- <dependency>\r
- <groupId>org.jetbrains.kotlin</groupId>\r
- <artifactId>kotlin-stdlib</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.jetbrains.kotlin</groupId>\r
- <artifactId>kotlin-reflect</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>com.fasterxml.jackson.module</groupId>\r
- <artifactId>jackson-module-kotlin</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>com.fasterxml.jackson.core</groupId>\r
- <artifactId>jackson-databind</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>com.fasterxml.jackson.core</groupId>\r
- <artifactId>jackson-annotations</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>com.fasterxml.jackson.core</groupId>\r
- <artifactId>jackson-core</artifactId>\r
- </dependency>\r
<dependency>\r
<groupId>com.fasterxml.jackson.dataformat</groupId>\r
<artifactId>jackson-dataformat-xml</artifactId>\r
<groupId>com.fasterxml.jackson.module</groupId>\r
<artifactId>jackson-module-jsonSchema</artifactId>\r
</dependency>\r
- <dependency>\r
- <groupId>org.apache.commons</groupId>\r
- <artifactId>commons-lang3</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>commons-collections</groupId>\r
- <artifactId>commons-collections</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>commons-io</groupId>\r
- <artifactId>commons-io</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>com.google.guava</groupId>\r
- <artifactId>guava</artifactId>\r
- </dependency>\r
<dependency>\r
<groupId>org.yaml</groupId>\r
<artifactId>snakeyaml</artifactId>\r
</dependency>\r
- <dependency>\r
- <groupId>com.jayway.jsonpath</groupId>\r
- <artifactId>json-path</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>junit</groupId>\r
- <artifactId>junit</artifactId>\r
- <scope>test</scope>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.jetbrains.kotlin</groupId>\r
- <artifactId>kotlin-test</artifactId>\r
- <scope>test</scope>\r
- </dependency>\r
-<!-- <dependency>\r
- <groupId>org.slf4j</groupId>\r
- <artifactId>slf4j-simple</artifactId>\r
- </dependency>-->\r
</dependencies>\r
\r
</project>\r
<groupId>org.onap.ccsdk.apps</groupId>\r
<artifactId>controllerblueprints-core</artifactId>\r
</dependency>\r
- <dependency>\r
- <groupId>junit</groupId>\r
- <artifactId>junit</artifactId>\r
- <scope>test</scope>\r
- </dependency>\r
-\r
-\r
</dependencies>\r
\r
\r
<groupId>org.onap.ccsdk.apps</groupId>\r
<artifactId>controllerblueprints-resource-dict</artifactId>\r
</dependency>\r
- <dependency>\r
- <groupId>org.apache.commons</groupId>\r
- <artifactId>commons-lang3</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>commons-collections</groupId>\r
- <artifactId>commons-collections</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>commons-io</groupId>\r
- <artifactId>commons-io</artifactId>\r
- </dependency>\r
<dependency>\r
<groupId>org.apache.velocity</groupId>\r
<artifactId>velocity</artifactId>\r
</dependency>\r
- <dependency>\r
- <groupId>io.swagger</groupId>\r
- <artifactId>swagger-jersey2-jaxrs</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.json</groupId>\r
- <artifactId>json</artifactId>\r
- </dependency>\r
<dependency>\r
<groupId>org.springframework.boot</groupId>\r
- <artifactId>spring-boot-starter-web</artifactId>\r
+ <artifactId>spring-boot-starter-webflux</artifactId>\r
</dependency>\r
<dependency>\r
<groupId>org.springframework.boot</groupId>\r
- <artifactId>spring-boot-starter-jersey</artifactId>\r
+ <artifactId>spring-boot-starter-web</artifactId>\r
</dependency>\r
<dependency>\r
<groupId>org.springframework.boot</groupId>\r
+++ /dev/null
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.apps.controllerblueprints.service.common;\r
-\r
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
-\r
-import javax.ws.rs.core.MediaType;\r
-import javax.ws.rs.core.Response;\r
-import javax.ws.rs.ext.ExceptionMapper;\r
-import javax.ws.rs.ext.Provider;\r
-import java.io.PrintWriter;\r
-import java.io.StringWriter;\r
-\r
-@Provider\r
-public class ServiceExceptionMapper implements ExceptionMapper<BluePrintException> {\r
-\r
- @Override\r
- public Response toResponse(BluePrintException ex) {\r
- ErrorMessage errorMessage = new ErrorMessage();\r
- errorMessage.setCode(ex.getCode());\r
- errorMessage.setMessage(ex.getMessage());\r
- StringWriter errorStackTrace = new StringWriter();\r
- ex.printStackTrace(new PrintWriter(errorStackTrace));\r
- errorMessage.setDeveloperMessage(ex.toString());\r
- return Response.status(500).entity(errorMessage).type(MediaType.APPLICATION_JSON).build();\r
- }\r
-\r
-}
\ No newline at end of file
/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Copyright © 2017-2018 AT&T Intellectual Property.\r
*\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
*\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
*\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
*/\r
\r
package org.onap.ccsdk.apps.controllerblueprints.service.common;\r
import io.swagger.models.parameters.BodyParameter;\r
import io.swagger.models.parameters.Parameter;\r
import io.swagger.models.properties.*;\r
-import io.swagger.util.Json;\r
import org.apache.commons.collections.MapUtils;\r
import org.apache.commons.lang3.BooleanUtils;\r
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;\r
swagger.setDefinitions(getDefinition());\r
\r
\r
- swaggerContent = Json.pretty(swagger);\r
- return swaggerContent;\r
+ return swagger.toString();\r
}\r
\r
private Info getInfo() {\r
\r
package org.onap.ccsdk.apps.controllerblueprints.service.rs;\r
\r
-import io.swagger.annotations.*;\r
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;\r
+import org.onap.ccsdk.apps.controllerblueprints.service.ConfigModelService;\r
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;\r
-import org.springframework.web.bind.annotation.RequestMapping;\r
-import org.springframework.web.bind.annotation.RequestMethod;\r
-import org.springframework.web.bind.annotation.ResponseBody;\r
+import org.springframework.stereotype.Component;\r
+import org.springframework.stereotype.Service;\r
+import org.springframework.web.bind.annotation.*;\r
\r
-import javax.ws.rs.*;\r
-import javax.ws.rs.core.MediaType;\r
import java.util.List;\r
\r
/**\r
- * ConfigModelRest.java Purpose: Rest service controller for ConfigModelRest Management\r
- *\r
- * @author Brinda Santh\r
- * @version 1.0\r
+ * {@inheritDoc}\r
*/\r
-@Api\r
-@Path("/service")\r
-@Produces({MediaType.APPLICATION_JSON})\r
-public interface ConfigModelRest {\r
+@RestController\r
+@RequestMapping("/api/v1/config-model")\r
+public class ConfigModelRest {\r
\r
- /**\r
- * This is a getConfigModel rest service\r
- * \r
- * @param id\r
- * @return ConfigModel\r
- * @throws BluePrintException\r
- */\r
- @GET\r
- @Path("/configmodel/{id}")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to Search Service Template", response = ConfigModel.class)\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- @RequestMapping(value = "/configmodel/{id}", method = RequestMethod.GET)\r
- @ResponseBody ConfigModel getConfigModel(@ApiParam(required = true) @PathParam("id") Long id)\r
- throws BluePrintException;\r
- \r
+ private ConfigModelService configModelService;\r
\r
/**\r
- * This is a saveConfigModel rest service\r
- * \r
- * @param configModel\r
- * @return ConfigModel\r
- * @throws BluePrintException\r
+ * This is a ConfigModelRest constructor.\r
+ *\r
+ * @param configModelService Config Model Service\r
*/\r
- @POST\r
- @Path("/configmodel")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to get Model Type by Tags", response = ServiceTemplate.class)\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- ConfigModel saveConfigModel(@ApiParam(required = true) ConfigModel configModel)\r
- throws BluePrintException;\r
+ public ConfigModelRest(ConfigModelService configModelService) {\r
+ this.configModelService = configModelService;\r
\r
- /**\r
- * This is a deleteConfigModel rest service\r
- * \r
- * @param id\r
- * @throws BluePrintException\r
- */\r
- @DELETE\r
- @Path("/configmodel/{id}")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to delete ConfigModel.")\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- void deleteConfigModel(@ApiParam(required = true) @PathParam("id") Long id) throws BluePrintException;\r
+ }\r
\r
- /**\r
- * This is a getInitialConfigModel rest service\r
- * \r
- * @param name\r
- * @return ConfigModel\r
- * @throws BluePrintException\r
- */\r
- @GET\r
- @Path("/configmodelinitial/{name}")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to create default Service Template", response = ConfigModel.class)\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- ConfigModel getInitialConfigModel(@ApiParam(required = true) @PathParam("name") String name)\r
- throws BluePrintException;\r
+ @GetMapping(path = "/initial/{name}")\r
+ public @ResponseBody\r
+ ConfigModel getInitialConfigModel(@PathVariable(value = "name") String name) throws BluePrintException {\r
+ try {\r
+ return this.configModelService.getInitialConfigModel(name);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(2000, e.getMessage(), e);\r
+ }\r
+ }\r
\r
- /**\r
- * This is a getCloneConfigModel rest service\r
- * \r
- * @param id\r
- * @return ConfigModel\r
- * @throws BluePrintException\r
- */\r
- @GET\r
- @Path("/configmodelclone/{id}")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to create default Service Template", response = ConfigModel.class)\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- ConfigModel getCloneConfigModel(@ApiParam(required = true) @PathParam("id") Long id)\r
- throws BluePrintException;\r
+ @PostMapping(path = "/")\r
+ public @ResponseBody\r
+ ConfigModel saveConfigModel(@RequestBody ConfigModel configModel) throws BluePrintException {\r
+ try {\r
+ return this.configModelService.saveConfigModel(configModel);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(2200, e.getMessage(), e);\r
+ }\r
+ }\r
\r
- /**\r
- * This is a publishConfigModel rest service\r
- * \r
- * @param id\r
- * @return ServiceTemplate\r
- * @throws BluePrintException\r
- */\r
- @GET\r
- @Path("/configmodelpublish/{id}")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to get Model Type by Tags", response = ConfigModel.class)\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- ConfigModel publishConfigModel(@ApiParam(required = true) @PathParam("id") Long id)\r
- throws BluePrintException;\r
+ @DeleteMapping(path = "/{id}")\r
+ public void deleteConfigModel(@PathVariable(value = "id") Long id) throws BluePrintException {\r
+ try {\r
+ this.configModelService.deleteConfigModel(id);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(4000, e.getMessage(), e);\r
+ }\r
+ }\r
\r
- /**\r
- * This is a getConfigModelByNameAndVersion rest service\r
- * \r
- * @param name\r
- * @param version\r
- * @return ConfigModel\r
- * @throws BluePrintException\r
- */\r
- @GET\r
- @Path("/configmodelbyname/{name}/version/{version}")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to Search Service Template", response = ConfigModel.class)\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- ConfigModel getConfigModelByNameAndVersion(@ApiParam(required = true) @PathParam("name") String name,\r
- @ApiParam(required = true) @PathParam("version") String version) throws BluePrintException;\r
+ @GetMapping(path = "/publish/{id}")\r
+ public @ResponseBody\r
+ ConfigModel publishConfigModel(@PathVariable(value = "id") Long id) throws BluePrintException {\r
+ try {\r
+ return this.configModelService.publishConfigModel(id);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(2500, e.getMessage(), e);\r
+ }\r
+ }\r
\r
- /**\r
- * This is a searchServiceModels rest service\r
- * \r
- * @param tags\r
- * @return List<ConfigModel>\r
- * @throws BluePrintException\r
- */\r
- @GET\r
- @Path("/configmodelsearch/{tags}")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to Search Service Template", response = ConfigModel.class)\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- List<ConfigModel> searchConfigModels(@ApiParam(required = true) @PathParam("tags") String tags)\r
- throws BluePrintException;\r
+ @GetMapping(path = "/{id}")\r
+ public @ResponseBody\r
+ ConfigModel getConfigModel(@PathVariable(value = "id") Long id) throws BluePrintException {\r
+ try {\r
+ return this.configModelService.getConfigModel(id);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(2001, e.getMessage(), e);\r
+ }\r
+ }\r
+\r
+ @GetMapping(path = "/by-name/{name}/version/{version}")\r
+ public @ResponseBody\r
+ ConfigModel getConfigModelByNameAndVersion(@PathVariable(value = "name") String name,\r
+ @PathVariable(value = "version") String version) throws BluePrintException {\r
+ try {\r
+ return this.configModelService.getConfigModelByNameAndVersion(name, version);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(2002, e.getMessage(), e);\r
+ }\r
+ }\r
+\r
+ @GetMapping(path = "/search/{tags}")\r
+ public @ResponseBody\r
+ List<ConfigModel> searchConfigModels(@PathVariable(value = "tags") String tags) throws BluePrintException {\r
+ try {\r
+ return this.configModelService.searchConfigModels(tags);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(2003, e.getMessage(), e);\r
+ }\r
+ }\r
+\r
+ @GetMapping(path = "/clone/{id}")\r
+ public @ResponseBody\r
+ ConfigModel getCloneConfigModel(@PathVariable(value = "id") Long id) throws BluePrintException {\r
+ try {\r
+ return this.configModelService.getCloneConfigModel(id);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(2004, e.getMessage(), e);\r
+ }\r
+ }\r
\r
}\r
+++ /dev/null
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.apps.controllerblueprints.service.rs;\r
-\r
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
-import org.onap.ccsdk.apps.controllerblueprints.service.ConfigModelService;\r
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;\r
-import org.springframework.stereotype.Service;\r
-\r
-import java.util.List;\r
-\r
-/**\r
- * {@inheritDoc}\r
- */\r
-@Service\r
-public class ConfigModelRestImpl implements ConfigModelRest {\r
-\r
- private ConfigModelService configModelService;\r
-\r
- /**\r
- * This is a ConfigModelRestImpl constructor.\r
- *\r
- * @param configModelService Config Model Service\r
- */\r
- public ConfigModelRestImpl(ConfigModelService configModelService) {\r
- this.configModelService = configModelService;\r
-\r
- }\r
-\r
- @Override\r
- public ConfigModel getInitialConfigModel(String name) throws BluePrintException {\r
- try {\r
- return this.configModelService.getInitialConfigModel(name);\r
- } catch (Exception e) {\r
- throw new BluePrintException(2000, e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public ConfigModel saveConfigModel(ConfigModel configModel) throws BluePrintException {\r
- try {\r
- return this.configModelService.saveConfigModel(configModel);\r
- } catch (Exception e) {\r
- throw new BluePrintException(2200, e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public void deleteConfigModel(Long id) throws BluePrintException {\r
- try {\r
- this.configModelService.deleteConfigModel(id);\r
- } catch (Exception e) {\r
- throw new BluePrintException(4000, e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public ConfigModel publishConfigModel(Long id) throws BluePrintException {\r
- try {\r
- return this.configModelService.publishConfigModel(id);\r
- } catch (Exception e) {\r
- throw new BluePrintException(2500, e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public ConfigModel getConfigModel(Long id) throws BluePrintException {\r
- try {\r
- return this.configModelService.getConfigModel(id);\r
- } catch (Exception e) {\r
- throw new BluePrintException(2001, e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public ConfigModel getConfigModelByNameAndVersion(String name, String version) throws BluePrintException {\r
- try {\r
- return this.configModelService.getConfigModelByNameAndVersion(name, version);\r
- } catch (Exception e) {\r
- throw new BluePrintException(2002, e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public List<ConfigModel> searchConfigModels(String tags) throws BluePrintException {\r
- try {\r
- return this.configModelService.searchConfigModels(tags);\r
- } catch (Exception e) {\r
- throw new BluePrintException(2003, e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public ConfigModel getCloneConfigModel(Long id) throws BluePrintException {\r
- try {\r
- return this.configModelService.getCloneConfigModel(id);\r
- } catch (Exception e) {\r
- throw new BluePrintException(2004, e.getMessage(), e);\r
- }\r
- }\r
-\r
-}\r
\r
package org.onap.ccsdk.apps.controllerblueprints.service.rs;\r
\r
-import io.swagger.annotations.*;\r
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
+import org.onap.ccsdk.apps.controllerblueprints.service.ModelTypeService;\r
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;\r
+import org.springframework.stereotype.Component;\r
+import org.springframework.stereotype.Service;\r
+import org.springframework.web.bind.annotation.*;\r
\r
-import javax.ws.rs.*;\r
-import javax.ws.rs.core.MediaType;\r
import java.util.List;\r
\r
/**\r
- * ModelTypeRest.java Purpose: Rest service controller for Artifact Handling\r
- *\r
- * @author Brinda Santh\r
- * @version 1.0\r
+ * {@inheritDoc}\r
*/\r
-@Api\r
-@Path("/service")\r
-@Produces({MediaType.APPLICATION_JSON})\r
-public interface ModelTypeRest {\r
+@RestController\r
+@RequestMapping("/api/v1/model-type")\r
+public class ModelTypeRest {\r
\r
- /**\r
- * This is a getModelTypeByName rest service\r
- * \r
- * @param name\r
- * @return ModelType\r
- * @throws BluePrintException\r
- */\r
- @GET\r
- @Path("/modeltype/{name}")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to get Model Type by id", response = ModelType.class)\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- ModelType getModelTypeByName(@ApiParam(required = true) @PathParam("name") String name)\r
- throws BluePrintException;\r
+ private ModelTypeService modelTypeService;\r
\r
/**\r
- * This is a saveModelType rest service\r
- * \r
- * @param modelType\r
- * @return ModelType\r
- * @throws BluePrintException\r
+ * This is a ModelTypeResourceImpl, used to save and get the model types stored in database\r
+ *\r
+ * @param modelTypeService Model Type Service\r
*/\r
+ public ModelTypeRest(ModelTypeService modelTypeService) {\r
+ this.modelTypeService = modelTypeService;\r
+ }\r
\r
- @POST\r
- @Path("/modeltype")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to Save Model Type", response = ModelType.class)\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- ModelType saveModelType(@ApiParam(required = true) ModelType modelType) throws BluePrintException;\r
+ @GetMapping(path = "/{name}")\r
+ public ModelType getModelTypeByName(@PathVariable(value = "name") String name) throws BluePrintException {\r
+ try {\r
+ return modelTypeService.getModelTypeByName(name);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(1000, e.getMessage(), e);\r
+ }\r
+ }\r
\r
- /**\r
- * This is a deleteModelType rest service\r
- * \r
- * @param name\r
- * @throws BluePrintException\r
- */\r
- @DELETE\r
- @Path("/modeltype/{name}")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to delete Model Type")\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- void deleteModelTypeByName(@ApiParam(required = true) @PathParam("name") String name)\r
- throws BluePrintException;\r
+ @GetMapping(path = "/search/{tags}")\r
+ public List<ModelType> searchModelTypes(@PathVariable(value = "tags") String tags) throws BluePrintException {\r
+ try {\r
+ return modelTypeService.searchModelTypes(tags);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(1001, e.getMessage(), e);\r
+ }\r
+ }\r
\r
- /**\r
- * This is a searchModelType rest service\r
- * \r
- * @param tags\r
- * @return List<ModelType>\r
- * @throws BluePrintException\r
- */\r
- @GET\r
- @Path("/modeltypesearch/{tags}")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to get Model Type by tags", response = ModelType.class,\r
- responseContainer = "List")\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- List<ModelType> searchModelTypes(@ApiParam(required = true) @PathParam("tags") String tags)\r
- throws BluePrintException;\r
+ @GetMapping(path = "/by-definition/{definitionType}")\r
+ public @ResponseBody\r
+ List<ModelType> getModelTypeByDefinitionType(@PathVariable(value = "definitionType") String definitionType) throws BluePrintException {\r
+ try {\r
+ return modelTypeService.getModelTypeByDefinitionType(definitionType);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(1002, e.getMessage(), e);\r
+ }\r
+ }\r
\r
- /**\r
- * This is a getModelTypeByDefinitionType rest service\r
- * \r
- * @param definitionType\r
- * @return List<ModelType>\r
- * @throws BluePrintException\r
- */\r
- @GET\r
- @Path("/modeltypebydefinition/{definitionType}")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to get Model Type by tags", response = ModelType.class,\r
- responseContainer = "List")\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- List<ModelType> getModelTypeByDefinitionType(\r
- @ApiParam(required = true) @PathParam("definitionType") String definitionType)\r
- throws BluePrintException;\r
+ @PostMapping(path = "/")\r
+ public @ResponseBody\r
+ ModelType saveModelType(@RequestBody ModelType modelType) throws BluePrintException {\r
+ try {\r
+ return modelTypeService.saveModel(modelType);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(1100, e.getMessage(), e);\r
+ }\r
+ }\r
\r
+ @DeleteMapping(path = "/{name}")\r
+ public void deleteModelTypeByName(@PathVariable(value = "name") String name) throws BluePrintException {\r
+ try {\r
+ modelTypeService.deleteByModelName(name);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(1400, e.getMessage(), e);\r
+ }\r
+ }\r
}\r
+++ /dev/null
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.apps.controllerblueprints.service.rs;\r
-\r
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
-import org.onap.ccsdk.apps.controllerblueprints.service.ModelTypeService;\r
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;\r
-import org.springframework.stereotype.Service;\r
-\r
-import java.util.List;\r
-\r
-/**\r
- * {@inheritDoc}\r
- */\r
-@Service\r
-public class ModelTypeRestImpl implements ModelTypeRest {\r
-\r
- private ModelTypeService modelTypeService;\r
-\r
- /**\r
- * This is a ModelTypeResourceImpl, used to save and get the model types stored in database\r
- *\r
- * @param modelTypeService Model Type Service\r
- */\r
- public ModelTypeRestImpl(ModelTypeService modelTypeService) {\r
- this.modelTypeService = modelTypeService;\r
- }\r
-\r
- @Override\r
- public ModelType getModelTypeByName(String modelName) throws BluePrintException {\r
- try {\r
- return modelTypeService.getModelTypeByName(modelName);\r
- } catch (Exception e) {\r
- throw new BluePrintException(1000, e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public List<ModelType> searchModelTypes(String tags) throws BluePrintException {\r
- try {\r
- return modelTypeService.searchModelTypes(tags);\r
- } catch (Exception e) {\r
- throw new BluePrintException(1001, e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public List<ModelType> getModelTypeByDefinitionType(String definitionType) throws BluePrintException {\r
- try {\r
- return modelTypeService.getModelTypeByDefinitionType(definitionType);\r
- } catch (Exception e) {\r
- throw new BluePrintException(1002, e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public ModelType saveModelType(ModelType modelType) throws BluePrintException {\r
- try {\r
- return modelTypeService.saveModel(modelType);\r
- } catch (Exception e) {\r
- throw new BluePrintException(1100, e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public void deleteModelTypeByName(String name) throws BluePrintException {\r
- try {\r
- modelTypeService.deleteByModelName(name);\r
- } catch (Exception e) {\r
- throw new BluePrintException(1400, e.getMessage(), e);\r
- }\r
- }\r
-}\r
\r
package org.onap.ccsdk.apps.controllerblueprints.service.rs;\r
\r
-import io.swagger.annotations.*;\r
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
+import org.onap.ccsdk.apps.controllerblueprints.service.ResourceDictionaryService;\r
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;\r
+import org.springframework.stereotype.Component;\r
+import org.springframework.stereotype.Service;\r
+import org.springframework.web.bind.annotation.*;\r
\r
-import javax.ws.rs.*;\r
-import javax.ws.rs.core.MediaType;\r
import java.util.List;\r
\r
/**\r
- * ResourceDictionaryRest.java Purpose: Rest service controller for Artifact Handling\r
- *\r
- * @author Brinda Santh\r
- * @version 1.0\r
+ * {@inheritDoc}\r
*/\r
-@Api\r
-@Path("/service")\r
-@Produces({MediaType.APPLICATION_JSON})\r
+@RestController\r
+@RequestMapping(value = "/api/v1/dictionary")\r
+public class ResourceDictionaryRest {\r
\r
-public interface ResourceDictionaryRest {\r
\r
- /**\r
- * This is a getDataDictionaryByPath rest service\r
- * \r
- * @param name\r
- * @return ResourceDictionary\r
- * @throws BluePrintException\r
- */\r
- @GET\r
- @Path("/dictionary/{name}")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to get Resource dictionary", response = ResourceDictionary.class)\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- ResourceDictionary getResourceDictionaryByName(@ApiParam(required = true) @PathParam("name") String name)\r
- throws BluePrintException;\r
+ private ResourceDictionaryService resourceDictionaryService;\r
\r
/**\r
- * This is a saveDataDictionary rest service\r
- * \r
- * @param resourceMapping\r
- * @return ResourceDictionary\r
- * @throws BluePrintException\r
+ * This is a DataDictionaryRestImpl, used to save and get the Resource Mapping stored in database\r
+ *\r
+ * @param dataDictionaryService Data Dictionary Service\r
*/\r
+ public ResourceDictionaryRest(ResourceDictionaryService dataDictionaryService) {\r
+ this.resourceDictionaryService = dataDictionaryService;\r
+ }\r
\r
- @POST\r
- @Path("/dictionary")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to Save Resource dictionary Type", response = ResourceDictionary.class)\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- ResourceDictionary saveResourceDictionary(@ApiParam(required = true) ResourceDictionary resourceMapping)\r
- throws BluePrintException;\r
+ @PostMapping(path = "/")\r
+ public @ResponseBody\r
+ ResourceDictionary saveResourceDictionary(@RequestBody ResourceDictionary dataDictionary)\r
+ throws BluePrintException {\r
+ try {\r
+ return resourceDictionaryService.saveResourceDictionary(dataDictionary);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(4100, e.getMessage(), e);\r
+ }\r
+ }\r
\r
- /**\r
- * This is a deleteDataDictionaryByName rest service\r
- * \r
- * @param name\r
- * @throws BluePrintException\r
- */\r
- @DELETE\r
- @Path("/dictionary/{name}")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to delete ResourceDictionary Type")\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- void deleteResourceDictionaryByName(@ApiParam(required = true) @PathParam("name") String name)\r
- throws BluePrintException;\r
+ @DeleteMapping(path = "/{name}")\r
+ public void deleteResourceDictionaryByName(@PathVariable(value = "name") String name) throws BluePrintException {\r
+ try {\r
+ resourceDictionaryService.deleteResourceDictionary(name);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(4400, e.getMessage(), e);\r
+ }\r
+ }\r
\r
- /**\r
- * This is a searchResourceDictionaryByTags rest service\r
- * \r
- * @param tags\r
- * @return ResourceDictionary\r
- * @throws BluePrintException\r
- */\r
- @GET\r
- @Path("/dictionarysearch/{tags}")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to search Resource dictionary by tags",\r
- response = ResourceDictionary.class, responseContainer = "List")\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- List<ResourceDictionary> searchResourceDictionaryByTags(\r
- @ApiParam(required = true) @PathParam("tags") String tags) throws BluePrintException;\r
+ @GetMapping(path = "/{name}")\r
+ public @ResponseBody\r
+ ResourceDictionary getResourceDictionaryByName(@PathVariable(value = "name") String name) throws BluePrintException {\r
+ try {\r
+ return resourceDictionaryService.getResourceDictionaryByName(name);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(4001, e.getMessage(), e);\r
+ }\r
+ }\r
\r
- /**\r
- * This is a searchResourceDictionaryByNames rest service\r
- * \r
- * @param names\r
- * @return List<ResourceDictionary>\r
- * @throws BluePrintException\r
- */\r
- @POST\r
- @Path("/dictionarybynames")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to get ResourceDictionary Type by names",\r
- response = ResourceDictionary.class, responseContainer = "List")\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- List<ResourceDictionary> searchResourceDictionaryByNames(@ApiParam(required = true) List<String> names)\r
- throws BluePrintException;\r
+ @PostMapping(path = "/by-names")\r
+ public @ResponseBody\r
+ List<ResourceDictionary> searchResourceDictionaryByNames(@RequestBody List<String> names)\r
+ throws BluePrintException {\r
+ try {\r
+ return resourceDictionaryService.searchResourceDictionaryByNames(names);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(4002, e.getMessage(), e);\r
+ }\r
+ }\r
+\r
+ @GetMapping(path = "/search/{tags}")\r
+ public @ResponseBody\r
+ List<ResourceDictionary> searchResourceDictionaryByTags(@PathVariable(value = "tags") String tags) throws BluePrintException {\r
+ try {\r
+ return resourceDictionaryService.searchResourceDictionaryByTags(tags);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(4003, e.getMessage(), e);\r
+ }\r
+ }\r
\r
}\r
+++ /dev/null
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.apps.controllerblueprints.service.rs;\r
-\r
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
-import org.onap.ccsdk.apps.controllerblueprints.service.ResourceDictionaryService;\r
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;\r
-import org.springframework.stereotype.Service;\r
-\r
-import java.util.List;\r
-\r
-/**\r
- * {@inheritDoc}\r
- */\r
-@Service\r
-public class ResourceDictionaryRestImpl implements ResourceDictionaryRest {\r
-\r
-\r
- private ResourceDictionaryService resourceDictionaryService;\r
-\r
- /**\r
- * This is a DataDictionaryRestImpl, used to save and get the Resource Mapping stored in database\r
- *\r
- * @param dataDictionaryService Data Dictionary Service\r
- */\r
- public ResourceDictionaryRestImpl(ResourceDictionaryService dataDictionaryService) {\r
- this.resourceDictionaryService = dataDictionaryService;\r
- }\r
-\r
- @Override\r
- public ResourceDictionary saveResourceDictionary(ResourceDictionary dataDictionary)\r
- throws BluePrintException {\r
- try {\r
- return resourceDictionaryService.saveResourceDictionary(dataDictionary);\r
- } catch (Exception e) {\r
- throw new BluePrintException(4100, e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public void deleteResourceDictionaryByName(String name) throws BluePrintException {\r
- try {\r
- resourceDictionaryService.deleteResourceDictionary(name);\r
- } catch (Exception e) {\r
- throw new BluePrintException(4400, e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public ResourceDictionary getResourceDictionaryByName(String resourcePath) throws BluePrintException {\r
- try {\r
- return resourceDictionaryService.getResourceDictionaryByName(resourcePath);\r
- } catch (Exception e) {\r
- throw new BluePrintException(4001, e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public List<ResourceDictionary> searchResourceDictionaryByNames(List<String> names)\r
- throws BluePrintException {\r
- try {\r
- return resourceDictionaryService.searchResourceDictionaryByNames(names);\r
- } catch (Exception e) {\r
- throw new BluePrintException(4002, e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public List<ResourceDictionary> searchResourceDictionaryByTags(String tags) throws BluePrintException {\r
- try {\r
- return resourceDictionaryService.searchResourceDictionaryByTags(tags);\r
- } catch (Exception e) {\r
- throw new BluePrintException(4003, e.getMessage(), e);\r
- }\r
- }\r
-\r
-}\r
\r
package org.onap.ccsdk.apps.controllerblueprints.service.rs;\r
\r
-import io.swagger.annotations.*;\r
+\r
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;\r
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;\r
+import org.onap.ccsdk.apps.controllerblueprints.service.ServiceTemplateService;\r
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;\r
import org.onap.ccsdk.apps.controllerblueprints.service.model.AutoMapResponse;\r
+import org.springframework.stereotype.Component;\r
+import org.springframework.stereotype.Service;\r
+import org.springframework.web.bind.annotation.*;\r
\r
-import javax.ws.rs.Consumes;\r
-import javax.ws.rs.POST;\r
-import javax.ws.rs.Path;\r
-import javax.ws.rs.Produces;\r
-import javax.ws.rs.core.MediaType;\r
import java.util.List;\r
\r
-\r
/**\r
- * ServiceTemplateRest.java Purpose: ServiceTemplateRest interface\r
- *\r
- * @author Brinda Santh\r
- * @version 1.0\r
+ * {@inheritDoc}\r
*/\r
+@RestController\r
+@RequestMapping(value = "/api/v1/service-template")\r
+public class ServiceTemplateRest {\r
\r
-@Api\r
-@Path("/service")\r
-@Produces({MediaType.APPLICATION_JSON})\r
-public interface ServiceTemplateRest {\r
+ private ServiceTemplateService serviceTemplateService;\r
\r
/**\r
- * This is a enrichServiceTemplate rest service\r
- * \r
- * @param serviceTemplate\r
- * @return ServiceTemplate\r
- * @throws BluePrintException\r
+ * This is a ServiceTemplateRest constructor\r
+ *\r
+ * @param serviceTemplateService Service Template Service\r
*/\r
- @POST\r
- @Path("/servicetemplate/enrich")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to enrich service template", response = ServiceTemplate.class)\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- ServiceTemplate enrichServiceTemplate(@ApiParam(required = true) ServiceTemplate serviceTemplate)\r
- throws BluePrintException;\r
+ public ServiceTemplateRest(ServiceTemplateService serviceTemplateService) {\r
+ this.serviceTemplateService = serviceTemplateService;\r
+ }\r
\r
- /**\r
- * This is a validateServiceTemplate rest service\r
- * \r
- * @param serviceTemplate\r
- * @return ServiceTemplate\r
- * @throws BluePrintException\r
- */\r
- @POST\r
- @Path("/servicetemplate/validate")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to validate service template", response = ServiceTemplate.class)\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- ServiceTemplate validateServiceTemplate(@ApiParam(required = true) ServiceTemplate serviceTemplate)\r
- throws BluePrintException;\r
+ @PostMapping(path = "/enrich")\r
+ public @ResponseBody\r
+ ServiceTemplate enrichServiceTemplate(@RequestBody ServiceTemplate serviceTemplate) throws BluePrintException {\r
+ try {\r
+ return serviceTemplateService.enrichServiceTemplate(serviceTemplate);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(3500, e.getMessage(), e);\r
+ }\r
+ }\r
\r
- /**\r
- * This is a generateResourceAssignments rest service\r
- * \r
- * @param templateContent\r
- * @return List<ResourceAssignment>\r
- * @throws BluePrintException\r
- */\r
- @POST\r
- @Path("/resourceassignment/generate")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to auto map for the Resource Mapping",\r
- response = ResourceAssignment.class, responseContainer = "List")\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- List<ResourceAssignment> generateResourceAssignments(\r
- @ApiParam(required = true) ConfigModelContent templateContent) throws BluePrintException;\r
+ @PostMapping(path = "/validate")\r
+ public @ResponseBody\r
+ ServiceTemplate validateServiceTemplate(@RequestBody ServiceTemplate serviceTemplate) throws BluePrintException {\r
+ try {\r
+ return serviceTemplateService.validateServiceTemplate(serviceTemplate);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(3501, e.getMessage(), e);\r
+ }\r
+ }\r
\r
- /**\r
- * This is a autoMap rest service\r
- * \r
- * @param resourceAssignments\r
- * @return AutoMapResponse\r
- * @throws BluePrintException\r
- */\r
- @POST\r
- @Path("/resourceassignment/automap")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to auto map for the Resource assignments",\r
- response = AutoMapResponse.class)\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- AutoMapResponse autoMap(@ApiParam(required = true) List<ResourceAssignment> resourceAssignments)\r
- throws BluePrintException;\r
+ @PostMapping(path = "/resource-assignment/auto-map")\r
+ public @ResponseBody\r
+ AutoMapResponse autoMap(@RequestBody List<ResourceAssignment> resourceAssignments) throws BluePrintException {\r
+ try {\r
+ return serviceTemplateService.autoMap(resourceAssignments);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(3502, e.getMessage(), e);\r
+ }\r
+ }\r
\r
- /**\r
- * This is a validateResourceAssignments rest service\r
- * \r
- * @param resourceAssignments\r
- * @return List<ResourceAssignment>\r
- * @throws BluePrintException\r
- */\r
- @POST\r
- @Path("/resourceassignment/validate")\r
- @Consumes({MediaType.APPLICATION_JSON})\r
- @Produces({MediaType.APPLICATION_JSON})\r
- @ApiOperation(value = "Provides Rest service to validate Resource assignments", response = ResourceAssignment.class,\r
- responseContainer = "List")\r
- @ApiResponses(value = {@ApiResponse(code = 404, message = "Service not available"),\r
- @ApiResponse(code = 500, message = "Unexpected Runtime error")})\r
- List<ResourceAssignment> validateResourceAssignments(\r
- @ApiParam(required = true) List<ResourceAssignment> resourceAssignments) throws BluePrintException;\r
+ @PostMapping(path = "/resource-assignment/validate")\r
+ public @ResponseBody\r
+ List<ResourceAssignment> validateResourceAssignments(@RequestBody List<ResourceAssignment> resourceAssignments)\r
+ throws BluePrintException {\r
+ try {\r
+ return serviceTemplateService.validateResourceAssignments(resourceAssignments);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(3503, e.getMessage(), e);\r
+ }\r
+ }\r
+\r
+ @PostMapping(path = "/resource-assignment/generate")\r
+ public @ResponseBody\r
+ List<ResourceAssignment> generateResourceAssignments(@RequestBody ConfigModelContent templateContent)\r
+ throws BluePrintException {\r
+ try {\r
+ return serviceTemplateService.generateResourceAssignments(templateContent);\r
+ } catch (Exception e) {\r
+ throw new BluePrintException(3504, e.getMessage(), e);\r
+ }\r
+ }\r
\r
}\r
+++ /dev/null
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.apps.controllerblueprints.service.rs;\r
-\r
-\r
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;\r
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment;\r
-import org.onap.ccsdk.apps.controllerblueprints.service.ServiceTemplateService;\r
-import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelContent;\r
-import org.onap.ccsdk.apps.controllerblueprints.service.model.AutoMapResponse;\r
-import org.springframework.stereotype.Service;\r
-\r
-import java.util.List;\r
-\r
-/**\r
- * {@inheritDoc}\r
- */\r
-@Service\r
-public class ServiceTemplateRestImpl implements ServiceTemplateRest {\r
-\r
- private ServiceTemplateService serviceTemplateService;\r
-\r
- /**\r
- * This is a ServiceTemplateRestImpl constructor\r
- *\r
- * @param serviceTemplateService Service Template Service\r
- */\r
- public ServiceTemplateRestImpl(ServiceTemplateService serviceTemplateService) {\r
- this.serviceTemplateService = serviceTemplateService;\r
- }\r
-\r
- @Override\r
- public ServiceTemplate enrichServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {\r
- try {\r
- return serviceTemplateService.enrichServiceTemplate(serviceTemplate);\r
- } catch (Exception e) {\r
- throw new BluePrintException(3500, e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public ServiceTemplate validateServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {\r
- try {\r
- return serviceTemplateService.validateServiceTemplate(serviceTemplate);\r
- } catch (Exception e) {\r
- throw new BluePrintException(3501, e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public AutoMapResponse autoMap(List<ResourceAssignment> resourceAssignments) throws BluePrintException {\r
- try {\r
- return serviceTemplateService.autoMap(resourceAssignments);\r
- } catch (Exception e) {\r
- throw new BluePrintException(3502, e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public List<ResourceAssignment> validateResourceAssignments(List<ResourceAssignment> resourceAssignments)\r
- throws BluePrintException {\r
- try {\r
- return serviceTemplateService.validateResourceAssignments(resourceAssignments);\r
- } catch (Exception e) {\r
- throw new BluePrintException(3503, e.getMessage(), e);\r
- }\r
- }\r
-\r
- @Override\r
- public List<ResourceAssignment> generateResourceAssignments(ConfigModelContent templateContent)\r
- throws BluePrintException {\r
- try {\r
- return serviceTemplateService.generateResourceAssignments(templateContent);\r
- } catch (Exception e) {\r
- throw new BluePrintException(3504, e.getMessage(), e);\r
- }\r
- }\r
-\r
-}\r
+++ /dev/null
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * 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.onap.ccsdk.apps.controllerblueprints;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.MapperFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import org.glassfish.jersey.logging.LoggingFeature;
-import org.glassfish.jersey.server.ResourceConfig;
-import org.glassfish.jersey.servlet.ServletProperties;
-import org.onap.ccsdk.apps.controllerblueprints.service.common.ServiceExceptionMapper;
-import org.onap.ccsdk.apps.controllerblueprints.service.rs.ConfigModelRestImpl;
-import org.onap.ccsdk.apps.controllerblueprints.service.rs.ModelTypeRestImpl;
-import org.onap.ccsdk.apps.controllerblueprints.service.rs.ResourceDictionaryRestImpl;
-import org.onap.ccsdk.apps.controllerblueprints.service.rs.ServiceTemplateRestImpl;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Primary;
-import org.springframework.stereotype.Component;
-
-import java.util.logging.Logger;
-
-
-@Component
-public class JerseyConfiguration extends ResourceConfig {
- private static final Logger log = Logger.getLogger(JerseyConfiguration.class.getName());
-
- @Bean
- @Primary
- public ObjectMapper objectMapper() {
- ObjectMapper objectMapper = new ObjectMapper();
- objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
- objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
- objectMapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES);
- objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
- objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
- return objectMapper;
- }
-
- @Autowired
- public JerseyConfiguration() {
- register(ConfigModelRestImpl.class);
- register(ModelTypeRestImpl.class);
- register(ResourceDictionaryRestImpl.class);
- register(ServiceTemplateRestImpl.class);
- // Exception Mapping
- register(ServiceExceptionMapper.class);
- property(ServletProperties.FILTER_FORWARD_ON_404, true);
- register(new LoggingFeature(log));
- }
-
-
-}
\ No newline at end of file
+++ /dev/null
-/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.apps.controllerblueprints;\r
-\r
-import org.springframework.context.annotation.Bean;\r
-\r
-import java.util.ArrayList;\r
-\r
-//@Configuration\r
-public class TestConfiguration {\r
-\r
- @Bean("jaxrsProviders")\r
- public ArrayList<Object> provider() {\r
- return new ArrayList<Object>();\r
- }\r
-\r
- @Bean("jaxrsServices")\r
- public ArrayList<Object> service() {\r
- return new ArrayList<Object>();\r
- }\r
-\r
-}\r
import org.junit.runner.RunWith;\r
import org.junit.runners.MethodSorters;\r
import org.onap.ccsdk.apps.controllerblueprints.TestApplication;\r
-import org.onap.ccsdk.apps.controllerblueprints.TestConfiguration;\r
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;\r
import org.onap.ccsdk.apps.controllerblueprints.service.utils.ConfigModelUtils;\r
import org.slf4j.Logger;\r
\r
@RunWith(SpringRunner.class)\r
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)\r
-@ContextConfiguration(classes = {TestApplication.class, TestConfiguration.class})\r
+@ContextConfiguration(classes = {TestApplication.class})\r
@FixMethodOrder(MethodSorters.NAME_ASCENDING)\r
public class ConfigModelRestTest {\r
\r
ConfigModel configModel = configModelRest.getInitialConfigModel(name);\r
Assert.assertNotNull("Failed to get Initial Config Model , Return object is Null", configModel);\r
Assert.assertNotNull("Failed to get Service Template Content ", configModel.getConfigModelContents());\r
-\r
}\r
\r
\r
import org.junit.runner.RunWith;\r
import org.junit.runners.MethodSorters;\r
import org.onap.ccsdk.apps.controllerblueprints.TestApplication;\r
-import org.onap.ccsdk.apps.controllerblueprints.TestConfiguration;\r
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;\r
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;\r
import org.slf4j.Logger;\r
\r
@RunWith(SpringRunner.class)\r
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)\r
-@ContextConfiguration(classes = {TestApplication.class, TestConfiguration.class})\r
+@ContextConfiguration(classes = {TestApplication.class})\r
@FixMethodOrder(MethodSorters.NAME_ASCENDING)\r
public class ModelTypeRestTest {\r
private static Logger log = LoggerFactory.getLogger(ModelTypeRestTest.class);\r
import org.junit.runner.RunWith;\r
import org.junit.runners.MethodSorters;\r
import org.onap.ccsdk.apps.controllerblueprints.TestApplication;\r
-import org.onap.ccsdk.apps.controllerblueprints.TestConfiguration;\r
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ResourceDictionary;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
@RunWith(SpringRunner.class)\r
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)\r
-@ContextConfiguration(classes = {TestApplication.class, TestConfiguration.class})\r
+@ContextConfiguration(classes = {TestApplication.class})\r
@FixMethodOrder(MethodSorters.NAME_ASCENDING)\r
public class ResourceDictionaryRestTest {\r
\r
import org.junit.runner.RunWith;\r
import org.junit.runners.MethodSorters;\r
import org.onap.ccsdk.apps.controllerblueprints.TestApplication;\r
-import org.onap.ccsdk.apps.controllerblueprints.TestConfiguration;\r
import org.onap.ccsdk.apps.controllerblueprints.core.ConfigModelConstant;\r
import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;\r
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
\r
@RunWith(SpringRunner.class)\r
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)\r
-@ContextConfiguration(classes = {TestApplication.class, TestConfiguration.class})\r
+@ContextConfiguration(classes = {TestApplication.class})\r
@FixMethodOrder(MethodSorters.NAME_ASCENDING)\r
public class ServiceTemplateRestTest {\r
\r
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
- <kotlin.version>1.2.51</kotlin.version>
- <ajsc.version>200.4.2-RELEASE</ajsc.version>
- <common.version>2.4.2-RELEASE</common.version>
- <cadi.aaf.version>1.4.2</cadi.aaf.version>
- <spring.boot.version>1.5.7.RELEASE</spring.boot.version>
- <sdnc.config.version>20.0.1-SNAPSHOT</sdnc.config.version>
+ <java.version>1.8</java.version>
+ <spring.boot.version>2.0.4.RELEASE</spring.boot.version>
+ <kotlin.version>1.2.60</kotlin.version>
+ <eelf.version>1.0.0</eelf.version>
+ <springfox.swagger2.version>2.9.2</springfox.swagger2.version>
+ <h2database.version>1.4.197</h2database.version>
</properties>
<dependencyManagement>
<dependencies>
+ <!-- Spring boot -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<scope>import</scope>
</dependency>
+ <dependency>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ <version>${eelf.version}</version>
+ </dependency>
+
+ <!--Swagger Dependencies -->
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger2</artifactId>
+ <version>${springfox.swagger2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger-ui</artifactId>
+ <version>${springfox.swagger2.version}</version>
+ </dependency>
+
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
- <dependency>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- <version>20180130</version>
- </dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>25.1-jre</version>
</dependency>
- <dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-jersey2-jaxrs</artifactId>
- <version>1.5.20</version>
- <exclusions>
- <exclusion>
- <groupId>org.glassfish.jersey.containers</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
<!-- Kotlin Dependencies -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
- <groupId>com.fasterxml.jackson.module</groupId>
- <artifactId>jackson-module-kotlin</artifactId>
- <version>2.9.6</version>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-stdlib-jdk8</artifactId>
+ <version>${kotlin.version}</version>
+ </dependency>
+
+
+ <!-- Database -->
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <version>${h2database.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
</dependencyManagement>
<dependencies>
+ <dependency>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.6</version>
+ </dependency>
+ <dependency>
+ <groupId>com.jayway.jsonpath</groupId>
+ <artifactId>json-path</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger2</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger-ui</artifactId>
+ </dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-stdlib-jdk8</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.module</groupId>
+ <artifactId>jackson-module-kotlin</artifactId>
+ </dependency>
+ <!-- test -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.projectreactor</groupId>
+ <artifactId>reactor-test</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>