summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/sdk-app/src/main/java/org/openecomp
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/sdk-app/src/main/java/org/openecomp')
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java188
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppInitializer.java60
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/HibernateMappingLocations.java37
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/AngularSinglePageController.java48
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/CallflowController.java44
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/ElasticSearchController.java128
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/LeafletMapContoller.java43
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/PostDroolsController.java138
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/UserProfileController.java72
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/WelcomeController.java43
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/model/Result.java37
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogJob.java47
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogRegistry.java57
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/Register.java82
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java108
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java34
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java73
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java104
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java46
-rw-r--r--ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/util/CustomLoggingFilter.java54
20 files changed, 1443 insertions, 0 deletions
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java
new file mode 100644
index 00000000..ff9f0f1a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java
@@ -0,0 +1,188 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.openecomp.portalapp.conf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openecomp.portalapp.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.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;
+
+/**
+ * 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 {
+
+ 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() {
+ 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.
+ */
+ @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 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
+ */
+ // @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;
+ }
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppInitializer.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppInitializer.java
new file mode 100644
index 00000000..dfdfcade
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppInitializer.java
@@ -0,0 +1,60 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.openecomp.portalapp.conf;
+
+import java.util.Arrays;
+
+import org.openecomp.portalsdk.core.conf.AppInitializer;
+
+public class ExternalAppInitializer extends AppInitializer{
+
+
+ @Override
+ protected Class<?>[] getRootConfigClasses() {
+ return super.getRootConfigClasses();
+ }
+
+ @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};
+ }
+
+ static Class<?>[] addConfigClass(Class<?>[] a, Class<?> e) {
+ a = Arrays.copyOf(a, a.length + 1);
+ a[a.length - 1] = e;
+ return a;
+ }
+
+ /*
+ * URL request will direct to the Spring dispatcher for processing
+ */
+ @Override
+ protected String[] getServletMappings() {
+ return super.getServletMappings();
+ }
+
+}
+
+
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/HibernateMappingLocations.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/HibernateMappingLocations.java
new file mode 100644
index 00000000..3e1d89d2
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/HibernateMappingLocations.java
@@ -0,0 +1,37 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.openecomp.portalapp.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;
+
+@Component
+@Profile("src")
+public class HibernateMappingLocations implements HibernateMappingLocatable {
+
+ 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/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/AngularSinglePageController.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/AngularSinglePageController.java
new file mode 100644
index 00000000..e654a51c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/AngularSinglePageController.java
@@ -0,0 +1,48 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.openecomp.portalapp.controller;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+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;
+
+/**
+ * Controller for a single-page application sample. The view is restricted to
+ * authenticated users. The named view resolves to page singlePageSample.html,
+ * which uses Angular.
+ */
+@Controller
+@RequestMapping("/")
+public class AngularSinglePageController extends RestrictedBaseController {
+
+ @RequestMapping(value = { "/singlePageSample" }, method = RequestMethod.GET)
+ public ModelAndView view(HttpServletRequest request) {
+ Map<String, Object> model = new HashMap<String, Object>();
+ return new ModelAndView("single_page_sample", "model", model);
+ }
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/CallflowController.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/CallflowController.java
new file mode 100644
index 00000000..a3d1be5f
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/CallflowController.java
@@ -0,0 +1,44 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.openecomp.portalapp.controller;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+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;
+
+/**
+ * Controller for a message sequence chart view. The view is restricted to
+ * authenticated users. The view name defaults to the request name with no
+ * suffix, "callflow", which resolves to page details.jsp. That page is an
+ * iframe around page details.html.
+ */
+@Controller
+@RequestMapping("/")
+public class CallflowController extends RestrictedBaseController {
+
+ @RequestMapping(value = { "/callflow" }, method = RequestMethod.GET)
+ public ModelAndView plot() {
+ final String defaultViewName = null;
+ return new ModelAndView(defaultViewName);
+ }
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/ElasticSearchController.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/ElasticSearchController.java
new file mode 100644
index 00000000..69ff63db
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/ElasticSearchController.java
@@ -0,0 +1,128 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.openecomp.portalapp.controller;
+
+import java.io.IOException;
+
+import org.json.JSONObject;
+import org.openecomp.portalapp.model.Result;
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+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 io.searchbox.client.JestClient;
+import io.searchbox.client.JestClientFactory;
+import io.searchbox.client.config.HttpClientConfig;
+import io.searchbox.core.Search;
+import io.searchbox.core.SearchResult;
+import io.searchbox.core.Suggest;
+import io.searchbox.core.SuggestResult;
+import io.searchbox.params.Parameters;
+
+/**
+ * Controller for views that demonstrate Elastic Search features.
+ */
+@RestController
+public class ElasticSearchController extends RestrictedBaseController{
+
+ @RequestMapping(value = {"/es_search_demo" }, method = RequestMethod.GET)
+ public ModelAndView search() {
+ return new ModelAndView("es_search_demo");
+ }
+
+ @RequestMapping(value = {"/es_suggest_demo" }, method = RequestMethod.GET)
+ public ModelAndView suggest() {
+ return new ModelAndView("es_suggest_demo");
+ }
+
+ @RequestMapping(value="/es_suggest/{task}",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<Result> doSuggest(@PathVariable("task") String task) throws IOException {
+ JSONObject obj = new JSONObject(task);
+ String searchTerm = obj.getString("data");
+ String searchSize = obj.getString("size");
+ String searchFuzzy = obj.getString("fuzzy");
+ String resultName = obj.getString("resultname");
+
+ JestClientFactory factory = new JestClientFactory();
+ factory.setHttpClientConfig(new HttpClientConfig
+ .Builder("http://todo_elastic_search_server")
+ .multiThreaded(true)
+ .build());
+ JestClient client = factory.getObject();
+
+
+ Suggest suggest = new Suggest.Builder("{\n"
+ +"\"" + resultName +"\" : {\n"
+ +"\"text\" : \""+ searchTerm +"\",\n"
+ +"\"completion\" : {\n"
+ +"\"field\" : \"suggest\",\n"
+ +"\"size\" : " + searchSize + ",\n"
+ +"\"fuzzy\" : \"" + searchFuzzy + "\"\n"
+ +"}\n"
+ +"}\n"
+ +"}").addIndex("customer").build();
+
+ SuggestResult result = client.execute(suggest);
+ System.err.println(result.getJsonObject().toString());
+ return new ResponseEntity<Result>(new Result(result.getJsonObject().toString()),HttpStatus.OK);
+ }
+
+ @RequestMapping(value="/es_search/{task}",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<Result> doSearch(@PathVariable("task") String task) throws IOException {
+ JSONObject obj = new JSONObject(task);
+ String searchTerm = obj.getString("data");
+ String searchSize = obj.getString("size");
+ // String searchFuzzy = obj.getString("fuzzy");
+
+ JestClientFactory factory = new JestClientFactory();
+ factory.setHttpClientConfig(new HttpClientConfig
+ .Builder("http://todo_elastic_search_server")
+ .multiThreaded(true)
+ .build());
+ JestClient client = factory.getObject();
+
+ Search search = new Search.Builder("{\n"
+ +"\"query\" : {\n"
+ +"\"query_string\" : {\n"
+ +"\"query\" : \"name:"+ searchTerm +"\"\n"
+ +"}\n"
+ +"}\n"
+ +"}").addIndex("customer").setParameter(Parameters.SIZE,Integer.valueOf(searchSize)).build();
+
+ SearchResult result = client.execute(search);
+ System.err.println(result.getJsonObject().toString());
+ return new ResponseEntity<Result>(new Result(result.getJsonObject().toString()),HttpStatus.OK);
+ }
+
+ public ResponseEntity<Result> sendResult(Result result) {
+ return new ResponseEntity<Result>(result, HttpStatus.OK);
+ }
+
+ @Override
+ public boolean isRESTfulCall() {
+ return true;
+ }
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/LeafletMapContoller.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/LeafletMapContoller.java
new file mode 100644
index 00000000..4c603fe1
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/LeafletMapContoller.java
@@ -0,0 +1,43 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.openecomp.portalapp.controller;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+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;
+
+/**
+ * Controller for geographic map view. The view is restricted to authenticated
+ * users. The view name defaults to the request name with no suffix,
+ * "leafletMap", which resolves to page leafletMap.jsp.
+ */
+@Controller
+@RequestMapping("/")
+public class LeafletMapContoller extends RestrictedBaseController {
+
+ @RequestMapping(value = { "/leafletMap" }, method = RequestMethod.GET)
+ public ModelAndView plot() {
+ final String defaultViewName = null;
+ return new ModelAndView(defaultViewName);
+ }
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/PostDroolsController.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/PostDroolsController.java
new file mode 100644
index 00000000..2729e873
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/PostDroolsController.java
@@ -0,0 +1,138 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.openecomp.portalapp.controller;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.json.JSONObject;
+import org.openecomp.portalsdk.core.command.PostDroolsBean;
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.openecomp.portalsdk.core.service.PostDroolsService;
+import org.openecomp.portalsdk.core.web.support.JsonMessage;
+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 com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Controller
+@RequestMapping("/")
+public class PostDroolsController extends RestrictedBaseController{
+
+ @Autowired
+ private PostDroolsService postDroolsService;
+
+ @RequestMapping(value = {"/drools" }, method = RequestMethod.GET)
+ public ModelAndView drools(HttpServletRequest request) {
+
+ return new ModelAndView(getViewName());
+ }
+
+
+ @RequestMapping(value = {"/getDrools" }, method = RequestMethod.GET)
+ public void getDrools(HttpServletRequest request, HttpServletResponse response) {
+ // Map<String, Object> model = new HashMap<String, Object>();
+
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ List<PostDroolsBean> beanList = postDroolsService.fetchDroolBeans();
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(beanList));
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+
+ } catch (JsonGenerationException e) {
+ e.printStackTrace();
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @RequestMapping(value = {"/getDroolDetails" }, method = RequestMethod.GET)
+ public void getDroolDetails(HttpServletRequest request, HttpServletResponse response) {
+
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+
+ PostDroolsBean postDroolsBean = new PostDroolsBean();
+ String selectedFile = request.getParameter("selectedFile");
+ postDroolsBean.setDroolsFile(selectedFile);//sample populated
+ //postDroolsBean.setSelectedRules("[\"NJ\",\"NY\",\"KY\"]");
+ postDroolsBean.setClassName(postDroolsService.retrieveClass(selectedFile));
+
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(postDroolsBean));
+ JSONObject j = new JSONObject(msg);
+ response.getWriter().write(j.toString());
+
+ } catch (JsonGenerationException e) {
+ e.printStackTrace();
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @RequestMapping(value = {"/post_drools/execute" }, method = RequestMethod.POST)
+ public ModelAndView search(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ PostDroolsBean postDroolsBean = mapper.readValue(root.get("postDroolsBean").toString(), PostDroolsBean.class);
+
+ String resultsString = postDroolsService.execute(postDroolsBean.getDroolsFile(), postDroolsBean.getClassName(), postDroolsBean.getSelectedRules());
+
+ response.setCharacterEncoding("UTF-8");
+ response.setContentType("application / json");
+ request.setCharacterEncoding("UTF-8");
+
+ PrintWriter out = response.getWriter();
+ //String responseString = mapper.writeValueAsString(resultsString);
+ JSONObject j = new JSONObject("{resultsString: "+resultsString+"}");
+
+ out.write(j.toString());
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/UserProfileController.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/UserProfileController.java
new file mode 100644
index 00000000..2f4ea93d
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/UserProfileController.java
@@ -0,0 +1,72 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.openecomp.portalapp.controller;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.openecomp.portalsdk.core.domain.Profile;
+import org.openecomp.portalsdk.core.service.ProfileService;
+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 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 {
+
+ @Autowired
+ ProfileService service;
+
+ @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/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/WelcomeController.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/WelcomeController.java
new file mode 100644
index 00000000..06853f0e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/WelcomeController.java
@@ -0,0 +1,43 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.openecomp.portalapp.controller;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+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;
+
+/**
+ * Controller for welcome view. The view is restricted to authenticated users.
+ * The view name defaults to the request name with no suffix, "welcome", which
+ * resolves to page welcome.jsp.
+ */
+@Controller
+@RequestMapping("/")
+public class WelcomeController extends RestrictedBaseController {
+ @RequestMapping(value = { "/welcome" }, method = RequestMethod.GET)
+ public ModelAndView welcome(HttpServletRequest request) {
+ final String defaultViewName = null;
+ return new ModelAndView(defaultViewName);
+ }
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/model/Result.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/model/Result.java
new file mode 100644
index 00000000..5e09cb2c
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/model/Result.java
@@ -0,0 +1,37 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.openecomp.portalapp.model;
+
+public class Result {
+ private String result;
+
+ public Result(String result) {
+ this.result = result;
+ }
+
+ public String getResult() {
+ return result;
+ }
+
+ public void setResult(String result) {
+ this.result = result;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogJob.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogJob.java
new file mode 100644
index 00000000..b308efbb
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogJob.java
@@ -0,0 +1,47 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.openecomp.portalapp.scheduler;
+
+import org.openecomp.portalapp.conf.ExternalAppConfig;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.quartz.DisallowConcurrentExecution;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.quartz.PersistJobDataAfterExecution;
+import org.springframework.scheduling.quartz.QuartzJobBean;
+
+@PersistJobDataAfterExecution
+@DisallowConcurrentExecution
+public class LogJob extends QuartzJobBean {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ExternalAppConfig.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.debugLogger, (Runtime.getRuntime().maxMemory() + " " + Runtime.getRuntime().maxMemory()));
+
+ }
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogRegistry.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogRegistry.java
new file mode 100644
index 00000000..dce9e26b
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogRegistry.java
@@ -0,0 +1,57 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.openecomp.portalapp.scheduler;
+
+import java.text.ParseException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openecomp.portalsdk.core.scheduler.CronRegistry;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.springframework.context.annotation.DependsOn;
+import org.springframework.scheduling.quartz.CronTriggerFactoryBean;
+import org.springframework.scheduling.quartz.JobDetailFactoryBean;
+import org.springframework.stereotype.Component;
+
+@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/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/Register.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/Register.java
new file mode 100644
index 00000000..3a29520e
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/Register.java
@@ -0,0 +1,82 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.openecomp.portalapp.scheduler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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 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"));
+ }
+
+
+ }
+
+
+ public List<Trigger> getScheduleTriggers() {
+ return scheduleTriggers;
+ }
+
+ public void setScheduleTriggers(List<Trigger> scheduleTriggers) {
+ this.scheduleTriggers = scheduleTriggers;
+ }
+
+
+
+
+
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java
new file mode 100644
index 00000000..1bc43fee
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java
@@ -0,0 +1,108 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.openecomp.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;
+
+/**
+ * TODO REFACTOR
+ * moved from org.openecomp.portalsdk.core.scheduler
+ * to org.openecomp.portalapp.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;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java
new file mode 100644
index 00000000..c4a36c61
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java
@@ -0,0 +1,34 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.openecomp.portalapp.service;
+
+import org.openecomp.portalsdk.core.domain.User;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service("adminAuthExtension")
+@Transactional
+public class AdminAuthExtension {
+
+ public void saveUserExtension(User user){
+ //app's developer implement their own logic here, like updating app's related tables
+ }
+
+}
diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java
new file mode 100644
index 00000000..c052187a
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java
@@ -0,0 +1,73 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.openecomp.portalapp.uebhandler;
+
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import javax.annotation.PostConstruct;
+
+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.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+
+//
+// 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.
+//
+@Configuration
+public class InitUebHandler {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(InitUebHandler.class);
+
+
+ @Autowired
+ MainUebHandler mainUebHandler;
+
+ public InitUebHandler() {
+
+ }
+
+ @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/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java
new file mode 100644
index 00000000..7ff07dd4
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java
@@ -0,0 +1,104 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.openecomp.portalapp.uebhandler;
+
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg;
+import org.openecomp.portalsdk.core.onboarding.ueb.UebMsgTypes;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+
+//-------------------------------------------------------------------------
+// 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).
+//
+//-------------------------------------------------------------------------
+@Component("MainUebHandler")
+public class MainUebHandler {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MainUebHandler.class);
+
+
+ ConcurrentLinkedQueue<UebMsg> inboxQueue = null;
+
+ @Autowired
+ WidgetNotificationHandler widgetNotificationHandler;
+
+ @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/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java
new file mode 100644
index 00000000..dd2213da
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java
@@ -0,0 +1,46 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.openecomp.portalapp.uebhandler;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+
+@Component
+public class WidgetNotificationHandler {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetNotificationHandler.class);
+
+
+ public WidgetNotificationHandler() {
+ }
+
+ @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/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/util/CustomLoggingFilter.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/util/CustomLoggingFilter.java
new file mode 100644
index 00000000..48c51195
--- /dev/null
+++ b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/util/CustomLoggingFilter.java
@@ -0,0 +1,54 @@
+/*-
+ * ================================================================================
+ * eCOMP 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.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.
+ */
+ @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;
+ }
+ }
+}