aboutsummaryrefslogtreecommitdiffstats
path: root/vid/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'vid/src/main/java/org')
-rw-r--r--vid/src/main/java/org/openecomp/aai/util/AAIProperties.java64
-rw-r--r--vid/src/main/java/org/openecomp/aai/util/AAIRestInterface.java300
-rw-r--r--vid/src/main/java/org/openecomp/aai/util/CustomJacksonJaxBJsonProvider.java72
-rw-r--r--vid/src/main/java/org/openecomp/aai/util/HttpsAuthClient.java111
-rw-r--r--vid/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java44
-rw-r--r--vid/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java88
-rw-r--r--vid/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java117
-rw-r--r--vid/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java61
-rw-r--r--vid/src/main/java/org/openecomp/portalapp/util/CustomLoggingFilter.java58
-rw-r--r--vid/src/main/java/org/openecomp/vid/client/HttpBasicClient.java67
-rw-r--r--vid/src/main/java/org/openecomp/vid/client/HttpsBasicClient.java143
-rw-r--r--vid/src/main/java/org/openecomp/vid/conf/ExternalAppConfig.java271
-rw-r--r--vid/src/main/java/org/openecomp/vid/conf/ExternalAppInitializer.java80
-rw-r--r--vid/src/main/java/org/openecomp/vid/conf/HibernateMappingLocations.java44
-rw-r--r--vid/src/main/java/org/openecomp/vid/controller/AaiController.java748
-rw-r--r--vid/src/main/java/org/openecomp/vid/controller/BrowseServiceTypesController.java87
-rw-r--r--vid/src/main/java/org/openecomp/vid/controller/CreateNewServiceInstanceController.java195
-rw-r--r--vid/src/main/java/org/openecomp/vid/controller/MsoController.java736
-rw-r--r--vid/src/main/java/org/openecomp/vid/controller/PropertyController.java121
-rw-r--r--vid/src/main/java/org/openecomp/vid/controller/SearchExistingSIController.java166
-rw-r--r--vid/src/main/java/org/openecomp/vid/controller/SubscriberDetailsController.java137
-rw-r--r--vid/src/main/java/org/openecomp/vid/controller/UserProfileController.java80
-rw-r--r--vid/src/main/java/org/openecomp/vid/controller/VidController.java242
-rw-r--r--vid/src/main/java/org/openecomp/vid/controller/VidHomeController.java79
-rw-r--r--vid/src/main/java/org/openecomp/vid/controller/ViewEditSubController.java107
-rw-r--r--vid/src/main/java/org/openecomp/vid/controller/ViewLogController.java84
-rw-r--r--vid/src/main/java/org/openecomp/vid/controller/test/TestAaiController.java93
-rw-r--r--vid/src/main/java/org/openecomp/vid/controller/test/TestAsdcController.java112
-rw-r--r--vid/src/main/java/org/openecomp/vid/controller/test/TestMsoController.java729
-rw-r--r--vid/src/main/java/org/openecomp/vid/controller/test/TestPageController.java57
-rw-r--r--vid/src/main/java/org/openecomp/vid/dao/ProfileDao.java45
-rw-r--r--vid/src/main/java/org/openecomp/vid/encryption/EncryptConvertor.java261
-rw-r--r--vid/src/main/java/org/openecomp/vid/encryption/EncryptedConfiguration.java413
-rw-r--r--vid/src/main/java/org/openecomp/vid/encryption/EncryptedPropValue.java279
-rw-r--r--vid/src/main/java/org/openecomp/vid/exceptions/VidServiceUnavailableException.java69
-rw-r--r--vid/src/main/java/org/openecomp/vid/model/ExceptionResponse.java70
-rw-r--r--vid/src/main/java/org/openecomp/vid/model/Network.java157
-rw-r--r--vid/src/main/java/org/openecomp/vid/model/Resource.java28
-rw-r--r--vid/src/main/java/org/openecomp/vid/model/Result.java58
-rw-r--r--vid/src/main/java/org/openecomp/vid/model/Service.java223
-rw-r--r--vid/src/main/java/org/openecomp/vid/model/ServiceModel.java126
-rw-r--r--vid/src/main/java/org/openecomp/vid/model/VNF.java248
-rw-r--r--vid/src/main/java/org/openecomp/vid/model/VfModule.java185
-rw-r--r--vid/src/main/java/org/openecomp/vid/model/VolumeGroup.java157
-rw-r--r--vid/src/main/java/org/openecomp/vid/mso/MsoProperties.java100
-rw-r--r--vid/src/main/java/org/openecomp/vid/mso/MsoResponseWrapper.java107
-rw-r--r--vid/src/main/java/org/openecomp/vid/mso/MsoRestInt.java71
-rw-r--r--vid/src/main/java/org/openecomp/vid/mso/MsoRestInterface.java290
-rw-r--r--vid/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceFactory.java48
-rw-r--r--vid/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceIfc.java79
-rw-r--r--vid/src/main/java/org/openecomp/vid/mso/MsoUtil.java125
-rw-r--r--vid/src/main/java/org/openecomp/vid/mso/RestObject.java68
-rw-r--r--vid/src/main/java/org/openecomp/vid/mso/rest/AsyncRequestStatus.java108
-rw-r--r--vid/src/main/java/org/openecomp/vid/mso/rest/RelatedInstance.java112
-rw-r--r--vid/src/main/java/org/openecomp/vid/mso/rest/RelatedModel.java112
-rw-r--r--vid/src/main/java/org/openecomp/vid/mso/rest/Request.java130
-rw-r--r--vid/src/main/java/org/openecomp/vid/mso/rest/RequestDetails.java205
-rw-r--r--vid/src/main/java/org/openecomp/vid/mso/rest/RequestList.java113
-rw-r--r--vid/src/main/java/org/openecomp/vid/properties/AsdcClientConfiguration.java70
-rw-r--r--vid/src/main/java/org/openecomp/vid/properties/VidProperties.java34
-rw-r--r--vid/src/main/java/org/openecomp/vid/scheduler/LogJob.java49
-rw-r--r--vid/src/main/java/org/openecomp/vid/scheduler/LogRegistry.java59
-rw-r--r--vid/src/main/java/org/openecomp/vid/scheduler/MyLoginsFeedJob.java434
-rw-r--r--vid/src/main/java/org/openecomp/vid/scheduler/MyLoginsFeedRegistry.java67
-rw-r--r--vid/src/main/java/org/openecomp/vid/scheduler/Register.java93
-rw-r--r--vid/src/main/java/org/openecomp/vid/scheduler/RegistryAdapter.java111
66 files changed, 0 insertions, 10197 deletions
diff --git a/vid/src/main/java/org/openecomp/aai/util/AAIProperties.java b/vid/src/main/java/org/openecomp/aai/util/AAIProperties.java
deleted file mode 100644
index c6ec5e175..000000000
--- a/vid/src/main/java/org/openecomp/aai/util/AAIProperties.java
+++ /dev/null
@@ -1,64 +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.aai.util;
-
-import org.openecomp.portalsdk.core.util.SystemProperties;
-
-/**
- * The Class AAIProperties.
- */
-public class AAIProperties extends SystemProperties {
-
- /** The Constant AAI_SERVER_URL_BASE. */
- //VID Specific
- public static final String AAI_SERVER_URL_BASE = "aai.server.url.base";
-
- /** The Constant AAI_SERVER_URL. */
- public static final String AAI_SERVER_URL = "aai.server.url";
-
- /** The Constant AAI_OLDSERVER_URL_BASE. */
- public static final String AAI_OLDSERVER_URL_BASE = "aai.oldserver.url.base";
-
- /** The Constant AAI_OLDSERVER_URL. */
- public static final String AAI_OLDSERVER_URL = "aai.oldserver.url";
-
- /** The Constant AAI_TRUSTSTORE_FILENAME. */
- public static final String AAI_TRUSTSTORE_FILENAME = "aai.truststore.filename";
-
- /** The Constant AAI_TRUSTSTORE_PASSWD_X. */
- public static final String AAI_TRUSTSTORE_PASSWD_X = "aai.truststore.passwd.x";
-
- /** The Constant AAI_KEYSTORE_FILENAME. */
- public static final String AAI_KEYSTORE_FILENAME = "aai.keystore.filename";
-
- /** The Constant AAI_KEYSTORE_PASSWD_X. */
- public static final String AAI_KEYSTORE_PASSWD_X = "aai.keystore.passwd.x";
-
- /** The Constant AAI_VID_USERNAME. */
- public static final String AAI_VID_USERNAME = "aai.vid.username";
-
- /** The Constant AAI_VID_PASSWD_X. */
- public static final String AAI_VID_PASSWD_X = "aai.vid.passwd.x";
-
- /** The Constant FILESEPARTOR. */
- public static final String FILESEPARTOR = (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator");
-
-}
diff --git a/vid/src/main/java/org/openecomp/aai/util/AAIRestInterface.java b/vid/src/main/java/org/openecomp/aai/util/AAIRestInterface.java
deleted file mode 100644
index ce61fdc7d..000000000
--- a/vid/src/main/java/org/openecomp/aai/util/AAIRestInterface.java
+++ /dev/null
@@ -1,300 +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.aai.util;
-
-import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.security.KeyManagementException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Base64;
-import java.util.Date;
-import java.util.UUID;
-
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.openecomp.vid.encryption.EncryptedPropValue;
-
-/**
- * The Class AAIRestInterface.
- */
-public class AAIRestInterface {
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AAIRestInterface.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /** The client. */
- private static Client client = null;
-
- /** The rest srvr base URL. */
- private String restSrvrBaseURL;
-
- /** The certificate path. */
- public String certificatePath = "";
-
- /**
- * Instantiates a new AAI rest interface.
- *
- * @param certPath the cert path
- */
- public AAIRestInterface(String certPath)
- {
- certificatePath = certPath;
- }
-
- /**
- * Encode URL.
- *
- * @param nodeKey the node key
- * @return the string
- * @throws UnsupportedEncodingException the unsupported encoding exception
- */
- public String encodeURL (String nodeKey) throws UnsupportedEncodingException {
- return URLEncoder.encode(nodeKey, "UTF-8").replaceAll("\\+", "%20");
- }
-
- /**
- * Inits the rest client.
- */
- private void initRestClient()
- {
- String methodName = "initRestClient";
-
- if (client == null) {
- try {
- client = HttpsAuthClient.getClient(certificatePath);
- }
- catch (KeyManagementException e){
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== KeyManagementException in " + methodName + e.toString());
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== KeyManagementException in " + methodName + e.toString());
- } catch (Exception e) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== Exception in REST call to DB in initRestClient" + e.toString());
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== Exception in REST call to DB : " + e.toString());
- }
- }
- }
-
- /**
- * Sets the rest srvr base URL.
- *
- * @param baseURL the base URL
- */
- public void SetRestSrvrBaseURL(String baseURL)
- {
- if (baseURL == null)
- {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== REST Server base URL cannot be null.");
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== REST Server base URL cannot be null.");
- }
-
- restSrvrBaseURL = baseURL;
- }
-
- /**
- * Gets the rest srvr base URL.
- *
- * @return the rest srvr base URL
- */
- public String getRestSrvrBaseURL()
- {
- return restSrvrBaseURL;
- }
-
-
- /**
- * Rest get.
- *
- * @param fromAppId the from app id
- * @param transId the trans id
- * @param requestUri the request uri
- * @param xml the xml
- * @return the string
- */
- public String RestGet(String fromAppId, String transId, String requestUri, boolean xml) throws UnsupportedEncodingException {
- String methodName = "RestGet";
-
- String responseType = "application/json";
- if (xml)
- responseType = "application/xml";
-
- initRestClient();
-
- String url = "";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- url = SystemProperties.getProperty(AAIProperties.AAI_SERVER_URL) + requestUri;
-
- try {
- // what is the point of this, just to check syntax??
- URL urlObj= new URL(url);
- URI uri = new URI(urlObj.getProtocol(), urlObj.getUserInfo(), urlObj.getHost(), urlObj.getPort(), urlObj.getPath(), urlObj.getQuery(), urlObj.getRef());
- url = uri.toASCIIString();
- } catch (URISyntaxException | MalformedURLException e) {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " bad URL");
- return null;
- }
- logger.debug(dateFormat.format(new Date()) + "<== " + url + " for the get REST API");
-
- String vidUsername = SystemProperties.getProperty(AAIProperties.AAI_VID_USERNAME);
- String vidPassword = EncryptedPropValue.decryptTriple(SystemProperties.getProperty(AAIProperties.AAI_VID_PASSWD_X));
- String encodeThis = vidUsername + ":" + vidPassword;
-
- final Response cres = client.target(url)
- .request()
- .accept(responseType)
- .header("X-TransactionId", transId)
- .header("X-FromAppId", fromAppId)
- .header("Authorization", "Basic " + Base64.getEncoder().encodeToString(encodeThis.getBytes("utf-8")))
- .header("Content-Type", "application/json")
- .get();
-
- if (cres.getStatus() == 200) {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " REST api GET was successful!");
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " REST api GET was successful!");
- } else {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName +" with status="+cres.getStatus()+", url="+url);
- }
-
- return cres.readEntity(String.class);
- }
-
-
- /**
- * Delete.
- *
- * @param sourceID the source ID
- * @param transId the trans id
- * @param path the path
- * @return true, if successful
- */
- public boolean Delete(String sourceID, String transId, String path) throws UnsupportedEncodingException {
- String methodName = "Delete";
- String url="";
- transId += ":" + UUID.randomUUID().toString();
- logger.debug(dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- initRestClient();
- String request = "{}";
- url = SystemProperties.getProperty(AAIProperties.AAI_SERVER_URL) + path;
-
- String vidUsername = SystemProperties.getProperty(AAIProperties.AAI_VID_USERNAME);
- String vidPassword = EncryptedPropValue.decryptTriple(SystemProperties.getProperty(AAIProperties.AAI_VID_PASSWD_X));
- String encodeThis = vidUsername + ":" + vidPassword;
-
- final Response cres = client.target(url)
- .request()
- .accept("application/json")
- .header("X-TransactionId", transId)
- .header("X-FromAppId", sourceID)
- .header("Authorization", "Basic " + Base64.getEncoder().encodeToString(encodeThis.getBytes("utf-8")))
- //.entity(request)
- .delete();
-
- if (cres.getStatus() == 404) { // resource not found
- String msg = "Resource does not exist...: " + cres.getStatus()
- + ":" + cres.readEntity(String.class);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + msg);
- return false;
- } else if (cres.getStatus() == 200 || cres.getStatus() == 204){
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "Resource " + url + " deleted");
- return true;
- } else {
- String msg = "Deleting Resource failed: " + cres.getStatus()
- + ":" + cres.readEntity(String.class);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + msg);
- }
-
- return false;
- }
-
-
- /**
- * Rest post.
- *
- * @param fromAppId the from app id
- * @param transId the trans id
- * @param path the path
- * @param payload the payload
- * @param xml the xml
- * @return the string
- */
- public String RestPost(String fromAppId, String transId, String path, String payload, boolean xml) throws UnsupportedEncodingException {
- String methodName = "RestPost";
- String url="";
- transId = UUID.randomUUID().toString();
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- try {
-
- String responseType = "application/json";
- if (xml)
- responseType = "application/xml";
-
- initRestClient();
-
- url = SystemProperties.getProperty(AAIProperties.AAI_SERVER_URL_BASE) + path;
-
- String vidUsername = SystemProperties.getProperty(AAIProperties.AAI_VID_USERNAME);
- String vidPassword = EncryptedPropValue.decryptTriple(SystemProperties.getProperty(AAIProperties.AAI_VID_PASSWD_X));
- String encodeThis = vidUsername + ":" + vidPassword;
-
- final Response cres = client.target(url)
- .request()
- .accept(responseType)
- .header("X-TransactionId", transId)
- .header("X-FromAppId", fromAppId)
- .header("Authorization", "Basic " + Base64.getEncoder().encodeToString(encodeThis.getBytes("utf-8")))
- .post(Entity.entity(payload, MediaType.APPLICATION_JSON));
-
- int statuscode = cres.getStatus();
- if ( statuscode >= 200 && statuscode <= 299 ) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!");
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!");
- return cres.readEntity(String.class);
- } else {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " with status="+statuscode+", url="+url + ", msg=" + cres.readEntity(String.class));
- return null;
- }
-
- } catch (Exception e)
- {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " with url="+url+ ", Exception: " + e.toString());
-
- }
-
- return null;
- }
-
-
-
-}
diff --git a/vid/src/main/java/org/openecomp/aai/util/CustomJacksonJaxBJsonProvider.java b/vid/src/main/java/org/openecomp/aai/util/CustomJacksonJaxBJsonProvider.java
deleted file mode 100644
index 12e96b8de..000000000
--- a/vid/src/main/java/org/openecomp/aai/util/CustomJacksonJaxBJsonProvider.java
+++ /dev/null
@@ -1,72 +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.aai.util;
-
-import javax.ws.rs.ext.Provider;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
-import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
-
-/**
- * The Class CustomJacksonJaxBJsonProvider.
- */
-@Provider
-public class CustomJacksonJaxBJsonProvider extends JacksonJaxbJsonProvider {
-
- /** The common mapper. */
- private static ObjectMapper commonMapper = null;
-
- /**
- * Instantiates a new custom jackson jax B json provider.
- */
- public CustomJacksonJaxBJsonProvider() {
- if (commonMapper == null) {
- ObjectMapper mapper = new ObjectMapper();
-
- mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
-
- mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
- mapper.configure(SerializationFeature.INDENT_OUTPUT, false);
- mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
-
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
-
- mapper.registerModule(new JaxbAnnotationModule());
-
- commonMapper = mapper;
- }
- super.setMapper(commonMapper);
- }
-
- /**
- * Gets the mapper.
- *
- * @return the mapper
- */
- public ObjectMapper getMapper() {
- return commonMapper;
- }
-}
diff --git a/vid/src/main/java/org/openecomp/aai/util/HttpsAuthClient.java b/vid/src/main/java/org/openecomp/aai/util/HttpsAuthClient.java
deleted file mode 100644
index dec0b8015..000000000
--- a/vid/src/main/java/org/openecomp/aai/util/HttpsAuthClient.java
+++ /dev/null
@@ -1,111 +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.aai.util;
-
-import java.io.FileInputStream;
-import java.security.KeyManagementException;
-import java.security.KeyStore;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSession;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-
-import org.openecomp.vid.encryption.EncryptedPropValue;
-
-import org.openecomp.portalsdk.core.util.SystemProperties;
-
-/**
- * The Class HttpsAuthClient.
- */
-public class HttpsAuthClient{
-
- /**
- * Gets the client.
- *
- * @param certFilePath the cert file path
- * @return the client
- * @throws KeyManagementException the key management exception
- */
- public static Client getClient(String certFilePath) throws KeyManagementException {
-
- //config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
- //config.getClasses().add(org.openecomp.aai.util.CustomJacksonJaxBJsonProvider.class);
-
- try {
- String truststore_path = certFilePath + AAIProperties.FILESEPARTOR + SystemProperties.getProperty(AAIProperties.AAI_TRUSTSTORE_FILENAME);
- String truststore_password = SystemProperties.getProperty(AAIProperties.AAI_TRUSTSTORE_PASSWD_X);
- String decrypted_truststore_password = EncryptedPropValue.decryptTriple(truststore_password);
-// String keystore_path = certFilePath + AAIProperties.FILESEPARTOR + SystemProperties.getProperty(AAIProperties.AAI_KEYSTORE_FILENAME);
-// String keystore_password = SystemProperties.getProperty(AAIProperties.AAI_KEYSTORE_PASSWD_X);
-// String decrypted_keystore_password = EncryptedPropValue.decryptTriple(keystore_password);
-
-
-
-
- System.setProperty("javax.net.ssl.trustStore", truststore_path);
- System.setProperty("javax.net.ssl.trustStorePassword", decrypted_truststore_password);
- HttpsURLConnection.setDefaultHostnameVerifier( new HostnameVerifier(){
- public boolean verify(String string,SSLSession ssls) {
- return true;
- }
- });
-
-// final SSLContext ctx = SSLContext.getInstance("TLS");
-// KeyManagerFactory kmf = null;
-// try {
-// kmf = KeyManagerFactory.getInstance("SunX509");
-// FileInputStream fin = new FileInputStream(keystore_path);
-// KeyStore ks = KeyStore.getInstance("PKCS12");
-// char[] pwd = decrypted_keystore_password.toCharArray();
-// ks.load(fin, pwd);
-// kmf.init(ks, pwd);
-// } catch (Exception e) {
-// System.out.println("Error setting up kmf: exiting");
-// e.printStackTrace();
-// System.exit(1);
-// }
-//
-// ctx.init(kmf.getKeyManagers(), null, null);
-
- return ClientBuilder.newBuilder()
- .hostnameVerifier(new HostnameVerifier() {
- @Override
- public boolean verify( String s, SSLSession sslSession ) {
- return true;
- }
- }).build()
- .register(org.openecomp.aai.util.CustomJacksonJaxBJsonProvider.class);
-
- } catch (Exception e) {
- System.out.println("Error setting up config: exiting");
- e.printStackTrace();
- System.exit(1);
- return null;
- }
- }
-
-
-
-}
diff --git a/vid/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java b/vid/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java
deleted file mode 100644
index f5f67b895..000000000
--- a/vid/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java
+++ /dev/null
@@ -1,44 +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.portalapp.service;
-
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import org.openecomp.portalsdk.core.domain.User;
-
-/**
- * The Class AdminAuthExtension.
- */
-@Service("adminAuthExtension")
-@Transactional
-public class AdminAuthExtension {
-
- /**
- * Save user extension.
- *
- * @param user the user
- */
- public void saveUserExtension(User user){
- //app's developer implement their own logic here, like updating app's related tables
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java b/vid/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java
deleted file mode 100644
index 31c5882c0..000000000
--- a/vid/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java
+++ /dev/null
@@ -1,88 +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.portalapp.uebhandler;
-
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-import javax.annotation.PostConstruct;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Configuration;
-
-import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants;
-import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties;
-import org.openecomp.portalsdk.core.onboarding.ueb.UebManager;
-import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg;
-import org.openecomp.vid.conf.ExternalAppConfig;
-
-//
-// Adding this class for the sole purpose of insuring that the MainUebHandler really
-// honors @Async and kicks off a thread. For more info google @Async and read about
-// @Async only working if called from different class.
-/**
- * The Class InitUebHandler.
- */
-//
-@Configuration
-public class InitUebHandler {
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(InitUebHandler.class);
-
-
- /** The main ueb handler. */
- @Autowired
- MainUebHandler mainUebHandler;
-
- /**
- * Instantiates a new inits the ueb handler.
- */
- public InitUebHandler() {
-
- }
-
- /**
- * Inits the ueb.
- */
- @PostConstruct
- public void initUeb() {
-
- try {
- String enableListenerThread = PortalApiProperties.getProperty(PortalApiConstants.UEB_LISTENERS_ENABLE);
- if (enableListenerThread.equalsIgnoreCase("true")) {
- ConcurrentLinkedQueue<UebMsg> inboxQueue = new ConcurrentLinkedQueue<UebMsg>();
- UebManager.getInstance().initListener(inboxQueue);
- mainUebHandler.runHandler(inboxQueue);
- logger.info(EELFLoggerDelegate.debugLogger, ("Returned from initiating mainUebHandler..."));
- }
- else {
- logger.info(EELFLoggerDelegate.debugLogger, ("Not starting UEB listening thread because ueb_listeners_enable is not set to true in the properties file."));
- }
- }
- catch (Exception e) {
- logger.error(EELFLoggerDelegate.debugLogger, ("Not starting UEB listening thread because property could not be read " + PortalApiConstants.UEB_LISTENERS_ENABLE),AlarmSeverityEnum.MAJOR);
- }
-
- }
-}
-
diff --git a/vid/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java b/vid/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java
deleted file mode 100644
index 5b7f0e4a6..000000000
--- a/vid/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java
+++ /dev/null
@@ -1,117 +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.portalapp.uebhandler;
-
-import java.util.concurrent.ConcurrentLinkedQueue;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Component;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg;
-import org.openecomp.portalsdk.core.onboarding.ueb.UebMsgTypes;
-
-//-------------------------------------------------------------------------
-// Listens for received UEB messages and handles the messages
-//
-// Note: To implement a synchronous reply call getMsgId on the request
-// and putMsgId on the reply (echoing the request MsgId).
-//
-/**
- * The Class MainUebHandler.
- */
-//-------------------------------------------------------------------------
-@Component("MainUebHandler")
-public class MainUebHandler {
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MainUebHandler.class);
-
-
- /** The inbox queue. */
- ConcurrentLinkedQueue<UebMsg> inboxQueue = null;
-
- /** The widget notification handler. */
- @Autowired
- WidgetNotificationHandler widgetNotificationHandler;
-
- /**
- * Run handler.
- *
- * @param queue the queue
- */
- @Async
- public void runHandler(ConcurrentLinkedQueue<UebMsg> queue) {
- inboxQueue = queue;
-
- logger.info(EELFLoggerDelegate.debugLogger, ("==> MainUebHandler started"));
-
- while (true) {
- UebMsg msg = null;
- while ((msg = inboxQueue.poll()) != null) {
- if (msg.getMsgType() != null) {
- logger.debug(EELFLoggerDelegate.debugLogger, ("<== Received UEB message : " + msg.toString()));
-
- switch (msg.getMsgType()) {
- /*
- * Add your own defined handler objects, use @Component for
- * the class. See WidgetNotificationHandler as an example.
- *
- * Use @Async on methods for performance
- *
- * For syncronous replies use UebManager publishReply and
- * echo back the msgId in your response ie
- * msg.putMsgId(requestMsg.getMsgId())
- *
- * case UebMsgTypes.UEB_MSG_TYPE_XYZ: {
- * XYZHandler.handleMsg(msg); break; }
- */
- case UebMsgTypes.UEB_MSG_TYPE_WIDGET_NOTIFICATION: {
- widgetNotificationHandler.handleWidgetNotification(msg);
- break;
- }
- default: {
-
- logger.info(EELFLoggerDelegate.debugLogger, ("Unknown message type [" + msg.getMsgType() + "] from " + msg.getSourceTopicName()));
-
- break;
- }
- }
- }
- }
-
- if (Thread.interrupted()) {
-
- logger.info(EELFLoggerDelegate.debugLogger, ("==> UebMainHandler exiting"));
-
- break;
- }
-
- try {
- Thread.sleep(10);
- } catch (InterruptedException e) {
- logger.info(EELFLoggerDelegate.debugLogger, ("UebMainHandler interrupted during sleep" + e.getMessage()));
-
- }
- }
- }
-}
diff --git a/vid/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java b/vid/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java
deleted file mode 100644
index dba84d4ac..000000000
--- a/vid/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java
+++ /dev/null
@@ -1,61 +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.portalapp.uebhandler;
-
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Component;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg;
-
-
-/**
- * The Class WidgetNotificationHandler.
- */
-@Component
-public class WidgetNotificationHandler {
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetNotificationHandler.class);
-
-
- /**
- * Instantiates a new widget notification handler.
- */
- public WidgetNotificationHandler() {
- }
-
- /**
- * Handle widget notification.
- *
- * @param requestMsg the request msg
- */
- @Async
- public void handleWidgetNotification(UebMsg requestMsg) {
- logger.debug(EELFLoggerDelegate.debugLogger, ("handleWidgetNotification received notification: " + requestMsg.toString()));
- /*
- * Here the notification msg can be handled
- *
- * requestMsg.getPayload() - returns string that contains the
- * Application defined content
- */
- }
-}
diff --git a/vid/src/main/java/org/openecomp/portalapp/util/CustomLoggingFilter.java b/vid/src/main/java/org/openecomp/portalapp/util/CustomLoggingFilter.java
deleted file mode 100644
index e4c877759..000000000
--- a/vid/src/main/java/org/openecomp/portalapp/util/CustomLoggingFilter.java
+++ /dev/null
@@ -1,58 +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.portalapp.util;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.filter.Filter;
-import ch.qos.logback.core.spi.FilterReply;
-
-/**
- * Custom Filter class bind with logback.xml
- * configuration file to strip out certain log messages
- * coming out of special packages or classes.
- *
- */
-public class CustomLoggingFilter extends Filter<ILoggingEvent> {
-
- /**
- * Custom Filter is added to strip out the continuous U-EB logging messages
- * But make sure we log the ERROR & WARNING Level messages.
- *
- * @param event the event
- * @return the filter reply
- */
- @Override
- public FilterReply decide(ILoggingEvent event) {
- try {
- if ((event.getLevel() != Level.ERROR || event.getLevel() != Level.WARN) &&
- (event.getThreadName().equalsIgnoreCase("UEBConsumerThread")) &&
- (event.getLoggerName().contains("org.openecomp.nsa") || event.getLoggerName().contains("org.apache.http"))
- ) {
- return FilterReply.DENY;
- } else {
- return FilterReply.NEUTRAL;
- }
- } catch(Exception e) {
- return FilterReply.NEUTRAL;
- }
- }
-}
diff --git a/vid/src/main/java/org/openecomp/vid/client/HttpBasicClient.java b/vid/src/main/java/org/openecomp/vid/client/HttpBasicClient.java
deleted file mode 100644
index ba82ae052..000000000
--- a/vid/src/main/java/org/openecomp/vid/client/HttpBasicClient.java
+++ /dev/null
@@ -1,67 +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.client;
-
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-
-import javax.servlet.ServletContext;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-
-import org.glassfish.jersey.client.ClientConfig;
-import org.glassfish.jersey.client.ClientProperties;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-
-/**
- * General HTTP client.
- */
-
-public class HttpBasicClient{
-
- /** The servlet context. */
- @Autowired
- private ServletContext servletContext;
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HttpBasicClient.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /**
- * Obtain a basic HTTP client .
- *
- * @return Client client object
- * @throws Exception the exception
- */
- public static Client getClient() throws Exception {
-
- ClientConfig config = new ClientConfig();
- config.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true);
-
- return ClientBuilder.newClient(config)
- .register(org.openecomp.aai.util.CustomJacksonJaxBJsonProvider.class);
- }
-}
diff --git a/vid/src/main/java/org/openecomp/vid/client/HttpsBasicClient.java b/vid/src/main/java/org/openecomp/vid/client/HttpsBasicClient.java
deleted file mode 100644
index 0519828df..000000000
--- a/vid/src/main/java/org/openecomp/vid/client/HttpsBasicClient.java
+++ /dev/null
@@ -1,143 +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.client;
-
-import java.io.File;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSession;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-
-import org.glassfish.jersey.client.ClientConfig;
-import org.glassfish.jersey.client.ClientProperties;
-import org.openecomp.vid.encryption.EncryptedPropValue;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.openecomp.vid.properties.VidProperties;
-
- /**
- * General SSL client using the VID tomcat keystore. It doesn't use client certificates.
- */
-
-public class HttpsBasicClient{
-
- /** The logger. */
- static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HttpsBasicClient.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /**
- * Retrieve an SSL client.
- *
- * @return Client The SSL client
- * @throws Exception the exception
- */
- public static Client getClient() throws Exception {
- String methodName = "getClient";
- ClientConfig config = new ClientConfig();
- //config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
- //config.getClasses().add(org.openecomp.aai.util.CustomJacksonJaxBJsonProvider.class);
-
- SSLContext ctx = null;
-
- try {
-
- config.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true);
-
- String truststore_path = SystemProperties.getProperty(VidProperties.VID_TRUSTSTORE_FILENAME);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + " " + methodName + " truststore_path=" + truststore_path);
- String truststore_password = SystemProperties.getProperty(VidProperties.VID_TRUSTSTORE_PASSWD_X);
-
-
- String decrypted_truststore_password = EncryptedPropValue.decryptTriple(truststore_password);
- //logger.debug(dateFormat.format(new Date()) + " " + methodName + " decrypted_truststore_password=" + decrypted_truststore_password);
-
- File tr = new File (truststore_path);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + " " + methodName + " absolute truststore path=" + tr.getAbsolutePath());
-
- //String keystore_path = certFilePath + AAIProperties.FILESEPARTOR + SystemProperties.getProperty(AAIProperties.AAI_KEYSTORE_FILENAME);
- //String keystore_password = SystemProperties.getProperty(AAIProperties.AAI_KEYSTORE_PASSWD_X);
- //String decrypted_keystore_password = EncryptedPropValue.decryptTriple(keystore_password);
-
- System.setProperty("javax.net.ssl.trustStore", truststore_path);
- System.setProperty("javax.net.ssl.trustStorePassword", decrypted_truststore_password);
- HttpsURLConnection.setDefaultHostnameVerifier( new HostnameVerifier(){
- public boolean verify(String string,SSLSession ssls) {
- return true;
- }
- });
-
- //May need to make the algorithm a parameter. MSO requires TLSv1.1 or TLSv1.2
- ctx = SSLContext.getInstance("TLSv1.2");
-
- /*
- KeyManagerFactory kmf = null;
- try {
- kmf = KeyManagerFactory.getInstance("SunX509");
- FileInputStream fin = new FileInputStream(keystore_path);
- KeyStore ks = KeyStore.getInstance("PKCS12");
- char[] pwd = decrypted_keystore_password.toCharArray();
- ks.load(fin, pwd);
- kmf.init(ks, pwd);
- } catch (Exception e) {
- System.out.println("Error setting up kmf: exiting");
- e.printStackTrace();
- System.exit(1);
- }
-
- ctx.init(kmf.getKeyManagers(), null, null);
- */
- ctx.init(null, null, null);
- //config.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
- // new HTTPSProperties( , ctx));
-
- return ClientBuilder.newBuilder()
- .sslContext(ctx)
- .hostnameVerifier(new HostnameVerifier() {
- @Override
- public boolean verify( String s, SSLSession sslSession ) {
- return true;
- }
- }).withConfig(config)
- .build()
- .register(org.openecomp.aai.util.CustomJacksonJaxBJsonProvider.class);
-
- } catch (Exception e) {
- System.out.println("Error setting up config: exiting");
- e.printStackTrace();
- return null;
- }
-
- //Client client = ClientBuilder.newClient(config);
- // uncomment this line to get more logging for the request/response
- // client.addFilter(new LoggingFilter(System.out));
-
- //return client;
- }
-}
diff --git a/vid/src/main/java/org/openecomp/vid/conf/ExternalAppConfig.java b/vid/src/main/java/org/openecomp/vid/conf/ExternalAppConfig.java
deleted file mode 100644
index e56c1b187..000000000
--- a/vid/src/main/java/org/openecomp/vid/conf/ExternalAppConfig.java
+++ /dev/null
@@ -1,271 +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.conf;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.PostConstruct;
-import javax.sql.DataSource;
-
-import org.openecomp.vid.scheduler.RegistryAdapter;
-import org.openecomp.portalapp.uebhandler.InitUebHandler;
-import org.openecomp.portalapp.uebhandler.MainUebHandler;
-import org.openecomp.portalapp.uebhandler.WidgetNotificationHandler;
-import org.openecomp.portalsdk.core.conf.AppConfig;
-import org.openecomp.portalsdk.core.conf.Configurable;
-import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager;
-import org.openecomp.portalsdk.core.service.DataAccessService;
-import org.openecomp.portalsdk.core.util.CacheManager;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Import;
-import org.springframework.context.annotation.Profile;
-import org.springframework.context.annotation.PropertySource;
-import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
-import org.springframework.core.io.Resource;
-import org.springframework.jdbc.datasource.init.DataSourceInitializer;
-import org.springframework.jdbc.datasource.init.DatabasePopulator;
-import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
-import org.springframework.scheduling.annotation.EnableAsync;
-import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.scheduling.quartz.SchedulerFactoryBean;
-import org.springframework.web.servlet.ViewResolver;
-import org.springframework.web.servlet.config.annotation.EnableWebMvc;
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-/**
- * Configures Spring features in the ECOMP Portal SDK sample application.
- * Subclasses the ECOMP Portal SDK core AppConfig class to reuse interceptors,
- * view resolvers and other features defined there.
- */
-@Configuration
-@EnableWebMvc
-@ComponentScan(basePackages = "org.openecomp")
-@PropertySource(value = { "${container.classpath:}/WEB-INF/conf/app/test.properties" }, ignoreResourceNotFound = true)
-@Profile("src")
-@EnableAsync
-@EnableScheduling
-public class ExternalAppConfig extends AppConfig implements Configurable {
-
- /** The Constant LOG. */
- private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(ExternalAppConfig.class);
-
- /** The scheduler registry adapter. */
- private RegistryAdapter schedulerRegistryAdapter;
-
- /** The vid schema script. */
- @Value("classpath:vid-schema.sql")
- private Resource vidSchemaScript;
-
- /** The vid data script. */
- @Value("classpath:vid-data.sql")
- private Resource vidDataScript;
-
- /**
- * The Class InnerConfiguration.
- */
- @Configuration
- @Import(SystemProperties.class)
- static class InnerConfiguration {
- }
-
- /**
- * View resolver.
- *
- * @return the view resolver
- * @see org.openecomp.portalsdk.core.conf.AppConfig#viewResolver()
- */
- public ViewResolver viewResolver() {
- return super.viewResolver();
- }
-
- /**
- * Adds the resource handlers.
- *
- * @param registry the registry
- * @see org.openecomp.portalsdk.core.conf.AppConfig#addResourceHandlers(ResourceHandlerRegistry)
- */
- public void addResourceHandlers(ResourceHandlerRegistry registry) {
- super.addResourceHandlers(registry);
- }
-
- /**
- * Data access service.
- *
- * @return the data access service
- * @see org.openecomp.portalsdk.core.conf.AppConfig#dataAccessService()
- */
- public DataAccessService dataAccessService() {
- return super.dataAccessService();
- }
-
- /**
- * Creates a new list with a single entry that is the external app
- * definitions.xml path.
- *
- * @return List of String, size 1
- */
- public List<String> addTileDefinitions() {
- List<String> definitions = new ArrayList<String>();
- definitions.add("/WEB-INF/defs/definitions.xml");
- return definitions;
- }
-
- /**
- * Adds request interceptors to the specified registry by calling
- * {@link AppConfig#addInterceptors(InterceptorRegistry)}, but excludes
- * certain paths from the session timeout interceptor.
- *
- * @param registry the registry
- */
- @Override
- public void addInterceptors(InterceptorRegistry registry) {
- super.setExcludeUrlPathsForSessionTimeout("/login_external", "*/login_external.htm", "login", "/login.htm",
- "/api*","/single_signon.htm","/single_signon");
- super.addInterceptors(registry);
- }
-
- /**
- * Creates and returns a new instance of a {@link CacheManager} class.
- *
- * @return New instance of {@link CacheManager}
- */
- @Bean
- public AbstractCacheManager cacheManager() {
- return new CacheManager();
- }
-
- /**
- * Inits the global local context.
- */
- @PostConstruct
- public void initGlobalLocalContext() {
- LOG.init();
- }
-
-
- /**
- * Creates and returns a new instance of a {@link MainUebHandler}.
- *
- * @return New instance of {@link MainUebHandler}.
- */
- @Bean
- public MainUebHandler mainUebHandler() {
-
- return new MainUebHandler();
- }
-
- /**
- * Creates and returns a new instance of a {@link InitUebHandler}.
- *
- * @return New instance of {@link InitUebHandler}.
- */
- @Bean
- public InitUebHandler initUebHandler() {
-
- return new InitUebHandler();
- }
-
- /**
- * Creates and returns a new instance of a {@link WidgetNotificationHandler}
- * .
- *
- * @return New instance of {@link WidgetNotificationHandler}.
- */
- @Bean
- public WidgetNotificationHandler widgetNotificationHandler() {
- return new WidgetNotificationHandler();
- }
-
- /**
- * Creates and returns a new instance of a {@link SchedulerFactoryBean} and
- * populates it with triggers.
- *
- * @return New instance of {@link SchedulerFactoryBean}
- * @throws Exception the exception
- */
- // @Bean // ANNOTATION COMMENTED OUT
- // APPLICATIONS REQUIRING QUARTZ SHOULD RESTORE ANNOTATION
- public SchedulerFactoryBean schedulerFactoryBean() throws Exception {
- SchedulerFactoryBean scheduler = new SchedulerFactoryBean();
- scheduler.setTriggers(schedulerRegistryAdapter.getTriggers());
- scheduler.setConfigLocation(appApplicationContext.getResource("WEB-INF/conf/quartz.properties"));
- scheduler.setDataSource(dataSource());
- return scheduler;
- }
-
- /**
- * Data source initializer.
- *
- * @param dataSource the data source
- * @return the data source initializer
- */
- @Bean
- public DataSourceInitializer dataSourceInitializer(DataSource dataSource) {
-
- LOG.info("Initializing VID data source");
-
- final DataSourceInitializer initializer = new DataSourceInitializer();
- initializer.setDataSource(dataSource);
- initializer.setDatabasePopulator(databasePopulator());
- return initializer;
- }
-
- /**
- * Database populator.
- *
- * @return the database populator
- */
- public DatabasePopulator databasePopulator() {
- LOG.info("Populating VID data source");
-
- final ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
- populator.addScript(vidSchemaScript);
- populator.addScript(vidDataScript);
- return populator;
- }
-
- /**
- * Sets the scheduler registry adapter.
- *
- * @param schedulerRegistryAdapter the new scheduler registry adapter
- */
- @Autowired
- public void setSchedulerRegistryAdapter(final RegistryAdapter schedulerRegistryAdapter) {
- this.schedulerRegistryAdapter = schedulerRegistryAdapter;
- }
-
- /**
- * Property config in dev.
- *
- * @return the property sources placeholder configurer
- */
- @Bean
- public static PropertySourcesPlaceholderConfigurer propertyConfigInDev() {
- return new PropertySourcesPlaceholderConfigurer();
- }
-}
diff --git a/vid/src/main/java/org/openecomp/vid/conf/ExternalAppInitializer.java b/vid/src/main/java/org/openecomp/vid/conf/ExternalAppInitializer.java
deleted file mode 100644
index 8e26484a3..000000000
--- a/vid/src/main/java/org/openecomp/vid/conf/ExternalAppInitializer.java
+++ /dev/null
@@ -1,80 +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.conf;
-
-import java.util.Arrays;
-
-import org.openecomp.portalsdk.core.conf.AppInitializer;
-
-/**
- * The Class ExternalAppInitializer.
- */
-public class ExternalAppInitializer extends AppInitializer{
-
-
- /* (non-Javadoc)
- * @see org.openecomp.portalsdk.core.conf.AppInitializer#getRootConfigClasses()
- */
- @Override
- protected Class<?>[] getRootConfigClasses() {
- return super.getRootConfigClasses();
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.portalsdk.core.conf.AppInitializer#getServletConfigClasses()
- */
- @Override
- protected Class<?>[] getServletConfigClasses() {
-// Class<?>[] configClasses = super.getServletConfigClasses();
-// Class<?>[] additionalConfigClasses = Arrays.copyOf(configClasses, configClasses.length);
-// addConfigClass(additionalConfigClasses, ExternalAppConfig.class);
-// return additionalConfigClasses;
-//
- return new Class[] {ExternalAppConfig.class};
- }
-
- /**
- * Adds the config class.
- *
- * @param a the a
- * @param e the e
- * @return the class[]
- */
- static Class<?>[] addConfigClass(Class<?>[] a, Class<?> e) {
- a = Arrays.copyOf(a, a.length + 1);
- a[a.length - 1] = e;
- return a;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.portalsdk.core.conf.AppInitializer#getServletMappings()
- */
- /*
- * URL request will direct to the Spring dispatcher for processing
- */
- @Override
- protected String[] getServletMappings() {
- return super.getServletMappings();
- }
-
-}
-
-
diff --git a/vid/src/main/java/org/openecomp/vid/conf/HibernateMappingLocations.java b/vid/src/main/java/org/openecomp/vid/conf/HibernateMappingLocations.java
deleted file mode 100644
index 848964bca..000000000
--- a/vid/src/main/java/org/openecomp/vid/conf/HibernateMappingLocations.java
+++ /dev/null
@@ -1,44 +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.conf;
-
-import org.openecomp.portalsdk.core.conf.HibernateMappingLocatable;
-import org.springframework.context.annotation.Profile;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
-import org.springframework.stereotype.Component;
-
-/**
- * The Class HibernateMappingLocations.
- */
-@Component
-@Profile("src")
-public class HibernateMappingLocations implements HibernateMappingLocatable {
-
- /* (non-Javadoc)
- * @see org.openecomp.portalsdk.core.conf.HibernateMappingLocatable#getMappingLocations()
- */
- public Resource[] getMappingLocations() {
- return new Resource[]{new ClassPathResource("../fusion/orm/Fusion.hbm.xml"), new ClassPathResource("../fusion/orm/Workflow.hbm.xml"), new ClassPathResource("../fusion/orm/RNoteBookIntegration.hbm.xml")};
- }
-
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/controller/AaiController.java b/vid/src/main/java/org/openecomp/vid/controller/AaiController.java
deleted file mode 100644
index b53b36c0c..000000000
--- a/vid/src/main/java/org/openecomp/vid/controller/AaiController.java
+++ /dev/null
@@ -1,748 +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 java.io.File;
-import java.io.IOException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.BadRequestException;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.WebApplicationException;
-
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
-import org.json.simple.parser.JSONParser;
-import org.openecomp.aai.util.AAIRestInterface;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.PathVariable;
-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;
-
-/**
- * Controller to handle a&ai requests.
- */
-
-@RestController
-public class AaiController extends RestrictedBaseController{
-
- /** The view name. */
- String viewName;
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AaiController.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /** The from app id. */
- protected String fromAppId = "VidAaiController";
-
- /** The model. */
- private Map<String,Object> model = new HashMap<String,Object>();
-
- /** The servlet context. */
- private @Autowired ServletContext servletContext;
-
- /**
- * Welcome method.
- *
- * @param request the request
- * @return ModelAndView The view
- */
- @RequestMapping(value = {"/subscriberSearch" }, method = RequestMethod.GET)
- public ModelAndView welcome(HttpServletRequest request) {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== AaiController welcome start");
- 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;
- }
-
- /**
- * Get services from a&ai.
- *
- * @return ResponseEntity<String> The response entity
- * @throws IOException Signals that an I/O exception has occurred.
- * @throws InterruptedException the interrupted exception
- */
-@RequestMapping(value="/aai_get_services",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<String> doGetServices() throws IOException, InterruptedException {
- File certiPath = GetCertificatesPath();
-
- String resp = doAaiGet(certiPath.getAbsolutePath(), "service-design-and-creation/services?depth=0", false);;
-
- return new ResponseEntity<String>(resp, HttpStatus.OK);
- }
-
-
-
- /**
- * Get services from a&ai.
- *
- * @param globalCustomerId the global customer id
- * @param serviceSubscriptionId the service subscription id
- * @return ResponseEntity The response entity
- * @throws IOException Signals that an I/O exception has occurred.
- * @throws InterruptedException the interrupted exception
- */
- @RequestMapping(value="/aai_get_service_subscription/{global-customer-id}/{service-subscription-id}",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<String> doGetServices(@PathVariable("global-customer-id") String globalCustomerId,
- @PathVariable("service-subscription-id") String serviceSubscriptionId) throws IOException, InterruptedException {
- File certiPath = GetCertificatesPath();
- String resp = doAaiGet(certiPath.getAbsolutePath(), "/business/customers/customer/" + globalCustomerId
- + "/service-subscriptions/service-subscription/" + serviceSubscriptionId + "?depth=0", false);
- return new ResponseEntity<String>(resp, HttpStatus.OK);
- }
-
- /**
- * Obtain the subscriber list from a&ai.
- *
- * @param fullSet the full set
- * @return ResponseEntity The response entity
- * @throws IOException Signals that an I/O exception has occurred.
- * @throws InterruptedException the interrupted exception
- */
- @RequestMapping(value="/aai_get_subscribers",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<String> doGetSubscriberList(@DefaultValue("n") @QueryParam("fullSet") String fullSet) throws IOException, InterruptedException {
-
- String res1 = getSubscribers(false);
-
- return new ResponseEntity<String>(res1, HttpStatus.OK);
-
- }
-
- /**
- * Obtain the full subscriber list from a&ai.
- *
- * @return ResponseEntity The response entity
- * @throws IOException Signals that an I/O exception has occurred.
- * @throws InterruptedException the interrupted exception
- */
- @RequestMapping(value="/aai_get_full_subscribers",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<String> getFullSubscriberList() throws IOException, InterruptedException {
-
- String res1 = getSubscribers(true);
-
- return new ResponseEntity<String>(res1, HttpStatus.OK);
-
- }
-
- /**
- * Refresh the subscriber list from a&ai.
- *
- * @return ResponseEntity The response entity
- * @throws IOException Signals that an I/O exception has occurred.
- */
- @RequestMapping(value="/aai_refresh_subscribers",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<String> doRefreshSubscriberList() throws IOException {
-
- String res1 = getSubscribers(false);
-
- // refresh the services too
- String resp = getServices();
-
- return new ResponseEntity<String>(res1, HttpStatus.OK);
- }
-
- /**
- * Refresh the full subscriber list from a&ai.
- *
- * @return ResponseEntity The response entity
- * @throws IOException Signals that an I/O exception has occurred.
- */
- @RequestMapping(value="/aai_refresh_full_subscribers",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<String> doRefreshFullSubscriberList() throws IOException {
- boolean isFullSet = true;
-
- String res1 = getSubscribers(isFullSet);
-
- // refresh the services too
- String resp = getServices();
-
- return new ResponseEntity<String>(res1, HttpStatus.OK);
- }
-
- /**
- * Get subscriber details from a&ai.
- *
- * @param subscriberId the subscriber id
- * @return ResponseEntity The response entity
- */
- @RequestMapping(value="/aai_sub_details/{subscriberId}", method = RequestMethod.GET)
- public ResponseEntity<String> GetSubscriber(@PathVariable("subscriberId") String subscriberId) {
-
- String res1 = getSubscriberDetails(subscriberId);
- return new ResponseEntity<String>(res1, HttpStatus.OK);
-
- }
-
- /**
- * Issue a named query to a&ai.
- *
- * @param namedQueryId the named query id
- * @param globalCustomerId the global customer id
- * @param serviceType the service type
- * @param serviceInstance the service instance
- * @return ResponseEntity The response entity
- */
- @RequestMapping(value="/aai_sub_viewedit/{namedQueryId}/{globalCustomerId}/{serviceType}/{serviceInstance}", method = RequestMethod.GET)
- public ResponseEntity<String> viewEditGetComponentList(
- @PathVariable("namedQueryId") String namedQueryId,
- @PathVariable("globalCustomerId") String globalCustomerId,
- @PathVariable("serviceType") String serviceType,
- @PathVariable("serviceInstance") String serviceInstance) {
-
- String componentListPayload = getComponentListPutPayload(namedQueryId, globalCustomerId, serviceType, serviceInstance);
- File certiPath = GetCertificatesPath();
-
- String getComponentListOutput = doAaiPost(certiPath.getAbsolutePath(), "search/named-query", componentListPayload, false);
- System.out.println(getComponentListOutput);
- return new ResponseEntity<String>(getComponentListOutput, HttpStatus.OK);
-
- }
-
- /**
- * Parses the for tenants.
- *
- * @param resp the resp
- * @return the string
- */
- private String parseForTenants(String resp)
- {
- String tenantList = "";
-
- try
- {
- JSONParser jsonParser = new JSONParser();
-
- JSONObject jsonObject = (JSONObject) jsonParser.parse(resp);
-
- return parseCustomerObjectForTenants(jsonObject);
- }
- catch (Exception ex) {
-
- }
-
- return tenantList;
- }
-
- /**
- * Parses the for tenants by service subscription.
- *
- * @param resp the resp
- * @return the string
- */
- private String parseForTenantsByServiceSubscription(String resp)
- {
- String tenantList = "";
-
- try
- {
- JSONParser jsonParser = new JSONParser();
-
- JSONObject jsonObject = (JSONObject) jsonParser.parse(resp);
-
- return parseServiceSubscriptionObjectForTenants(jsonObject);
- }
- catch (Exception ex) {
-
- }
-
- return tenantList;
- }
-
-
-// @RequestMapping(value="/aai_get_tenants/{global-customer-id}", method = RequestMethod.GET)
-// public ResponseEntity<String> viewEditGetComponentList(
-// @PathVariable("global-customer-id") String globalCustomerId) {
-// return new ResponseEntity<String>(getTenants(globalCustomerId), HttpStatus.OK);
-// }
-
- /**
- * Obtain tenants for a given service type.
- *
- * @param globalCustomerId the global customer id
- * @param serviceType the service type
- * @return ResponseEntity The response entity
- */
- @RequestMapping(value="/aai_get_tenants/{global-customer-id}/{service-type}", method = RequestMethod.GET)
- public ResponseEntity<String> viewEditGetTenantsFromServiceType(
- @PathVariable("global-customer-id") String globalCustomerId, @PathVariable("service-type") String serviceType) {
-
- return new ResponseEntity<String>(getTenantsFromServiceType(globalCustomerId, serviceType), HttpStatus.OK);
- }
-
-
-
- /**
- * Gets the tenants.
- *
- * @param globalCustomerId the global customer id
- * @return the tenants
- */
- private String getTenants(String globalCustomerId)
- {
- File certiPath = GetCertificatesPath();
- String resp = doAaiGet(certiPath.getAbsolutePath(), "business/customers/customer/" + globalCustomerId, false);
- resp = parseForTenants(resp);
- //model.put("tenants", resp);
- return resp;
- }
-
- /**
- * Gets the tenants from service type.
- *
- * @param globalCustomerId the global customer id
- * @param serviceType the service type
- * @return the tenants from service type
- */
- private String getTenantsFromServiceType(String globalCustomerId, String serviceType)
- {
- File certiPath = GetCertificatesPath();
- String url = "business/customers/customer/" + globalCustomerId + "/service-subscriptions/service-subscription/" + serviceType;
- System.out.println("URL: " + url);
- String resp = doAaiGet(certiPath.getAbsolutePath(), url, false);
- System.out.println("URL: " + url + "RES: " + resp);
- resp = parseForTenantsByServiceSubscription(resp);
- //model.put("tenants", resp);
- return resp;
- }
-
- /**
- * Gets the services.
- *
- * @return the services
- */
- private String getServices()
- {
- File certiPath = GetCertificatesPath();
- String resp = doAaiGet(certiPath.getAbsolutePath(), "/service-design-and-creation/services?depth=0", false);
- //model.put("aai_get_services", resp);
- return resp;
- }
-
-
- /**
- * Gets the subscribers.
- *
- * @param isFullSet the is full set
- * @return the subscribers
- */
- private String getSubscribers(boolean isFullSet)
- {
- File certiPath = GetCertificatesPath();
- String depth = "0";
- if (isFullSet == true) {
- depth = "all";
- }
- String resp = doAaiGet(certiPath.getAbsolutePath(), "business/customers?subscriber-type=INFRA&depth=" + depth, false);
- //model.put("subscribernames" + depth, resp);
- return resp;
- }
-
- /**
- * Gets the subscriber details.
- *
- * @param subscriberId the subscriber id
- * @return the subscriber details
- */
- private String getSubscriberDetails(String subscriberId)
- {
- File certiPath = GetCertificatesPath();
- String resp = doAaiGet(certiPath.getAbsolutePath(), "business/customers/customer/" + subscriberId, false);
- return resp;
- }
-
- /**
- * Gets the certificates path.
- *
- * @return the file
- */
- private File GetCertificatesPath()
- {
- if (servletContext != null)
- return new File( servletContext.getRealPath("/WEB-INF/cert/") );
- return null;
- }
-
- /**
- * Send a GET request to a&ai.
- *
- * @param certiPath the certi path
- * @param uri the uri
- * @param xml the xml
- * @return String The response
- */
- protected String doAaiGet(String certiPath, String uri, boolean xml) {
- String methodName = "getSubscriberList";
- String transId = UUID.randomUUID().toString();
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- try {
-
- AAIRestInterface restContrller = new AAIRestInterface(certiPath);
- return restContrller.RestGet(fromAppId, transId, uri, xml);
-
- } catch (WebApplicationException e) {
- final String message = ((BadRequestException) e).getResponse().readEntity(String.class);
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + message);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + message);
- } catch (Exception e) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- }
-
- return null;
- }
-
- /**
- * Send a POST request to a&ai.
- *
- * @param certiPath the certi path
- * @param uri the uri
- * @param payload the payload
- * @param xml the xml
- * @return String The response
- */
- protected String doAaiPost(String certiPath, String uri, String payload, boolean xml) {
- String methodName = "getSubscriberList";
- String transId = UUID.randomUUID().toString();
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- try {
-
- AAIRestInterface restContrller = new AAIRestInterface(certiPath);
- return restContrller.RestPost(fromAppId, transId, uri, payload, xml);
-
- } catch (Exception e) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- }
-
- return null;
- }
-
- /**
- * Gets the component list put payload.
- *
- * @param namedQueryId the named query id
- * @param globalCustomerId the global customer id
- * @param serviceType the service type
- * @param serviceInstance the service instance
- * @return the component list put payload
- */
- private String getComponentListPutPayload(String namedQueryId, String globalCustomerId, String serviceType, String serviceInstance) {
- return
- " {" +
- " \"instance-filters\": {" +
- " \"instance-filter\": [" +
- " {" +
-// " \"customer\": {" +
-// " \"global-customer-id\": \"" + globalCustomerId + "\"" +
-// " }," +
- " \"service-instance\": {" +
- " \"service-instance-id\": \"" + serviceInstance + "\"" +
- " }" +
-// " }," +
-// " \"service-subscription\": {" +
-// " \"service-type\": \"" + serviceType + "\"" +
-// " }" +
- " }" +
- " ]" +
- " }," +
- " \"query-parameters\": {" +
- " \"named-query\": {" +
- " \"named-query-uuid\": \"" + namedQueryId + "\"" +
- " }" +
- " }" +
- "}";
-
- }
-
-
- /**
- * Return tenant details.
- *
- * @param jsonObject the json object
- * @return String The parsing results
- */
- public static String parseCustomerObjectForTenants(JSONObject jsonObject) {
-
- JSONArray tenantArray = new JSONArray();
- boolean bconvert = false;
-
- try {
-
- JSONObject serviceSubsObj = (JSONObject) jsonObject.get("service-subscriptions");
-
- if (serviceSubsObj != null)
- {
- JSONArray srvcSubArray = (JSONArray) serviceSubsObj.get("service-subscription");
-
- if (srvcSubArray != null)
- {
- Iterator i = srvcSubArray.iterator();
-
- while (i.hasNext()) {
-
- JSONObject innerObj = (JSONObject) i.next();
-
- if (innerObj == null)
- continue;
-
- JSONObject relationShipListsObj = (JSONObject) innerObj.get("relationship-list");
- if (relationShipListsObj != null)
- {
- JSONArray rShipArray = (JSONArray) relationShipListsObj.get("relationship");
- if (rShipArray != null)
- {
- Iterator i1 = rShipArray.iterator();
-
- while (i1.hasNext()) {
-
- JSONObject inner1Obj = (JSONObject) i1.next();
-
- if (inner1Obj == null)
- continue;
-
- String relatedTo = checkForNull((String)inner1Obj.get("related-to"));
- if (relatedTo.equalsIgnoreCase("tenant"))
- {
- JSONObject tenantNewObj = new JSONObject();
-
- String relatedLink = checkForNull((String) inner1Obj.get("related-link"));
- tenantNewObj.put("link", relatedLink);
-
- JSONArray rDataArray = (JSONArray) inner1Obj.get("relationship-data");
- if (rDataArray != null)
- {
- Iterator i2 = rDataArray.iterator();
-
- while (i2.hasNext()) {
- JSONObject inner2Obj = (JSONObject) i2.next();
-
- if (inner2Obj == null)
- continue;
-
- String rShipKey = checkForNull((String)inner2Obj.get("relationship-key"));
- String rShipVal = checkForNull((String)inner2Obj.get("relationship-value"));
- if (rShipKey.equalsIgnoreCase("cloud-region.cloud-owner"))
- {
- tenantNewObj.put("cloudOwner", rShipVal);
- }
- else if (rShipKey.equalsIgnoreCase("cloud-region.cloud-region-id"))
- {
- tenantNewObj.put("cloudRegionID", rShipVal);
- }
-
- if (rShipKey.equalsIgnoreCase("tenant.tenant-id"))
- {
- tenantNewObj.put("tenantID", rShipVal);
- }
- }
- }
-
- JSONArray relatedTPropArray = (JSONArray) inner1Obj.get("related-to-property");
- if (relatedTPropArray != null)
- {
- Iterator i3 = relatedTPropArray.iterator();
-
- while (i3.hasNext()) {
- JSONObject inner3Obj = (JSONObject) i3.next();
-
- if (inner3Obj == null)
- continue;
-
- String propKey = checkForNull((String)inner3Obj.get("property-key"));
- String propVal = checkForNull((String)inner3Obj.get("property-value"));
- if (propKey.equalsIgnoreCase("tenant.tenant-name"))
- {
- tenantNewObj.put("tenantName", propVal);
- }
- }
- }
- bconvert = true;
- tenantArray.add(tenantNewObj);
- }
- }
- }
- }
- }
- }
- }
- } catch (NullPointerException ex) {
-
-
- }
-
- if (bconvert)
- return tenantArray.toJSONString();
- else
- return "";
-
- }
-
-
- /**
- * Retrieve the service subscription from the jsonObject.
- *
- * @param jsonObject the json object
- * @return String
- */
- public static String parseServiceSubscriptionObjectForTenants(JSONObject jsonObject) {
-
- JSONArray tenantArray = new JSONArray();
- boolean bconvert = false;
-
- try {
- JSONObject relationShipListsObj = (JSONObject) jsonObject.get("relationship-list");
- if (relationShipListsObj != null)
- {
- JSONArray rShipArray = (JSONArray) relationShipListsObj.get("relationship");
- if (rShipArray != null)
- {
- Iterator i1 = rShipArray.iterator();
-
- while (i1.hasNext()) {
-
- JSONObject inner1Obj = (JSONObject) i1.next();
-
- if (inner1Obj == null)
- continue;
-
- String relatedTo = checkForNull((String)inner1Obj.get("related-to"));
- if (relatedTo.equalsIgnoreCase("tenant"))
- {
- JSONObject tenantNewObj = new JSONObject();
-
- String relatedLink = checkForNull((String) inner1Obj.get("related-link"));
- tenantNewObj.put("link", relatedLink);
-
- JSONArray rDataArray = (JSONArray) inner1Obj.get("relationship-data");
- if (rDataArray != null)
- {
- Iterator i2 = rDataArray.iterator();
-
- while (i2.hasNext()) {
- JSONObject inner2Obj = (JSONObject) i2.next();
-
- if (inner2Obj == null)
- continue;
-
- String rShipKey = checkForNull((String)inner2Obj.get("relationship-key"));
- String rShipVal = checkForNull((String)inner2Obj.get("relationship-value"));
- if (rShipKey.equalsIgnoreCase("cloud-region.cloud-owner"))
- {
- tenantNewObj.put("cloudOwner", rShipVal);
- }
- else if (rShipKey.equalsIgnoreCase("cloud-region.cloud-region-id"))
- {
- tenantNewObj.put("cloudRegionID", rShipVal);
- }
-
- if (rShipKey.equalsIgnoreCase("tenant.tenant-id"))
- {
- tenantNewObj.put("tenantID", rShipVal);
- }
- }
- }
-
- JSONArray relatedTPropArray = (JSONArray) inner1Obj.get("related-to-property");
- if (relatedTPropArray != null)
- {
- Iterator i3 = relatedTPropArray.iterator();
-
- while (i3.hasNext()) {
- JSONObject inner3Obj = (JSONObject) i3.next();
-
- if (inner3Obj == null)
- continue;
-
- String propKey = checkForNull((String)inner3Obj.get("property-key"));
- String propVal = checkForNull((String)inner3Obj.get("property-value"));
- if (propKey.equalsIgnoreCase("tenant.tenant-name"))
- {
- tenantNewObj.put("tenantName", propVal);
- }
- }
- }
- bconvert = true;
- tenantArray.add(tenantNewObj);
- }
- }
-
- }
- }
- } catch (NullPointerException ex) {
-
-
- }
-
- if (bconvert)
- return tenantArray.toJSONString();
- else
- return "";
-
- }
-
- /**
- * Check for null.
- *
- * @param local the local
- * @return the string
- */
- private static String checkForNull(String local)
- {
- if (local != null)
- return local;
- else
- return "";
-
- }
-} \ No newline at end of file
diff --git a/vid/src/main/java/org/openecomp/vid/controller/BrowseServiceTypesController.java b/vid/src/main/java/org/openecomp/vid/controller/BrowseServiceTypesController.java
deleted file mode 100644
index d0867028b..000000000
--- a/vid/src/main/java/org/openecomp/vid/controller/BrowseServiceTypesController.java
+++ /dev/null
@@ -1,87 +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 java.text.DateFormat;
-import java.text.SimpleDateFormat;
-
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-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 BrowseServiceTypesController.
- */
-@RestController
-public class BrowseServiceTypesController extends RestrictedBaseController{
-
- /** The view name. */
- String viewName;
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(BrowseServiceTypesController.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /** The servlet context. */
- private @Autowired ServletContext servletContext;
-
- /**
- * Welcome.
- *
- * @param request the request
- * @return the model and view
- */
- @RequestMapping(value = {"/browseservicetypes" }, 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;
- }
-
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/controller/CreateNewServiceInstanceController.java b/vid/src/main/java/org/openecomp/vid/controller/CreateNewServiceInstanceController.java
deleted file mode 100644
index 0418c93c5..000000000
--- a/vid/src/main/java/org/openecomp/vid/controller/CreateNewServiceInstanceController.java
+++ /dev/null
@@ -1,195 +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 java.io.File;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-
-import org.openecomp.aai.util.AAIRestInterface;
-import org.openecomp.vid.model.Result;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.PathVariable;
-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 CreateNewServiceInstanceController.
- */
-@RestController
-public class CreateNewServiceInstanceController extends RestrictedBaseController{
-
- /** The view name. */
- String viewName;
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CreateNewServiceInstanceController.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /** The trans id. */
- protected String transId;
-
- /** The from app id. */
- protected String fromAppId = "VID";
-
- /** The model. */
- private Map<String, Object> model = new HashMap<String, Object>();
-
- /** The servlet context. */
- private @Autowired ServletContext servletContext;
-
- /**
- * Welcome.
- *
- * @param request the request
- * @return the model and view
- */
- @RequestMapping(value = {"/createnewserviceinstance" }, 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;
- }
-
- /**
- * Do get subscfriber list.
- *
- * @return the response entity
- * @throws IOException Signals that an I/O exception has occurred.
- */
- @RequestMapping(value="/get_subscribers",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<Result> doGetSubscfriberList() throws IOException {
-
- String res1 = (String) model.get("subscribernames");
- if (res1 == null)
- {
- res1 = getSubscribers();
- }
-
- return new ResponseEntity<Result>(new Result(res1),HttpStatus.OK);
-
- }
-
- /**
- * Do refresh subscfriber list.
- *
- * @return the response entity
- * @throws IOException Signals that an I/O exception has occurred.
- */
- @RequestMapping(value="/refresh_subscribers",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<Result> doRefreshSubscfriberList() throws IOException {
-
-
- String res1 = getSubscribers();
-
- return new ResponseEntity<Result>(new Result(res1),HttpStatus.OK);
-
- }
-
- /**
- * Gets the subscriber.
- *
- * @param subscriberId the subscriber id
- */
- @RequestMapping(value="/createsubscriber/{subscriberId}", method = RequestMethod.GET)
- public void GetSubscriber(@PathVariable("subscriberId") String subscriberId) throws UnsupportedEncodingException {
-
-
- File certiPath = GetCertificatesPath();
- AAIRestInterface restContrller = new AAIRestInterface(certiPath.getAbsolutePath());
- try {
- subscriberId = restContrller.encodeURL(subscriberId);
- }
- catch (Exception e)
- {
-
- }
- String res1 = restContrller.RestGet(fromAppId, transId, "business/customers/customer/" + subscriberId, false);
- model.put("customerInfo", res1);
-
- }
-
- /**
- * Gets the subscribers.
- *
- * @return the subscribers
- */
- private String getSubscribers() throws UnsupportedEncodingException
- {
- File certiPath = GetCertificatesPath();
- AAIRestInterface restContrller = new AAIRestInterface(certiPath.getAbsolutePath());
- String res1 = restContrller.RestGet(fromAppId, transId, "business/customers?depth=0", false);
- model.put("subscribernames", res1);
-
- return res1;
- }
-
- /**
- * Gets the certificates path.
- *
- * @return the file
- */
- private File GetCertificatesPath()
- {
- if (servletContext != null)
- return new File( servletContext.getRealPath("/WEB-INF/cert/") );
-
-
- return null;
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/controller/MsoController.java b/vid/src/main/java/org/openecomp/vid/controller/MsoController.java
deleted file mode 100644
index a1d90abef..000000000
--- a/vid/src/main/java/org/openecomp/vid/controller/MsoController.java
+++ /dev/null
@@ -1,736 +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 java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-//import java.util.UUID;
-import java.util.Date;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.glassfish.jersey.client.ClientResponse;
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
-import org.json.simple.parser.JSONParser;
-import org.openecomp.vid.model.ExceptionResponse;
-import org.openecomp.vid.mso.MsoProperties;
-import org.openecomp.vid.mso.MsoResponseWrapper;
-import org.openecomp.vid.mso.MsoRestInterfaceFactory;
-import org.openecomp.vid.mso.MsoRestInterfaceIfc;
-import org.openecomp.vid.mso.MsoUtil;
-import org.openecomp.vid.mso.RestObject;
-import org.openecomp.vid.mso.rest.RequestDetails;
-import org.springframework.http.HttpStatus;
-//import org.springframework.http.ResponseEntity;
-//import org.springframework.http.RequestEntity;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.PathVariable;
-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;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/**
- * The Class MsoController.
- */
-@RestController
-@RequestMapping("mso")
-public class MsoController extends RestrictedBaseController{
-
- /** The view name. */
- String viewName;
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoController.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /** The Constant SVC_INSTANCE_ID. */
- public final static String SVC_INSTANCE_ID = "<service_instance_id>";
-
- /** The Constant VNF_INSTANCE_ID. */
- public final static String VNF_INSTANCE_ID = "<vnf_instance_id>";
-
- /**
- * Welcome.
- *
- * @param request the request
- * @return the model and view
- */
- public ModelAndView welcome(HttpServletRequest request) {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== MsoController welcome start");
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + " MSO_SERVER_URL=" +
- SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) );
- 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;
- }
-
- /**
- * Creates the svc instance.
- *
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_create_svc_instance", method = RequestMethod.POST)
- public ResponseEntity<String> createSvcInstance(HttpServletRequest request) throws Exception {
- String methodName = "createSvcInstance";
-
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start" );
-
- RequestDetails mso_request = retrieveRequestObject (request);
- String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE);
-
- MsoResponseWrapper w = createInstance(mso_request, p);
- // always return OK, the MSO status code is embedded in the body
-
- return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
-
- }
-
- /**
- * Creates the vnf.
- *
- * @param serviceInstanceId the service instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value="/mso_create_vnf_instance/{serviceInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> createVnf(@PathVariable("serviceInstanceId") String serviceInstanceId, HttpServletRequest request) throws Exception {
-
- String methodName = "createVnf";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- RequestDetails mso_request = retrieveRequestObject (request);
- String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_VNF_INSTANCE);
-
- if ( p == null || p.isEmpty()) {
- throw new Exception ( "Vnf instance path is not defined");
- }
- // /serviceInstances/v2/<service_instance_id>/vnfs
- String vnf_path = p.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId );
- MsoResponseWrapper w = createInstance(mso_request, vnf_path);
-
- // always return OK, the MSO status code is embedded in the body
-
- return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
-
- }
-
- /**
- * Creates the nw instance.
- *
- * @param serviceInstanceId the service instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_create_nw_instance/{serviceInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> createNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, HttpServletRequest request) throws Exception {
-
- String methodName = "createNwInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start, serviceInstanceId = " + serviceInstanceId );
-
- RequestDetails mso_request = retrieveRequestObject (request);
-
- String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_NETWORK_INSTANCE);
-
- if ( p == null || p.isEmpty()) {
- throw new Exception ( "Network instance path is not defined");
- }
- // /serviceInstances/v2/<serviceInstanceId>/networks/
-
- String nw_path = p.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId );
- MsoResponseWrapper w = createInstance(mso_request, nw_path);
-
- // always return OK, the MSO status code is embedded in the body
-
- return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
-
- }
-
- /**
- * Creates the volume group instance.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_create_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> createVolumeGroupInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
- HttpServletRequest request) throws Exception {
- String methodName = "createVolumeGroupInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- RequestDetails mso_request = retrieveRequestObject (request);
- String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE);
-
- if ( p == null || p.isEmpty()) {
- throw new Exception ( "Volume group instance path is not defined");
- }
- String path = p.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);
- path = path.replaceFirst(VNF_INSTANCE_ID, vnfInstanceId);
-
- MsoResponseWrapper w = createInstance(mso_request, path);
-
- // always return OK, the MSO status code is embedded in the body
- return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
- }
-
- /**
- * Creates the vf module instance.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_create_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> createVfModuleInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletRequest request) throws Exception {
- String methodName = "createVfModuleInstance";
-
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
- RequestDetails mso_request = retrieveRequestObject (request);
- String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE);
-
- if ( p == null || p.isEmpty()) {
- throw new Exception ( "VF module instance path is not defined");
- }
- // /serviceInstances/v2/<serviceInstanceId>/vnfs/<vnfInstanceId>/vfmodules
- String path = p.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);
- path = path.replaceFirst(VNF_INSTANCE_ID, vnfInstanceId);
-
- MsoResponseWrapper w = createInstance(mso_request, path);
-
- // always return OK, the MSO status code is embedded in the body
-
- return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
- }
-
- /**
- * Creates the instance.
- *
- * @param request the request
- * @param path the path
- * @return the mso response wrapper
- * @throws ClientHandlerException the client handler exception
- * @throws Exception the exception
- */
- protected MsoResponseWrapper createInstance(RequestDetails request, String path) throws Exception {
- String methodName = "createInstance";
- logger.debug(dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- try {
- MsoRestInterfaceIfc restController = MsoRestInterfaceFactory.getInstance();
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Post, request = (" + request + ")");
-
- RestObject<String> restObjStr = new RestObject<String>();
- String str = new String();
- restObjStr.set(str);
- restController.<String>Post(str, request, "", path, restObjStr );
- MsoResponseWrapper w = MsoUtil.wrapResponse (restObjStr);
-
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
- return w;
- } catch (Exception e) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- throw e;
- }
- }
-
- /**
- * Delete svc instance.
- *
- * @param serviceInstanceId the service instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_delete_svc_instance/{serviceInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> deleteSvcInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- HttpServletRequest request) throws Exception {
-
- String methodName = "deleteSvcInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- RequestDetails mso_request = retrieveRequestObject (request);
- String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE);
- String path = p + "/" + serviceInstanceId;
- MsoResponseWrapper w = deleteInstance ( mso_request, path );
-
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
- // always return OK, the MSO status code is embedded in the body
-
- return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
-
- }
-
- /**
- * Delete vnf.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_delete_vnf_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
-
- public ResponseEntity<String> deleteVnf(@PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
- HttpServletRequest request) throws Exception {
- String methodName = "deleteVnf";
-
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- RequestDetails mso_request = retrieveRequestObject (request);
- String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_VNF_INSTANCE);
- if ( p == null || p.isEmpty()) {
- throw new Exception ( "Vnf instance path is not defined");
- }
- // /serviceInstances/v2/<service_instance_id>/vnfs/
- String vnf_path = p.replaceFirst(SVC_INSTANCE_ID, vnfInstanceId );
- MsoResponseWrapper w = deleteInstance ( mso_request, vnf_path + "/" + vnfInstanceId );
-
- // always return OK, the MSO status code is embedded in the body
- return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
-
- }
-
- /**
- * Delete vf module.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param vfModuleId the vf module id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- //mso_delete_vf_module/bc305d54-75b4-431b-adb2-eb6b9e546014/vnfs/fe9000-0009-9999/vfmodules/abeeee-abeeee-abeeee
- @RequestMapping(value = "/mso_delete_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfModuleId}", method = RequestMethod.POST)
- public ResponseEntity<String> deleteVfModule (
- @PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
- @PathVariable("vfModuleId") String vfModuleId, HttpServletRequest request) throws Exception {
-
- String methodName = "deleteVfModule";
-
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- RequestDetails mso_request = retrieveRequestObject (request);
- String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE);
- if ( p == null || p.isEmpty()) {
- throw new Exception ( "VF Module instance path is not defined");
- }
- // /serviceInstances/v2/<serviceInstanceId>/vnfs/<vnfInstanceId>/vfmodules
- String path = p.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId );
- path = path.replaceFirst(VNF_INSTANCE_ID, vnfInstanceId );
- MsoResponseWrapper w = deleteInstance ( mso_request, path + "/" + vfModuleId);
-
- // always return OK, the MSO status code is embedded in the body
- return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
-
- }
-
- /**
- * Delete volume group instance.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param volumeGroupId the volume group id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_delete_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupId}", method = RequestMethod.POST)
- public ResponseEntity<String> deleteVolumeGroupInstance (
- @PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId, @PathVariable("volumeGroupId") String volumeGroupId,
- HttpServletRequest request) throws Exception {
-
- String methodName = "deleteVolumeGroupInstance";
-
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
- RequestDetails mso_request = retrieveRequestObject (request);
-
- String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE);
- if ( p == null || p.isEmpty()) {
- throw new Exception ( "Volume group instance path is not defined");
- }
- // /serviceInstances/v2/{serviceInstanceId}/volumeGroups
- String path = p.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId );
- path = path.replaceFirst(VNF_INSTANCE_ID, vnfInstanceId );
- MsoResponseWrapper w = deleteInstance ( mso_request, path + "/" + volumeGroupId);
-
- // always return OK, the MSO status code is embedded in the body
- return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
- }
-
- /**
- * Delete nw instance.
- *
- * @param serviceInstanceId the service instance id
- * @param networkInstanceId the network instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_delete_nw_instance/{serviceInstanceId}/networks/{networkInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> deleteNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- @PathVariable("networkInstanceId") String networkInstanceId, HttpServletRequest request) throws Exception {
-
- String methodName = "deleteNwInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- RequestDetails mso_request = retrieveRequestObject (request);
-
- String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_NETWORK_INSTANCE);
- if ( p == null || p.isEmpty()) {
- throw new Exception ( "Network instance path is not defined");
- }
- // /serviceInstances/v2/<service_instance_id>/networks
- String path = p.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId );
- MsoResponseWrapper w = deleteInstance ( mso_request, path + "/" + networkInstanceId);
-
- // always return OK, the MSO status code is embedded in the body
- return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
-
- }
-
- /**
- * Delete instance.
- *
- * @param request the request
- * @param path the path
- * @return the mso response wrapper
- * @throws Exception the exception
- */
- protected MsoResponseWrapper deleteInstance(RequestDetails request, String path) throws Exception {
- String methodName = "deleteInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- try {
- MsoRestInterfaceIfc restController = MsoRestInterfaceFactory.getInstance();
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Delete, path =[" + path + "]");
-
- RestObject<String> restObjStr = new RestObject<String>();
- String str = new String();
- restObjStr.set(str);
- restController.<String>Delete(str, request, "", path, restObjStr );
- MsoResponseWrapper w = MsoUtil.wrapResponse (restObjStr);
-
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
- return w;
-
- } catch (Exception e) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- throw e;
- }
-
- }
-
- /**
- * Gets the orchestration request.
- *
- * @param requestId the request id
- * @param request the request
- * @return the orchestration request
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_get_orch_req/{requestId}", method = RequestMethod.GET)
- public ResponseEntity<String> getOrchestrationRequest(@PathVariable("requestId") String requestId,
- HttpServletRequest request) throws Exception {
-
- String methodName = "getOrchestrationRequest";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
- MsoResponseWrapper w = null;
- try {
- MsoRestInterfaceIfc restController = MsoRestInterfaceFactory.getInstance();
- String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQ);
- String path = p + "/" + requestId;
-
- RestObject<String> restObjStr = new RestObject<String>();
- String str = new String();
- restObjStr.set(str);
-
- restController.<String>Get(str, "", path, restObjStr);
-
- w = MsoUtil.wrapResponse (restObjStr);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
- // always return OK, the MSO status code is embedded in the body
-
- }
- catch (Exception e) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- throw e;
- }
- // always return OK, the MSO status code is embedded in the body
- return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
- }
-
-
- /**
- * Gets the orchestration requests.
- *
- * @param filterString the filter string
- * @param request the request
- * @return the orchestration requests
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_get_orch_reqs/{filterString}", method = RequestMethod.GET)
- public ResponseEntity<String> getOrchestrationRequests(@PathVariable("filterString") String filterString,
- HttpServletRequest request) throws Exception {
-
- String methodName = "getOrchestrationRequests";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
- MsoResponseWrapper w = null;
- try {
- MsoRestInterfaceIfc restController = MsoRestInterfaceFactory.getInstance();
- String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQS);
- String path = p + filterString;
-
- RestObject<String> restObjStr = new RestObject<String>();
- String str = new String();
- restObjStr.set(str);
-
- restController.<String>Get(str, "", path, restObjStr);
-
- w = MsoUtil.wrapResponse (restObjStr);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
- }
- catch (Exception e) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- throw e;
- }
- // always return OK, the MSO status code is embedded in the body
- return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
- }
-
- /**
- * Gets the orchestration requests for svc instance.
- *
- * @param svc_instance_id the svc instance id
- * @return the orchestration requests for svc instance
- * @throws Exception the exception
- */
- public MsoResponseWrapper getOrchestrationRequestsForSvcInstance (String svc_instance_id) throws Exception {
-
- String methodName = "getOrchestrationRequestsForSvcInstance";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
- MsoResponseWrapper w = null;
-
- try {
- MsoRestInterfaceIfc restController = MsoRestInterfaceFactory.getInstance();
- String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQS);
- String path = p + svc_instance_id;
-
- RestObject<String> restObjStr = new RestObject<String>();
- String str = new String();
- restObjStr.set(str);
-
- restController.<String>Get(str, "", path, restObjStr);
- w = MsoUtil.wrapResponse (restObjStr);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
-
- }
- catch (Exception e) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- throw e;
- }
- return w;
- }
-
- /**
- * Exception handler.
- *
- * @param e the e
- * @param response the response
- * @throws IOException Signals that an I/O exception has occurred.
- */
- @ExceptionHandler(Exception.class)
- private void exceptionHandler(Exception e, HttpServletResponse response) throws IOException {
-
- /*
- * The following "logger.error" lines "should" be sufficient for logging the exception.
- * However, the console output in my Eclipse environment is NOT showing ANY of the
- * logger statements in this class. Thus the temporary "e.printStackTrace" statement
- * is also included.
- */
-
- String methodName = "exceptionHandler";
- logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- StringWriter sw = new StringWriter();
- e.printStackTrace(new PrintWriter(sw));
- logger.error(EELFLoggerDelegate.errorLogger, sw.toString());
-
- /*
- * Temporary - IF the above mentioned "logger.error" glitch is resolved ...
- * this statement could be removed since it would then likely result in duplicate
- * trace output.
- */
- e.printStackTrace(System.err);
-
- response.setContentType("application/json; charset=UTF-8");
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-
- ExceptionResponse exceptionResponse = new ExceptionResponse();
- exceptionResponse.setException(e.getClass().toString().replaceFirst("^.*\\.", ""));
- exceptionResponse.setMessage(e.getMessage());
-
- response.getWriter().write(new ObjectMapper().writeValueAsString(exceptionResponse));
-
- response.flushBuffer();
-
- }
-
- /**
- * Parses the orchestration requests for svc instance.
- *
- * @param resp the resp
- * @return the list
- * @throws ParseException the parse exception
- * @throws Exception the exception
- */
- @SuppressWarnings("unchecked")
- public List<JSONObject> parseOrchestrationRequestsForSvcInstance ( ClientResponse resp ) throws org.json.simple.parser.ParseException, Exception {
-
- String methodName = "parseOrchestrationRequestsForSvcInstance";
-
- ArrayList<JSONObject> json_list = new ArrayList<JSONObject>();
-
- String rlist_str = resp.readEntity (String.class);
- logger.debug (EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + " Response string: " + rlist_str);
-
- JSONParser parser = new JSONParser();
- try {
- Object obj = parser.parse(rlist_str);
-
- JSONObject jsonObject = (JSONObject) obj;
-
- JSONArray requestList = (JSONArray) jsonObject.get("requestList");
-
- if ( requestList != null && ! (requestList.isEmpty()) )
- for ( Object container : requestList) {
-
- JSONObject containerJsonObj = (JSONObject) container;
- //logger.debug(dateFormat.format(new Date()) + "<== " + "." + methodName + " reqJsonObj: " + containerJsonObj.toJSONString());
- JSONObject reqJsonObj = (JSONObject) containerJsonObj.get("request");
-
- //logger.debug(dateFormat.format(new Date()) + "<== " + "." + methodName + " reqJsonObj.requestId: " +
- // reqJsonObj.get("requestId") );
- JSONObject result = new JSONObject();
-
- result.put("requestId", reqJsonObj.get ("requestId"));
- if ( reqJsonObj.get("requestType") != null ) {
- result.put("requestType", (reqJsonObj.get("requestType").toString()));
- }
- JSONObject req_status = (JSONObject)reqJsonObj.get("requestStatus");
- if ( req_status != null ) {
- result.put("timestamp", (req_status.get("timestamp")));
- result.put("requestState", (req_status.get("requestState")));
- result.put("statusMessage", (req_status.get("statusMessage")));
- result.put("percentProgress", (req_status.get("percentProgress")));
- }
- json_list.add (result);
- }
- } catch (org.json.simple.parser.ParseException pe) {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + " Parse exception: " + pe.toString());
- throw pe;
- } catch (Exception e) {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + " Exception: " + e.toString());
- throw e;
- }
- return ( json_list );
- }
-
- /**
- * Retrieve request object.
- *
- * @param request the request
- * @return the request details
- * @throws Exception the exception
- */
- public RequestDetails retrieveRequestObject ( HttpServletRequest request ) throws Exception {
-
- String methodName = "retrieveRequestObject";
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start" );
-
- ObjectMapper mapper = new ObjectMapper();
- //JSON from String to Object
- RequestDetails mso_request;
- try {
- mso_request = mapper.readValue(request.getInputStream(), RequestDetails.class);
- }
- catch ( Exception e ) {
- logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " Unable to read json object RequestDetails e=" + e.getMessage());
- throw e;
- }
- if ( mso_request == null) {
- logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " mso_request is null");
- throw new Exception ("RequestDetails is missing");
- }
- try {
- String json_req = mapper.writeValueAsString(mso_request);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " request=[" + json_req + "]");
- }
- catch ( Exception e ) {
- logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " Unable to convert RequestDetails to json string e=" + e.getMessage());
- throw e;
- }
- return (mso_request);
- }
-}
diff --git a/vid/src/main/java/org/openecomp/vid/controller/PropertyController.java b/vid/src/main/java/org/openecomp/vid/controller/PropertyController.java
deleted file mode 100644
index e0aa22866..000000000
--- a/vid/src/main/java/org/openecomp/vid/controller/PropertyController.java
+++ /dev/null
@@ -1,121 +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 java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.PathVariable;
-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;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-
-/**
- * The Class PropertyController.
- */
-@RestController
-public class PropertyController extends RestrictedBaseController{
-
- /** The view name. */
- String viewName;
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PropertyController.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /**
- * Welcome.
- *
- * @param request the request
- * @return the model and view
- */
- public ModelAndView welcome(HttpServletRequest request) {
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== PropertyController welcome start");
- 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;
- }
-
- /**
- * Gets the property.
- *
- * @param name the name
- * @param defaultvalue the defaultvalue
- * @param request the request
- * @return the property
- * @throws Exception the exception
- */
- @RequestMapping(value = "/get_property/{name}/{defaultvalue}", method = RequestMethod.GET)
- public ResponseEntity<String> getProperty (@PathVariable("name") String name, @PathVariable("defaultvalue") String defaultvalue,
- HttpServletRequest request) throws Exception {
-
- String methodName = "getProperty";
- ResponseEntity<String> resp = null;
- String pvalue = null;
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- try {
- // convert "_" to "." in the property name
- if (name == null || name.length() == 0 ) {
- return ( new ResponseEntity<String> (defaultvalue, HttpStatus.OK));
- }
- // convert "_" to "." in the property name
- String propertyName = name.replace('_', '.');
- pvalue = SystemProperties.getProperty(propertyName);
- if ( ( pvalue == null ) || ( pvalue.length() == 0 ) ) {
- pvalue = defaultvalue;
- }
- resp = new ResponseEntity<String>(pvalue, HttpStatus.OK);
- }
- catch (Exception e) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
- throw e;
- }
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " returning " + pvalue);
- return ( resp );
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/controller/SearchExistingSIController.java b/vid/src/main/java/org/openecomp/vid/controller/SearchExistingSIController.java
deleted file mode 100644
index 1bd54fe15..000000000
--- a/vid/src/main/java/org/openecomp/vid/controller/SearchExistingSIController.java
+++ /dev/null
@@ -1,166 +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 java.io.File;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-
-import org.openecomp.aai.util.AAIRestInterface;
-import org.openecomp.vid.model.Result;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-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;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-
-/**
- * The Class SearchExistingSIController.
- */
-@RestController
-public class SearchExistingSIController extends RestrictedBaseController{
-
- /** The view name. */
- String viewName;
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SearchExistingSIController.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /** The trans id. */
- protected String transId;
-
- /** The from app id. */
- protected String fromAppId = "VID";
-
- /** The model. */
- private Map<String, Object> model = new HashMap<String, Object>();
-
- /** The servlet context. */
- private @Autowired ServletContext servletContext;
-
- /**
- * Welcome.
- *
- * @param request the request
- * @return the model and view
- */
- @RequestMapping(value = {"/searchexistingsi" }, 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;
- }
-
- /**
- * Do get subscfriber list.
- *
- * @return the response entity
- * @throws IOException Signals that an I/O exception has occurred.
- */
- @RequestMapping(value="/searchexistingsi_get_subscribers",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<Result> doGetSubscfriberList() throws IOException, UnsupportedEncodingException {
-
- String res1 = (String) model.get("subscribernames");
- if (res1 == null)
- {
- res1 = getSubscribers();
- }
-
- return new ResponseEntity<Result>(new Result(res1),HttpStatus.OK);
-
- }
-
- /**
- * Do refresh subscfriber list.
- *
- * @return the response entity
- * @throws IOException Signals that an I/O exception has occurred.
- */
- @RequestMapping(value="/searchexistingsi_refresh_subscribers",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<Result> doRefreshSubscfriberList() throws IOException, UnsupportedEncodingException {
-
-
- String res1 = getSubscribers();
-
- return new ResponseEntity<Result>(new Result(res1),HttpStatus.OK);
-
- }
-
- /**
- * Gets the subscribers.
- *
- * @return the subscribers
- */
- private String getSubscribers() throws UnsupportedEncodingException
- {
- File certiPath = GetCertificatesPath();
- AAIRestInterface restContrller = new AAIRestInterface(certiPath.getAbsolutePath());
- String res1 = restContrller.RestGet(fromAppId, transId, "business/customers?depth=0", false);
- model.put("subscribernames", res1);
-
- return res1;
- }
-
- /**
- * Gets the certificates path.
- *
- * @return the file
- */
- private File GetCertificatesPath()
- {
- if (servletContext != null)
- return new File( servletContext.getRealPath("/WEB-INF/cert/") );
-
-
- return null;
- }
-
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/controller/SubscriberDetailsController.java b/vid/src/main/java/org/openecomp/vid/controller/SubscriberDetailsController.java
deleted file mode 100644
index 222dfe755..000000000
--- a/vid/src/main/java/org/openecomp/vid/controller/SubscriberDetailsController.java
+++ /dev/null
@@ -1,137 +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 java.io.File;
-import java.io.UnsupportedEncodingException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-
-import org.openecomp.aai.util.AAIRestInterface;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-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 SubscriberDetailsController.
- */
-@RestController
-public class SubscriberDetailsController extends RestrictedBaseController{
-
- /** The view name. */
- String viewName;
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SubscriberDetailsController.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /** The trans id. */
- protected String transId;
-
- /** The from app id. */
- protected String fromAppId = "VID";
-
- /** The model. */
- private Map<String, Object> model = new HashMap<String, Object>();
-
- /** The servlet context. */
- private @Autowired ServletContext servletContext;
-
- /**
- * Welcome.
- *
- * @param request the request
- * @return the model and view
- */
- @RequestMapping(value = {"/subscriberdetails" }, method = RequestMethod.GET)
- public ModelAndView welcome(HttpServletRequest request) {
-
- return new ModelAndView("subscriberdetails","model", model);
- //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;
- }
-
- /**
- * Gets the subscriber.
- *
- * @param subscriberId the subscriber id
- */
- @RequestMapping(value="/subscriberdetails/{subscriberId}", method = RequestMethod.GET)
- public void GetSubscriber(@PathVariable("subscriberId") String subscriberId) throws UnsupportedEncodingException {
-
-
- File certiPath = GetCertificatesPath();
- AAIRestInterface restContrller = new AAIRestInterface(certiPath.getAbsolutePath());
- try {
- subscriberId = restContrller.encodeURL(subscriberId);
- }
- catch (Exception e)
- {
-
- }
- String res1 = restContrller.RestGet(fromAppId, transId, "business/customers/customer/" + subscriberId, false);
- model.put("customerInfo", res1);
-
- }
-
- /**
- * Gets the certificates path.
- *
- * @return the file
- */
- private File GetCertificatesPath()
- {
- if (servletContext != null)
- return new File( servletContext.getRealPath("/WEB-INF/cert/") );
-
-
- return null;
- }
-}
-
diff --git a/vid/src/main/java/org/openecomp/vid/controller/UserProfileController.java b/vid/src/main/java/org/openecomp/vid/controller/UserProfileController.java
deleted file mode 100644
index cd3e5f73c..000000000
--- a/vid/src/main/java/org/openecomp/vid/controller/UserProfileController.java
+++ /dev/null
@@ -1,80 +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 java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.servlet.ModelAndView;
-
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-import org.openecomp.portalsdk.core.domain.Profile;
-import org.openecomp.portalsdk.core.service.ProfileService;
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/**
- * Controller for user profile view. The view is restricted to authenticated
- * users. The view name resolves to page user_profile.jsp which uses Angular.
- */
-
-@Controller
-@RequestMapping("/")
-public class UserProfileController extends RestrictedBaseController {
-
- /** The service. */
- @Autowired
- ProfileService service;
-
- /**
- * Profile search.
- *
- * @param request the request
- * @return the model and view
- */
- @RequestMapping(value = {"/user_profile" }, method = RequestMethod.GET)
- public ModelAndView ProfileSearch(HttpServletRequest request) {
- Map<String, Object> model = new HashMap<String, Object>();
- ObjectMapper mapper = new ObjectMapper();
- List<Profile> profileList = service.findAll();
- try {
- model.put("customerInfo", mapper.writeValueAsString(profileList));
- } catch (JsonGenerationException e) {
- e.printStackTrace();
- } catch (JsonMappingException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- return new ModelAndView("user_profile","model", model);
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/controller/VidController.java b/vid/src/main/java/org/openecomp/vid/controller/VidController.java
deleted file mode 100644
index d6df31c4d..000000000
--- a/vid/src/main/java/org/openecomp/vid/controller/VidController.java
+++ /dev/null
@@ -1,242 +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 java.io.InputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.UUID;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.client.ClientBuilder;
-
-import org.json.JSONObject;
-import org.json.JSONTokener;
-import org.openecomp.vid.exceptions.VidServiceUnavailableException;
-import org.openecomp.vid.model.Network;
-import org.openecomp.vid.model.ServiceModel;
-import org.openecomp.vid.model.VNF;
-import org.openecomp.vid.model.VfModule;
-import org.openecomp.vid.model.VolumeGroup;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.web.bind.annotation.PathVariable;
-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;
-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.Resource;
-import org.openecomp.vid.asdc.beans.Service;
-import org.openecomp.vid.asdc.beans.tosca.Group;
-import org.openecomp.vid.asdc.beans.tosca.NodeTemplate;
-import org.openecomp.vid.asdc.beans.tosca.ToscaCsar;
-import org.openecomp.vid.asdc.beans.tosca.ToscaModel;
-import org.openecomp.vid.asdc.memory.InMemoryAsdcClient;
-import org.openecomp.vid.asdc.rest.RestfulAsdcClient;
-import org.openecomp.vid.properties.AsdcClientConfiguration;
-import org.openecomp.vid.properties.AsdcClientConfiguration.AsdcClientType;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/**
- * The Class VidController.
- */
-@RestController
-public class VidController extends RestrictedBaseController {
-
- /** The Constant LOG. */
- private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(VidController.class);
-
- /** The app context. */
- @Autowired
- private ApplicationContext appContext;
-
- /**
- * Gets the object mapper.
- *
- * @return the object mapper
- */
- @Bean
- public ObjectMapper getObjectMapper() {
- return new ObjectMapper();
- }
-
- /**
- * Gets the asdc client.
- *
- * @return the asdc client
- */
- @Bean
- public AsdcClient getAsdcClient() {
-
- final AsdcClientConfiguration asdcClientConfig = appContext.getBean(AsdcClientConfiguration.class);
-
- switch (asdcClientConfig.getAsdcClientType()) {
- case IN_MEMORY:
- final InputStream asdcCatalogFile = VidController.class.getClassLoader().getResourceAsStream("catalog.json");
- final JSONTokener tokener = new JSONTokener(asdcCatalogFile);
- final JSONObject catalog = new JSONObject(tokener);
-
- return new InMemoryAsdcClient.Builder().catalog(catalog).build();
- case REST:
-
- final String protocol = asdcClientConfig.getAsdcClientProtocol();
- final String host = asdcClientConfig.getAsdcClientHost();
- final int port = asdcClientConfig.getAsdcClientPort();
- final String auth = asdcClientConfig.getAsdcClientAuth();
-
- try {
- final URI uri = new URI(protocol + "://" + host + ":" + port + "/");
- return new RestfulAsdcClient.Builder(ClientBuilder.newClient(), uri)
- .auth(auth)
- .build();
- } catch (URISyntaxException e) {
- throw new RuntimeException("SDC Client could not be instantiated due to a syntax error in the URI", e);
- }
-
- default:
- throw new RuntimeException(asdcClientConfig.getAsdcClientType() + " is invalid; must be one of " + Arrays.toString(AsdcClientType.values()));
- }
- }
-
- /**
- * Gets the services.
- *
- * @param request the request
- * @return the services
- * @throws VidServiceUnavailableException the vid service unavailable exception
- */
- @RequestMapping(value={"/rest/models/services"}, method = RequestMethod.GET)
- public Collection<Service> getServices(HttpServletRequest request) throws VidServiceUnavailableException {
- try {
- return getAsdcClient().getServices(request.getParameterMap());
- } catch (AsdcCatalogException e) {
- LOG.error("Failed to retrieve service definitions from SDC", e);
- throw new VidServiceUnavailableException("Failed to retrieve service definitions from SDC", e);
- } catch (Throwable t) {
- LOG.debug("Unexpected error while retrieving service definitions from SDC: " + t.getMessage() + ":", t);
- t.printStackTrace();
- throw new VidServiceUnavailableException("Unexpected error while retrieving service definitions from SDC: " + t.getMessage(), t);
- }
- }
-
- /**
- * Gets the services.
- *
- * @param uuid the uuid
- * @return the services
- * @throws VidServiceUnavailableException the vid service unavailable exception
- */
- @RequestMapping(value={"/rest/models/services/{uuid}"}, method = RequestMethod.GET)
- public ServiceModel getServices(@PathVariable("uuid") String uuid) throws VidServiceUnavailableException {
- try {
- final ServiceModel serviceModel = new ServiceModel();
- final Map<UUID, VNF> vnfs = new HashMap<UUID, VNF> ();
- final Map<UUID, Network> networks = new HashMap<UUID, Network> ();
-
- final ToscaCsar serviceCsar = getAsdcClient().getServiceToscaModel(UUID.fromString(uuid));
- final Service asdcServiceMetadata = getAsdcClient().getService(UUID.fromString(uuid));
- final ToscaModel asdcService = serviceCsar.getParent();
-
- serviceModel.setService(ServiceModel.extractService(asdcService, asdcServiceMetadata));
-
- for (Entry<String, NodeTemplate> component: asdcService.gettopology_template().getnode_templates().entrySet()) {
- final String modelCustomizationName = component.getKey();
- final NodeTemplate nodeTemplate = component.getValue();
- final String type = nodeTemplate.getType();
-
- if (type.startsWith("org.openecomp.resource.vf")) {
- final UUID vnfUuid = UUID.fromString(nodeTemplate.getMetadata().getUUID());
- final VNF vnf = VNF.extractVnf(modelCustomizationName, nodeTemplate);
-
- if (vnf.getVersion() == null) {
- final Resource vnfMetadata = getAsdcClient().getResource(UUID.fromString(nodeTemplate.getMetadata().getUUID()));
- vnf.setVersion(vnfMetadata.getVersion());
- }
-
- vnfs.put(vnfUuid, vnf);
- }
- }
-
- for (ToscaModel vnfModel : serviceCsar.getChildren()) {
- final UUID vnfUuid = UUID.fromString(vnfModel.getMetadata().getUUID());
- final VNF vnf = vnfs.get(vnfUuid);
- final Map<UUID, VfModule> vfModules = new HashMap<UUID, VfModule> ();
- final Map<UUID, VolumeGroup> volumeGroups = new HashMap<UUID, VolumeGroup> ();
-
- if (vnf == null) {
- LOG.warn("Couldn't find VNF object " + vnfUuid + ". Problem with Tosca model?");
- continue;
- }
-
- vnf.setInputs(vnfModel.gettopology_template().getInputs());
-
- for (Entry<String, Group> component : vnfModel.gettopology_template().getGroups().entrySet()) {
- final Group group = component.getValue();
- final String type = group.getType();
-
- if (type.startsWith("org.openecomp.groups.VfModule")) {
- final UUID vfModuleUuid = UUID.fromString(group.getMetadata().getVfModuleModelUUID());
-
- vfModules.put(vfModuleUuid, VfModule.extractVfModule(group));
-
- if (Boolean.valueOf(group.getProperties().get("volume_group"))) {
- volumeGroups.put(vfModuleUuid, VolumeGroup.extractVolumeGroup(group));
- }
- }
- }
-
- vnf.setVfModules(vfModules);
- vnf.setVolumeGroups(volumeGroups);
- }
-
- serviceModel.setVnfs(vnfs);
- serviceModel.setNetworks(networks);
-
- return serviceModel;
- } catch (AsdcCatalogException e) {
- LOG.error("Failed to retrieve service definitions from SDC", e);
- throw new VidServiceUnavailableException("Failed to retrieve service definitions from SDC", e);
- }
- }
-
- /**
- * Gets the services view.
- *
- * @param request the request
- * @return the services view
- * @throws VidServiceUnavailableException the vid service unavailable exception
- */
- @RequestMapping(value={"/serviceModels"}, method=RequestMethod.GET)
- public ModelAndView getServicesView(HttpServletRequest request) throws VidServiceUnavailableException {
- return new ModelAndView("serviceModels");
- }
-}
diff --git a/vid/src/main/java/org/openecomp/vid/controller/VidHomeController.java b/vid/src/main/java/org/openecomp/vid/controller/VidHomeController.java
deleted file mode 100644
index 6a14542a0..000000000
--- a/vid/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;
- }
-
-
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/controller/ViewEditSubController.java b/vid/src/main/java/org/openecomp/vid/controller/ViewEditSubController.java
deleted file mode 100644
index 87b6b213d..000000000
--- a/vid/src/main/java/org/openecomp/vid/controller/ViewEditSubController.java
+++ /dev/null
@@ -1,107 +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 java.io.File;
-import java.text.DateFormat;
-import java.util.HashMap;
-import java.util.Map;
-
-
-
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-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 ViewEditSubController.
- */
-@RestController
-public class ViewEditSubController extends RestrictedBaseController{
-
- /** The view name. */
- String viewName;
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ViewEditSubController.class);
-
- /** The model. */
- private Map<String, Object> model = new HashMap<String, Object>();
-
- /** The servlet context. */
- private @Autowired ServletContext servletContext;
-
- /**
- * Welcome.
- *
- * @param request the request
- * @return the model and view
- */
- @RequestMapping(value = {"/vieweditsub" }, method = RequestMethod.GET)
- public ModelAndView welcome(HttpServletRequest request) {
- return new ModelAndView("vieweditsub","model", model);
- // return new ModelAndView(getViewName());
- }
-
- /**
- * Post subscriber.
- *
- * @param request the request
- */
- @RequestMapping(value="/vieweditsub/subedit", method = RequestMethod.POST)
- public void PostSubscriber(HttpServletRequest request) {
-
- String subID = request.getParameter("subscriberID");
- model.put("subInfo", subID);
-
- }
-
- /* (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;
- }
-
-
-
-
-}
-
diff --git a/vid/src/main/java/org/openecomp/vid/controller/ViewLogController.java b/vid/src/main/java/org/openecomp/vid/controller/ViewLogController.java
deleted file mode 100644
index 99b412aa4..000000000
--- a/vid/src/main/java/org/openecomp/vid/controller/ViewLogController.java
+++ /dev/null
@@ -1,84 +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 java.text.DateFormat;
-import java.text.SimpleDateFormat;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-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 ViewLogController.
- */
-@RestController
-public class ViewLogController extends RestrictedBaseController{
-
- /** The view name. */
- String viewName;
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ViewLogController.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /** The servlet context. */
- private @Autowired ServletContext servletContext;
-
- /**
- * Welcome.
- *
- * @param request the request
- * @return the model and view
- */
- @RequestMapping(value = {"/viewlog" }, 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;
- }
-
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/controller/test/TestAaiController.java b/vid/src/main/java/org/openecomp/vid/controller/test/TestAaiController.java
deleted file mode 100644
index 3bfe0b21e..000000000
--- a/vid/src/main/java/org/openecomp/vid/controller/test/TestAaiController.java
+++ /dev/null
@@ -1,93 +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.test;
-
-import java.io.IOException;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.codehaus.jackson.map.ObjectMapper;
-import org.openecomp.vid.model.ExceptionResponse;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-
-/**
- * The Class TestAaiController.
- */
-@RestController
-@RequestMapping("testaai")
-public class TestAaiController extends RestrictedBaseController {
-
- /**
- * Gets the subscription service type list.
- *
- * @param globalCustomerId the global customer id
- * @param request the request
- * @return the subscription service type list
- * @throws Exception the exception
- */
- @RequestMapping(value = "/getSubscriptionServiceTypeList/{globalCustomerId}", method = RequestMethod.GET)
- public String getSubscriptionServiceTypeList(@PathVariable("globalCustomerId") String globalCustomerId, HttpServletRequest request)
- throws Exception {
-
- System.err.println("GET SUBSCRIPTION SERVICE TYPE LIST: globalCustomerId: " + globalCustomerId);
-
- return "[\"vMOG\", \"sevice type 2\", \"sevice type 3\", \"sevice type 4\"]";
- }
-
- /**
- * Exception.
- *
- * @param e the e
- * @param response the response
- * @throws IOException Signals that an I/O exception has occurred.
- */
- @ExceptionHandler(Exception.class)
- private void exception(Exception e, HttpServletResponse response) throws IOException {
-
- /*
- * This logging step should preferably be replaced with an appropriate
- * logging method consistent whatever logging mechanism the rest of the
- * application code uses.
- */
-
- e.printStackTrace(System.err);
-
- response.setContentType("application/json; charset=UTF-8");
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-
- ExceptionResponse exceptionResponse = new ExceptionResponse();
- exceptionResponse.setException(e.getClass().toString().replaceFirst("^.*\\.", ""));
- exceptionResponse.setMessage(e.getMessage());
-
- response.getWriter().write(new ObjectMapper().writeValueAsString(exceptionResponse));
-
- response.flushBuffer();
-
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/controller/test/TestAsdcController.java b/vid/src/main/java/org/openecomp/vid/controller/test/TestAsdcController.java
deleted file mode 100644
index 2702d3673..000000000
--- a/vid/src/main/java/org/openecomp/vid/controller/test/TestAsdcController.java
+++ /dev/null
@@ -1,112 +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.test;
-
-import java.io.IOException;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.codehaus.jackson.map.ObjectMapper;
-import org.openecomp.vid.model.ExceptionResponse;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-
-/**
- * The Class TestAsdcController.
- */
-@RestController
-@RequestMapping("testasdc")
-public class TestAsdcController extends RestrictedBaseController {
-
- /**
- * Gets the model.
- *
- * @param modelId the model id
- * @param request the request
- * @return the model
- * @throws Exception the exception
- */
- @RequestMapping(value = "/getModel/{modelId}", method = RequestMethod.GET)
- public String getModel(@PathVariable("modelId") String modelId, HttpServletRequest request) throws Exception {
-
- System.err.println("SDC: GET MODEL: modelId: " + modelId);
-
- // @formatter:off
- return
- "{" +
- "\"uuid\": \"5be686dc-fdca-4d54-8548-5d0ed23e962b\"," +
- "\"invariantUUID\": \"e5962da9-fe4f-433a-bc99-b43e0d88a9a1\"," +
- "\"name\": \"DE220127\"," +
- "\"version\": \"0.1\"," +
- "\"inputs\": {" +
- "\"defaultGateway\": {" +
- "\"type\": \"String\"," +
- "\"default\": \"192.168.1.1\"," +
- "\"description\": \"Router default gateway - use any valid IPv4 address\"" +
- "}," +
- "\"subnetMask\": {" +
- "\"type\": \"String\"," +
- "\"default\": \"255.255.255.0\"," +
- "\"description\": \"Router subnet mask - example (255.255.255.0)\"" +
- "}" +
- "}" +
- "}";
- // @formatter:on
- }
-
- /**
- * Exception.
- *
- * @param e the e
- * @param response the response
- * @throws IOException Signals that an I/O exception has occurred.
- */
- @ExceptionHandler(Exception.class)
- private void exception(Exception e, HttpServletResponse response) throws IOException {
-
- /*
- * This logging step should preferably be replaced with an appropriate
- * logging method consistent whatever logging mechanism the rest of the
- * application code uses.
- */
-
- e.printStackTrace(System.err);
-
- response.setContentType("application/json; charset=UTF-8");
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-
- ExceptionResponse exceptionResponse = new ExceptionResponse();
- exceptionResponse.setException(e.getClass().toString().replaceFirst("^.*\\.", ""));
- exceptionResponse.setMessage(e.getMessage());
-
- response.getWriter().write(new ObjectMapper().writeValueAsString(exceptionResponse));
-
- response.flushBuffer();
-
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/controller/test/TestMsoController.java b/vid/src/main/java/org/openecomp/vid/controller/test/TestMsoController.java
deleted file mode 100644
index 88ffc6af6..000000000
--- a/vid/src/main/java/org/openecomp/vid/controller/test/TestMsoController.java
+++ /dev/null
@@ -1,729 +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.test;
-
-import java.io.IOException;
-import java.util.stream.Collectors;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.codehaus.jackson.map.ObjectMapper;
-import org.openecomp.vid.model.ExceptionResponse;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-
-/*
- * The "TestMsoController" class is primarily designed to help test "msoCommitController.js"
- *
- * This class expects and receives JSON data in the same format as expected
- * in the "real" application version of this code. However, string versions of JSON are
- * maintained internally here instead of marshalled / unmarshalled JSON objects.
- * The primary reasons for this were to encapsulate all the test code in this single file and
- * minimize the time required to support initial test cases.
- *
- * The non-test equivalent of this controller could alternatively incorporate POJO objects
- * instead of strings. However, the same data format sent to / received from the browser
- * JavaScript code would still be expected.
- *
- * Two specific mechanisms used in this test class may be useful to the application version:
- *
- * 1) The use of "{variable}" elements in @RequestMappings along with the corresponding
- * @PathVariable declarations.
- *
- * 2) The use of @ExceptionHandler for general purpose exception handler.
- * (See @ExceptionHandler comments)
- *
- * This class is intended to be used in either:
- *
- * A) Eclipse environments
- * OR
- * B) Linux environments with ONLY a single user running tests.
- * The "quick and dirty" error simulation approach used here makes use of static states for some
- * scenarios. Thus multiple users simultaneously testing in Linux environments
- * may have contention issues.
- */
-
-/**
- * The Class TestMsoController.
- */
-@RestController
-@RequestMapping("testmso")
-public class TestMsoController extends RestrictedBaseController {
-
- /*
- * Artificial delay (in milliseconds) added before responding to create /
- * delete requests
- */
-
- /** The Constant TEST_DELAY_SHORT_MSEC. */
- private final static int TEST_DELAY_SHORT_MSEC = 1000;
-
- /*
- * Long delay to simulate non-responsive server test
- */
-
- /** The Constant TEST_DELAY_LONG_MSEC. */
- private final static int TEST_DELAY_LONG_MSEC = 15000;
-
- /*
- * Default number of polls expected before transaction complete.
- */
-
- /** The Constant MAXIMUM_POLLS_DEFAULT. */
- private final static int MAXIMUM_POLLS_DEFAULT = 4;
-
- /*
- * Number of polls to simulate "maximum polls exceeded" test.
- */
-
- /** The Constant MAXIMUM_POLLS_LARGE. */
- private final static int MAXIMUM_POLLS_LARGE = 10;
-
- /*
- * Simulated error types. The GUI front end is expected to set these values
- * in the "modelName" field of the "mso_create_svc_instance" request.
- */
-
- /** The Constant ERROR_POLICY_EXCEPTION. */
- private final static String ERROR_POLICY_EXCEPTION = "ERROR_POLICY_EXCEPTION";
-
- /** The Constant ERROR_SERVICE_EXCEPTION. */
- private final static String ERROR_SERVICE_EXCEPTION = "ERROR_SERVICE_EXCEPTION";
-
- /** The Constant ERROR_POLL_FAILURE. */
- private final static String ERROR_POLL_FAILURE = "ERROR_POLL_FAILURE";
-
- /** The Constant ERROR_INVALID_FIELD_INITIAL. */
- private final static String ERROR_INVALID_FIELD_INITIAL = "ERROR_INVALID_FIELD_INITIAL";
-
- /** The Constant ERROR_INVALID_FIELD_POLL. */
- private final static String ERROR_INVALID_FIELD_POLL = "ERROR_INVALID_FIELD_POLL";
-
- /** The Constant ERROR_GENERAL_SERVER_EXCEPTION. */
- private final static String ERROR_GENERAL_SERVER_EXCEPTION = "ERROR_GENERAL_SERVER_EXCEPTION";
-
- /** The Constant ERROR_MAX_POLLS. */
- private final static String ERROR_MAX_POLLS = "ERROR_MAX_POLLS";
-
- /** The Constant ERROR_SERVER_TIMEOUT_INITIAL. */
- private final static String ERROR_SERVER_TIMEOUT_INITIAL = "ERROR_SERVER_TIMEOUT_INITIAL";
-
- /** The Constant ERROR_SERVER_TIMEOUT_POLL. */
- private final static String ERROR_SERVER_TIMEOUT_POLL = "ERROR_SERVER_TIMEOUT_POLL";
-
- /** The simulated error. */
- private String simulatedError = "";
-
- /** The maximum polls. */
- private int maximumPolls = 0;
-
- /** The attempt count. */
- private int attemptCount = 0;
-
- /**
- * Creates the svc instance.
- *
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_create_svc_instance", method = RequestMethod.POST)
- public ResponseEntity<String> createSvcInstance(HttpServletRequest request) throws Exception {
- readAndLogRequest("CREATE SERVICE INSTANCE", request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
-
- /*
- * This block of code simulates various errors and would NOT be expected
- * in a non-test method
- */
- System.err.println("simulatedError: " + simulatedError);
-
- if (simulatedError.equals(ERROR_POLICY_EXCEPTION)) {
- return new ResponseEntity<String>(policyExceptionResponse, HttpStatus.OK);
- }
- if (simulatedError.equals(ERROR_SERVICE_EXCEPTION)) {
- return new ResponseEntity<String>(serviceExceptionResponse, HttpStatus.OK);
- }
- if (simulatedError.equals(ERROR_INVALID_FIELD_INITIAL)) {
- /*
- * Force invalid response field name. Return
- * "XXXXXrequestReferences" instead of "requestReferences"
- */
- return new ResponseEntity<String>(acceptResponse.replace("requestReferences", "XXXXXrequestReferences"),
- HttpStatus.OK);
- }
-
- if (simulatedError.equals(ERROR_GENERAL_SERVER_EXCEPTION)) {
- throw new IOException("an example of an IO exception");
- }
-
- if (simulatedError.equals(ERROR_SERVER_TIMEOUT_INITIAL)) {
- Thread.sleep(TEST_DELAY_LONG_MSEC);
- }
-
- if (simulatedError.equals(ERROR_MAX_POLLS)) {
- maximumPolls = MAXIMUM_POLLS_LARGE;
- }
-
- /*
- * End of block of simulated error code.
- */
-
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- /**
- * Delete svc instance.
- *
- * @param serviceInstanceId the service instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_delete_svc_instance/{serviceInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> deleteSvcInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- HttpServletRequest request) throws Exception {
- readAndLogRequest("DELETE SERVICE INSTANCE: serviceInstanceId: " + serviceInstanceId, request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- /**
- * Creates the vnf instance.
- *
- * @param serviceInstanceId the service instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_create_vnf_instance/{serviceInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> createVnfInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- HttpServletRequest request) throws Exception {
- readAndLogRequest("CREATE VNF INSTANCE: serviceInstanceId: " + serviceInstanceId, request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- /**
- * Delete vnf instance.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_delete_vnf_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> deleteVnfInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletRequest request) throws Exception {
- readAndLogRequest(
- "DELETE VNF INSTANCE: serviceInstanceId: " + serviceInstanceId + " vnfInstanceId: " + vnfInstanceId,
- request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- /**
- * Creates the vf module instance.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- // /serviceInstances/v2/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs/ff305d54-75b4-ff1b-adb2-eb6b9e5460ff/vfModules
- @RequestMapping(value = "/mso_create_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> createVfModuleInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletRequest request) throws Exception {
- readAndLogRequest("CREATE VF MODULE INSTANCE: serviceInstanceId: " + serviceInstanceId + " vnfInstanceId: "
- + vnfInstanceId, request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- /**
- * Delete vf module instance.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param vfModuleInstanceId the vf module instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- // /serviceInstances/v2/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs/ff305d54-75b4-ff1b-adb2-eb6b9e5460ff/vfModules/ff305d54-75b4-ff1b-bdb2-eb6b9e5460ff
- @RequestMapping(value = "/mso_delete_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfModuleInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> deleteVfModuleInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- @PathVariable("vnfInstanceId") String vnfInstanceId,
- @PathVariable("vfModuleInstanceId") String vfModuleInstanceId, HttpServletRequest request)
- throws Exception {
- readAndLogRequest("DELETE VF MODULE INSTANCE: serviceInstanceId: " + serviceInstanceId + " vnfInstanceId: "
- + vnfInstanceId + " vfModuleInstanceId: " + vfModuleInstanceId, request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- // POST
- /**
- * Creates the volume group instance.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- // /serviceInstances/v2/ff305d54-75b4-431b-adb2-eb6b9e5ff000/volumeGroups
- @RequestMapping(value = "/mso_create_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> createVolumeGroupInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletRequest request) throws Exception {
- readAndLogRequest("CREATE VOLUME GROUP INSTANCE: seviceInstanceId: " + serviceInstanceId + " vnfInstanceId: "
- + vnfInstanceId, request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- /**
- * Delete volume group instance.
- *
- * @param serviceInstanceId the service instance id
- * @param vnfInstanceId the vnf instance id
- * @param volumeGroupInstanceId the volume group instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- // /serviceInstances/v2/ff305d54-75b4-431b-adb2-eb6b9e5ff000/volumeGroups/ff305d54-75b4-ff1b-cdb2-eb6b9e5460ff
- @RequestMapping(value = "/mso_delete_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> deleteVolumeGroupInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- @PathVariable("vnfInstanceId") String vnfInstanceId,
- @PathVariable("volumeGroupInstanceId") String volumeGroupInstanceId, HttpServletRequest request)
- throws Exception {
- readAndLogRequest("DELETE NW INSTANCE: serviceInstanceId: " + serviceInstanceId + " vnfInstanceId: "
- + vnfInstanceId + " volumeGroupInstanceId: " + volumeGroupInstanceId, request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- /**
- * Creates the nw instance.
- *
- * @param serviceInstanceId the service instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_create_nw_instance/{serviceInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> createNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- HttpServletRequest request) throws Exception {
- readAndLogRequest("CREATE NW INSTANCE: serviceInstanceId: " + serviceInstanceId, request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- /**
- * Delete nw instance.
- *
- * @param serviceInstanceId the service instance id
- * @param networkInstanceId the network instance id
- * @param request the request
- * @return the response entity
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_delete_nw_instance/{serviceInstanceId}/networks/{networkInstanceId}", method = RequestMethod.POST)
- public ResponseEntity<String> deleteNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
- @PathVariable("networkInstanceId") String networkInstanceId, HttpServletRequest request) throws Exception {
- readAndLogRequest("DELETE NW INSTANCE: serviceInstanceId: " + serviceInstanceId + " networkInstanceId: "
- + networkInstanceId, request);
- Thread.sleep(TEST_DELAY_SHORT_MSEC);
- maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
- attemptCount = 0;
- return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
- }
-
- /**
- * Gets the orchestration request.
- *
- * @param requestId the request id
- * @param request the request
- * @return the orchestration request
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_get_orch_req/{requestId}", method = RequestMethod.GET)
- public ResponseEntity<String> getOrchestrationRequest(@PathVariable("requestId") String requestId,
- HttpServletRequest request) throws Exception {
-
- System.err.println("GET ORCHESTRATION REQUEST: requestId: " + requestId);
-
- /*
- * This block of code simulates various errors and would NOT be expected
- * in a non-test method
- */
-
- if (simulatedError.equals(ERROR_INVALID_FIELD_POLL)) {
- /*
- * Force invalid response field name. Return "XXXXXrequestStatus"
- * instead of "requestStatus"
- */
- return new ResponseEntity<String>(inProgressResponse.replace("requestStatus", "XXXXXrequestStatus"),
- HttpStatus.OK);
- }
-
- if (simulatedError.equals(ERROR_POLL_FAILURE)) {
- /*
- * Force status field with "Failure"
- */
- return new ResponseEntity<String>(inProgressResponse.replace("InProgress", "Failure"), HttpStatus.OK);
- }
-
- if (simulatedError.equals(ERROR_SERVER_TIMEOUT_POLL)) {
- Thread.sleep(TEST_DELAY_LONG_MSEC);
- }
-
- /*
- * End of block of simulated error code.
- */
-
- /*
- * This logic simulates how MSO might behave ... i.e. return different
- * results depending on the value of 'maximumPolls'.
- *
- */
- int percentProgress = (++attemptCount * 100) / maximumPolls;
-
- System.err.println("attempts: " + attemptCount + " max: " + maximumPolls + " percent: " + percentProgress);
-
- String response = inProgressResponse.replace("\"50\"", "\"" + Integer.toString(percentProgress) + "\"");
-
- if (attemptCount < maximumPolls) {
- if (attemptCount > 1) {
- response = response.replace("vLan setup", "setup step " + Integer.toString(attemptCount));
- }
- return new ResponseEntity<String>(response, HttpStatus.OK);
- } else {
- return new ResponseEntity<String>(
- response.replace("InProgress", "Complete").replace("vLan setup complete", ""), HttpStatus.OK);
- }
- }
-
- /**
- * Gets the orchestration requests.
- *
- * @param filterString the filter string
- * @param request the request
- * @return the orchestration requests
- * @throws Exception the exception
- */
- @RequestMapping(value = "/mso_get_orch_reqs/{filterString}", method = RequestMethod.GET)
- public ResponseEntity<String> getOrchestrationRequests(@PathVariable("filterString") String filterString,
- HttpServletRequest request) throws Exception {
-
- System.err.println("GET ORCHESTRATION REQUESTS: filterString: " + filterString);
-
- return new ResponseEntity<String>(getOrchestrationRequestsResponse, HttpStatus.OK);
-
- }
-
- /*
- * General purpose exception handler that could be used in application code.
- *
- * The method returns exceptions as error code 500. Both the exception type
- * and message are written as a JSON object.
- *
- * See the following references:
- *
- * 1) The ExceptionResponse POJO.
- *
- * 2) The "getHttpErrorMessage" function in "utilityService.js" - an example
- * of how the browser JavaScript code can interpret this response.
- */
-
- /**
- * Exception.
- *
- * @param e the e
- * @param response the response
- * @throws IOException Signals that an I/O exception has occurred.
- */
- @ExceptionHandler(Exception.class)
- private void exception(Exception e, HttpServletResponse response) throws IOException {
-
- /*
- * This logging step should preferably be replaced with an appropriate
- * logging method consistent whatever logging mechanism the rest of the
- * application code uses.
- */
-
- e.printStackTrace(System.err);
-
- response.setContentType("application/json; charset=UTF-8");
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-
- ExceptionResponse exceptionResponse = new ExceptionResponse();
- exceptionResponse.setException(e.getClass().toString().replaceFirst("^.*\\.", ""));
- exceptionResponse.setMessage(e.getMessage());
-
- response.getWriter().write(new ObjectMapper().writeValueAsString(exceptionResponse));
-
- response.flushBuffer();
-
- }
-
- /*
- * 'readAndLogRequest' only intended to be used for testing.
- *
- * The method reads JSON from the input stream and thus prevents other
- * mechanisms from reading the input.
- */
-
- /**
- * Read and log request.
- *
- * @param label the label
- * @param request the request
- * @throws Exception the exception
- */
- private void readAndLogRequest(String label, HttpServletRequest request) throws Exception {
- String input = request.getReader().lines().collect(Collectors.joining(System.lineSeparator()));
-
- ObjectMapper mapper = new ObjectMapper();
- Object json = mapper.readValue(input, Object.class);
-
- System.err.println(label + "\n" + mapper.writerWithDefaultPrettyPrinter().writeValueAsString(json));
-
- /*
- * Only needed for error simulation ...
- */
- if (input.matches("^.*modelName.*$")) {
- simulatedError = input.replaceAll("^.*\"modelName\":\"", "").replaceAll("\".*$", "");
- }
- }
-
- /*
- * Various test responses:
- */
-
- // @formatter:off
-
- /** The accept response. */
- /*
- * Sample responses to initial create / delete transaction
- */
- private String acceptResponse =
- "{" +
- " \"status\": 202," +
- " \"entity\": {" +
- " \"requestReferences\": {" +
- " \"instanceId\": \"bc305d54-75b4-431b-adb2-eb6b9e546014\"," +
- " \"requestId\": \"rq1234d1-5a33-55df-13ab-12abad84e331\"" +
- " }" +
- " }" +
- "}";
-
- /** The policy exception response. */
- private String policyExceptionResponse =
- "{" +
- " \"status\": 400," +
- " \"entity\": { " +
- " \"requestError\": {" +
- " \"policyException\": {" +
- " \"messageId\": \"POL9003\"," +
- " \"text\": \"Message content size exceeds the allowable limit\"" +
- " }" +
- " }" +
- " }" +
- "}";
-
- /** The service exception response. */
- private String serviceExceptionResponse =
- "{" +
- " \"status\": 400," +
- " \"entity\": { " +
- " \"requestError\": {" +
- " \"serviceException\": {" +
- " \"messageId\": \"SVC2000\"," +
- " \"text\": \"Missing Parameter: %1. Error code is %2\"," +
- " \"variables\": [" +
- " \"severity\"," +
- " \"400\"" +
- " ]" +
- " }" +
- " }" +
- " }" +
- "}" +
- "";
-
- /** The in progress response. */
- /*
- * Sample response to subsequent getOrchestrationRequest
- */
- private String inProgressResponse =
- "{" +
- " \"status\": 200," +
- " \"entity\": {" +
- " \"request\": {" +
- " \"requestId\": \"rq1234d1-5a33-55df-13ab-12abad84e333\"," +
- " \"startTime\": \"Thu, 04 Jun 2009 02:51:59 GMT\"," +
- " \"instanceIds\": {" +
- " \"serviceInstanceId\": \"bc305d54-75b4-431b-adb2-eb6b9e546014\"" +
- " }," +
- " \"requestScope\": \"service\"," +
- " \"requestType\": \"createInstance\"," +
- " \"requestDetails\": {" +
- " \"modelInfo\": {" +
- " \"modelType\": \"service\"," +
- " \"modelId\": \"sn5256d1-5a33-55df-13ab-12abad84e764\"," +
- " \"modelNameVersionId\": \"ab6478e4-ea33-3346-ac12-ab121484a333\"," +
- " \"modelName\": \"WanBonding\"," +
- " \"modelVersion\": \"1\"" +
- " }," +
- " \"subscriberInfo\": {" +
- " \"globalSubscriberId\": \"C12345\"," +
- " \"subscriberName\": \"General Electric Division 12\"" +
- " }," +
- " \"requestParameters\": {" +
- " \"vpnId\": \"1a2b3c4d5e6f\"," +
- " \"productName\": \"Trinity\"," +
- " \"customerId\": \"icore9883749\"" +
- " }" +
- " }," +
- " \"requestStatus\": {" +
- " \"timestamp\": \"Thu, 04 Jun 2009 02:53:39 GMT\"," +
- " \"requestState\": \"InProgress\"," +
- " \"statusMessage\": \"vLan setup complete\"," +
- " \"percentProgress\": \"50\"" +
- " }" +
- " }" +
- " }" +
- "}";
-
- /*
- * Sample response to subsequent getOrchestrationRequests
- */
-
- /** The get orchestration requests response. */
- private String getOrchestrationRequestsResponse =
- "{" +
- " \"status\": 200," +
- " \"entity\": {" +
- " \"requestList\": [" +
- " {" +
- " \"request\": {" +
- " \"requestId\": \"rq1234d1-5a33-55df-13ab-12abad84e333\"," +
- " \"startTime\": \"Thu, 04 Jun 2009 02:51:59 GMT\"," +
- " \"finishTime\": \"Thu, 04 Jun 2009 02:55:59 GMT\"," +
- " \"instanceReferences\": {" +
- " \"serviceInstanceId\": \"bc305d54-75b4-431b-adb2-eb6b9e546014\"" +
- " }," +
- " \"requestScope\": \"service\"," +
- " \"requestType\": \"createInstance\"," +
- " \"requestDetails\": {" +
- " \"modelInfo\": {" +
- " \"modelType\": \"service\"," +
- " \"modelId\": \"sn5256d1-5a33-55df-13ab-12abad84e764\"," +
- " \"modelNameVersionId\": \"ab6478e4-ea33-3346-ac12-ab121484a333\"," +
- " \"modelName\": \"WanBonding\"," +
- " \"modelVersion\": \"1\"" +
- " }," +
- " \"subscriberInfo\": {" +
- " \"globalSubscriberId\": \"C12345\"," +
- " \"subscriberName\": \"General Electric Division 12\"" +
- " }," +
- " \"requestParameters\": {" +
- " \"vpnId\": \"1a2b3c4d5e6f\"," +
- " \"productName\": \"Trinity\"," +
- " \"customerId\": \"icore9883749\"" +
- " }" +
- " }," +
- " \"requestStatus\": {" +
- " \"timestamp\": \"Thu, 04 Jun 2009 02:54:49 GMT\"," +
- " \"requestState\": \"complete\"," +
- " \"statusMessage\": \"Resource Created\"," +
- " \"percentProgress\": \"100\"" +
- " }" +
- " }" +
- " }," +
- " {" +
- " \"request\": {" +
- " \"requestId\": \"rq1234d1-5a33-55df-13ab-12abad84e334\"," +
- " \"startTime\": \"Thu, 04 Jun 2009 03:52:59 GMT\"," +
- " \"instanceReferences\": {" +
- " \"serviceInstanceId\": \"bc305d54-75b4-431b-adb2-eb6b9e546014\"" +
- " }," +
- " \"requestScope\": \"service\"," +
- " \"requestType\": \"updateInstance\"," +
- " \"requestDetails\": {" +
- " \"modelInfo\": {" +
- " \"modelType\": \"service\"," +
- " \"modelId\": \"sn5256d1-5a33-55df-13ab-12abad84e764\"," +
- " \"modelNameVersionId\": \"ab6478e4-ea33-3346-ac12-ab121484a333\"," +
- " \"modelName\": \"WanBonding\"," +
- " \"modelVersion\": \"1\"" +
- " }," +
- " \"subscriberInfo\": {" +
- " \"globalSubscriberId\": \"C12345\"," +
- " \"subscriberName\": \"General Electric Division 12\"" +
- " }," +
- " \"requestParameters\": {" +
- " \"vpnId\": \"1a2b3c4d5e70\"," +
- " \"productName\": \"Trinity\"," +
- " \"customerId\": \"icore9883749\"" +
- " }" +
- " }," +
- " \"requestStatus\": {" +
- " \"timestamp\": \"Thu, 04 Jun 2009 03:53:39 GMT\"," +
- " \"requestState\": \"InProgress\"," +
- " \"statusMessage\": \"vLan setup complete\"," +
- " \"percentProgress\": \"50\"" +
- " }" +
- " }" +
- " }" +
- " ]" +
- " }" +
- "}";
-}
diff --git a/vid/src/main/java/org/openecomp/vid/controller/test/TestPageController.java b/vid/src/main/java/org/openecomp/vid/controller/test/TestPageController.java
deleted file mode 100644
index c2c2b04ff..000000000
--- a/vid/src/main/java/org/openecomp/vid/controller/test/TestPageController.java
+++ /dev/null
@@ -1,57 +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.test;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.servlet.ModelAndView;
-
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
-
-/**
- * The Class TestPageController.
- */
-@Controller
-public class TestPageController extends RestrictedBaseController {
-
- /**
- * Test mso page.
- *
- * @return the model and view
- */
- @RequestMapping(value = { "testMso.htm" }, method = RequestMethod.GET)
- public ModelAndView testMsoPage() {
- return new ModelAndView(getViewName());
- }
-
- /**
- * Test view edit page.
- *
- * @return the model and view
- */
- @RequestMapping(value = { "testViewEdit" }, method = RequestMethod.GET)
- public ModelAndView testViewEditPage() {
- return new ModelAndView(getViewName());
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/dao/ProfileDao.java b/vid/src/main/java/org/openecomp/vid/dao/ProfileDao.java
deleted file mode 100644
index b50b58b7c..000000000
--- a/vid/src/main/java/org/openecomp/vid/dao/ProfileDao.java
+++ /dev/null
@@ -1,45 +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.dao;
-
-import java.util.List;
-import org.openecomp.portalsdk.core.domain.Profile;
-
-/**
- * The Interface ProfileDao.
- */
-public interface ProfileDao {
-
- /**
- * Find all.
- *
- * @return the list
- */
- List<Profile> findAll();
-
- /**
- * Gets the profile.
- *
- * @param id the id
- * @return the profile
- */
- Profile getProfile(int id);
-}
diff --git a/vid/src/main/java/org/openecomp/vid/encryption/EncryptConvertor.java b/vid/src/main/java/org/openecomp/vid/encryption/EncryptConvertor.java
deleted file mode 100644
index 51a5ee2e3..000000000
--- a/vid/src/main/java/org/openecomp/vid/encryption/EncryptConvertor.java
+++ /dev/null
@@ -1,261 +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.encryption;
-
-import java.lang.Character;
-
-/**
- * The Class EncryptConvertor.
- */
-public class EncryptConvertor {
-
- /** The Constant HEX_CHARS. */
- private static final char[] HEX_CHARS = "0123456789abcdef".toCharArray();
-
- /**
- * toHexString(String) - convert a string into its hex equivalent.
- *
- * @param buf the buf
- * @return the string
- */
- public final static String toHexString(String buf) {
- if (buf == null) return "";
- return toHexString(buf.getBytes());
- }
-
- /**
- * toHexString(byte[]) - convert a byte-string into its hex equivalent.
- *
- * @param buf the buf
- * @return the string
- */
- public final static String toHexString(byte[] buf) {
-
- if (buf == null) return "";
- char[] chars = new char[2 * buf.length];
- for (int i = 0; i < buf.length; ++i) {
- chars[2 * i] = HEX_CHARS[(buf[i] & 0xF0) >>> 4];
- chars[2 * i + 1] = HEX_CHARS[buf[i] & 0x0F];
- }
- return new String(chars);
- }
-
- // alternate implementation that's slightly slower
-// protected static final byte[] Hexhars = {
-// '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
-// };
-// public static String encode(byte[] b) {
-// StringBuilder s = new StringBuilder(2 * b.length);
-// for (int i = 0; i < b.length; i++) {
-// int v = b[i] & 0xff;
-// s.append((char)Hexhars[v >> 4]);
-// s.append((char)Hexhars[v & 0xf]);
-// }
-// return s.toString();
-// }
-
- /**
- * Convert a hex string to its equivalent value.
- *
- * @param hexString the hex string
- * @return the string
- * @throws Exception the exception
- */
- public final static String stringFromHex(String hexString) throws Exception
- {
- if (hexString == null) return "";
- return stringFromHex(hexString.toCharArray());
- }
-
- /**
- * String from hex.
- *
- * @param hexCharArray the hex char array
- * @return the string
- * @throws Exception the exception
- */
- public final static String stringFromHex(char[] hexCharArray)
- throws Exception {
- if (hexCharArray == null) return "";
- return new String(bytesFromHex(hexCharArray));
- }
-
- /**
- * Bytes from hex.
- *
- * @param hexString the hex string
- * @return the byte[]
- * @throws Exception the exception
- */
- public final static byte[] bytesFromHex(String hexString) throws Exception
- {
- if (hexString == null) return new byte[0];
- return bytesFromHex(hexString.toCharArray());
- }
-
- /**
- * Bytes from hex.
- *
- * @param hexCharArray the hex char array
- * @return the byte[]
- * @throws Exception the exception
- */
- public final static byte[] bytesFromHex(char[] hexCharArray)
- throws Exception {
- if (hexCharArray == null) return new byte[0];
- int len = hexCharArray.length;
- if ((len % 2) != 0) throw new Exception("Odd number of characters: '" + String.valueOf(hexCharArray) + "'");
- byte [] txtInByte = new byte [len / 2];
- int j = 0;
- for (int i = 0; i < len; i += 2) {
- txtInByte[j++] = (byte)(((fromHexDigit(hexCharArray[i], i) << 4) | fromHexDigit(hexCharArray[i+1], i)) & 0xFF);
- }
- return txtInByte;
- }
-
- /**
- * From hex digit.
- *
- * @param ch the ch
- * @param index the index
- * @return the int
- * @throws Exception the exception
- */
- protected final static int fromHexDigit(char ch, int index) throws Exception
- {
- int digit = Character.digit(ch, 16);
- if (digit == -1) throw new Exception("Illegal hex character '" + ch + "' at index " + index);
- return digit;
- }
-
- // UNIT TESTS (same junit, but we want to run from command line
-
- /**
- * Check to hex string B.
- *
- * @param arg the arg
- * @param expected the expected
- * @return true, if successful
- */
- public static boolean checkToHexStringB(String arg, String expected) {
- String ret = toHexString(arg != null ? arg.getBytes() : null);
- System.out.println("toHexString(" + arg + ")=> " + ret);
- if (!ret.equals(expected)) System.out.println("\tWRONG, expected: " + expected);
- return ret.equals(expected);
- }
-
- /**
- * Check to hex string.
- *
- * @param arg the arg
- * @param expected the expected
- * @return true, if successful
- */
- public static boolean checkToHexString(String arg, String expected) {
- String ret = toHexString(arg);
- System.out.println("toHexString(" + arg + ")=> " + ret);
- if (!ret.equals(expected)) System.out.println("\tWRONG, expected: " + expected);
- return ret.equals(expected);
- }
-
- /**
- * Check from hex string.
- *
- * @param arg the arg
- * @param expected the expected
- * @return true, if successful
- */
- public static boolean checkFromHexString(String arg, String expected) {
- try {
- String ret = stringFromHex(arg);
- System.out.println("fromHexString(" + arg + ")=> " + ret);
- if (!ret.equals(expected)) System.out.println("\tWRONG, expected: " + expected);
- return ret.equals(expected);
- } catch (Exception e) {
- System.out.println("Caught exception: " + e.toString());
- return false;
- }
- }
-
- /**
- * Check from hex string B.
- *
- * @param arg the arg
- * @param expected the expected
- * @return true, if successful
- */
- public static boolean checkFromHexStringB(String arg, String expected) {
- try {
- byte[] ret = bytesFromHex(arg);
- String sret = new String(ret);
- System.out.println("fromHexString(" + arg + ")=> " + sret);
- if (!sret.equals(expected)) System.out.println("\tWRONG, expected: " + expected);
- return sret.equals(expected);
- } catch (Exception e) {
- System.out.println("Caught exception: " + e.toString());
- return false;
- }
- }
-
-
- /**
- * The main method.
- *
- * @param args the arguments
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- int pass = 0, fail = 0;
- if (checkToHexString("", "")) pass++; else fail++;
- if (checkToHexString(null, "")) pass++; else fail++;
- if (checkToHexString("0", "30")) pass++; else fail++;
- if (checkToHexString("abc", "616263")) pass++; else fail++;
- if (checkToHexString("!@#$%^&*()", "21402324255e262a2829")) pass++; else fail++;
- if (checkToHexStringB("", "")) pass++; else fail++;
- if (checkToHexStringB(null, "")) pass++; else fail++;
- if (checkToHexStringB("0", "30")) pass++; else fail++;
- if (checkToHexStringB("abc", "616263")) pass++; else fail++;
- if (checkToHexStringB("!@#$%^&*()", "21402324255e262a2829")) pass++; else fail++;
- if (checkFromHexString("", "")) pass++; else fail++;
- if (checkFromHexString(null, "")) pass++; else fail++;
- if (checkFromHexString("30", "0")) pass++; else fail++;
- if (checkFromHexString("616263", "abc")) pass++; else fail++;
- if (checkFromHexString("21402324255e262a2829", "!@#$%^&*()")) pass++; else fail++;
- if (checkFromHexStringB("", "")) pass++; else fail++;
- if (checkFromHexStringB(null, "")) pass++; else fail++;
- if (checkFromHexStringB("30", "0")) pass++; else fail++;
- if (checkFromHexStringB("616263", "abc")) pass++; else fail++;
- if (checkFromHexStringB("21402324255e262a2829", "!@#$%^&*()")) pass++; else fail++;
- System.out.println("Tests passed: " + Integer.toString(pass));
- System.out.println("Tests failed: " + Integer.toString(fail));
- System.out.println("=======");
- System.out.println("abc toHex = " + toHexString("abc"));
- System.out.println("123 toHex = " + toHexString("123"));
- try {
- System.out.println("616263 FromHex = " + stringFromHex("616263"));
- System.out.println("313233 FromHex = " + stringFromHex("313233"));
- //System.out.println("current key FromHex = " + stringFromHex("57ajqe{kJjjarj}G#(3)ea7"));
- } catch (Exception e) {
- System.out.println("exception: " + e.toString());
- }
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/encryption/EncryptedConfiguration.java b/vid/src/main/java/org/openecomp/vid/encryption/EncryptedConfiguration.java
deleted file mode 100644
index 30d40812d..000000000
--- a/vid/src/main/java/org/openecomp/vid/encryption/EncryptedConfiguration.java
+++ /dev/null
@@ -1,413 +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.encryption;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.MessageDigest;
-import java.util.Properties;
-
-import javax.crypto.Cipher;
-import javax.crypto.spec.SecretKeySpec;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.DefaultParser;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-
-
-/**
- * Class to manage encrypted configuration values.
- */
-public class EncryptedConfiguration {
-
- /** The logger. */
- static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EncryptedConfiguration.class);
-
-
- /** Our secret key and method. */
- private String encryptionKey;
-
- /** The encryption method. */
- private String encryptionMethod;
-
- /**
- * Where to log when things go wrong.
- *
- * @param key the key
- * @param method the method
- */
-
- public EncryptedConfiguration(String key, String method) {
- encryptionKey = key.trim();
- encryptionMethod = method;
- }
-
- /**
- * Retrieve an encrypted string from the given configuration.
- * The name will have ".x" appended to it.
- * Decoded from hex, it will be "method:hexsalt:hexvalue".
- * The format of the value will be in hex.
- * Method will be "r" to begin with, for "rc4".
- *
- * @param f the f
- * @param name the name
- * @param deflt the deflt
- * @return the string
- * @throws Exception the exception
- */
- public String getString(String f, String name, String deflt)
- throws Exception {
- logger.debug(EELFLoggerDelegate.debugLogger, "==> getString");
- return getString(f, name, deflt, encryptionKey);
- }
-
- /**
- * Retrieve an encrypted string from the given configuration.
- * The name will have ".x" appended to it.
- * Decoded from hex, it will be "method:hexsalt:hexvalue".
- * The format of the value will be in hex.
- * Method will be "r" to begin with, for "rc4".
- *
- * @param f the f
- * @param name the name
- * @param deflt the deflt
- * @param key the key
- * @return the string
- * @throws Exception the exception
- */
- public String getString(String f, String name, String deflt, String key)
- throws Exception {
-
- logger.debug(EELFLoggerDelegate.debugLogger, "==> getString");
- logger.debug(EELFLoggerDelegate.debugLogger, " key = " + key);
- Properties prop = new Properties();
- InputStream input = null;
-
- try {
- input = new FileInputStream(f);
-
- prop.load(input);
-
- /* for testing, a dump of all key-value pairs
- Enumeration<?> e = prop.propertyNames();
- while (e.hasMoreElements()) {
- String k = (String) e.nextElement();
- String value = prop.getProperty(k);
- System.out.println("Key : " + k + ", Value : " + value);
- }
- */
-
- } catch (IOException ex) {
- ex.printStackTrace(); // TODO: fix
- } finally {
- input.close();
- }
-
- String str = prop.getProperty(name + ".x");
- logger.debug(EELFLoggerDelegate.debugLogger, "str = " + str);
-
- if (str == null) {
- // not encrypted version
- str = prop.getProperty(name);
- if (str == null) {
- return deflt;
- }
- return str;
- }
-
- String method = encryptionMethod;
- logger.debug(EELFLoggerDelegate.debugLogger, "method = " + method);
- String salt = EncryptedConfiguration.generateSalt();
- logger.debug(EELFLoggerDelegate.debugLogger, "salt = " + salt);
-
- return decrypt(str, key, method, salt);
- }
-
- /**
- * Decrypt a string in 'method:hexsalt:hexvalue' format.
- *
- * @param triple the triple
- * @param key the key
- * @param method the method
- * @param salt the salt
- * @return the string
- * @throws Exception the exception
- */
- public static String decrypt(String triple, String key, String method, String salt) throws Exception {
- /*
- String[] strParts = triple.trim().split(":");
- if (strParts.length != 3) throw new Exception("Encrypted value must look like 'x:y:z'");
- return decrypt(strParts[0], Convert.stringFromHex(strParts[1]), key, Convert.bytesFromHex(strParts[2]));
- */
-
- return decrypt(method, salt, key, EncryptConvertor.bytesFromHex(triple));
- }
-
- /**
- * Decrypt a string 'method:hexsalt:hexvalue' format.
- *
- * @param method the method
- * @param salt the salt
- * @param key the key
- * @param bvalue the bvalue
- * @return the string
- * @throws Exception the exception
- */
- public static String decrypt(String method, String salt, String key, byte[] bvalue) throws Exception {
- logger.debug(EELFLoggerDelegate.debugLogger, "==> decrypt method");
- logger.debug(EELFLoggerDelegate.debugLogger, " method = " + method);
- logger.debug(EELFLoggerDelegate.debugLogger, " salt = " + salt);
- logger.debug(EELFLoggerDelegate.debugLogger, " key = " + key);
- byte[] secretKey = runDigest(salt + "." + key);
-
- SecretKeySpec skeySpec = new SecretKeySpec(secretKey, method);
-
- Cipher cipher = Cipher.getInstance(method); // "AES"
- cipher.init(Cipher.DECRYPT_MODE, skeySpec);
-
- byte[] decrypted = cipher.doFinal(bvalue);
- return new String(decrypted);
- }
-
- /**
- * Encrypt a string using the given method, salt and key.
- *
- * @param method the method
- * @param salt the salt
- * @param key the key
- * @param value the value
- * @return the byte[]
- * @throws Exception the exception
- */
- public static byte[] encrypt(String method, String salt, String key, String value) throws Exception {
- logger.debug(EELFLoggerDelegate.debugLogger, "==> encrypt() method");
- byte[] bvalue = value.getBytes();
- byte[] secretKey = runDigest(salt + "." + key);
-
- SecretKeySpec skeySpec = new SecretKeySpec(secretKey, method);
-
- Cipher cipher = Cipher.getInstance(method); // "AES"
- cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
-
- byte[] encrypted = cipher.doFinal(bvalue);
- return encrypted;
- }
-
- /**
- * Prepare a secret key by running a digest on it.
- *
- * @param text the text
- * @return the byte[]
- * @throws Exception the exception
- */
- private static byte[] runDigest(String text) throws Exception {
- logger.debug(EELFLoggerDelegate.debugLogger, "==> runDigest() method");
- MessageDigest md = MessageDigest.getInstance("MD5");
- md.reset();
- md.update(text.getBytes(), 0, text.length());
- return md.digest();
- }
-
- /**
- * Encrypt a string using the given method, salt and key, and return it as a hex-formated triple.
- *
- * @param method the method
- * @param salt the salt
- * @param key the key
- * @param value the value
- * @return the string
- * @throws Exception the exception
- */
- public static String encryptToTriple(String method, String salt, String key, String value) throws Exception {
- logger.debug(EELFLoggerDelegate.debugLogger, "==> Enter encryptToTriple()");
- logger.debug(EELFLoggerDelegate.debugLogger, "method = " + method);
- logger.debug(EELFLoggerDelegate.debugLogger, "salt = " + salt);
- logger.debug(EELFLoggerDelegate.debugLogger, "key = " + key);
- logger.debug(EELFLoggerDelegate.debugLogger, "valye = " + value);
-
- /*
- StringBuffer sb = new StringBuffer(method);
- sb.append(":").append(Convert.toHexString(salt))
- .append(":").append(Convert.toHexString(encrypt(method, salt, key, value)));
- logger.debug("s = " + sb.toString());
- */
-
- StringBuffer sb2 = new StringBuffer("");
- sb2.append(EncryptConvertor.toHexString(encrypt(method, salt, key, value)));
- String s = sb2.toString();
- logger.debug(EELFLoggerDelegate.debugLogger, "s = " + s);
- return s;
- }
-
- /**
- * Create a value that can be used as a salt.
- *
- * @return the string
- */
- public static String generateSalt() {
- logger.debug(EELFLoggerDelegate.debugLogger, "==> generaltSalt");
-
- // G2 wants to hard code the value for salt.
- // set the value as 123456789
- // return Long.toString(System.currentTimeMillis() % 1000) + Pid.getPidStr();
- return Long.toString(123456789 % 10000);
- }
-
- /**
- * Usage.
- */
- public static void usage() {
- usage(null);
- }
-
- /**
- * Usage.
- *
- * @param msg the msg
- */
- public static void usage(String msg) {
- if (msg != null) System.out.println(msg);
- System.out.println("Usage: java EncryptedConfiguration -D triple -k key\n" +
- "java EncryptedConfiguration -d string -m method [-s salt | -S] -k key\n" +
- "java EncryptedConfiguration -e string -m method [-s salt | -S] -k key\n" +
- "-D\tdecrypt x:y:z triple\n" +
- "-d\tdecrypt string (in hex)\n" +
- "-e\tencrypt string\n" +
- "-S\tgenerate a salt\n"
- );
- System.exit(1);
- }
-
-
-
- /**
- * The main method.
- *
- * @param args the arguments
- */
- public static void main(String[] args) {
-
- Options options = new Options();
- options.addOption("s", true, "salt");
- options.addOption("S", false, "Generate salt");
- options.addOption("k", true, "key");
- options.addOption("m", true, "method");
- options.addOption("e", true, "encryptString");
- options.addOption("d", true, "decryptString");
- options.addOption("D", true, "triple x:y:z");
- options.addOption("h", false, "show help");
- options.addOption("?", false, "show help");
-
- String salt = null, key = null, method = null, encStr = null, decStr = null, triple = null;
- boolean genSalt = false;
-
- CommandLineParser parser = new DefaultParser();
- CommandLine cmd = null;
-
- try {
- cmd = parser.parse(options, args);
-
- System.out.println("You picked " + cmd.toString() + "\n");
- if (cmd.hasOption("s")) {
- salt = cmd.getOptionValue("s");
- }
- if (cmd.hasOption("S")) {
- genSalt = true;
- System.out.println("here in S");
- }
- if (cmd.hasOption("k")) {
- key = cmd.getOptionValue("k");
- }
- if (cmd.hasOption("m")) {
- method = cmd.getOptionValue("m");
- }
- if (cmd.hasOption("e")) {
- encStr = cmd.getOptionValue("e");
- }
- if (cmd.hasOption("d")) {
- decStr = cmd.getOptionValue("d");
- }
- if (cmd.hasOption("D")) {
- triple = cmd.getOptionValue("D");
- }
- if (cmd.hasOption("?") || cmd.hasOption("h")) {
- usage();
- System.exit(0);
- }
-
- if (triple == null) {
- if ((salt == null) && !genSalt) usage("one of -s or -S must be specified");
- if ((salt != null) && genSalt) usage("only one of -s or -S must be specified");
- if (key == null) usage("-k must be specified");
- if (method == null) usage("-m must be specified");
- if ((encStr == null) && (decStr == null)) usage("one of -d or -e must be specified");
- if ((encStr != null) && (decStr != null)) usage("only one of -d or -e may be specified");
- if (genSalt) {
- salt = generateSalt();
- System.out.println("salt = " + salt);
- }
-
- if (encStr != null)
- System.out.println(encryptToTriple(method, salt, key, encStr));
- if (decStr != null)
- System.out.println(decrypt(method, salt, key, EncryptConvertor.bytesFromHex(decStr)));
- } else {
- if (key == null) {
- usage("-k not specified");
- System.exit(0);
- }
- System.out.println(decrypt(triple, key, method, salt));
- }
-
- } catch (ParseException e) {
- System.out.println("Failed to parse command line properties e="+e.toString());
- } catch (Exception e) {
- System.out.println("Failed to run EncryptedConfiguration main() e="+e.toString());
- }
-
- // http://forums.sun.com/thread.jspa?threadID=5290983
- // try {
- // String message = "Strong Versus Unlimited Strength Cryptography";
- // SecretKeySpec skeySpec = new SecretKeySpec("0123456789ABCDEF".getBytes(), "AES"); //AES-128
-
- // Cipher cipher = Cipher.getInstance("AES"); // "AES/ECB/NoPadding"
- // cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
-
- // byte[] encrypted = cipher.doFinal(message.getBytes());
- // System.out.println("encrypted string: " + encrypted); //storing into MySQL DB
- // System.out.println("in hex: '" + Convert.toHexString(encrypted) + "'");
-
- // cipher.init(Cipher.DECRYPT_MODE, skeySpec);
- // byte[] original = cipher.doFinal(encrypted);
- // String originalString = new String(original);
- // System.out.println("Original string: " + originalString);
- // } catch (Exception e) {
- // System.err.println("Exception caught: " + e.toString());
- // }
- System.exit(0);
-
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/encryption/EncryptedPropValue.java b/vid/src/main/java/org/openecomp/vid/encryption/EncryptedPropValue.java
deleted file mode 100644
index 651df697c..000000000
--- a/vid/src/main/java/org/openecomp/vid/encryption/EncryptedPropValue.java
+++ /dev/null
@@ -1,279 +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.encryption;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.DefaultParser;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-
-/**
- * The Class EncryptedPropValue.
- */
-public class EncryptedPropValue {
-
- /** The encrypted configuration. */
- private EncryptedConfiguration encryptedConfiguration;
-
- /** The encryption key. */
- private String encryptionKey;
-
- /** The encryption method. */
- private String encryptionMethod;
-
- /** The logger. */
- static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EncryptedPropValue.class);
-
- /**
- * Instantiates a new encrypted prop value.
- */
- public EncryptedPropValue() {
- // encryptionKey = "57ajqe{kJjjarj}G#(3)ea7";
- encryptionKey = "aa1adm1n";
- encryptionMethod = "AES";
- encryptedConfiguration = new EncryptedConfiguration(encryptionKey, encryptionMethod);
- }
-
- /**
- * Gets the encrypted string.
- *
- * @param f the f
- * @param name the name
- * @param deflt the deflt
- * @return the encrypted string
- * @throws Exception the exception
- */
- public String getEncryptedString(String f, String name, String deflt) throws Exception {
- return encryptedConfiguration.getString(f, name, deflt);
- }
-
- /**
- * Generate encrypted property.
- *
- * @param name the name
- * @param value the value
- */
- public static void generateEncryptedProperty(String name, String value) {
- logger.debug(EELFLoggerDelegate.debugLogger, "==> generateEncryptedProperty");
- EncryptedPropValue aaiPropValue = new EncryptedPropValue();
- try {
- System.out.println(name + ".x=" +
- EncryptedConfiguration.encryptToTriple(
- aaiPropValue.encryptionMethod,
- EncryptedConfiguration.generateSalt(),
- aaiPropValue.encryptionKey, value));
- } catch (Exception e) {
- System.err.println("Cannot encrypt '" + value + "' for property '" + name + "': "+ e.toString());
- }
- }
-
- /**
- * Extract property.
- *
- * @param f the f
- * @param name the name
- */
- public static void extractProperty(String f, String name) {
- EncryptedPropValue aaiPropValue = new EncryptedPropValue();
- String val = "";
- logger.debug(EELFLoggerDelegate.debugLogger, "==> extractProperty");
- try {
- val = aaiPropValue.getEncryptedString(f, name, "");
- System.out.println(val);
- } catch (Exception e) {
- System.err.println("Cannot extract '" + name + "' from '" + f + "': " + e.toString());
- }
- }
-
- /**
- * Usage.
- */
- public static void usage() {
- usage(null);
- }
-
-
- /**
- * Decrypt triple.
- *
- * @param triple the triple
- * @return the string
- */
- public static String decryptTriple(String triple) {
- EncryptedPropValue aaiPropValue = new EncryptedPropValue();
- logger.debug(EELFLoggerDelegate.debugLogger, "==> descrptTriple");
-
- String out = "";
- try {
- //System.out.println(dragonPropValue.encryptedConfiguration.decrypt(triple, dragonPropValue.encryptionKey));
- logger.debug(EELFLoggerDelegate.debugLogger, "calling dragonPropValue.encryptedConfiguration.decrypt()");
- out = EncryptedConfiguration.decrypt(triple,
- aaiPropValue.encryptionKey,
- aaiPropValue.encryptionMethod,
- EncryptedConfiguration.generateSalt());
- //System.out.println("out = " + out);
- } catch (Exception e) {
- System.err.println("Cannot decrypt '" + triple + "': " + e.toString());
- }
-
- return out;
- }
-
- /**
- * Encrypt input.
- */
- public static void encryptInput() {
- String s;
-
- Pattern p = Pattern.compile("^ENCRYPTME[.]([A-Z]*)[.]([^= \t]*)[ \t]*=[ \t]*([^ \t]*)[ \t]*$");
-
- EncryptedPropValue aaiPropValue = null;
-
- BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
-
- try {
- while ((s = in.readLine()) != null) {
- Matcher m = p.matcher(s);
- if (m.matches()) {
- if (aaiPropValue == null)
- aaiPropValue = new EncryptedPropValue();
- String method = m.group(1);
- String name = m.group(2);
- String value = m.group(3);
- try {
- System.out.println(name + ".x=" +
- EncryptedConfiguration.encryptToTriple(method,
- EncryptedConfiguration.generateSalt(),
- aaiPropValue.encryptionKey, value));
- } catch (Exception e) {
- System.err.println("Error: Cannot encrypt '" + value + "', method '" + method + "' for property '" + name + "': " + e.toString());
- } // end of try
- } else {
- System.out.println(s);
- }
- } // end of while
- } catch (IOException e) {
- System.err.println("Error: Cannot read from stdin: " + e.toString());
- }
-
- }
-
- /**
- * Usage.
- *
- * @param msg the msg
- */
- public static void usage(String msg) {
- if (msg != null) System.err.println(msg);
- System.err.println("Usage: java EncryptedPropValue -n property -f property-file");
- System.err.println("\tExtract the named value from the given property-file (or full pathname)");
- System.err.println("Usage: java EncryptedPropValue -n property -v value");
- System.err.println("\tEncrypt the given property with the given name and value");
- System.err.println("Usage: java EncryptedPropValue -E");
- System.err.println("\tEncrypt all lines that look like ENCRYPTME.METHOD.name=value");
- System.err.println("Usage: java EncryptedPropValue -u value");
- System.err.println("\tDecrypt the given value, expressed as a single HEXVAL");
- System.exit(1);
- }
-
- /**
- * The main method.
- *
- * @param args the arguments
- */
- public static void main(String[] args) {
- Options options = new Options();
- options.addOption("n", true, "name");
- options.addOption("f", true, "property-file");
- options.addOption("v", true, "value");
- options.addOption("E", false, "Encrypt all lines that look like ENCRYPTME.METHOD.name=value");
- options.addOption("u", true, "Decrypt the given value, expressed as a single HEXVAL");
- options.addOption("h", false, "show help");
- options.addOption("?", false, "show help");
-
- String propfile = null, name = null, value = null, unencrypt = null;
- boolean encryptStdin = false;
-
- CommandLineParser parser = new DefaultParser();
- CommandLine cmd = null;
-
- try {
- cmd = parser.parse(options, args);
-
- System.out.println("You picked " + cmd.toString() + "\n");
- if (cmd.hasOption("n")) {
- name = cmd.getOptionValue("n");
- }
- if (cmd.hasOption("f")) {
- propfile = cmd.getOptionValue("f");
- }
- if (cmd.hasOption("u")) {
- unencrypt = cmd.getOptionValue("u");
- }
- if (cmd.hasOption("E")) {
- encryptStdin = true;
- }
- if (cmd.hasOption("v")) {
- value = cmd.getOptionValue("v");
- }
- if (cmd.hasOption("?") || cmd.hasOption("h")) {
- usage();
- System.exit(0);
- }
-
- if (encryptStdin) {
- if (name != null || propfile != null || value != null) {
- usage("cannot use -E with other options");
- }
- encryptInput();
- } else if (unencrypt == null) {
- if (name == null) usage("-n is required");
- if (propfile == null) {
- if (value == null) usage("-v required");
- if (value != null) {
- generateEncryptedProperty(name, value);
- }
- } else {
- extractProperty(propfile, name);
- }
- } else {
- String out = decryptTriple(unencrypt);
- System.out.println(out);
- }
- } catch (ParseException e) {
- System.out.println("Failed to parse command line properties e="+e.toString());
- } catch (Exception e) {
- System.out.println("Failed to run EncryptedConfiguration main() e="+e.toString());
- }
-
- System.exit(0);
-
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/exceptions/VidServiceUnavailableException.java b/vid/src/main/java/org/openecomp/vid/exceptions/VidServiceUnavailableException.java
deleted file mode 100644
index e2fdd6b2d..000000000
--- a/vid/src/main/java/org/openecomp/vid/exceptions/VidServiceUnavailableException.java
+++ /dev/null
@@ -1,69 +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.exceptions;
-
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.ResponseStatus;
-
-/**
- * The Class VidServiceUnavailableException.
- */
-@ResponseStatus(value=HttpStatus.SERVICE_UNAVAILABLE)
-public class VidServiceUnavailableException extends Exception {
-
- /** The Constant serialVersionUID. */
- private static final long serialVersionUID = 1L;
-
- /**
- * Instantiates a new vid service unavailable exception.
- */
- public VidServiceUnavailableException() {
- super();
- }
-
- /**
- * Instantiates a new vid service unavailable exception.
- *
- * @param msg the msg
- */
- public VidServiceUnavailableException(String msg) {
- super(msg);
- }
-
- /**
- * Instantiates a new vid service unavailable exception.
- *
- * @param t the t
- */
- public VidServiceUnavailableException(Throwable t) {
- super(t);
- }
-
- /**
- * Instantiates a new vid service unavailable exception.
- *
- * @param msg the msg
- * @param t the t
- */
- public VidServiceUnavailableException(String msg, Throwable t) {
- super(msg, t);
- }
-}
diff --git a/vid/src/main/java/org/openecomp/vid/model/ExceptionResponse.java b/vid/src/main/java/org/openecomp/vid/model/ExceptionResponse.java
deleted file mode 100644
index 6af79927e..000000000
--- a/vid/src/main/java/org/openecomp/vid/model/ExceptionResponse.java
+++ /dev/null
@@ -1,70 +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.model;
-
-/**
- * The Class ExceptionResponse.
- */
-public class ExceptionResponse {
-
- /** The exception. */
- private String exception;
-
- /** The message. */
- private String message;
-
- /**
- * Gets the exception.
- *
- * @return the exception
- */
- public String getException() {
- return exception;
- }
-
- /**
- * Sets the exception.
- *
- * @param exception the new exception
- */
- public void setException(String exception) {
- this.exception = exception;
- }
-
- /**
- * Gets the message.
- *
- * @return the message
- */
- public String getMessage() {
- return message;
- }
-
- /**
- * Sets the message.
- *
- * @param message the new message
- */
- public void setMessage(String message) {
- this.message = message;
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/model/Network.java b/vid/src/main/java/org/openecomp/vid/model/Network.java
deleted file mode 100644
index 792060149..000000000
--- a/vid/src/main/java/org/openecomp/vid/model/Network.java
+++ /dev/null
@@ -1,157 +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.model;
-
-import org.openecomp.vid.asdc.beans.tosca.NodeTemplate;
-
-/**
- * The Class Network.
- */
-public class Network {
-
- /** The uuid. */
- private String uuid;
-
- /** The invariant uuid. */
- private String invariantUuid;
-
- /** The description. */
- private String description;
-
- /** The name. */
- private String name;
-
- /** The version. */
- private String version;
-
- /**
- * Instantiates a new network.
- */
- public Network() {}
-
- /**
- * Gets the uuid.
- *
- * @return the uuid
- */
- public String getUuid() {
- return uuid;
- }
-
- /**
- * Gets the invariant uuid.
- *
- * @return the invariant uuid
- */
- public String getInvariantUuid() {
- return invariantUuid;
- }
-
- /**
- * Gets the description.
- *
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Gets the name.
- *
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Gets the version.
- *
- * @return the version
- */
- public String getVersion() {
- return version;
- }
-
- /**
- * Sets the uuid.
- *
- * @param uuid the new uuid
- */
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- /**
- * Sets the invariant uuid.
- *
- * @param invariantUuid the new invariant uuid
- */
- public void setInvariantUuid(String invariantUuid) {
- this.invariantUuid = invariantUuid;
- }
-
- /**
- * Sets the description.
- *
- * @param description the new description
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Sets the name.
- *
- * @param name the new name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Sets the version.
- *
- * @param version the new version
- */
- public void setVersion(String version) {
- this.version = version;
- }
-
- /**
- * Extract network.
- *
- * @param nodeTemplate the node template
- * @return the network
- */
- public static Network extractNetwork(NodeTemplate nodeTemplate) {
- final Network network = new Network();
-
- network.setUuid(nodeTemplate.getMetadata().getUUID());
- network.setInvariantUuid(nodeTemplate.getMetadata().getInvariantUUID());
- network.setDescription(nodeTemplate.getMetadata().getDescription());
- network.setName(nodeTemplate.getMetadata().getName());
- network.setVersion(nodeTemplate.getMetadata().getVersion());
-
- return network;
- }
-}
diff --git a/vid/src/main/java/org/openecomp/vid/model/Resource.java b/vid/src/main/java/org/openecomp/vid/model/Resource.java
deleted file mode 100644
index d2ef634e1..000000000
--- a/vid/src/main/java/org/openecomp/vid/model/Resource.java
+++ /dev/null
@@ -1,28 +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.model;
-
-/**
- * The Class Resource.
- */
-public class Resource {
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/model/Result.java b/vid/src/main/java/org/openecomp/vid/model/Result.java
deleted file mode 100644
index b676dbbba..000000000
--- a/vid/src/main/java/org/openecomp/vid/model/Result.java
+++ /dev/null
@@ -1,58 +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.model;
-
-/**
- * The Class Result.
- */
-public class Result {
-
- /** The result. */
- private String result;
-
- /**
- * Instantiates a new result.
- *
- * @param result the result
- */
- public Result(String result) {
- this.result = result;
- }
-
- /**
- * Gets the result.
- *
- * @return the result
- */
- public String getResult() {
- return result;
- }
-
- /**
- * Sets the result.
- *
- * @param result the new result
- */
- public void setResult(String result) {
- this.result = result;
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/model/Service.java b/vid/src/main/java/org/openecomp/vid/model/Service.java
deleted file mode 100644
index f698cda53..000000000
--- a/vid/src/main/java/org/openecomp/vid/model/Service.java
+++ /dev/null
@@ -1,223 +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.model;
-
-import java.util.Map;
-import java.util.UUID;
-
-import org.openecomp.vid.asdc.beans.tosca.Input;
-
-/**
- * The Class Service.
- */
-public class Service {
-
- /** The uuid. */
- private String uuid;
-
- /** The invariant uuid. */
- private String invariantUuid;
-
- /** The name. */
- private String name;
-
- /** The version. */
- private String version;
-
- /** The tosca model URL. */
- private String toscaModelURL;
-
- /** The category. */
- private String category;
-
- /** The description. */
- private String description;
-
- /** The inputs. */
- private Map<String, Input> inputs;
-
- /**
- * Gets the uuid.
- *
- * @return the uuid
- */
- public String getUuid() {
- return uuid;
- }
-
- /**
- * Gets the invariant uuid.
- *
- * @return the invariant uuid
- */
- public String getInvariantUuid() {
- return invariantUuid;
- }
-
- /**
- * Gets the name.
- *
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Gets the version.
- *
- * @return the version
- */
- public String getVersion() {
- return version;
- }
-
- /**
- * Gets the tosca model URL.
- *
- * @return the tosca model URL
- */
- public String getToscaModelURL() {
- return toscaModelURL;
- }
-
- /**
- * Gets the category.
- *
- * @return the category
- */
- public String getCategory() {
- return category;
- }
-
- /**
- * Gets the description.
- *
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Gets the inputs.
- *
- * @return the inputs
- */
- public Map<String, Input> getInputs() {
- return inputs;
- }
-
- /**
- * Sets the uuid.
- *
- * @param uuid the new uuid
- */
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- /**
- * Sets the invariant uuid.
- *
- * @param invariantUuid the new invariant uuid
- */
- public void setInvariantUuid(String invariantUuid) {
- this.invariantUuid = invariantUuid;
- }
-
- /**
- * Sets the name.
- *
- * @param name the new name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Sets the version.
- *
- * @param version the new version
- */
- public void setVersion(String version) {
- this.version = version;
- }
-
- /**
- * Sets the tosca model URL.
- *
- * @param toscaModelURL the new tosca model URL
- */
- public void setToscaModelURL(String toscaModelURL) {
- this.toscaModelURL = toscaModelURL;
- }
-
- /**
- * Sets the category.
- *
- * @param category the new category
- */
- public void setCategory(String category) {
- this.category = category;
- }
-
- /**
- * Sets the description.
- *
- * @param description the new description
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Sets the inputs.
- *
- * @param inputs the inputs
- */
- public void setInputs(Map<String, Input> inputs) {
- this.inputs = inputs;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final UUID uuid = UUID.fromString(getUuid());
-
- return uuid.hashCode();
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object o) {
- if (o == this) return true;
- if (!(o instanceof Service)) return false;
-
- final Service service = (Service) o;
-
- return (service.getUuid().equals(getUuid()));
- }
-}
diff --git a/vid/src/main/java/org/openecomp/vid/model/ServiceModel.java b/vid/src/main/java/org/openecomp/vid/model/ServiceModel.java
deleted file mode 100644
index 87c087780..000000000
--- a/vid/src/main/java/org/openecomp/vid/model/ServiceModel.java
+++ /dev/null
@@ -1,126 +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.model;
-
-import java.util.Map;
-import java.util.UUID;
-
-import org.openecomp.vid.asdc.beans.tosca.ToscaModel;
-
-/**
- * The Class ServiceModel.
- */
-public class ServiceModel {
-
- /** The service. */
- private Service service;
-
- /** The vnfs. */
- private Map<UUID, VNF> vnfs;
-
- /** The networks. */
- private Map<UUID, Network> networks;
-
- /**
- * Instantiates a new service model.
- */
- public ServiceModel() {}
-
- /**
- * Gets the service.
- *
- * @return the service
- */
- public Service getService() {
- return service;
- }
-
- /**
- * Gets the vnfs.
- *
- * @return the vnfs
- */
- public Map<UUID, VNF> getVnfs() {
- return vnfs;
- }
-
- /**
- * Gets the networks.
- *
- * @return the networks
- */
- public Map<UUID, Network> getNetworks() {
- return networks;
- }
-
- /**
- * Sets the service.
- *
- * @param service the new service
- */
- public void setService(Service service) {
- this.service = service;
- }
-
- /**
- * Sets the vnfs.
- *
- * @param vnfs the vnfs
- */
- public void setVnfs(Map<UUID, VNF> vnfs) {
- this.vnfs = vnfs;
- }
-
- /**
- * Sets the networks.
- *
- * @param networks the networks
- */
- public void setNetworks(Map<UUID, Network> networks) {
- this.networks = networks;
- }
-
- /**
- * Extract service.
- *
- * @param serviceToscaModel the service tosca model
- * @param asdcServiceMetadata the asdc service metadata
- * @return the service
- */
- public static Service extractService(ToscaModel serviceToscaModel, org.openecomp.vid.asdc.beans.Service asdcServiceMetadata) {
-
- final Service service = new Service();
-
- service.setCategory(serviceToscaModel.getMetadata().getCategory());
- service.setInvariantUuid(serviceToscaModel.getMetadata().getInvariantUUID());
- service.setName(serviceToscaModel.getMetadata().getName());
- service.setUuid(serviceToscaModel.getMetadata().getUUID());
- service.setDescription(serviceToscaModel.getMetadata().getDescription());
- service.setInputs(serviceToscaModel.gettopology_template().getInputs());
-
- //FIXME: ASDC is not sending the Version with the Tosca Model for 1610 - they should send it in 1702
- //THIS IS A TEMPORARY FIX, AT SOME POINT UNCOMMENT ME
- //service.setVersion(serviceToscaModel.getMetadata().getVersion());
- service.setVersion(asdcServiceMetadata.getVersion());
-
- return service;
- }
-}
diff --git a/vid/src/main/java/org/openecomp/vid/model/VNF.java b/vid/src/main/java/org/openecomp/vid/model/VNF.java
deleted file mode 100644
index fc0aef150..000000000
--- a/vid/src/main/java/org/openecomp/vid/model/VNF.java
+++ /dev/null
@@ -1,248 +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.model;
-
-import java.util.Map;
-import java.util.UUID;
-
-import org.openecomp.vid.asdc.beans.tosca.Input;
-import org.openecomp.vid.asdc.beans.tosca.NodeTemplate;
-
-/**
- * The Class VNF.
- */
-public class VNF {
-
- /** The uuid. */
- private String uuid;
-
- /** The invariant uuid. */
- private String invariantUuid;
-
- /** The description. */
- private String description;
-
- /** The name. */
- private String name;
-
- /** The version. */
- private String version;
-
- /** The model customization name. */
- private String modelCustomizationName;
-
- /** The inputs. */
- private Map<String, Input> inputs;
-
- /** The vf modules. */
- private Map<UUID, VfModule> vfModules;
-
- /** The volume groups. */
- private Map<UUID, VolumeGroup> volumeGroups;
-
- /**
- * Instantiates a new vnf.
- */
- public VNF() {}
-
- /**
- * Gets the uuid.
- *
- * @return the uuid
- */
- public String getUuid() {
- return uuid;
- }
-
- /**
- * Gets the invariant uuid.
- *
- * @return the invariant uuid
- */
- public String getInvariantUuid() {
- return invariantUuid;
- }
-
- /**
- * Gets the description.
- *
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Gets the name.
- *
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Gets the version.
- *
- * @return the version
- */
- public String getVersion() {
- return version;
- }
-
- /**
- * Gets the model customization name.
- *
- * @return the model customization name
- */
- public String getModelCustomizationName() {
- return modelCustomizationName;
- }
-
- /**
- * Gets the inputs.
- *
- * @return the inputs
- */
- public Map<String, Input> getInputs() {
- return inputs;
- }
-
- /**
- * Sets the uuid.
- *
- * @param uuid the new uuid
- */
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- /**
- * Sets the invariant uuid.
- *
- * @param invariantUuid the new invariant uuid
- */
- public void setInvariantUuid(String invariantUuid) {
- this.invariantUuid = invariantUuid;
- }
-
- /**
- * Sets the description.
- *
- * @param description the new description
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Sets the name.
- *
- * @param name the new name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Sets the version.
- *
- * @param version the new version
- */
- public void setVersion(String version) {
- this.version = version;
- }
-
- /**
- * Gets the vf modules.
- *
- * @return the vf modules
- */
- public Map<UUID, VfModule> getVfModules() {
- return vfModules;
- }
-
- /**
- * Sets the vf modules.
- *
- * @param vfModules the vf modules
- */
- public void setVfModules(Map<UUID, VfModule> vfModules) {
- this.vfModules = vfModules;
- }
-
- /**
- * Gets the volume groups.
- *
- * @return the volume groups
- */
- public Map<UUID, VolumeGroup> getVolumeGroups() {
- return volumeGroups;
- }
-
- /**
- * Sets the volume groups.
- *
- * @param volumeGroups the volume groups
- */
- public void setVolumeGroups(Map<UUID, VolumeGroup> volumeGroups) {
- this.volumeGroups = volumeGroups;
- }
-
- /**
- * Sets the inputs.
- *
- * @param inputs the inputs
- */
- public void setInputs(Map<String, Input> inputs) {
- this.inputs = inputs;
- }
-
- /**
- * Extract vnf.
- *
- * @param modelCustomizationName the model customization name
- * @param nodeTemplate the node template
- * @return the vnf
- */
- public static VNF extractVnf(String modelCustomizationName, NodeTemplate nodeTemplate) {
-
- final VNF vnf = new VNF();
-
- vnf.setUuid(nodeTemplate.getMetadata().getUUID());
- vnf.setInvariantUuid(nodeTemplate.getMetadata().getInvariantUUID());
- vnf.setDescription(nodeTemplate.getMetadata().getDescription());
- vnf.setName(nodeTemplate.getMetadata().getName());
- vnf.setModelCustomizationName(modelCustomizationName);
- vnf.setVersion(nodeTemplate.getMetadata().getVersion());
-
- return vnf;
- }
-
- /**
- * Sets the model customization name.
- *
- * @param modelCustomizationName the new model customization name
- */
- private void setModelCustomizationName(String modelCustomizationName) {
- this.modelCustomizationName = modelCustomizationName;
- }
-}
diff --git a/vid/src/main/java/org/openecomp/vid/model/VfModule.java b/vid/src/main/java/org/openecomp/vid/model/VfModule.java
deleted file mode 100644
index 33008d5af..000000000
--- a/vid/src/main/java/org/openecomp/vid/model/VfModule.java
+++ /dev/null
@@ -1,185 +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.model;
-
-import org.openecomp.vid.asdc.beans.tosca.Group;
-
-/**
- * The Class VfModule.
- */
-public class VfModule {
-
- /** The uuid. */
- private String uuid;
-
- /** The invariant uuid. */
- private String invariantUuid;
-
- /** The description. */
- private String description;
-
- /** The name. */
- private String name;
-
- /** The version. */
- private String version;
-
- /** The volume group allowed. */
- private boolean volumeGroupAllowed;
-
- /**
- * Instantiates a new vf module.
- */
- public VfModule() {}
-
- /**
- * Gets the uuid.
- *
- * @return the uuid
- */
- public String getUuid() {
- return uuid;
- }
-
- /**
- * Gets the invariant uuid.
- *
- * @return the invariant uuid
- */
- public String getInvariantUuid() {
- return invariantUuid;
- }
-
- /**
- * Gets the description.
- *
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Gets the name.
- *
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Gets the version.
- *
- * @return the version
- */
- public String getVersion() {
- return version;
- }
-
- /**
- * Checks if is volume group allowed.
- *
- * @return true, if is volume group allowed
- */
- public boolean isVolumeGroupAllowed() {
- return volumeGroupAllowed;
- }
-
- /**
- * Sets the uuid.
- *
- * @param uuid the new uuid
- */
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- /**
- * Sets the invariant uuid.
- *
- * @param invariantUuid the new invariant uuid
- */
- public void setInvariantUuid(String invariantUuid) {
- this.invariantUuid = invariantUuid;
- }
-
- /**
- * Sets the description.
- *
- * @param description the new description
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Sets the name.
- *
- * @param name the new name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Sets the version.
- *
- * @param version the new version
- */
- public void setVersion(String version) {
- this.version = version;
- }
-
- /**
- * Sets the volume group allowed.
- *
- * @param volumeGroupAllowed the new volume group allowed
- */
- private void setVolumeGroupAllowed(boolean volumeGroupAllowed) {
- this.volumeGroupAllowed = volumeGroupAllowed;
- }
-
- /**
- * Extract vf module.
- *
- * @param group the group
- * @return the vf module
- */
- public static VfModule extractVfModule(Group group) {
-
- final VfModule vfModule = new VfModule();
-
- vfModule.setUuid(group.getMetadata().getVfModuleModelUUID());
- vfModule.setInvariantUuid(group.getMetadata().getVfModuleModelInvariantUUID());
- vfModule.setDescription(group.getMetadata().getDescription());
- vfModule.setName(group.getMetadata().getVfModuleModelName());
- vfModule.setVersion(group.getMetadata().getVfModuleModelVersion());
-
- if (group.getProperties().containsKey("volume_group")) {
- vfModule.setVolumeGroupAllowed(Boolean.valueOf(group.getProperties().get("volume_group")));
- } else {
- vfModule.setVolumeGroupAllowed(false);
- }
-
- return vfModule;
- }
-}
diff --git a/vid/src/main/java/org/openecomp/vid/model/VolumeGroup.java b/vid/src/main/java/org/openecomp/vid/model/VolumeGroup.java
deleted file mode 100644
index 7e8ea35b2..000000000
--- a/vid/src/main/java/org/openecomp/vid/model/VolumeGroup.java
+++ /dev/null
@@ -1,157 +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.model;
-
-import org.openecomp.vid.asdc.beans.tosca.Group;
-
-/**
- * The Class VolumeGroup.
- */
-public class VolumeGroup {
-
- /** The uuid. */
- private String uuid;
-
- /** The invariant uuid. */
- private String invariantUuid;
-
- /** The description. */
- private String description;
-
- /** The name. */
- private String name;
-
- /** The version. */
- private String version;
-
- /**
- * Instantiates a new volume group.
- */
- public VolumeGroup() {}
-
- /**
- * Gets the uuid.
- *
- * @return the uuid
- */
- public String getUuid() {
- return uuid;
- }
-
- /**
- * Gets the invariant uuid.
- *
- * @return the invariant uuid
- */
- public String getInvariantUuid() {
- return invariantUuid;
- }
-
- /**
- * Gets the description.
- *
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Gets the name.
- *
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Gets the version.
- *
- * @return the version
- */
- public String getVersion() {
- return version;
- }
-
- /**
- * Sets the uuid.
- *
- * @param uuid the new uuid
- */
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- /**
- * Sets the invariant uuid.
- *
- * @param invariantUuid the new invariant uuid
- */
- public void setInvariantUuid(String invariantUuid) {
- this.invariantUuid = invariantUuid;
- }
-
- /**
- * Sets the description.
- *
- * @param description the new description
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Sets the name.
- *
- * @param name the new name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Sets the version.
- *
- * @param version the new version
- */
- public void setVersion(String version) {
- this.version = version;
- }
-
- /**
- * Extract volume group.
- *
- * @param group the group
- * @return the volume group
- */
- public static VolumeGroup extractVolumeGroup(Group group) {
- final VolumeGroup volumeGroup = new VolumeGroup();
-
- volumeGroup.setUuid(group.getMetadata().getVfModuleModelUUID());
- volumeGroup.setInvariantUuid(group.getMetadata().getVfModuleModelInvariantUUID());
- volumeGroup.setDescription(group.getMetadata().getDescription());
- volumeGroup.setName(group.getMetadata().getVfModuleModelName());
- volumeGroup.setVersion(group.getMetadata().getVfModuleModelVersion());
-
- return volumeGroup;
- }
-}
diff --git a/vid/src/main/java/org/openecomp/vid/mso/MsoProperties.java b/vid/src/main/java/org/openecomp/vid/mso/MsoProperties.java
deleted file mode 100644
index 92177e30b..000000000
--- a/vid/src/main/java/org/openecomp/vid/mso/MsoProperties.java
+++ /dev/null
@@ -1,100 +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.mso;
-
-import org.openecomp.portalsdk.core.util.SystemProperties;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-
-/**
- * The Class MsoProperties.
- */
-public class MsoProperties extends SystemProperties {
-
- /** The Constant MSO_SERVER_URL. */
- //VID Properties related to MSO
- public static final String MSO_SERVER_URL = "mso.server.url";
-
- /** The Constant MSO_DME2_SERVER_URL. */
- public static final String MSO_DME2_SERVER_URL = "mso.dme2.server.url";
-
- /** The Constant MSO_DME2_CLIENT_TIMEOUT. */
- public static final String MSO_DME2_CLIENT_TIMEOUT = "mso.dme2.client.timeout";
-
- /** The Constant MSO_DME2_CLIENT_READ_TIMEOUT. */
- public static final String MSO_DME2_CLIENT_READ_TIMEOUT = "mso.dme2.client.read.timeout";
-
- /** The Constant MSO_SERVER_URL_DEFAULT. */
- public static final String MSO_SERVER_URL_DEFAULT= "";
-
- /** The Constant MSO_POLLING_INTERVAL_MSECS. */
- // number of msecs to wait between polling requests
- public static final String MSO_POLLING_INTERVAL_MSECS = "mso.polling.interval.msecs";
-
- /** The Constant MSO_POLLING_INTERVAL_MSECS_DEFAULT. */
- public static final String MSO_POLLING_INTERVAL_MSECS_DEFAULT = "60000";
-
- /** The Constant MSO_DME2_ENABLED. */
- public static final String MSO_DME2_ENABLED = "mso.dme2.enabled";
-
- /** The Constant MSO_MAX_POLLS. */
- public static final String MSO_MAX_POLLS = "mso.max.polls";
-
- /** The Constant MSO_MAX_POLLS_DEFAULT. */
- public static final String MSO_MAX_POLLS_DEFAULT = "10"; //10
-
- /** The Constant MSO_USER_NAME. */
- public static final String MSO_USER_NAME = "mso.user.name"; //m03346
-
- /** The Constant MSO_PASSWORD. */
- public static final String MSO_PASSWORD = "mso.password.x";
-
- /** The Constant MSO_REST_API_SVC_INSTANCE. */
- public static final String MSO_REST_API_SVC_INSTANCE = "mso.restapi.svc.instance"; // /serviceInstances/v2
-
- /** The Constant MSO_REST_API_VNF_INSTANCE. */
- public static final String MSO_REST_API_VNF_INSTANCE = "mso.restapi.vnf.instance"; // /serviceInstances/v2/{service_instance_id}/vnfs
-
- /** The Constant MSO_REST_API_NETWORK_INSTANCE. */
- public static final String MSO_REST_API_NETWORK_INSTANCE = "mso.restapi.network.instance"; // /serviceInstances/v2/{serviceInstanceId}/networks
-
- /** The Constant MSO_REST_API_GET_ORC_REQ. */
- public static final String MSO_REST_API_GET_ORC_REQ = "mso.restapi.get.orc.req";
-
- /** The Constant MSO_REST_API_GET_ORC_REQS. */
- public static final String MSO_REST_API_GET_ORC_REQS = "mso.restapi.get.orc.reqs";
-
- /** The Constant MSO_REST_API_VF_MODULE_INSTANCE. */
- public static final String MSO_REST_API_VF_MODULE_INSTANCE = "mso.restapi.vf.module.instance";
-
- /** The Constant MSO_REST_API_VOLUME_GROUP_INSTANCE. */
- public static final String MSO_REST_API_VOLUME_GROUP_INSTANCE = "mso.restapi.volume.group.instance"; //serviceInstances/v2/{serviceInstanceId}/volumeGroups
-
- /** The logger. */
- public EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoProperties.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/mso/MsoResponseWrapper.java b/vid/src/main/java/org/openecomp/vid/mso/MsoResponseWrapper.java
deleted file mode 100644
index b9fa8f082..000000000
--- a/vid/src/main/java/org/openecomp/vid/mso/MsoResponseWrapper.java
+++ /dev/null
@@ -1,107 +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.mso;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-/**
- * This wrapper encapsulates the MSO response in the format expected by the pages.
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "status",
- "entity"
-})
-
-public class MsoResponseWrapper {
-
- /** The status. */
- @JsonProperty("status")
- private int status;
-
- /** The entity. */
- @JsonProperty("entity")
- private String entity;
-
- /**
- * Gets the entity.
- *
- * @return the entity
- */
- @JsonProperty("entity")
- public String getEntity() {
- return entity;
- }
-
- /**
- * Gets the status.
- *
- * @return the status
- */
- @JsonProperty("status")
- public int getStatus() {
- return status;
- }
-
- /**
- * Sets the status.
- *
- * @param v the new status
- */
- @JsonProperty("status")
- public void setStatus(int v) {
- this.status = v;
- }
-
- /**
- * Sets the entity.
- *
- * @param v the new entity
- */
- @JsonProperty("entity")
- public void setEntity(String v) {
- this.entity = v;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
- /**
- * Gets the response.
- *
- * @return the response
- */
- public String getResponse () {
-
- StringBuilder b = new StringBuilder ("{ \"status\": ");
- b.append(getStatus()).append(", \"entity\": " ).append(this.getEntity()).append("}");
- return (b.toString());
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/mso/MsoRestInt.java b/vid/src/main/java/org/openecomp/vid/mso/MsoRestInt.java
deleted file mode 100644
index 67fe70003..000000000
--- a/vid/src/main/java/org/openecomp/vid/mso/MsoRestInt.java
+++ /dev/null
@@ -1,71 +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.mso;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/**
- * The Class MsoRestInt.
- */
-public class MsoRestInt {
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoRestInterface.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /** The request date format. */
- public DateFormat requestDateFormat = new SimpleDateFormat("EEE, dd MMM YYYY HH:mm:ss z");
-
- /**
- * Instantiates a new mso rest int.
- */
- public MsoRestInt() {
- requestDateFormat.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));
- }
-
- /**
- * Log request.
- *
- * @param r the r
- */
- public void logRequest ( org.openecomp.vid.mso.rest.RequestDetails r ) {
- String methodName = "logRequest";
- ObjectMapper mapper = new ObjectMapper();
- String r_json_str = "";
- if ( r != null ) {
- r_json_str = r.toString();
- try {
- r_json_str = mapper.writeValueAsString(r);
- }
- catch ( com.fasterxml.jackson.core.JsonProcessingException j ) {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " Unable to parse request as json");
- }
- }
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " Request=(" + r_json_str + ")");
- }
-}
diff --git a/vid/src/main/java/org/openecomp/vid/mso/MsoRestInterface.java b/vid/src/main/java/org/openecomp/vid/mso/MsoRestInterface.java
deleted file mode 100644
index 064af1061..000000000
--- a/vid/src/main/java/org/openecomp/vid/mso/MsoRestInterface.java
+++ /dev/null
@@ -1,290 +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.mso;
-
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Collections;
-import java.util.Date;
-
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedHashMap;
-import javax.ws.rs.core.Response;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-
-import org.apache.commons.codec.binary.Base64;
-import org.openecomp.vid.client.HttpBasicClient;
-import org.openecomp.vid.client.HttpsBasicClient;
-import org.openecomp.vid.encryption.EncryptedPropValue;
-import org.openecomp.vid.mso.rest.RequestDetails;
-
-/**
- * The Class MsoRestInterface.
- */
-public class MsoRestInterface extends MsoRestInt implements MsoRestInterfaceIfc {
-
- /** The logger. */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoRestInterface.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /** The client. */
- private static Client client = null;
-
- /** The common headers. */
- private MultivaluedHashMap<String, Object> commonHeaders;
-
- /**
- * Instantiates a new mso rest interface.
- */
- public MsoRestInterface() {
- super();
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.mso.MsoRestInterfaceIfc#initRestClient()
- */
- public void initRestClient()
- {
- final String methodname = "initRestClient()";
-
- final String username = SystemProperties.getProperty(MsoProperties.MSO_USER_NAME);
- final String password = SystemProperties.getProperty(MsoProperties.MSO_PASSWORD);
- final String mso_url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL);
- final String decrypted_password = EncryptedPropValue.decryptTriple(password);
-
- String authString = username + ":" + decrypted_password;
-
- byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
- String authStringEnc = new String(authEncBytes);
-
- commonHeaders = new MultivaluedHashMap<String, Object> ();
- commonHeaders.put("Authorization", Collections.singletonList((Object) ("Basic " + authStringEnc)));
-
- boolean use_ssl = true;
- if ( (mso_url != null) && ( !(mso_url.isEmpty()) ) ) {
- if ( mso_url.startsWith("https")) {
- use_ssl = true;
- }
- else {
- use_ssl = false;
- }
- }
- if (client == null) {
-
- try {
- if ( use_ssl ) {
- //logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodname + " getting HttpsBasicClient with username=" + username
- // + " password=" + password);
- client = HttpsBasicClient.getClient();
- }
- else {
- //logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodname + " getting HttpsBasicClient with username=" + username
- // + " password=" + password);
- client = HttpBasicClient.getClient();
- }
- } catch (Exception e) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodname + " Unable to get the SSL client");
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.mso.MsoRestInterfaceIfc#Get(java.lang.Object, java.lang.String, java.lang.String, org.openecomp.vid.mso.RestObject)
- */
- @SuppressWarnings("unchecked")
- public <T> void Get (T t, String sourceId, String path, RestObject<T> restObject ) throws Exception {
- String methodName = "Get";
-
- logger.debug(EELFLoggerDelegate.debugLogger, methodName + " start");
-
- String url="";
- restObject.set(t);
-
- url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " sending request to url= " + url);
-
- initRestClient();
-
- final Response cres = client.target(url)
- .request()
- .accept("application/json")
- .headers(commonHeaders)
- .get();
-
- int status = cres.getStatus();
- restObject.setStatusCode (status);
-
- if (status == 200) {
- t = (T) cres.readEntity(t.getClass());
- restObject.set(t);
- logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " REST api was successfull!");
-
- } else {
- throw new Exception(methodName + " with status="+ status + ", url= " + url );
- }
-
- logger.debug(EELFLoggerDelegate.debugLogger,methodName + " received status=" + status );
-
- return;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.mso.MsoRestInterfaceIfc#Delete(java.lang.Object, org.openecomp.vid.mso.rest.RequestDetails, java.lang.String, java.lang.String, org.openecomp.vid.mso.RestObject)
- */
- @SuppressWarnings("unchecked")
- public <T> void Delete(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) {
-
- String methodName = "Delete";
- String url="";
- Response cres = null;
-
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " start");
- logRequest (r);
-
- try {
- initRestClient();
-
- url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + " methodName sending request to: " + url);
-
- cres = client.target(url)
- .request()
- .accept("application/json")
- .headers(commonHeaders)
- //.entity(r)
- .build("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON)).invoke();
- // .method("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON));
- //.delete(Entity.entity(r, MediaType.APPLICATION_JSON));
-
- int status = cres.getStatus();
- restObject.setStatusCode (status);
-
- if (status == 404) { // resource not found
- String msg = "Resource does not exist...: " + cres.getStatus();
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);
- } else if (status == 200 || status == 204){
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + "Resource " + url + " deleted");
- } else if (status == 202) {
- String msg = "Delete in progress: " + status;
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);
- }
- else {
- String msg = "Deleting Resource failed: " + status;
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);
- }
-
- try {
- t = (T) cres.readEntity(t.getClass());
- restObject.set(t);
- }
- catch ( Exception e ) {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " No response entity, this is probably ok, e="
- + e.getMessage());
- }
-
- }
- catch (Exception e)
- {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " with url="+url+ ", Exception: " + e.toString());
- throw e;
-
- }
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.mso.MsoRestInterfaceIfc#Post(java.lang.Object, org.openecomp.vid.mso.rest.RequestDetails, java.lang.String, java.lang.String, org.openecomp.vid.mso.RestObject)
- */
- @SuppressWarnings("unchecked")
- public <T> void Post(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) throws Exception {
-
- String methodName = "Post";
- String url="";
-
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " start");
-
- logRequest (r);
- try {
-
- initRestClient();
-
- url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " sending request to url= " + url);
- // Change the content length
- final Response cres = client.target(url)
- .request()
- .accept("application/json")
- .headers(commonHeaders)
- //.header("content-length", 201)
- //.header("X-FromAppId", sourceID)
- .post(Entity.entity(r, MediaType.APPLICATION_JSON));
-
- try {
- t = (T) cres.readEntity(t.getClass());
- restObject.set(t);
- }
- catch ( Exception e ) {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " No response entity, this is probably ok, e="
- + e.getMessage());
- }
-
- int status = cres.getStatus();
- restObject.setStatusCode (status);
-
- if ( status >= 200 && status <= 299 ) {
- logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!");
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!");
-
- } else {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " with status="+status+", url="+url);
- }
-
- } catch (Exception e)
- {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " with url="+url+ ", Exception: " + e.toString());
- throw e;
-
- }
- }
-
-
- /**
- * Gets the single instance of MsoRestInterface.
- *
- * @param <T> the generic type
- * @param clazz the clazz
- * @return single instance of MsoRestInterface
- * @throws IllegalAccessException the illegal access exception
- * @throws InstantiationException the instantiation exception
- */
- public <T> T getInstance(Class<T> clazz) throws IllegalAccessException, InstantiationException
- {
- return clazz.newInstance();
- }
-
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceFactory.java b/vid/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceFactory.java
deleted file mode 100644
index 4e15e3fb4..000000000
--- a/vid/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceFactory.java
+++ /dev/null
@@ -1,48 +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.mso;
-
-import org.openecomp.portalsdk.core.util.SystemProperties;
-
-/**
- * A factory for creating MsoRestInterface objects.
- */
-public class MsoRestInterfaceFactory {
-
- /**
- * Gets the single instance of MsoRestInterfaceFactory.
- *
- * @return single instance of MsoRestInterfaceFactory
- */
- public static MsoRestInterfaceIfc getInstance () {
- MsoRestInterfaceIfc obj = null;
-
- String mso_dme2_enabled = SystemProperties.getProperty(MsoProperties.MSO_DME2_ENABLED);
-// if ( (mso_dme2_enabled != null) && (mso_dme2_enabled.equalsIgnoreCase("true") ) ) {
-// obj = new MsoDme2RestInterface();
-// }
-// else {
- obj = new MsoRestInterface();
-// }
- return ( obj );
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceIfc.java b/vid/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceIfc.java
deleted file mode 100644
index 9a733f9c5..000000000
--- a/vid/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceIfc.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.mso;
-
-import org.openecomp.vid.mso.rest.RequestDetails;
-
-/**
- * The Interface MsoRestInterfaceIfc.
- */
-public interface MsoRestInterfaceIfc {
-
- /**
- * Inits the rest client.
- */
- public void initRestClient();
-
- /**
- * Gets the.
- *
- * @param <T> the generic type
- * @param t the t
- * @param sourceId the source id
- * @param path the path
- * @param restObject the rest object
- * @throws Exception the exception
- */
- public <T> void Get (T t, String sourceId, String path, RestObject<T> restObject ) throws Exception;
-
- /**
- * Delete.
- *
- * @param <T> the generic type
- * @param t the t
- * @param r the r
- * @param sourceID the source ID
- * @param path the path
- * @param restObject the rest object
- * @throws Exception the exception
- */
- public <T> void Delete(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) throws Exception;
-
- /**
- * Post.
- *
- * @param <T> the generic type
- * @param t the t
- * @param r the r
- * @param sourceID the source ID
- * @param path the path
- * @param restObject the rest object
- * @throws Exception the exception
- */
- public <T> void Post(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) throws Exception;
-
- /**
- * Log request.
- *
- * @param r the r
- */
- public void logRequest ( RequestDetails r );
-}
diff --git a/vid/src/main/java/org/openecomp/vid/mso/MsoUtil.java b/vid/src/main/java/org/openecomp/vid/mso/MsoUtil.java
deleted file mode 100644
index 5d46cb07b..000000000
--- a/vid/src/main/java/org/openecomp/vid/mso/MsoUtil.java
+++ /dev/null
@@ -1,125 +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.mso;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.glassfish.jersey.client.ClientResponse;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.vid.controller.MsoController;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/**
- * The Class MsoUtil.
- */
-public class MsoUtil {
-
- /** The logger. */
- private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoController.class);
-
- /** The Constant dateFormat. */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /**
- * Wrap response.
- *
- * @param body the body
- * @param statusCode the status code
- * @return the mso response wrapper
- */
- public static MsoResponseWrapper wrapResponse ( String body, int statusCode ) {
-
- MsoResponseWrapper w = new MsoResponseWrapper();
- w.setStatus (statusCode);
- w.setEntity(body);
-
- return w;
- }
-
- /**
- * Wrap response.
- *
- * @param cres the cres
- * @return the mso response wrapper
- */
- public static MsoResponseWrapper wrapResponse (ClientResponse cres) {
- String resp_str = "";
- if ( cres != null ) {
- resp_str = cres.readEntity(String.class);
- }
- int statuscode = cres.getStatus();
- MsoResponseWrapper w = MsoUtil.wrapResponse ( resp_str, statuscode );
- return (w);
- }
-
- /**
- * Wrap response.
- *
- * @param rs the rs
- * @return the mso response wrapper
- */
- public static MsoResponseWrapper wrapResponse (RestObject<String> rs) {
- String resp_str = "";
- int status = 0;
- if ( rs != null ) {
- resp_str = rs.get();
- status = rs.getStatusCode();
- }
- MsoResponseWrapper w = MsoUtil.wrapResponse ( resp_str, status );
- return (w);
- }
-
- /**
- * Convert pojo to string.
- *
- * @param <T> the generic type
- * @param t the t
- * @return the string
- * @throws JsonProcessingException the json processing exception
- */
- public static <T> String convertPojoToString ( T t ) throws com.fasterxml.jackson.core.JsonProcessingException {
-
- String methodName = "convertPojoToString";
- ObjectMapper mapper = new ObjectMapper();
- String r_json_str = "";
- if ( t != null ) {
- try {
- r_json_str = mapper.writeValueAsString(t);
- }
- catch ( com.fasterxml.jackson.core.JsonProcessingException j ) {
- logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " Unable to parse object as json");
- }
- }
- return (r_json_str);
- }
-
- /**
- * The main method.
- *
- * @param args the arguments
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/vid/src/main/java/org/openecomp/vid/mso/RestObject.java b/vid/src/main/java/org/openecomp/vid/mso/RestObject.java
deleted file mode 100644
index 0e43f126d..000000000
--- a/vid/src/main/java/org/openecomp/vid/mso/RestObject.java
+++ /dev/null
@@ -1,68 +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.mso;
-
-/**
- * The Class RestObject.
- *
- * @param <T> the generic type
- */
-public class RestObject<T> {
-
- /**
- * Generic version of the RestObject class.
- *
- */
- // T stands for "Type"
- private T t;
-
- /** The status code. */
- private int statusCode= 0;
-
- /**
- * Sets the.
- *
- * @param t the t
- */
- public void set(T t) { this.t = t; }
-
- /**
- * Gets the.
- *
- * @return the t
- */
- public T get() { return t; }
-
- /**
- * Sets the status code.
- *
- * @param v the new status code
- */
- public void setStatusCode(int v) { this.statusCode = v; }
-
- /**
- * Gets the status code.
- *
- * @return the status code
- */
- public int getStatusCode() { return this.statusCode; }
-}
-
diff --git a/vid/src/main/java/org/openecomp/vid/mso/rest/AsyncRequestStatus.java b/vid/src/main/java/org/openecomp/vid/mso/rest/AsyncRequestStatus.java
deleted file mode 100644
index 99000748b..000000000
--- a/vid/src/main/java/org/openecomp/vid/mso/rest/AsyncRequestStatus.java
+++ /dev/null
@@ -1,108 +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.mso.rest;
-
-//import java.util.HashMap;
-//import java.util.Map;
-//import javax.annotation.Generated;
-
-import org.openecomp.vid.domain.mso.InstanceIds;
-import org.openecomp.vid.domain.mso.RequestStatus;
-//import com.fasterxml.jackson.annotation.JsonAnyGetter;
-//import com.fasterxml.jackson.annotation.JsonAnySetter;
-//import com.fasterxml.jackson.annotation.JsonCreator;
-//import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-//import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-//import com.fasterxml.jackson.annotation.JsonValue;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-
-/**
- * request structure
- *
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-
-public class AsyncRequestStatus extends org.openecomp.vid.domain.mso.AsyncRequestStatus {
-
-
- private InstanceIds instanceIds;
-
- private RequestStatus requestStatus;
-
- public InstanceIds getInstanceIds() {
- return instanceIds;
- }
-
- public void setInstanceIds(InstanceIds instanceIds) {
- this.instanceIds = instanceIds;
- }
-
-
- /**
- *
- * (Required)
- *
- * @return
- * The requestStatus
- */
- @JsonProperty("requestStatus")
- public RequestStatus getRequestStatus() {
- return requestStatus;
- }
-
- /**
- *
- * (Required)
- *
- * @param requestStatus
- * The requestStatus
- */
- @JsonProperty("requestStatus")
- public void setRequestStatus(RequestStatus requestStatus) {
- this.requestStatus = requestStatus;
- }
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(getCorrelator()).append(getFinishTime()).append(instanceIds).append(getRequestId()).append(getRequestScope()).append(getRequestStatus()).append(getRequestType()).append(getStartTime()).append(getAdditionalProperties()).toHashCode();
- }
-
- @Override
- public boolean equals(Object other) {
- if (other == this) {
- return true;
- }
- if ((other instanceof AsyncRequestStatus) == false) {
- return false;
- }
- AsyncRequestStatus rhs = ((AsyncRequestStatus) other);
- return new EqualsBuilder().append(getCorrelator(), rhs.getCorrelator()).append(getFinishTime(), rhs.getFinishTime()).append(instanceIds, rhs.instanceIds).append(getRequestId(), rhs.getRequestId()).append(getRequestScope(), rhs.getRequestScope()).append(getRequestStatus(), rhs.getRequestStatus()).append(getRequestType(), rhs.getRequestType()).append(getStartTime(), rhs.getStartTime()).append(getAdditionalProperties(), rhs.getAdditionalProperties()).isEquals();
- }
-}
diff --git a/vid/src/main/java/org/openecomp/vid/mso/rest/RelatedInstance.java b/vid/src/main/java/org/openecomp/vid/mso/rest/RelatedInstance.java
deleted file mode 100644
index a0bea6742..000000000
--- a/vid/src/main/java/org/openecomp/vid/mso/rest/RelatedInstance.java
+++ /dev/null
@@ -1,112 +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.mso.rest;
-
-import java.util.HashMap;
-import java.util.Map;
-import javax.annotation.Generated;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-
-/**
- * modelInfo and optional instanceId and instanceName for a model related to the modelInfo being operated on
- *
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@Generated("org.jsonschema2pojo")
-@JsonPropertyOrder({
- "instanceName",
- "instanceId",
- "modelInfo"
-})
-public class RelatedInstance extends org.openecomp.vid.domain.mso.RelatedInstance{
-
-
- @JsonProperty("modelInfo")
- private org.openecomp.vid.domain.mso.ModelInfo modelInfo;
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
-
- /**
- *
- * (Required)
- *
- * @return
- * The modelInfo
- */
- @JsonProperty("modelInfo")
- public org.openecomp.vid.domain.mso.ModelInfo getModelInfo() {
- return modelInfo;
- }
-
- /**
- *
- * (Required)
- *
- * @param modelInfo
- * The modelInfo
- */
- @JsonProperty("modelInfo")
- public void setModelInfo(org.openecomp.vid.domain.mso.ModelInfo modelInfo) {
- this.modelInfo = modelInfo;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(getInstanceName()).append(getInstanceId()).append(modelInfo).append(additionalProperties).toHashCode();
- }
-
- @Override
- public boolean equals(Object other) {
- if (other == this) {
- return true;
- }
- if ((other instanceof RelatedInstance) == false) {
- return false;
- }
- RelatedInstance rhs = ((RelatedInstance) other);
- return new EqualsBuilder().append(getInstanceName(), rhs.getInstanceName()).append(getInstanceId(), rhs.getInstanceId()).append(modelInfo, rhs.getModelInfo()).append(additionalProperties, rhs.additionalProperties).isEquals();
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/mso/rest/RelatedModel.java b/vid/src/main/java/org/openecomp/vid/mso/rest/RelatedModel.java
deleted file mode 100644
index 545b43064..000000000
--- a/vid/src/main/java/org/openecomp/vid/mso/rest/RelatedModel.java
+++ /dev/null
@@ -1,112 +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.mso.rest;
-
-import java.util.HashMap;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-
-/**
- * modelInfo and optional instance id for a model related to the modelInfo being operated on
- *
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "instanceId",
- "modelInfo"
-})
-public class RelatedModel extends org.openecomp.vid.domain.mso.RelatedModel {
- /**
- *
- * (Required)
- *
- */
- @JsonProperty("modelInfo")
- private org.openecomp.vid.domain.mso.ModelInfo modelInfo;
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
-
- /**
- *
- * (Required)
- *
- * @return
- * The modelInfo
- */
- @JsonProperty("modelInfo")
- public org.openecomp.vid.domain.mso.ModelInfo getModelInfo() {
- return modelInfo;
- }
-
- /**
- *
- * (Required)
- *
- * @param modelInfo
- * The modelInfo
- */
- @JsonProperty("modelInfo")
- public void setModelInfo(org.openecomp.vid.domain.mso.ModelInfo modelInfo) {
- this.modelInfo = modelInfo;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(getInstanceId()).append(modelInfo).append(additionalProperties).toHashCode();
- }
-
- @Override
- public boolean equals(Object other) {
- if (other == this) {
- return true;
- }
- if ((other instanceof RelatedModel) == false) {
- return false;
- }
- RelatedModel rhs = ((RelatedModel) other);
- return new EqualsBuilder().append(getInstanceId(), rhs.getInstanceId()).append(modelInfo, rhs.modelInfo).append(additionalProperties, rhs.additionalProperties).isEquals();
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/mso/rest/Request.java b/vid/src/main/java/org/openecomp/vid/mso/rest/Request.java
deleted file mode 100644
index 7b234e29c..000000000
--- a/vid/src/main/java/org/openecomp/vid/mso/rest/Request.java
+++ /dev/null
@@ -1,130 +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.mso.rest;
-
-//import java.util.HashMap;
-//import java.util.Map;
-//import javax.annotation.Generated;
-
-import org.openecomp.vid.domain.mso.InstanceIds;
-import org.openecomp.vid.domain.mso.RequestStatus;
-//import com.fasterxml.jackson.annotation.JsonAnyGetter;
-//import com.fasterxml.jackson.annotation.JsonAnySetter;
-//import com.fasterxml.jackson.annotation.JsonCreator;
-//import com.fasterxml.jackson.annotation.JsonIgnore;
-//import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-//import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-//import com.fasterxml.jackson.annotation.JsonValue;
-import org.apache.commons.lang.builder.EqualsBuilder;
-//import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-
-/**
- * request structure
- *
- */
-public class Request extends org.openecomp.vid.domain.mso.Request {
-
-
- private InstanceIds instanceIds;
- private RequestDetails requestDetails;
- private RequestStatus requestStatus;
-
-
- @JsonProperty("instanceIds")
- public InstanceIds getInstanceIds() {
- return instanceIds;
- }
-
- /**
- *
- * @param instanceIds
- * The instanceIds
- */
- @JsonProperty("instanceIds")
- public void setInstanceIds(InstanceIds instanceIds) {
- this.instanceIds = instanceIds;
- }
-
- /**
- *
- * (Required)
- *
- * @return
- * The requestDetails
- */
- @JsonProperty("requestDetails")
- public RequestDetails getRequestDetails() {
- return requestDetails;
- }
-
- /**
- *
- * (Required)
- *
- * @param requestDetails
- * The requestDetails
- */
- @JsonProperty("requestDetails")
- public void setRequestDetails(RequestDetails requestDetails) {
- this.requestDetails = requestDetails;
- }
-
-
- /**
- *
- * @return
- * The requestStatus
- */
- @JsonProperty("requestStatus")
- public RequestStatus getRequestStatus() {
- return requestStatus;
- }
-
- /**
- *
- * @param requestStatus
- * The requestStatus
- */
- @JsonProperty("requestStatus")
- public void setRequestStatus(RequestStatus requestStatus) {
- this.requestStatus = requestStatus;
- }
-
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
- @Override
- public boolean equals(Object other) {
- if (other == this) {
- return true;
- }
- if ((other instanceof Request) == false) {
- return false;
- }
- Request rhs = ((Request) other);
- return new EqualsBuilder().append(getFinishTime(), rhs.getFinishTime()).append(getInstanceIds(), rhs.getInstanceIds()).append(getRequestDetails(), rhs.getRequestDetails()).append(getRequestId(), rhs.getRequestId()).append(getRequestScope(), rhs.getRequestScope()).append(getRequestStatus(), rhs.getRequestStatus()).append(getRequestType(), rhs.getRequestType()).append(getStartTime(), rhs.getStartTime()).append(getAdditionalProperties(), rhs.getAdditionalProperties()).isEquals();
- }
-}
diff --git a/vid/src/main/java/org/openecomp/vid/mso/rest/RequestDetails.java b/vid/src/main/java/org/openecomp/vid/mso/rest/RequestDetails.java
deleted file mode 100644
index 2896b3b6c..000000000
--- a/vid/src/main/java/org/openecomp/vid/mso/rest/RequestDetails.java
+++ /dev/null
@@ -1,205 +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.mso.rest;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.List;
-//import javax.annotation.Generated;
-
-import org.openecomp.vid.domain.mso.CloudConfiguration;
-import org.openecomp.vid.domain.mso.ModelInfo;
-import org.openecomp.vid.domain.mso.RequestInfo;
-import org.openecomp.vid.domain.mso.RequestParameters;
-import org.openecomp.vid.domain.mso.SubscriberInfo;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-
-/**
- * aggregates the context, configuraiton and detailed parameters associated with the request into a single structure
- *
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({
- "cloudConfiguration",
- "modelInfo",
- "relatedModelList",
- "requestInfo",
- "subscriberInfo",
- "requestParameters"
-})
-public class RequestDetails extends org.openecomp.vid.domain.mso.RequestDetails {
-
- @JsonProperty("cloudConfiguration")
- private CloudConfiguration cloudConfiguration;
- @JsonProperty("modelInfo")
- private ModelInfo modelInfo;
- @JsonProperty("relatedModelList")
- private List<RelatedModel> relatedModelList;
- @JsonProperty("requestInfo")
- private RequestInfo requestInfo;
- @JsonProperty("subscriberInfo")
- private SubscriberInfo subscriberInfo;
- @JsonProperty("requestParameters")
- private RequestParameters requestParameters;
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
-
- /**
- *
- * @return
- * The cloudConfiguration
- */
- @JsonProperty("cloudConfiguration")
- public CloudConfiguration getCloudConfiguration() {
- return cloudConfiguration;
- }
-
- /**
- *
- * @param cloudConfiguration
- * The cloudConfiguration
- */
- @JsonProperty("cloudConfiguration")
- public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
- this.cloudConfiguration = cloudConfiguration;
- }
-
- /**
- *
- * @return
- * The modelInfo
- */
- @JsonProperty("modelInfo")
- public ModelInfo getModelInfo() {
- return modelInfo;
- }
-
- /**
- *
- * @param modelInfo
- * The modelInfo
- */
- @JsonProperty("modelInfo")
- public void setModelInfo(ModelInfo modelInfo) {
- this.modelInfo = modelInfo;
- }
-
- /**
- *
- * @return
- * The relatedModelList
- */
- @JsonProperty("relatedModelList")
- public List<RelatedModel> getRelatedModelList() {
- return relatedModelList;
- }
-
- /**
- *
- * @param relatedModelList
- * The relatedModelList
- */
- @JsonProperty("relatedModelList")
- public void setRelatedModelList( List<RelatedModel> relatedModelList) {
- this.relatedModelList = relatedModelList;
- }
-
- /**
- *
- * @return
- * The requestInfo
- */
- @JsonProperty("requestInfo")
- public RequestInfo getRequestInfo() {
- return requestInfo;
- }
-
- /**
- *
- * @param requestInfo
- * The requestInfo
- */
- @JsonProperty("requestInfo")
- public void setRequestInfo(RequestInfo requestInfo) {
- this.requestInfo = requestInfo;
- }
- /**
- *
- * @return
- * The subscriberInfo
- */
- @JsonProperty("subscriberInfo")
- public SubscriberInfo getSubscriberInfo() {
- return subscriberInfo;
- }
-
- /**
- *
- * @param subscriberInfo
- * The subscriberInfo
- */
- @JsonProperty("subscriberInfo")
- public void setSubscriberInfo(SubscriberInfo subscriberInfo) {
- this.subscriberInfo = subscriberInfo;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(cloudConfiguration).append(modelInfo).append(relatedModelList).append(requestInfo).append(getRequestParameters()).append(subscriberInfo).append(additionalProperties).toHashCode();
- }
-
- @Override
- public boolean equals(Object other) {
- if (other == this) {
- return true;
- }
- if ((other instanceof RequestDetails) == false) {
- return false;
- }
- RequestDetails rhs = ((RequestDetails) other);
- return new EqualsBuilder().append(cloudConfiguration, rhs.cloudConfiguration).append(modelInfo, rhs.modelInfo).append(relatedModelList, rhs.relatedModelList).append(requestInfo, rhs.requestInfo).append(getRequestParameters(), rhs.getRequestParameters()).append(subscriberInfo, rhs.subscriberInfo).append(additionalProperties, rhs.additionalProperties).isEquals();
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/mso/rest/RequestList.java b/vid/src/main/java/org/openecomp/vid/mso/rest/RequestList.java
deleted file mode 100644
index 64ef82a57..000000000
--- a/vid/src/main/java/org/openecomp/vid/mso/rest/RequestList.java
+++ /dev/null
@@ -1,113 +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.mso.rest;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.annotation.Generated;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-//import com.fasterxml.jackson.annotation.JsonInclude;
-//import com.fasterxml.jackson.annotation.JsonProperty;
-//import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-import java.util.List;
-
-/**
- * List of relatedModel structures that are related to a modelInfo being operated on
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@Generated("org.jsonschema2pojo")
-@JsonPropertyOrder({
- "finishTime",
- "instanceIds",
- "requestDetails",
- "requestId",
- "requestScope",
- "requestStatus",
- "requestType",
- "startTime"
-})
-
-public class RequestList {
-
- private List<Request> requestList;
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<String, Object>();
-
- /**
- *
- * (Required)
- *
- * @return
- * The RelatedModel List
- */
- public List<Request> getRequestList() {
- return requestList;
- }
-
- /**
- */
- public void setRequestList(List<Request> l) {
- this.requestList = l;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(getRequestList()).append(additionalProperties).toHashCode();
- }
-
- @Override
- public boolean equals(Object other) {
- if (other == this) {
- return true;
- }
- if ((other instanceof RequestList) == false) {
- return false;
- }
- RequestList rhs = ((RequestList) other);
- return new EqualsBuilder().append(getRequestList(), rhs.getRequestList()).append(additionalProperties, rhs.additionalProperties).isEquals();
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/properties/AsdcClientConfiguration.java b/vid/src/main/java/org/openecomp/vid/properties/AsdcClientConfiguration.java
deleted file mode 100644
index b6a8cfce7..000000000
--- a/vid/src/main/java/org/openecomp/vid/properties/AsdcClientConfiguration.java
+++ /dev/null
@@ -1,70 +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.properties;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.PropertySource;
-
-@Configuration
-@PropertySource(value="${container.classpath:}/WEB-INF/conf/asdc.properties")
-public class AsdcClientConfiguration {
-
- @Value("${asdc.client.type}")
- private AsdcClientType asdcClientType;
-
- @Value("${asdc.client.rest.host}")
- private String asdcClientHost;
-
- @Value("${asdc.client.rest.port}")
- private int asdcClientPort;
-
- @Value("${asdc.client.rest.auth}")
- public String asdcClientAuth;
-
- @Value("${asdc.client.rest.protocol}")
- public String asdcClientProtocol;
-
- public AsdcClientType getAsdcClientType() {
- return asdcClientType;
- }
-
- public String getAsdcClientHost() {
- return asdcClientHost;
- }
-
- public int getAsdcClientPort() {
- return asdcClientPort;
- }
-
- public String getAsdcClientAuth() {
- return asdcClientAuth;
- }
-
- public String getAsdcClientProtocol() {
- return asdcClientProtocol;
- }
-
- public enum AsdcClientType {
- IN_MEMORY,
- REST
- }
-}
diff --git a/vid/src/main/java/org/openecomp/vid/properties/VidProperties.java b/vid/src/main/java/org/openecomp/vid/properties/VidProperties.java
deleted file mode 100644
index fcec7d636..000000000
--- a/vid/src/main/java/org/openecomp/vid/properties/VidProperties.java
+++ /dev/null
@@ -1,34 +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.properties;
-
-import org.openecomp.portalsdk.core.util.SystemProperties;
-
-public class VidProperties extends SystemProperties {
-
- //VID General Properties
-
- public static final String VID_TRUSTSTORE_FILENAME = "vid.truststore.filename";
- public static final String VID_TRUSTSTORE_PASSWD_X = "vid.truststore.passwd.x";
-
- public static final String FILESEPARATOR = (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator");
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/scheduler/LogJob.java b/vid/src/main/java/org/openecomp/vid/scheduler/LogJob.java
deleted file mode 100644
index 05e7f1f96..000000000
--- a/vid/src/main/java/org/openecomp/vid/scheduler/LogJob.java
+++ /dev/null
@@ -1,49 +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.scheduler;
-
-import org.quartz.DisallowConcurrentExecution;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-import org.quartz.PersistJobDataAfterExecution;
-import org.springframework.scheduling.quartz.QuartzJobBean;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.vid.conf.ExternalAppConfig;
-
-@PersistJobDataAfterExecution
-@DisallowConcurrentExecution
-public class LogJob extends QuartzJobBean {
-
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(LogJob.class);
-
-
- @Override
- protected void executeInternal(JobExecutionContext ctx)
- throws JobExecutionException {
- // JobDataMap dataMap = ctx.getJobDetail().getJobDataMap();
- //int cnt = dataMap.getInt("");
- // JobKey jobKey = ctx.getJobDetail().getKey();
- logger.info(EELFLoggerDelegate.errorLogger, (Runtime.getRuntime().maxMemory() + " " + Runtime.getRuntime().maxMemory()));
-
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/scheduler/LogRegistry.java b/vid/src/main/java/org/openecomp/vid/scheduler/LogRegistry.java
deleted file mode 100644
index 2d52b5868..000000000
--- a/vid/src/main/java/org/openecomp/vid/scheduler/LogRegistry.java
+++ /dev/null
@@ -1,59 +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.scheduler;
-
-import java.text.ParseException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.springframework.context.annotation.DependsOn;
-import org.springframework.scheduling.quartz.CronTriggerFactoryBean;
-import org.springframework.scheduling.quartz.JobDetailFactoryBean;
-import org.springframework.stereotype.Component;
-
-import org.openecomp.portalsdk.core.scheduler.CronRegistry;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-
-@Component
-@DependsOn({ "systemProperties" })
-public class LogRegistry extends CronRegistry {
-
- private static final String groupName = "AppGroup";
- private static final String jobName = "LogJob";
- private static final String triggerName = "LogTrigger";
-
- // @Autowired
- // private SystemProperties systemProperties;
-
- // @Bean
- public JobDetailFactoryBean jobDetailFactoryBean() {
- Map<String, Object> map = new HashMap<String, Object>();
- map.put("units", "bytes");
- return jobDetailFactoryBean(groupName, jobName, LogJob.class, map);
- }
-
- // @Bean
- public CronTriggerFactoryBean cronTriggerFactoryBean() throws ParseException {
- // "0 * * * * ? *
- return cronTriggerFactoryBean(groupName, triggerName, SystemProperties.getProperty(SystemProperties.LOG_CRON));
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/scheduler/MyLoginsFeedJob.java b/vid/src/main/java/org/openecomp/vid/scheduler/MyLoginsFeedJob.java
deleted file mode 100644
index 2b94470fe..000000000
--- a/vid/src/main/java/org/openecomp/vid/scheduler/MyLoginsFeedJob.java
+++ /dev/null
@@ -1,434 +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.scheduler;
-
-
-
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import javax.sql.DataSource;
-
-import org.quartz.DisallowConcurrentExecution;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-import org.quartz.PersistJobDataAfterExecution;
-import org.springframework.scheduling.quartz.QuartzJobBean;
-
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.openecomp.vid.conf.ExternalAppConfig;
-
-
-@PersistJobDataAfterExecution
-@DisallowConcurrentExecution
-public class MyLoginsFeedJob extends QuartzJobBean{
-
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MyLoginsFeedJob.class);
-
-
- private Connection connection;
-
- private String APP_QUERY ;
-
- private String USER_LOG_QUERY ;
-
- private String ALL_ACCOUNTS_LOG_QUERY ;
-
- private String PROFILE_LOG_QUERY ;
-
- private String USER_PROFILE_LOG_QUERY ;
-
-
- class App {
-
- private Integer appId;
- private Integer motsId;
- private String mlAppName;
-
- public Integer getAppId() {
- return appId;
- }
- public void setAppId(Integer appId) {
- this.appId = appId;
- }
- public Integer getMotsId() {
- return motsId;
- }
- public void setMotsId(Integer motsId) {
- this.motsId = motsId;
- }
- public String getMlAppName() {
- return mlAppName;
- }
- public void setMlAppName(String mlAppName) {
- this.mlAppName = mlAppName;
- }
-
- }
-
-
-
-
- private String getOutputFolder(){
- String outputFolder = SystemProperties.getProperty("my_login_feed_output_dir") + File.separator;
-
- return outputFolder;
- }
-
-
- public List<App> getApplicationList(Connection conn) {
-
- PreparedStatement stmt = null;
- ResultSet rs = null;
- List<App> appList = new ArrayList<App>();
- try{
- APP_QUERY = SystemProperties.getProperty("app.query");
- stmt = conn.prepareStatement(this.APP_QUERY);
- rs = stmt.executeQuery();
- while(rs.next()) {
-
- App app = new App();
- app.setAppId(rs.getInt("APP_ID"));
- app.setMotsId(rs.getInt("MOTS_ID"));
- app.setMlAppName(rs.getString("ML_APP_NAME"));
- appList.add(app);
- }
-
- }
- catch (Exception e){
- logger.error(EELFLoggerDelegate.errorLogger, ("UADM Audit Log. "+ new Date().toString() + ". Error getting connection. " + e.getMessage()));
- }
- finally{
- try {
- if(rs != null) {
- rs.close();
- }
- if(stmt != null){
- stmt.close();
- }
- }
- catch (Exception e){
- logger.error(EELFLoggerDelegate.errorLogger, ("UADM Audit Log. "+ new Date().toString() + ". Error getting connection. " + e.getMessage()));
-
- }
- }
-
- return appList;
- }
-
-
-
- public void generateLogs(){
- Connection con = null;
- try{
- con = getConnection();
-
- List<App> appList = getApplicationList(con);
-
- for(App app : appList) {
-
- this.generateUserLogs(con, app);
- this.generateProfileLogs(con, app);
- this.generateUserProfileLogs(con, app);
- this.generateAllAccountsLogs(con, app);
-
- }
-
- } catch (Exception e){
- logger.error(EELFLoggerDelegate.errorLogger, ("UADM Audit Log. "+ new Date().toString() + ". Error getting connection. " + e.getMessage()));
- }
- finally{
- try {
- if(con != null){
- con.close();
- }
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, ("UADM Audit Log. "+ new Date().toString() + ". Error closing connection"));
-
- }
- }
- }
-
- private void generateAllAccountsLogs(Connection con, App app){
- PreparedStatement stmt = null;
- ResultSet rs = null;
- try{
-
- ALL_ACCOUNTS_LOG_QUERY = SystemProperties.getProperty("all.accounts.log.query");
- stmt = con.prepareStatement(ALL_ACCOUNTS_LOG_QUERY);
- stmt.setInt(1, app.getAppId());
- rs = stmt.executeQuery();
- SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
- FileOutputStream fos = new java.io.FileOutputStream(this.getOutputFolder()+app.getMlAppName() + "_AllAccounts_" + sdf.format(new Date()) + ".txt");
- BufferedOutputStream bout = new BufferedOutputStream(fos);
-
- String header = "ATTUID,ACCOUNT_STATUS,APPLICATION_USERID,LAST_LOGON_DATE,LAST_PASSWORD_CHANGE_DATE,PROFILE_NAME";
- bout.write(header.getBytes());
- int userCount = 0; //need to include header and footer in the count
- while (rs.next()){
- userCount ++;
- bout.write("\n".getBytes());
- String CUID = rs.getString("CUID") == null ? "" : rs.getString("CUID");
- String activeYN = rs.getString("ACTIVE_YN") == null ? "" : rs.getString("ACTIVE_YN");
- String APPLICATIONUSERID = rs.getString("APPLICATIONUSERID") == null ? "" : rs.getString("APPLICATIONUSERID");
- String LAST_LOGON_DATE = rs.getString("LAST_LOGON_DATE") == null ? "" : rs.getString("LAST_LOGON_DATE");
- String LAST_PASSWORD_CHANGE_DATE = rs.getString("LAST_PASSWORD_CHANGE_DATE") == null ? "" : rs.getString("LAST_PASSWORD_CHANGE_DATE");
- String PROFILE_NAME = rs.getString("PROFILE_NAME") == null ? "" : rs.getString("PROFILE_NAME");
-
- String dat =
- CUID + "," + activeYN + "," + APPLICATIONUSERID + "," +
- LAST_LOGON_DATE + "," + LAST_PASSWORD_CHANGE_DATE + "," + PROFILE_NAME
- ;
- bout.write(dat.getBytes());
-
- }
- bout.write("\n".getBytes());
- bout.write(("TotalRecords," + userCount + "," + (app.getMotsId() != null ? app.getMotsId():app.getMlAppName())).getBytes());
- bout.close();
-
-
- } catch (Exception e){
- logger.error(EELFLoggerDelegate.errorLogger, ("UADM Audit Log. "+ new Date().toString() + ". Error While writing user data. " + e.getMessage()));
-
- }
- finally{
- try {
- if(rs != null){
- rs.close();
- }
- if(stmt != null){
- stmt.close();
- }
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, ("UADM Audit Log. "+ new Date().toString() + ". Error closing user rs / stmt"));
-
- }
- }
-
- }
-
- private void generateUserLogs(Connection con, App app){
- PreparedStatement stmt = null;
- ResultSet rs = null;
- try{
-
- USER_LOG_QUERY = SystemProperties.getProperty("user.log.query");
- stmt = con.prepareStatement(USER_LOG_QUERY);
- stmt.setInt(1, app.getAppId());
- rs = stmt.executeQuery();
- SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
- FileOutputStream fos = new java.io.FileOutputStream(this.getOutputFolder()+app.getMlAppName() + "_User_" + sdf.format(new Date()) + ".txt");
- BufferedOutputStream bout = new BufferedOutputStream(fos);
-
- String header = "CUID,AWID,APPLICATIONUSERID,FIRST_NAME,MIDDLE_INITIAL,LAST_NAME,LAST_LOGON_DATE,ACCOUNT_ACTIVATION_DATE,LAST_DATE_ACCOUNT_MODIFIED,LAST_PASSWORD_CHANGE_DATE,FULL_USER_NAME,NT_ID,EMAIL";
- bout.write(header.getBytes());
- int userCount = 2; //need to include header and footer in the count
- while (rs.next()){
- userCount ++;
- bout.write("\n".getBytes());
- String CUID = rs.getString("CUID") == null ? "" : rs.getString("CUID");
- String AWID = rs.getString("AWID") == null ? "" : rs.getString("AWID");
- String APPLICATIONUSERID = rs.getString("APPLICATIONUSERID") == null ? "" : rs.getString("APPLICATIONUSERID");
- String FIRST_NAME = rs.getString("FIRST_NAME") == null ? "" : rs.getString("FIRST_NAME");
- String MIDDLE_INITIAL = rs.getString("MIDDLE_INITIAL") == null ? "" : rs.getString("MIDDLE_INITIAL");
- String LAST_NAME = rs.getString("LAST_NAME") == null ? "" : rs.getString("LAST_NAME");
- String LAST_LOGON_DATE = rs.getString("LAST_LOGON_DATE") == null ? "" : rs.getString("LAST_LOGON_DATE");
- String ACCOUNT_ACTIVATION_DATE = rs.getString("ACCOUNT_ACTIVATION_DATE") == null ? "" : rs.getString("ACCOUNT_ACTIVATION_DATE");
- String LAST_DATE_ACCOUNT_MODIFIED = rs.getString("LAST_DATE_ACCOUNT_MODIFIED") == null ? "" : rs.getString("LAST_DATE_ACCOUNT_MODIFIED");
- String LAST_PASSWORD_CHANGE_DATE = rs.getString("LAST_PASSWORD_CHANGE_DATE") == null ? "" : rs.getString("LAST_PASSWORD_CHANGE_DATE");
- String FULL_USER_NAME = rs.getString("FULL_USER_NAME") == null ? "" : rs.getString("FULL_USER_NAME");
- String NT_ID = rs.getString("NT_ID") == null ? "" : rs.getString("NT_ID");
- String EMAIL = rs.getString("EMAIL") == null ? "" : rs.getString("EMAIL");
- String dat =
- CUID + "," + AWID + "," + APPLICATIONUSERID + "," +
- FIRST_NAME + "," + MIDDLE_INITIAL + "," + LAST_NAME + "," + LAST_LOGON_DATE + "," +
- ACCOUNT_ACTIVATION_DATE + "," +
- LAST_DATE_ACCOUNT_MODIFIED + "," + LAST_PASSWORD_CHANGE_DATE + "," +
- FULL_USER_NAME + "," + NT_ID + "," + EMAIL
- ;
- bout.write(dat.getBytes());
-
- }
- bout.write("\n".getBytes());
- bout.write(("TotalRecords," + userCount + ",\"UADM USER DATA STANDARD 2.2\"").getBytes());
- bout.close();
-
-
- } catch (Exception e){
- logger.error(EELFLoggerDelegate.errorLogger, ("UADM Audit Log. "+ new Date().toString() + ". Error While writing user data. " + e.getMessage()));
- }
- finally{
- try {
- if(rs != null){
- rs.close();
- }
- if(stmt != null){
- stmt.close();
- }
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, ("UADM Audit Log. "+ new Date().toString() + ". Error closing user rs / stmt"));
- }
- }
-
- }
-
- private void generateProfileLogs(Connection con, App app){
- PreparedStatement stmt = null;
- ResultSet rs = null;
- try{
-
- PROFILE_LOG_QUERY = SystemProperties.getProperty("profile.log.query");
- stmt = con.prepareStatement(PROFILE_LOG_QUERY);
- stmt.setInt(1, app.getAppId());
- rs = stmt.executeQuery();
- SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
- FileOutputStream fos = new java.io.FileOutputStream(this.getOutputFolder()+app.getMlAppName() + "_profile_" + sdf.format(new Date()) + ".txt");
- BufferedOutputStream bout = new BufferedOutputStream(fos);
-
- String header = "PROFILE_NAME,SECURITY_SETTINGS";
- bout.write(header.getBytes());
- int userCount = 2; //need to include header and footer in count= count
- while (rs.next()){
- userCount ++;
- bout.write("\n".getBytes());
- String PROFILE_NAME = rs.getString("PROFILE_NAME") == null ? "" : rs.getString("PROFILE_NAME");
- String SECURITY_SETTINGS = rs.getString("SECURITY_SETTINGS") == null ? "" : rs.getString("SECURITY_SETTINGS");
- String dat =
- PROFILE_NAME + "," + SECURITY_SETTINGS ;
- bout.write(dat.getBytes());
-
- }
- bout.write("\n".getBytes());
- bout.write(("TotalRecords," + userCount + ",\"UADM PROFILE DATA STANDARD 2.2\"").getBytes());
- bout.close();
-
-
- } catch (Exception e){
- System.out.println("UADM Audit Log. "+ new Date().toString() + ". Error While writing profile data. " + e.getMessage());
- e.printStackTrace();
- }
- finally{
- try {
- if(rs != null){
- rs.close();
- }
- if(stmt != null){
- stmt.close();
- }
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, ("UADM Audit Log. "+ new Date().toString() + ". Error closing profile rs / stmt"));
- }
- }
-
- }
-
- private void generateUserProfileLogs(Connection con, App app){
- PreparedStatement stmt = null;
- ResultSet rs = null;
- try{
- USER_PROFILE_LOG_QUERY = SystemProperties.getProperty("user.profile.log.query");
- stmt = con.prepareStatement(USER_PROFILE_LOG_QUERY);
- stmt.setInt(1, app.getAppId());
- rs = stmt.executeQuery();
- SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
- FileOutputStream fos = new java.io.FileOutputStream(this.getOutputFolder()+app.getMlAppName() + "_userprofiles_" + sdf.format(new Date()) + ".txt");
- BufferedOutputStream bout = new BufferedOutputStream(fos);
-
- String header = "CUID,AWID,APPLICATIONUSERID,PROFILE_NAME";
- bout.write(header.getBytes());
- int userCount = 2; //need to include header and footer in count= count
- while (rs.next()){
- userCount ++;
- bout.write("\n".getBytes());
- String CUID = rs.getString("CUID") == null ? "" : rs.getString("CUID");
- String AWID = rs.getString("AWID") == null ? "" : rs.getString("AWID");
- String APPLICATIONUSERID = rs.getString("APPLICATIONUSERID") == null ? "" : rs.getString("APPLICATIONUSERID");
- String PROFILE_NAME = rs.getString("PROFILE_NAME") == null ? "" : rs.getString("PROFILE_NAME");
- String dat =
- CUID + "," + AWID + "," + APPLICATIONUSERID + "," + PROFILE_NAME ;
- bout.write(dat.getBytes());
-
- }
- bout.write("\n".getBytes());
- bout.write(("TotalRecords," + userCount + ",\"UADM USER PROFILE DATA STANDARD 2.2\"").getBytes());
- bout.close();
-
-
- } catch (Exception e){
- System.out.println("UADM Audit Log. "+ new Date().toString() + ". Error While writing user profile data. " + e.getMessage());
- e.printStackTrace();
- }
- finally{
- try {
- if(rs != null){
- rs.close();
- }
- if(stmt != null){
- stmt.close();
- }
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, ("UADM Audit Log. "+ new Date().toString() + ". Error closing user profile rs / stmt"));
- }
- }
-
- }
-
- @Override
- protected void executeInternal(JobExecutionContext context)
- throws JobExecutionException {
- DataSource dataSource = (DataSource)context.getMergedJobDataMap().get("dataSource");
-
- try {
- setConnection(dataSource.getConnection());
- } catch (SQLException e) {
- logger.error(EELFLoggerDelegate.errorLogger, (e.getMessage()));
-
- return;
- }
- logger.info(EELFLoggerDelegate.errorLogger, (" Generate MyLogins feeds"));
-
- generateLogs();
-
- }
-
- public Connection getConnection() {
- return connection;
- }
-
- public void setConnection(Connection connection) {
- this.connection = connection;
- }
-
-
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/scheduler/MyLoginsFeedRegistry.java b/vid/src/main/java/org/openecomp/vid/scheduler/MyLoginsFeedRegistry.java
deleted file mode 100644
index ea4583ebc..000000000
--- a/vid/src/main/java/org/openecomp/vid/scheduler/MyLoginsFeedRegistry.java
+++ /dev/null
@@ -1,67 +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.scheduler;
-
-import java.text.ParseException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.DependsOn;
-import org.springframework.scheduling.quartz.CronTriggerFactoryBean;
-import org.springframework.scheduling.quartz.JobDetailFactoryBean;
-import org.springframework.stereotype.Component;
-
-import org.openecomp.portalsdk.core.scheduler.CronRegistry;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import com.mchange.v2.c3p0.ComboPooledDataSource;
-
-@Component
-@DependsOn({ "dataSource", "systemProperties" })
-public class MyLoginsFeedRegistry extends CronRegistry {
-
- // @Autowired
- // private SystemProperties systemProperties;
-
- @Autowired
- public MyLoginsFeedRegistry(ComboPooledDataSource dataSource) {
- super(dataSource);
- }
-
- private static final String groupName = "AppGroup";
- private static final String jobName = "MyLoginsFeedJob";
- private static final String triggerName = "MyLoginsFeedTrigger";
-
- // @Bean
- public JobDetailFactoryBean jobDetailFactoryBean() {
- Map<String, Object> map = new HashMap<String, Object>();
- map.put("dataSource", getDataSource());
- return jobDetailFactoryBean(groupName, jobName, MyLoginsFeedJob.class, map);
- }
-
- // @Bean
- public CronTriggerFactoryBean cronTriggerFactoryBean() throws ParseException {
- // "0 * * * * ? *"
- return cronTriggerFactoryBean(groupName, triggerName,
- SystemProperties.getProperty(SystemProperties.MYLOGINS_FEED_CRON));
- }
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/scheduler/Register.java b/vid/src/main/java/org/openecomp/vid/scheduler/Register.java
deleted file mode 100644
index 6ce4d1b9e..000000000
--- a/vid/src/main/java/org/openecomp/vid/scheduler/Register.java
+++ /dev/null
@@ -1,93 +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.scheduler;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.quartz.Trigger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.DependsOn;
-import org.springframework.stereotype.Component;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.scheduler.Registerable;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-
-
-@Component
-@DependsOn({"logRegistry", "myLoginsFeedRegistry", "systemProperties"})
-public class Register implements Registerable {
-
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(Register.class);
-
-
- private List<Trigger> scheduleTriggers = new ArrayList<Trigger>();
- Trigger trigger[] = new Trigger[1];
-
-
- @Autowired
- private LogRegistry logRegistry;
-
- @Autowired
- private MyLoginsFeedRegistry myLoginsFeedRegistry;
-
- @Override
- public Trigger[] getTriggers() {
- return getScheduleTriggers().toArray(trigger);
- }
-
- @Override
- public void registerTriggers() {
- // if the property value is not available; the cron will not be added and can be ignored. its safe to ignore the exceptions
- try {
- if(SystemProperties.getProperty(SystemProperties.LOG_CRON) != null)
- getScheduleTriggers().add(logRegistry.getTrigger());
-
- } catch(IllegalStateException ies) {
- logger.info(EELFLoggerDelegate.errorLogger, ("Log Cron not available"));
- }
-
- try {
- if(SystemProperties.getProperty(SystemProperties.MYLOGINS_FEED_CRON) != null)
- getScheduleTriggers().add(myLoginsFeedRegistry.getTrigger());
-
- } catch(IllegalStateException ies) {
- logger.info(EELFLoggerDelegate.errorLogger, ("MyLogins Cron not available"));
- }
-
- }
-
-
- public List<Trigger> getScheduleTriggers() {
- return scheduleTriggers;
- }
-
- public void setScheduleTriggers(List<Trigger> scheduleTriggers) {
- this.scheduleTriggers = scheduleTriggers;
- }
-
-
-
-
-
-
-}
diff --git a/vid/src/main/java/org/openecomp/vid/scheduler/RegistryAdapter.java b/vid/src/main/java/org/openecomp/vid/scheduler/RegistryAdapter.java
deleted file mode 100644
index e8068cf8d..000000000
--- a/vid/src/main/java/org/openecomp/vid/scheduler/RegistryAdapter.java
+++ /dev/null
@@ -1,111 +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.scheduler;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.quartz.Trigger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.quartz.SchedulerFactoryBean;
-import org.springframework.stereotype.Component;
-
-import org.openecomp.portalsdk.core.scheduler.Registerable;
-import org.openecomp.portalsdk.workflow.services.WorkflowScheduleService;
-
-/**
- * TODO REFACTOR
- * moved from org.openecomp.portalsdk.core.scheduler
- * to org.openecomp.portalsdk.scheduler
- *
- */
-@Component
-public class RegistryAdapter {
-
- @Autowired
- private Registerable registry;
-
- @Autowired
- private WorkflowScheduleService workflowScheduleService;
-
- private SchedulerFactoryBean schedulerBean;
-
- Trigger trigger[] = new Trigger[1];
-
- public Trigger[] getTriggers() {
-
- registry.registerTriggers();
-
- List<Trigger> allTriggers = new ArrayList<Trigger>();
-
- List<Trigger> coreTriggers = addCoreTriggers();
- final Trigger[] extTriggerArray = registry.getTriggers();
-
- allTriggers.addAll(Arrays.asList(extTriggerArray));
- allTriggers.addAll(coreTriggers);
-
- return allTriggers.toArray(trigger);
-
-
- }
-
-
- public List<Trigger> addCoreTriggers() {
- //On startup of the application after crash recovery, invoke workflow schedule trigger
- List<Trigger> triggers = getWorkflowScheduleService().triggerWorkflowScheduling();
- return triggers;
- }
-
-
- public void setSchedulerBean(SchedulerFactoryBean _schedulerBean) {
- schedulerBean = _schedulerBean;
-
- }
-
- public SchedulerFactoryBean getSchedulerBean() {
- return schedulerBean;
-
- }
-
-
- public Registerable getRegistry() {
- return registry;
- }
-
-
- public void setRegistry(Registerable registry) {
- this.registry = registry;
- }
-
-
- public WorkflowScheduleService getWorkflowScheduleService() {
- return workflowScheduleService;
- }
-
-
- public void setWorkflowScheduleService(
- WorkflowScheduleService workflowScheduleService) {
- this.workflowScheduleService = workflowScheduleService;
- }
-
-}
-