aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org
diff options
context:
space:
mode:
authorjimmydot <jf2512@att.com>2017-05-30 16:06:51 -0400
committerjimmydot <jf2512@att.com>2017-05-30 16:06:51 -0400
commit6c7dcba5be04a502a2d5de7e7c5f14eedf9eaa2a (patch)
tree85f583353ede474b859e46707f15cb4326ea863a /vid-app-common/src/main/java/org
parentef3524df38879e4f070a018beb3de494cf276fee (diff)
[VID-12] Delivery of remaining features for v1.1
Change-Id: I50305ba25aaa34ee1ca7640237f31ab824655a34 Signed-off-by: jimmydot <jf2512@att.com>
Diffstat (limited to 'vid-app-common/src/main/java/org')
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMeta.java26
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/rest/RestfulAsdcClient.java27
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/controller/AaiController.java5
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/controller/VidHomeController.java79
4 files changed, 38 insertions, 99 deletions
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMeta.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMeta.java
index 66938372e..a5295c476 100755
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMeta.java
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMeta.java
@@ -1,9 +1,9 @@
/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
* 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
@@ -14,7 +14,7 @@
* 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.
+ * limitations under the License.
* ============LICENSE_END=========================================================
*/
@@ -104,12 +104,14 @@ public class ToscaMeta {
try {
while ((line = br.readLine()) != null) {
- final String[] entry = line.split(":");
-
- if (entry.length != 2) throw new AsdcCatalogException("TOSCA.meta file cannot be parsed (more than 1 colon found on a single line");
- if (!entry[1].startsWith(" ")) throw new AsdcCatalogException("TOSCA.meta file cannot be parsed (: not immediately followed by ' ')");
-
- metadata.put(entry[0], entry[1].substring(1));
+ if ( line.length() > 0 ) {
+ final String[] entry = line.split(":");
+
+ if (entry.length != 2) throw new AsdcCatalogException("TOSCA.meta file cannot be parsed (more than 1 colon found on a single line");
+ if (!entry[1].startsWith(" ")) throw new AsdcCatalogException("TOSCA.meta file cannot be parsed (: not immediately followed by ' ')");
+
+ metadata.put(entry[0], entry[1].substring(1));
+ }
}
} catch (IOException e) {
metadata.clear();
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/rest/RestfulAsdcClient.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/rest/RestfulAsdcClient.java
index 26d45cc7e..9f7c3a57d 100755
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/rest/RestfulAsdcClient.java
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/rest/RestfulAsdcClient.java
@@ -22,16 +22,19 @@ package org.openecomp.vid.asdc.rest;
import java.io.IOException;
import java.io.InputStream;
+import java.io.FileInputStream;
+import java.io.File;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
import java.util.UUID;
-import java.util.logging.Logger;
import java.util.zip.ZipFile;
import javax.ws.rs.NotFoundException;
@@ -44,6 +47,7 @@ import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedHashMap;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.openecomp.vid.asdc.AsdcCatalogException;
import org.openecomp.vid.asdc.AsdcClient;
import org.openecomp.vid.asdc.beans.Artifact;
@@ -64,8 +68,11 @@ import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
*/
public class RestfulAsdcClient implements AsdcClient {
- /** The Constant LOGGER. */
- private static final Logger LOGGER = Logger.getLogger(RestfulAsdcClient.class.getName());
+ /** The Constant LOG. */
+ private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(RestfulAsdcClient.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
/** The client. */
private final Client client;
@@ -422,7 +429,6 @@ public class RestfulAsdcClient implements AsdcClient {
*/
private ToscaCsar getToscaModel(InputStream csarInputStream) throws AsdcCatalogException {
final Path csarFile;
-
try {
csarFile = Files.createTempFile("csar", ".zip");
Files.copy(csarInputStream, csarFile, StandardCopyOption.REPLACE_EXISTING);
@@ -444,10 +450,17 @@ public class RestfulAsdcClient implements AsdcClient {
final ToscaCsar.Builder csarBuilder = new ToscaCsar.Builder(parentModel);
for (Map<String, Map<String, String>> imports : parentModel.getImports()) {
+ LOG.debug("imports = " + imports.toString());
for (Entry<String, Map<String, String>> entry : imports.entrySet()) {
- final InputStream toscaChildEntryYamlStream = csar.getInputStream(csar.getEntry("Definitions/" + entry.getValue().get("file")));
- final ToscaModel childModel = yaml.loadAs(toscaChildEntryYamlStream, ToscaModel.class);
- csarBuilder.addVnf(childModel);
+ if ( entry.getValue() != null) {
+ String fname = entry.getValue().get("file");
+ if ( ( fname != null ) && (fname.startsWith("service") || fname.startsWith("resource")) ) {
+ LOG.debug("fname = " + fname);
+ final InputStream toscaChildEntryYamlStream = csar.getInputStream(csar.getEntry("Definitions/" + fname ));
+ final ToscaModel childModel = yaml.loadAs(toscaChildEntryYamlStream, ToscaModel.class);
+ csarBuilder.addVnf(childModel);
+ }
+ }
}
}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/AaiController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/AaiController.java
index 7cb25c264..92b752859 100755
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/AaiController.java
+++ b/vid-app-common/src/main/java/org/openecomp/vid/controller/AaiController.java
@@ -126,7 +126,10 @@ public class AaiController extends RestrictedBaseController{
User user = (User) session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME));
if (user != null)
{
- userId = user.getHrid();
+ //userId = user.getHrid();
+ userId = user.getLoginId();
+ if (userId == null)
+ userId = user.getOrgUserId();
}
}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/VidHomeController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/VidHomeController.java
deleted file mode 100755
index cfb915b03..000000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/controller/VidHomeController.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.openecomp.vid.controller;
-
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-
-
-import org.springframework.beans.factory.annotation.Autowired;
-
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.servlet.ModelAndView;
-
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-
-
-/**
- * The Class VidHomeController.
- */
-@RestController
-public class VidHomeController extends RestrictedBaseController{
-
- /** The view name. */
- String viewName;
-
-
- /** The servlet context. */
- private @Autowired ServletContext servletContext;
-
- /**
- * Welcome.
- *
- * @param request the request
- * @return the model and view
- */
- @RequestMapping(value = {"/vidhome" }, method = RequestMethod.GET)
- public ModelAndView welcome(HttpServletRequest request) {
-
- return new ModelAndView(getViewName());
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#getViewName()
- */
- public String getViewName() {
- return viewName;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#setViewName(java.lang.String)
- */
- public void setViewName(String viewName) {
- this.viewName = viewName;
- }
-
-
-
-}