OSAM infra seed code - merge with osam-core side-by-side - fixed warnings in onap-enabler POMs

Change-Id: I0cd9ea39d4b7c1dc088ab0ecd6fb787c7f490e5e
Signed-off-by: Aharoni, Pavel (pa0916) <pavel.aharoni@intl.att.com>
diff --git a/osam-core/web/src/main/java/org/onap/osam/controller/ServiceController.java b/osam-core/web/src/main/java/org/onap/osam/controller/ServiceController.java
new file mode 100644
index 0000000..d033a1a
--- /dev/null
+++ b/osam-core/web/src/main/java/org/onap/osam/controller/ServiceController.java
@@ -0,0 +1,135 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM Core

+ * ================================================================================

+ * Copyright (C) 2018 Netsia

+ * ================================================================================

+ * 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.

+ * ============LICENSE_END=========================================================

+ */

+

+

+

+package org.onap.osam.controller;

+

+import lombok.extern.slf4j.Slf4j;

+import org.onap.osam.model.dao.SpeedProfile;

+import org.onap.osam.model.dao.TechnologyProfile;

+import org.onap.osam.api.service.BroadBandService;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.http.HttpStatus;

+import org.springframework.http.ResponseEntity;

+import org.springframework.web.bind.annotation.DeleteMapping;

+import org.springframework.web.bind.annotation.GetMapping;

+import org.springframework.web.bind.annotation.PathVariable;

+import org.springframework.web.bind.annotation.PostMapping;

+import org.springframework.web.bind.annotation.RequestBody;

+import org.springframework.web.bind.annotation.RequestMapping;

+import org.springframework.web.bind.annotation.RestController;

+

+import java.util.List;

+

+/**

+ * Created by cemturker on 19.09.2018.

+ */

+@RestController

+@RequestMapping("/service")

+@Slf4j

+public class ServiceController extends AbstractController {

+

+    private BroadBandService broadBandService;

+

+    //TODOs add validations for post reqs...

+

+    @Autowired

+    public ServiceController(BroadBandService broadBandService){

+        super(log);

+        this.broadBandService = broadBandService;

+    }

+

+    @GetMapping("/speedProfile")

+    public ResponseEntity<List<SpeedProfile>> getSpeedProfiles() {

+        try{

+            return ResponseEntity.ok(this.broadBandService.getSpeedProfiles());

+        }catch (Exception e){

+            return super.proceedException(e);

+        }

+    }

+

+    @GetMapping("/speedProfile/{id}")

+    public ResponseEntity<SpeedProfile> getSpeedProfile(@PathVariable("id") Long id) {

+        try {

+            return ResponseEntity.ok(this.broadBandService.getSpeedProfile(id));

+        }catch (Exception e) {

+            return super.proceedException(e);

+        }

+    }

+

+    @DeleteMapping("/speedProfile/{id}")

+    public ResponseEntity deleteSpeedProfile(@PathVariable("id") Long id) {

+        try {

+            this.broadBandService.removeSpeedProfile(id);

+            return ResponseEntity.ok().build();

+        }catch (Exception e) {

+            return super.proceedException(e);

+        }

+    }

+

+    @PostMapping("/speedProfile")

+    public ResponseEntity<SpeedProfile> createSpeedProfile(@RequestBody SpeedProfile speedProfile) {

+        try {

+            return new ResponseEntity<>(this.broadBandService.addSpeedProfile(speedProfile),

+                    HttpStatus.CREATED);

+        }catch (Exception e) {

+            return super.proceedException(e);

+        }

+

+    }

+

+    @GetMapping("/technologyProfile")

+    public ResponseEntity<List<TechnologyProfile>> getTechnologyProfiles() {

+        try {

+            return ResponseEntity.ok(this.broadBandService.getTechnologyProfiles());

+        }catch (Exception e) {

+            return super.proceedException(e);

+        }

+    }

+

+    @GetMapping("/technologyProfile/{id}")

+    public ResponseEntity<TechnologyProfile> getTechnologyProfile(@PathVariable("id") Long id) {

+        try {

+            return ResponseEntity.ok(this.broadBandService.getTechnologyProfile(id));

+        }catch (Exception e) {

+            return super.proceedException(e);

+        }

+    }

+

+    @DeleteMapping("/technologyProfile/{id}")

+    public ResponseEntity deleteTechnologyProfile(@PathVariable("id") Long id) {

+        try {

+            this.broadBandService.removeSpeedProfile(id);

+            return ResponseEntity.ok().build();

+        }catch (Exception e){

+            return super.proceedException(e);

+        }

+    }

+

+    @PostMapping("/technologyProfile")

+    public ResponseEntity<TechnologyProfile> createTechnologyProfile(@RequestBody TechnologyProfile technologyProfile) {

+        try {

+            return new ResponseEntity<>(this.broadBandService.addTechnologyProfile(technologyProfile),HttpStatus.CREATED);

+        }catch (Exception e){

+            return super.proceedException(e);

+        }

+    }

+}