aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-SDK-APP/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'ONAP-SDK-APP/src/main/java')
-rw-r--r--ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java161
-rw-r--r--ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java47
-rw-r--r--ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/HibernateMappingLocations.java57
-rw-r--r--ONAP-SDK-APP/src/main/java/org/onap/portalapp/lm/FusionLicenseManagerImpl.java69
-rw-r--r--ONAP-SDK-APP/src/main/java/org/onap/portalapp/lm/LicenseableClassImpl.java62
-rw-r--r--ONAP-SDK-APP/src/main/java/org/onap/portalapp/login/LoginStrategyImpl.java73
-rw-r--r--ONAP-SDK-APP/src/main/java/org/onap/portalapp/scheduler/Register.java72
-rw-r--r--ONAP-SDK-APP/src/main/java/org/onap/portalapp/scheduler/RegistryAdapter.java92
-rw-r--r--ONAP-SDK-APP/src/main/java/org/onap/portalapp/service/AdminAuthExtension.java114
9 files changed, 747 insertions, 0 deletions
diff --git a/ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java
new file mode 100644
index 000000000..15a6c765e
--- /dev/null
+++ b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java
@@ -0,0 +1,161 @@
+/*-
+ * ================================================================================
+ * ONAP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * 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.
+ * ================================================================================
+ */
+package org.onap.portalapp.conf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.onap.portalapp.login.LoginStrategyImpl;
+import org.onap.portalapp.scheduler.RegistryAdapter;
+import org.openecomp.portalsdk.core.auth.LoginStrategy;
+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.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.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;
+
+/**
+ * ONAP Portal SDK sample application. ONAP Portal SDK core AppConfig class to
+ * reuse interceptors, view resolvers and other features defined there.
+ */
+@Configuration
+@EnableWebMvc
+@ComponentScan(basePackages = "org.onap")
+@PropertySource(value = { "${container.classpath:}/WEB-INF/conf/app/test.properties" }, ignoreResourceNotFound = true)
+@Profile("src")
+@EnableAsync
+@EnableScheduling
+public class ExternalAppConfig extends AppConfig implements Configurable {
+
+ private RegistryAdapter schedulerRegistryAdapter;
+
+ @Configuration
+ @Import(SystemProperties.class)
+ static class InnerConfiguration {
+ }
+
+ /**
+ * @see org.openecomp.portalsdk.core.conf.AppConfig#viewResolver()
+ */
+ public ViewResolver viewResolver() {
+ return super.viewResolver();
+ }
+
+ /**
+ * @see org.openecomp.portalsdk.core.conf.AppConfig#addResourceHandlers(ResourceHandlerRegistry)
+ *
+ * @param registry
+ */
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
+ super.addResourceHandlers(registry);
+ }
+
+ /**
+ * @see org.openecomp.portalsdk.core.conf.AppConfig#dataAccessService()
+ */
+ public DataAccessService dataAccessService() {
+ // Echo the JDBC URL to assist developers when starting the app.
+ System.out.println("ExternalAppConfig: " + SystemProperties.DB_CONNECTIONURL + " is "
+ + SystemProperties.getProperty(SystemProperties.DB_CONNECTIONURL));
+ 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<>();
+ 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.
+ */
+ @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();
+ }
+
+ /**
+ * Creates and returns a new instance of a {@link SchedulerFactoryBean} and
+ * populates it with triggers.
+ *
+ * @return New instance of {@link SchedulerFactoryBean}
+ * @throws 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;
+ }
+
+ /**
+ * Sets the scheduler registry adapter.
+ *
+ * @param schedulerRegistryAdapter
+ */
+ @Autowired
+ public void setSchedulerRegistryAdapter(final RegistryAdapter schedulerRegistryAdapter) {
+ this.schedulerRegistryAdapter = schedulerRegistryAdapter;
+ }
+
+ @Bean
+ public LoginStrategy loginStrategy() {
+
+ return new LoginStrategyImpl();
+ }
+}
diff --git a/ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java
new file mode 100644
index 000000000..a77c781ff
--- /dev/null
+++ b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java
@@ -0,0 +1,47 @@
+/*-
+ * ================================================================================
+ * ONAP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * 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.
+ * ================================================================================
+ */
+package org.onap.portalapp.conf;
+
+import org.openecomp.portalsdk.core.conf.AppInitializer;
+
+public class ExternalAppInitializer extends AppInitializer {
+
+ @Override
+ protected Class<?>[] getRootConfigClasses() {
+ return super.getRootConfigClasses();
+ }
+
+ @Override
+ protected Class<?>[] getServletConfigClasses() {
+ Class<?> appConfigClass = ExternalAppConfig.class;
+ // Show something on stdout to indicate the app is starting.
+ System.out.println("ExternalAppInitializer: servlet configuration class is " + appConfigClass.getName());
+ return new Class[] { appConfigClass };
+ }
+
+ /*
+ * URL request will direct to the Spring dispatcher for processing
+ */
+ @Override
+ protected String[] getServletMappings() {
+ return super.getServletMappings();
+ }
+
+}
diff --git a/ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/HibernateMappingLocations.java b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/HibernateMappingLocations.java
new file mode 100644
index 000000000..ee73a5a98
--- /dev/null
+++ b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/HibernateMappingLocations.java
@@ -0,0 +1,57 @@
+/*-
+ * ================================================================================
+ * ONAP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * 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.
+ * ================================================================================
+ */
+package org.onap.portalapp.conf;
+
+import org.springframework.context.annotation.Profile;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+import org.springframework.stereotype.Component;
+
+import org.openecomp.portalsdk.core.conf.HibernateMappingLocatable;
+
+@Component
+@Profile("src")
+public class HibernateMappingLocations implements HibernateMappingLocatable {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.openecomp.portalsdk.core.conf.HibernateMappingLocatable#
+ * getMappingLocations()
+ */
+ @Override
+ 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") };
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.openecomp.portalsdk.core.conf.HibernateMappingLocatable#
+ * getPackagesToScan()
+ */
+ @Override
+ public String[] getPackagesToScan() {
+ return new String[] { "org.onap" };
+ }
+
+}
diff --git a/ONAP-SDK-APP/src/main/java/org/onap/portalapp/lm/FusionLicenseManagerImpl.java b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/lm/FusionLicenseManagerImpl.java
new file mode 100644
index 000000000..5028162b5
--- /dev/null
+++ b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/lm/FusionLicenseManagerImpl.java
@@ -0,0 +1,69 @@
+package org.onap.portalapp.lm;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+
+import org.openecomp.portalsdk.core.lm.FusionLicenseManager;
+import org.springframework.stereotype.Component;
+
+/*
+ * Please note that this class is not being used; its a dummy stub to have a qualifying bean for the interface.
+ */
+
+@Component
+public class FusionLicenseManagerImpl implements FusionLicenseManager {
+
+ @Override
+ public void initKeyStoreParam() {
+
+ }
+
+ @Override
+ public void initCipherParam() {
+
+ }
+
+ @Override
+ public void initLicenseParam() {
+
+ }
+
+ @Override
+ public void doInitWork() {
+
+ }
+
+ @Override
+ public int installLicense() {
+ return 0;
+ }
+
+ @Override
+ public synchronized int verifyLicense(ServletContext context) {
+ return 0;
+ }
+
+ @Override
+ public void generateLicense(Map<String, String> clientInfoMap, List<String> ipAddressList) throws Exception {
+
+ }
+
+ @Override
+ public String nvl(String s) {
+ return null;
+ }
+
+ @Override
+ public Date getExpiredDate() {
+ return null;
+ }
+
+ @Override
+ public void setExpiredDate(Date expiredDate) {
+
+ }
+
+}
diff --git a/ONAP-SDK-APP/src/main/java/org/onap/portalapp/lm/LicenseableClassImpl.java b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/lm/LicenseableClassImpl.java
new file mode 100644
index 000000000..d3b08e242
--- /dev/null
+++ b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/lm/LicenseableClassImpl.java
@@ -0,0 +1,62 @@
+/*-
+ * ================================================================================
+ * onap Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * 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.
+ * ================================================================================
+ */
+package org.onap.portalapp.lm;
+
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+
+import org.openecomp.portalsdk.core.lm.LicenseableClass;
+
+/*
+ * Please note that this class is not being used; its a dummy stub to have a qualifying bean for the interface.
+ */
+
+public class LicenseableClassImpl implements LicenseableClass {
+
+ public String getApplicationName() {
+ return "";
+ }
+
+ public InputStream getPublicKeystoreAsInputStream() throws FileNotFoundException {
+ return null;
+ }
+
+ public String getAlias() {
+ return "";
+ }
+
+ public String getKeyPasswd() {
+ return "";
+ }
+
+ public String getPublicKeystorePassword() {
+ return "";
+ }
+
+ public String getCipherParamPassword() {
+ return "";
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Class getClassToLicense() {
+ return this.getClass();
+ }
+}
+
diff --git a/ONAP-SDK-APP/src/main/java/org/onap/portalapp/login/LoginStrategyImpl.java b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/login/LoginStrategyImpl.java
new file mode 100644
index 000000000..dca71ae5f
--- /dev/null
+++ b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/login/LoginStrategyImpl.java
@@ -0,0 +1,73 @@
+package org.onap.portalapp.login;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
+import org.openecomp.portalsdk.core.auth.LoginStrategy;
+import org.openecomp.portalsdk.core.onboarding.exception.PortalAPIException;
+import org.openecomp.portalsdk.core.onboarding.util.CipherUtil;
+import org.openecomp.portalsdk.core.onboarding.util.PortalApiConstants;
+import org.openecomp.portalsdk.core.onboarding.util.PortalApiProperties;
+import org.springframework.web.servlet.ModelAndView;
+
+public class LoginStrategyImpl extends LoginStrategy {
+
+ private static final Logger LOGGER = FlexLogger.getLogger(LoginStrategyImpl.class);
+
+ @Override
+ public ModelAndView doLogin(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ //'login' for opensource is same as 'external' login.
+ return doExternalLogin(request, response);
+ }
+
+ @Override
+ public String getUserId(HttpServletRequest request) throws PortalAPIException {
+ // Check ONAP Portal cookie
+ if (!isLoginCookieExist(request))
+ return null;
+
+ String userid = null;
+ try {
+ userid = getUserIdFromCookie(request);
+ } catch (Exception e) {
+ LOGGER.error("Exception Occured"+e);
+ }
+ return userid;
+ }
+
+ private static String getUserIdFromCookie(HttpServletRequest request) throws Exception {
+ String userId = "";
+ Cookie[] cookies = request.getCookies();
+ Cookie userIdcookie = null;
+ if (cookies != null)
+ for (Cookie cookie : cookies)
+ if (cookie.getName().equals(USER_ID))
+ userIdcookie = cookie;
+ if(userIdcookie!=null){
+ userId = CipherUtil.decrypt(userIdcookie.getValue(),
+ PortalApiProperties.getProperty(PortalApiConstants.Decryption_Key));
+ }
+ return userId;
+
+ }
+
+ private static boolean isLoginCookieExist(HttpServletRequest request) {
+ Cookie ep = getCookie(request, EP_SERVICE);
+ return (ep != null);
+ }
+
+ private static Cookie getCookie(HttpServletRequest request, String cookieName) {
+ Cookie[] cookies = request.getCookies();
+ if (cookies != null)
+ for (Cookie cookie : cookies)
+ if (cookie.getName().equals(cookieName))
+ return cookie;
+
+ return null;
+ }
+
+
+}
diff --git a/ONAP-SDK-APP/src/main/java/org/onap/portalapp/scheduler/Register.java b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/scheduler/Register.java
new file mode 100644
index 000000000..b33707f2a
--- /dev/null
+++ b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/scheduler/Register.java
@@ -0,0 +1,72 @@
+/*-
+ * ================================================================================
+ * ONAP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * 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.
+ * ================================================================================
+ */
+package org.onap.portalapp.scheduler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openecomp.portalapp.scheduler.LogRegistry;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.scheduler.Registerable;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.quartz.Trigger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.DependsOn;
+import org.springframework.stereotype.Component;
+
+@Component
+@DependsOn({ "logRegistry", "systemProperties" })
+public class Register implements Registerable {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(Register.class);
+
+ private List<Trigger> scheduleTriggers = new ArrayList<>();
+ Trigger trigger[] = new Trigger[1];
+
+ @Autowired
+ private LogRegistry logRegistry;
+
+ @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.debugLogger, ("Log Cron not available") + ies);
+ }
+
+ }
+
+ public List<Trigger> getScheduleTriggers() {
+ return scheduleTriggers;
+ }
+
+ public void setScheduleTriggers(List<Trigger> scheduleTriggers) {
+ this.scheduleTriggers = scheduleTriggers;
+ }
+
+}
diff --git a/ONAP-SDK-APP/src/main/java/org/onap/portalapp/scheduler/RegistryAdapter.java b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/scheduler/RegistryAdapter.java
new file mode 100644
index 000000000..40069cf77
--- /dev/null
+++ b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/scheduler/RegistryAdapter.java
@@ -0,0 +1,92 @@
+/*-
+ * ================================================================================
+ * ONAP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * 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.
+ * ================================================================================
+ */
+package org.onap.portalapp.scheduler;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.openecomp.portalsdk.core.scheduler.Registerable;
+import org.openecomp.portalsdk.workflow.services.WorkflowScheduleService;
+import org.quartz.Trigger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.quartz.SchedulerFactoryBean;
+import org.springframework.stereotype.Component;
+
+@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<>();
+
+ 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;
+ }
+
+}
diff --git a/ONAP-SDK-APP/src/main/java/org/onap/portalapp/service/AdminAuthExtension.java b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/service/AdminAuthExtension.java
new file mode 100644
index 000000000..dadb66c8e
--- /dev/null
+++ b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/service/AdminAuthExtension.java
@@ -0,0 +1,114 @@
+/*-
+ * ================================================================================
+ * ONAP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * 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.
+ * ================================================================================
+ */
+package org.onap.portalapp.service;
+
+import java.util.Set;
+
+import org.onap.policy.model.Roles;
+import org.onap.policy.rest.dao.CommonClassDao;
+import org.onap.policy.rest.jpa.UserInfo;
+import org.openecomp.portalapp.service.IAdminAuthExtension;
+import org.openecomp.portalsdk.core.domain.Role;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+
+@Service("adminAuthExtension")
+@Transactional
+/**
+ * Provides empty implementations of the methods in IAdminAuthExtension.
+ */
+public class AdminAuthExtension implements IAdminAuthExtension {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AdminAuthExtension.class);
+
+ @Autowired
+ CommonClassDao commonClassDao;
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.onap.portalapp.service.IAdminAuthExtension#saveUserExtension(org.openecomp.portalsdk.core.domain.User)
+ */
+ public void saveUserExtension(User user) {
+ logger.debug("saveUserExtension");
+ savePolicyRole(null, user);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.onap.portalapp.service.IAdminAuthExtension#editUserExtension(org.openecomp.portalsdk.core.domain.User)
+ */
+ public void editUserExtension(User user) {
+ logger.debug("editUserExtension");
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.onap.portalapp.service.IAdminAuthExtension#saveUserRoleExtension(java.util.Set, org.openecomp.portalsdk.core.domain.User)
+ */
+ public void saveUserRoleExtension(Set<Role> roles, User user) {
+ logger.debug("saveUserRoleExtension");
+ savePolicyRole(roles, user);
+ }
+
+ private void savePolicyRole(Set<Role> roles, User user){
+ System.out.println("User Object Recieved");
+ try{
+ Roles roles1 = new Roles();
+ roles1.setName(user.getFullName());
+ roles1.setLoginId(user.getLoginId());
+ if(user.getRoles() != null){
+ String query = "delete from Roles where loginid='"+user.getLoginId()+"'";
+ commonClassDao.updateQuery(query);
+ for(Role role : user.getRoles()){
+ System.out.println("User Role"+role);
+ if(role.getName().trim().equalsIgnoreCase("Policy Super Admin") || role.getName().trim().equalsIgnoreCase("System Administrator") || role.getName().trim().equalsIgnoreCase("Standard User") ){
+ roles1.setRole("super-admin");
+ }else if(role.getName().trim().equalsIgnoreCase("Policy Super Editor")){
+ roles1.setRole("super-editor");
+ }else if(role.getName().trim().equalsIgnoreCase("Policy Super Guest")){
+ roles1.setRole("super-guest");
+ }else if(role.getName().trim().equalsIgnoreCase("Policy Admin")){
+ roles1.setRole("admin");
+ }else if(role.getName().trim().equalsIgnoreCase("Policy Editor")){
+ roles1.setRole("editor");
+ }else if(role.getName().trim().equalsIgnoreCase("Policy Guest")){
+ roles1.setRole("guest");
+ }
+ commonClassDao.save(roles1);
+ }
+ }
+
+ UserInfo userInfo = new UserInfo();
+ userInfo.setUserLoginId(user.getLoginId());
+ userInfo.setUserName(user.getFullName());
+ commonClassDao.save(userInfo);
+ System.out.println("User Object Updated Successfully");
+ }
+ catch(Exception e){
+ logger.error("Exception caused while Setting role to Policy DB"+e);
+ }
+ }
+
+}