summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/controller
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/controller')
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/controller/FusionBaseController.java135
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedBaseController.java50
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedRESTfulBaseController.java50
-rw-r--r--ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/controller/UnRestrictedBaseController.java40
4 files changed, 0 insertions, 275 deletions
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/controller/FusionBaseController.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/controller/FusionBaseController.java
deleted file mode 100644
index c7820115..00000000
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/controller/FusionBaseController.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*-
- * ================================================================================
- * 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.portalsdk.core.controller;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-import org.openecomp.portalsdk.core.domain.MenuData;
-import org.openecomp.portalsdk.core.domain.User;
-import org.openecomp.portalsdk.core.interfaces.SecurityInterface;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.menu.MenuBuilder;
-import org.openecomp.portalsdk.core.service.AppService;
-import org.openecomp.portalsdk.core.service.DataAccessService;
-import org.openecomp.portalsdk.core.service.FnMenuService;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.openecomp.portalsdk.core.web.support.UserUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.ModelAttribute;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-@Controller
-public abstract class FusionBaseController implements SecurityInterface{
-
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FusionBaseController.class);
-
- @Override
- public boolean isAccessible() {
- return true;
- }
-
- public boolean isRESTfulCall(){
- return true;
- }
- @Autowired
- private FnMenuService fnMenuService;
-
- @Autowired
- private MenuBuilder menuBuilder;
-
- @Autowired
- private DataAccessService dataAccessService;
-
- @Autowired
- AppService appService;
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- @ModelAttribute("menu")
- public Map<String, Object> getMenu(HttpServletRequest request) {
- HttpSession session = null;
- Map<String, Object> model = new HashMap<String, Object>();
- try {
- try {
- String appName = appService.getDefaultAppName();
- if (appName==null || appName=="") {
- appName = SystemProperties.SDK_NAME;
- }
- logger.setRequestBasedDefaultsIntoGlobalLoggingContext(request, appName);
- } catch (Exception e) {
- }
-
- session = request.getSession();
- User user = UserUtils.getUserSession(request);
- if(session!=null && user!=null){
- Set<MenuData> menuResult = (Set<MenuData>) session.getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME));
- if(menuResult==null){
- Set appMenu = getMenuBuilder().getMenu(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_SET_NAME),dataAccessService);
- session.setAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME), MenuBuilder.filterMenu(appMenu, request));
- menuResult = (Set<MenuData>) session.getAttribute(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_ATTRIBUTE_NAME));
- }
- model = setMenu(menuResult);
- }
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage());
- }
- return model;
- }
-
- public Map<String, Object> setMenu(Set<MenuData> menuResult) throws Exception{
- ObjectMapper mapper = new ObjectMapper();
- List<List<MenuData>> childItemList = new ArrayList<List<MenuData>>();;
- List<MenuData> parentList = new ArrayList<MenuData>();;
- Map<String, Object> model = new HashMap<String, Object>();
- try{
- fnMenuService.setMenuDataStructure(childItemList, parentList, menuResult);
- }catch(Exception e){
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage());
- }
- model.put("childItemList",childItemList!=null?mapper.writeValueAsString(childItemList):"");
- model.put("parentList",parentList!=null?mapper.writeValueAsString(parentList):"");
- return model;
- }
-
- public MenuBuilder getMenuBuilder() {
- return menuBuilder;
- }
-
- public void setMenuBuilder(MenuBuilder menuBuilder) {
- this.menuBuilder = menuBuilder;
- }
-
- public DataAccessService getDataAccessService() {
- return dataAccessService;
- }
-
- public void setDataAccessService(DataAccessService dataAccessService) {
- this.dataAccessService = dataAccessService;
- }
-
-}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedBaseController.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedBaseController.java
deleted file mode 100644
index 2b2e3426..00000000
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedBaseController.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * ================================================================================
- * 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.portalsdk.core.controller;
-
-public class RestrictedBaseController extends FusionBaseController{
-
- protected String viewName;
- private String exceptionView;
- @Override
- public boolean isAccessible() {
- return false;
- }
- @Override
- public boolean isRESTfulCall(){
- return false;
- }
- protected String getViewName() {
- return viewName;
- }
- protected void setViewName(String viewName) {
- this.viewName = viewName;
- }
-
- public String getExceptionView() {
- return (exceptionView == null) ? "runtime_error_handler" : exceptionView;
- }
-
- public void setExceptionView(String exceptionView) {
- this.exceptionView = exceptionView;
- }
-
-
-}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedRESTfulBaseController.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedRESTfulBaseController.java
deleted file mode 100644
index d11c7d76..00000000
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/controller/RestrictedRESTfulBaseController.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * ================================================================================
- * 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.portalsdk.core.controller;
-
-public class RestrictedRESTfulBaseController extends FusionBaseController{
-
- protected String viewName;
- private String exceptionView;
- @Override
- public boolean isAccessible() {
- return false;
- }
- @Override
- public boolean isRESTfulCall(){
- return true;
- }
- protected String getViewName() {
- return viewName;
- }
- protected void setViewName(String viewName) {
- this.viewName = viewName;
- }
-
- public String getExceptionView() {
- return (exceptionView == null) ? "runtime_error_handler" : exceptionView;
- }
-
- public void setExceptionView(String exceptionView) {
- this.exceptionView = exceptionView;
- }
-
-
-}
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/controller/UnRestrictedBaseController.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/controller/UnRestrictedBaseController.java
deleted file mode 100644
index 78bf4c51..00000000
--- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/controller/UnRestrictedBaseController.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*-
- * ================================================================================
- * 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.portalsdk.core.controller;
-
-public class UnRestrictedBaseController extends FusionBaseController{
- protected String viewName;
-
- @Override
- public boolean isAccessible() {
- return true;
- }
- @Override
- public boolean isRESTfulCall(){
- return false;
- }
- protected String getViewName() {
- return viewName;
- }
-
- protected void setViewName(String viewName) {
- this.viewName = viewName;
- }
-}