Merge 1806 code of vid-common

Change-Id: I75d52abed4a24dfe3827d79edc4a2938726aa87a
Issue-ID: VID-208
Signed-off-by: Sonsino, Ofir (os0695) <os0695@intl.att.com>
diff --git a/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java b/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java
index 2d222f0..9cf5df5 100644
--- a/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java
+++ b/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java
@@ -63,6 +63,8 @@
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.quartz.SchedulerFactoryBean;
+import org.springframework.scheduling.quartz.SpringBeanJobFactory;
+import org.springframework.web.multipart.commons.CommonsMultipartResolver;
 import org.springframework.web.servlet.ViewResolver;
 import org.springframework.web.servlet.config.annotation.EnableWebMvc;
 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
@@ -176,13 +178,14 @@
 	 * @return New instance of {@link SchedulerFactoryBean}
 	 * @throws Exception
 	 */
-	// @Bean // ANNOTATION COMMENTED OUT
+	@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());
+	    scheduler.setJobFactory(new SpringBeanJobFactory());
 		return scheduler;
 	}
 
@@ -218,6 +221,14 @@
         return populator;
     }
 	
+
+	/*@Bean
+	public SpringLiquibase liquibaseBean(DataSource dataSource) {
+		SpringLiquibase springLiquibase = new SpringLiquibase();
+		springLiquibase.setDataSource(dataSource);
+		springLiquibase.setChangeLog("classpath:db-master-changelog.xml");
+		return springLiquibase;
+	}*/
 	
 	/**
 	 * Sets the scheduler registry adapter.
@@ -233,4 +244,12 @@
 	public LoginStrategy loginStrategy() {
 		return new LoginStrategyImpl();
 	}
+
+	@Bean
+	public CommonsMultipartResolver multipartResolver() {
+		CommonsMultipartResolver resolver=new CommonsMultipartResolver();
+		resolver.setDefaultEncoding("utf-8");
+		return resolver;
+	}
+
 }
diff --git a/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java b/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java
index c8fbc43..93e867d 100644
--- a/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java
+++ b/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java
@@ -37,7 +37,13 @@
  */
 package org.onap.portalapp.conf;
 
+import org.onap.vid.controllers.ChangeManagementController;
+import org.onap.vid.controllers.MaintenanceController;
+import org.onap.vid.controllers.RoleGeneratorController;
 import org.onap.portalsdk.core.conf.AppInitializer;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import java.util.TimeZone;
 
 public class ExternalAppInitializer extends AppInitializer {
 
@@ -62,4 +68,20 @@
 		return super.getServletMappings();
 	}
 
+//	@Override
+//	public void onStartup(ServletContext servletContext) throws ServletException {
+//		super.onStartup(servletContext);
+//		setDefaultTimeZoneToUTC();
+//		servletContext.addFilter("requestFromLocalhost", LocalhostFilter.class)
+//				.addMappingForUrlPatterns(null, false,
+//						String.format("/%s/%s/*", ChangeManagementController.CHANGE_MANAGEMENT, ChangeManagementController.VNF_WORKFLOW_RELATION),
+//						String.format("/%s/*", RoleGeneratorController.GENERATE_ROLE_SCRIPT),
+//						String.format("/%s/*", MaintenanceController.MAINTENANCE));
+//	}
+
+	//set time zone to UTC so Dates would be written to DB in UTC timezone
+	private void setDefaultTimeZoneToUTC() {
+		System.setProperty("user.timezone", "UTC");
+		TimeZone.setDefault(TimeZone.getTimeZone("UTC")); //since TimeZone cache previous user.timezone
+	}
 }
diff --git a/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system.properties b/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system.properties
index defbff9..035d3d8 100755
--- a/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system.properties
+++ b/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system.properties
@@ -162,6 +162,7 @@
 #E2E is v3

 mso.restapi.svc.e2einstance=/e2eServiceInstances/v3

 mso.restapi.svc.instance=/serviceInstances/v6

+mso.restapi.svc.instance.deleteAndUnassign=/serviceInstantiation/v7/serviceInstances

 mso.restapi.vnf.instance=/serviceInstances/v6/<service_instance_id>/vnfs

 mso.restapi.vnf.changemanagement.instance=/serviceInstances/v6/<service_instance_id>/vnfs/<vnf_instance_id>/<request_type>

 mso.restapi.network.instance=/serviceInstances/v6/<service_instance_id>/networks

@@ -170,6 +171,29 @@
 mso.restapi.get.orc.req=/orchestrationRequests/v6

 mso.restapi.get.orc.reqs=/orchestrationRequests/v6?

 mso.restapi.get.man.tasks=/tasks/v1

+mso.restapi.configurations=/serviceInstances/v6/<service_instance_id>/configurations

+mso.restapi.configuration.instance=${mso.restapi.configurations}/<configuration_id>

+

+mso.restapi.serviceInstantiationApiRoot=/serviceInstantiation/v7

