aboutsummaryrefslogtreecommitdiffstats
path: root/epsdk-app-onap/src/main/java/org/onap/portalapp/conf
diff options
context:
space:
mode:
authorSonsino, Ofir (os0695) <os0695@intl.att.com>2018-07-10 14:20:54 +0300
committerSonsino, Ofir (os0695) <os0695@intl.att.com>2018-07-10 14:20:54 +0300
commitc72d565bb58226b20625b2bce5f0019046bee649 (patch)
tree8658e49595705b02e47ddc14afa20d6bb7123547 /epsdk-app-onap/src/main/java/org/onap/portalapp/conf
parentef8a6b47847012fd59ea20da21d8d3d7c4a301ed (diff)
Merge 1806 code of vid-common
Change-Id: I75d52abed4a24dfe3827d79edc4a2938726aa87a Issue-ID: VID-208 Signed-off-by: Sonsino, Ofir (os0695) <os0695@intl.att.com>
Diffstat (limited to 'epsdk-app-onap/src/main/java/org/onap/portalapp/conf')
-rw-r--r--epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java21
-rw-r--r--epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java22
2 files changed, 42 insertions, 1 deletions
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 2d222f0dc..9cf5df548 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.context.annotation.PropertySource;
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 @@ public class ExternalAppConfig extends AppConfig implements Configurable {
* @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 @@ public class ExternalAppConfig extends AppConfig implements Configurable {
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 class ExternalAppConfig extends AppConfig implements Configurable {
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 c8fbc4347..93e867d63 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 @@ public class ExternalAppInitializer extends AppInitializer {
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
+ }
}