+mso.restapi.serviceInstanceCreate=${mso.restapi.serviceInstantiationApiRoot}/serviceInstances

+mso.restapi.serviceInstanceAssign=${mso.restapi.serviceInstantiationApiRoot}/serviceInstances/assign

+

+mso.restapi.cloudResourcesApiRoot=/cloudResources/v1

+mso.restapi.operationalEnvironment=${mso.restapi.cloudResourcesApiRoot}/operationalEnvironments/<operational_environment_id>

+

+mso.restapi.operationalEnvironment.activate=${mso.restapi.operationalEnvironment}/activate

+mso.restapi.operationalEnvironment.deactivate=${mso.restapi.operationalEnvironment}/deactivate

+mso.restapi.operationalEnvironment.create=${mso.restapi.cloudResourcesApiRoot}/operationalEnvironments

+

+mso.restapi.cloudResourcesRequestsApiRoot=/cloudResourcesRequests/v1

+mso.restapi.operationalEnvironment.cloudResourcesRequests.status=${mso.restapi.cloudResourcesRequestsApiRoot}?requestId=<request_id>

+

+mso.displayTestAPIOnScreen=true

+mso.defaultTestAPI=GR_API

+mso.maxOpenedInstantiationRequests=20

+mso.asyncPollingIntervalSeconds=1

+refreshTimeInstantiationDashboard=10

+

 vid.truststore.filename=/opt/app/vid/etc/vid_keystore.jks

 mso.dme2.client.timeout=30000

 mso.dme2.client.read.timeout=120000

diff --git a/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system_template.properties b/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system_template.properties
index 0731963..2ca038a 100755
--- a/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system_template.properties
+++ b/epsdk-app-onap/src/main/webapp/WEB-INF/conf/system_template.properties
@@ -105,6 +105,7 @@
 #E2E is v3

 mso.restapi.svc.e2einstance=/ecomp/mso/infra/e2eServiceInstances/v3

 mso.restapi.svc.instance=/ecomp/mso/infra/serviceInstances/v6

+mso.restapi.svc.instance.deleteAndUnassign=/serviceInstantiation/v7/serviceInstances

 mso.restapi.vnf.instance=/ecomp/mso/infra/serviceInstances/v6/<service_instance_id>/vnfs

 mso.restapi.vnf.changemanagement.instance=/ecomp/mso/infra/serviceInstances/v6/<service_instance_id>/vnfs/<vnf_instance_id>/<request_type>

 mso.restapi.network.instance=/ecomp/mso/infra/serviceInstances/v6/<service_instance_id>/networks

@@ -112,6 +113,30 @@
 mso.restapi.volume.group.instance=/ecomp/mso/infra/serviceInstances/v6/<service_instance_id>/vnfs/<vnf_instance_id>/volumeGroups

 mso.restapi.get.orc.req=/ecomp/mso/infra/orchestrationRequests/v6

 mso.restapi.get.orc.reqs=/ecomp/mso/infra/orchestrationRequests/v6?

+mso.restapi.get.man.tasks=/tasks/v1

+mso.restapi.configurations=/serviceInstances/v6/<service_instance_id>/configurations

+mso.restapi.configuration.instance=${mso.restapi.configurations}/<configuration_id>

+

+mso.restapi.serviceInstantiationApiRoot=/serviceInstantiation/v7

+mso.restapi.serviceInstanceCreate=${mso.restapi.serviceInstantiationApiRoot}/serviceInstances

+mso.restapi.serviceInstanceAssign=${mso.restapi.serviceInstantiationApiRoot}/serviceInstances/assign

+

+mso.restapi.cloudResourcesApiRoot=/cloudResources/v1

+mso.restapi.operationalEnvironment=${mso.restapi.cloudResourcesApiRoot}/operationalEnvironments/<operational_environment_id>

+

+mso.restapi.operationalEnvironment.activate=${mso.restapi.operationalEnvironment}/activate

+mso.restapi.operationalEnvironment.deactivate=${mso.restapi.operationalEnvironment}/deactivate

+mso.restapi.operationalEnvironment.create=${mso.restapi.cloudResourcesApiRoot}/operationalEnvironments

+

+mso.restapi.cloudResourcesRequestsApiRoot=/cloudResourcesRequests/v1

+mso.restapi.operationalEnvironment.cloudResourcesRequests.status=${mso.restapi.cloudResourcesRequestsApiRoot}?requestId=<request_id>

+

+mso.displayTestAPIOnScreen=true

+mso.defaultTestAPI=GR_API

+mso.maxOpenedInstantiationRequests=20

+mso.asyncPollingIntervalSeconds=1

+refreshTimeInstantiationDashboard=10

+

 vid.truststore.filename=${VID_TRUSTSTORE_FILE}

 vid.truststore.passwd.x=${VID_TRUSTSTORE_PASS}

 mso.dme2.client.timeout=${MSO_DME2_CLIENT_TIMEOUT}