summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service')
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppService.java61
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppServiceImpl.java106
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditService.java36
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditServiceImpl.java50
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastService.java37
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastServiceImpl.java248
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessService.java80
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessServiceImpl.java592
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementLinkService.java269
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementMapService.java915
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java46
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java145
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapService.java31
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapServiceImpl.java269
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginService.java36
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceImpl.java190
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsService.java34
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsServiceImpl.java179
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchService.java30
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchServiceImpl.java203
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileService.java36
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceImpl.java72
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleService.java50
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceImpl.java171
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceNonSpringImpl.java122
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileService.java36
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceImpl.java210
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallService.java26
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallServiceImpl.java189
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/FusionService.java27
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocator.java27
-rw-r--r--ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocatorImpl.java74
32 files changed, 0 insertions, 4597 deletions
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppService.java
deleted file mode 100644
index 55180fd7..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppService.java
+++ /dev/null
@@ -1,61 +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.service;
-
-import java.util.List;
-
-import org.openecomp.portalsdk.core.domain.App;
-
-/**
- * Defines methods to fetch App domain objects.
- *
- * Very thin interface; Portal defines a much richer interface.
- */
-public interface AppService {
-
- /**
- * Gets all apps defined in the table.
- *
- * @return List of apps.
- */
- List<App> getApps();
-
- /**
- * Gets the app with the specified ID.
- *
- * @param appId
- * @return App with the specified ID.
- */
- App getApp(Long appId);
-
- /**
- * Gets the singleton entry - applications should have exactly 1 row in the
- * FN_APP table.
- */
- App getDefaultApp();
-
- /**
- * Fetches the application name once from database
- * and keep refers to the same name later on as required.
- * @return Default Application Name
- */
- String getDefaultAppName();
-
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppServiceImpl.java
deleted file mode 100644
index 30e566a2..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AppServiceImpl.java
+++ /dev/null
@@ -1,106 +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.service;
-
-import java.util.List;
-
-import org.openecomp.portalsdk.core.domain.App;
-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("appService")
-@Transactional
-public class AppServiceImpl implements AppService{
-
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AppServiceImpl.class);
-
- @Autowired
- private DataAccessService dataAccessService;
-
- /**
- * Loads the appName once from database and
- * keep refers to it as required.
- */
- private static String defaultAppName = "";
-
- /*
- * (non-Javadoc)
- * @see org.openecomp.portalsdk.core.service.AppService#getApps()
- */
- @SuppressWarnings("unchecked")
- @Override
- public List<App> getApps() {
- return getDataAccessService().getList(App.class, null);
- }
-
- /*
- * (non-Javadoc)
- * @see org.openecomp.portalsdk.core.service.AppService#getApp(long)
- */
- @Override
- public App getApp(Long appId) {
- return (App)getDataAccessService().getDomainObject(App.class, appId, null);
- }
-
- /*
- * (non-Javadoc)
- * @see org.openecomp.portalsdk.core.service.AppService#getApp()
- */
- @Override
- public App getDefaultApp() {
- return getApp(1L);
- }
-
- /**
- * Gets the data access service.
- * @return DataAccessService
- */
- public DataAccessService getDataAccessService() {
- return dataAccessService;
- }
-
- /**
- * Sets the data access service.
- * @param dataAccessService
- */
- public void setDataAccessService(DataAccessService dataAccessService) {
- this.dataAccessService = dataAccessService;
- }
-
- /**
- * Fetches the application name once from database
- * and keep refers to the same name later on as required.
- * @return Default Application Name
- */
- @Override
- public String getDefaultAppName() {
- if (AppServiceImpl.defaultAppName==null || AppServiceImpl.defaultAppName=="") {
- App app = getApp(1L);
- if (app!=null) {
- AppServiceImpl.defaultAppName = app.getName();
- } else {
- logger.warn(EELFLoggerDelegate.errorLogger, ("Unable to locate the app information from the database."));
- }
- }
- return AppServiceImpl.defaultAppName;
- }
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditService.java
deleted file mode 100644
index b632c92c..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditService.java
+++ /dev/null
@@ -1,36 +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.service;
-
-import java.util.HashMap;
-
-import org.openecomp.portalsdk.core.domain.AuditLog;
-
-public interface AuditService {
- /**
- *
- * Update log data in database
- *
- * @param auditLog
- * @param additionalParams
- */
- @SuppressWarnings("rawtypes")
- void logActivity(AuditLog auditLog, HashMap additionalParams);
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditServiceImpl.java
deleted file mode 100644
index 8fbd550c..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/AuditServiceImpl.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.service;
-
-import java.util.HashMap;
-
-import org.openecomp.portalsdk.core.domain.AuditLog;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-@Service("auditService")
-@Transactional
-public class AuditServiceImpl implements AuditService {
- public AuditServiceImpl() {}
-
- @Autowired
- private DataAccessService dataAccessService;
-
- @SuppressWarnings("rawtypes")
- public void logActivity(AuditLog auditLog, HashMap additionalParams) {
- getDataAccessService().saveDomainObject(auditLog, additionalParams);
- }
-
- public DataAccessService getDataAccessService() {
- return dataAccessService;
- }
-
- public void setDataAccessService(DataAccessService dataAccessService) {
- this.dataAccessService = dataAccessService;
- }
-
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastService.java
deleted file mode 100644
index 8d60e74b..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastService.java
+++ /dev/null
@@ -1,37 +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.service;
-
-import java.util.HashMap;
-import java.util.Hashtable;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.openecomp.portalsdk.core.domain.BroadcastMessage;
-
-@SuppressWarnings("rawtypes")
-public interface BroadcastService {
- HashMap getBcModel(HttpServletRequest request);
- Hashtable getBroadcastMessages();
- void loadMessages();
- BroadcastMessage getBroadcastMessage(HttpServletRequest request);
- void saveBroadcastMessage(BroadcastMessage broadcastMessage);
- void removeBroadcastMessage(BroadcastMessage broadcastMessage);
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastServiceImpl.java
deleted file mode 100644
index def1c1a6..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/BroadcastServiceImpl.java
+++ /dev/null
@@ -1,248 +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.service;
-
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.openecomp.portalsdk.core.domain.BroadcastMessage;
-import org.openecomp.portalsdk.core.domain.Lookup;
-import org.openecomp.portalsdk.core.service.support.FusionService;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.openecomp.portalsdk.core.web.support.AppUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.ServletRequestBindingException;
-import org.springframework.web.bind.ServletRequestUtils;
-
-@SuppressWarnings("rawtypes")
-@Service("broadcastService")
-@Transactional
-public class BroadcastServiceImpl extends FusionService implements BroadcastService {
-
- public BroadcastServiceImpl() {
- }
-
- @Autowired
- private DataAccessService dataAccessService;
- private static Hashtable broadcastMessages = new Hashtable();
-
- @SuppressWarnings("unchecked")
- public void loadMessages() {
- List messageLocations = AppUtils.getLookupListNoCache("fn_lu_message_location", "message_location_id", "message_location_descr", "", "message_location_id");
-
- for (int i=0; i < messageLocations.size(); i++) {
- Lookup location = (Lookup)messageLocations.get(i);
- String locationId = location.getValue();
-
- broadcastMessages.put(locationId, getPersistedBroadcastMessages(locationId));
- }
- }
-
- @SuppressWarnings("unchecked")
- public HashMap getBcModel(HttpServletRequest request){
- HashMap bcModel = new HashMap();
-
- List items = null;
- int messageId = ServletRequestUtils.getIntParameter(request, "message_id", 0);
- String task = ServletRequestUtils.getStringParameter(request, "task", "get");
-
- // delete or toggle activation on the selected record (if applicable)
- if (messageId != 0 && (task.equals("delete") || task.equals("toggleActive"))) {
- BroadcastMessage message = (BroadcastMessage)getDataAccessService().getDomainObject(BroadcastMessage.class, new Long(messageId), null);
-
- if (task.equals("delete")) {
- getDataAccessService().deleteDomainObject(message, null);
- }
- else if (task.equals("toggleActive")) {
- HashMap additionalParams = new HashMap();
- additionalParams.put(Parameters.PARAM_HTTP_REQUEST, request);
-
- message.setActive(new Boolean(!message.getActive().booleanValue()));
- getDataAccessService().saveDomainObject(message, additionalParams);
- }
- loadMessages();
- }
-
- items = getDataAccessService().getList(BroadcastMessage.class, null);
- Collections.sort(items);
- bcModel.put("messagesList", packageMessages(items));
-
- List locations = AppUtils.getLookupList("fn_lu_message_location", "message_location_id", "message_location_descr", "", "message_location_id");
- bcModel.put("messageLocations", locations);
-
- if ("true".equals(SystemProperties.getProperty(SystemProperties.CLUSTERED))) {
- List sites = AppUtils.getLookupList("fn_lu_broadcast_site", "broadcast_site_cd", "broadcast_site_descr", "", "broadcast_site_descr");
- bcModel.put("broadcastSites", sites);
- }
-
- return bcModel;
- }
-
- @SuppressWarnings("unchecked")
- private HashMap packageMessages(List messages) {
- HashMap messagesList = new HashMap();
- Set locationMessages = null;
-
- Integer previousLocationId = null;
-
- for (int i=0; i < messages.size(); i++) {
- BroadcastMessage message = (BroadcastMessage)messages.get(i);
-
- if (!message.getLocationId().equals(previousLocationId)) {
- if (previousLocationId != null) {
- messagesList.put(previousLocationId.toString(), locationMessages);
- }
-
- locationMessages = new TreeSet();
- previousLocationId = message.getLocationId();
- }
-
- locationMessages.add(message);
- }
-
- if (previousLocationId != null) {
- messagesList.put(previousLocationId.toString(), locationMessages);
- }
-
- return messagesList;
- }
-
-
- @SuppressWarnings("unchecked")
- private List getPersistedBroadcastMessages(String locationId) {
-
- HashMap params = new HashMap();
- params.put("location_id", new Integer(locationId));
- Calendar calInstanceToday = Calendar.getInstance();
- calInstanceToday.set(Calendar.HOUR, 0);
- calInstanceToday.set(Calendar.MINUTE, 0);
- calInstanceToday.set(Calendar.SECOND, 0);
- params.put("today_date", calInstanceToday.getTime());
-
- return getDataAccessService().executeNamedQuery("broadcastMessages", params, null);
- }
-
- public Hashtable getBroadcastMessages() {
- return broadcastMessages;
- }
-
- public static List getBroadcastMessages(String locationId) {
- return (List)broadcastMessages.get(locationId);
- }
-
- public static String displayMessages(String locationId) {
- return displayServerMessages(locationId, null);
- }
-
- public static String displayServerMessages(String locationId, String siteCd) {
- StringBuffer html = new StringBuffer();
-
- List messages = getBroadcastMessages(locationId);
-
- for (int i=0; i < messages.size(); i++) {
- BroadcastMessage message = (BroadcastMessage)messages.get(i);
-
- if ((message.getSiteCd() == null) || ((message.getSiteCd() != null) && message.getSiteCd().equals(siteCd))) {
- html.append("<li class=\"broadcastMessage\">")
- .append(message.getMessageText());
- }
- }
-
- if (html.length() > 0) {
- html.insert(0, "<ul class=\"broadcastMessageList\">");
- html.append("</ul>");
- }
-
- return html.toString();
- }
-
- public static boolean hasMessages(String locationId) {
- return hasServerMessages(locationId, null);
- }
-
- public static boolean hasServerMessages(String locationId, String siteCd) {
- List messages = getBroadcastMessages(locationId);
-
- boolean messagesExist = !((messages == null) || messages.size() == 0);
-
- if (siteCd == null) {
- return messagesExist;
- }
- else {
- for (int i=0; i < messages.size(); i++) {
- BroadcastMessage message = (BroadcastMessage)messages.get(i);
-
- if ((message.getSiteCd() == null) || message.getSiteCd().equals(siteCd)) {
- return true;
- }
- }
- return false;
- }
- }
-
- public DataAccessService getDataAccessService() {
- return dataAccessService;
- }
-
- public void setDataAccessService(DataAccessService dataAccessService) {
- this.dataAccessService = dataAccessService;
- }
-
- public BroadcastMessage getBroadcastMessage(HttpServletRequest request) {
- long messageId = ServletRequestUtils.getLongParameter(request, "message_id", 0);
-
- BroadcastMessage message = new BroadcastMessage();
- if(messageId!=0)
- message = (BroadcastMessage)getDataAccessService().getDomainObject(BroadcastMessage.class, new Long(messageId), null);
-
- if (message.getLocationId() == null) {
- try {
- message.setLocationId(new Integer(ServletRequestUtils.getStringParameter(request, "message_location_id")));
- } catch (NumberFormatException e) {
- e.printStackTrace();
- } catch (ServletRequestBindingException e) {
- e.printStackTrace();
- }
- message.setActive(Boolean.TRUE);
- }
-
- return message;
- }
-
- @Override
- public void saveBroadcastMessage(BroadcastMessage broadcastMessage) {
- dataAccessService.saveDomainObject(broadcastMessage, null);
- }
-
- @Override
- public void removeBroadcastMessage(BroadcastMessage broadcastMessage) {
- dataAccessService.deleteDomainObject(broadcastMessage, null);
- }
-
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessService.java
deleted file mode 100644
index 26892b88..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessService.java
+++ /dev/null
@@ -1,80 +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.service;
-
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.hibernate.FetchMode;
-import org.hibernate.criterion.Criterion;
-import org.hibernate.criterion.Order;
-import org.hibernate.criterion.ProjectionList;
-import org.openecomp.portalsdk.core.domain.support.DomainVo;
-
-@SuppressWarnings("rawtypes")
-public interface DataAccessService {
-
- // generic view, save, delete methods
- DomainVo getDomainObject(Class domainClass, Serializable id, HashMap additionalParams);
- void deleteDomainObject(DomainVo domainObject, HashMap additionalParams);
- void deleteDomainObjects(Class domainClass, String whereClause, HashMap additionalParams);
- void saveDomainObject(DomainVo domainObject, HashMap additionalParams);
-
- // generic get list method(s)
- List getList(Class domainClass, HashMap additionalParams);
- List getList(Class domainClass, String filter, String orderBy, HashMap additionalParams);
- List getList(Class domainClass, String filter, int fromIndex, int toIndex, String orderBy, HashMap additionalParams);
- List<?> getList(Class<?> domainClass, ProjectionList projectionsList , List<Criterion> restrictionsList , List<Order> orderByList);
- public List<?> getList(Class<?> domainClass, ProjectionList projectionsList, List<Criterion> restrictionsList, List<Order> orderByList,HashMap<String,FetchMode> fetchModeMap);
-
- List getLookupList(String dbTable, String dbValueCol, String dbLabelCol, String dbFilter, String dbOrderBy, HashMap additionalParams);
-
- // generic native-SQL execution methods
- List executeSQLQuery(String sql, Class domainClass, HashMap additionalParams);
- List executeSQLQuery(String sql, Class domainClass, Integer fromIndex, Integer toIndex,HashMap additionalParams);
-
- // generic HQL execution methods
- List executeQuery(String hql, HashMap additionalParams);
- List executeQuery(String hql, Integer fromIndex, Integer toIndex, HashMap additionalParams);
-
- // generic named query execution methods
- List executeNamedQuery(String queryName, Integer fromIndex, Integer toIndex, HashMap additionalParams);
- List executeNamedQuery(String queryName, Map params, HashMap additionalParams);
- List executeNamedQuery(String queryName, Map params, Integer fromIndex, Integer toIndex, HashMap additionalParams);
-
- //with Where Clause for RAPTOR ZK
- List executeNamedQueryWithOrderBy(Class entity, String queryName, Map params, String _orderBy, boolean asc, Integer fromIndex, Integer toIndex, HashMap additionalParams);
- List executeNamedCountQuery(Class entity, String queryName, String whereClause, Map params);
- List executeNamedQuery(Class entity, String queryName, String whereClause, Map params, Integer fromIndex, Integer toIndex, HashMap additionalParams);
- List executeNamedQueryWithOrderBy(Class entity, String queryName, String whereClause, Map params, String _orderBy, boolean asc, Integer fromIndex, Integer toIndex, HashMap additionalParams);
-
- // generic update query execution method
- int executeUpdateQuery(String sql, HashMap additionalParams) throws RuntimeException;
-
- // generic named update query execution method
- int executeNamedUpdateQuery(String queryName, Map params, HashMap additionalParams) throws RuntimeException;
-
- // synchronizes the local updates with the database (and vice versa)
- void synchronize(HashMap additionalParams);
-
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessServiceImpl.java
deleted file mode 100644
index a4644b72..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/DataAccessServiceImpl.java
+++ /dev/null
@@ -1,592 +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.service;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.hibernate.Criteria;
-import org.hibernate.FetchMode;
-import org.hibernate.Query;
-import org.hibernate.SQLQuery;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.criterion.Criterion;
-import org.hibernate.criterion.Order;
-import org.hibernate.criterion.ProjectionList;
-import org.openecomp.portalsdk.core.domain.Lookup;
-import org.openecomp.portalsdk.core.domain.support.DomainVo;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.service.support.FusionService;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * Provides implementations of methods in {@link DataAccessService}.
- */
-@Transactional
-public class DataAccessServiceImpl extends FusionService implements DataAccessService {
-
- @Autowired
- private SessionFactory sessionFactory;
-
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(DataAccessServiceImpl.class);
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#getDomainObject(java.lang.
- * Class, java.io.Serializable, java.util.HashMap)
- */
- @Override
- public DomainVo getDomainObject(Class domainClass, Serializable id, HashMap additionalParams) {
- DomainVo vo = null;
- Session session = sessionFactory.getCurrentSession();
- logger.info(EELFLoggerDelegate.debugLogger, "Getting " + domainClass.getName() + " record for id - " + id.toString());
- vo = (DomainVo) session.get(domainClass, id);
-
- if (vo == null) {
- try {
- vo = (DomainVo) domainClass.newInstance();
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, "An error occured while instantiating a class of " + domainClass.getName() + e.getMessage());
- }
- }
- return vo;
- }
-
- /*
- * (non-Javadoc)
- *
- */
- @Override
- public void deleteDomainObject(DomainVo domainObject, HashMap additionalParams) {
- Session session = sessionFactory.getCurrentSession();
- session.delete(domainObject);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#deleteDomainObjects(java.
- * lang.Class, java.lang.String, java.util.HashMap)
- */
- @Override
- public void deleteDomainObjects(Class domainClass, String whereClause, HashMap additionalParams) {
- Session session = sessionFactory.getCurrentSession();
-
- StringBuffer sql = new StringBuffer("delete from ");
-
- sql.append(domainClass.getName()).append(" where ").append(whereClause);
-
- session.createQuery(sql.toString()).executeUpdate();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#saveDomainObject
- */
- @Override
- public void saveDomainObject(DomainVo vo, HashMap additionalParams) {
- Integer userId = 1;
- if (additionalParams != null) {
- // look for a passed user id
- // userId = (Integer)additionalParams.get(Parameters.PARAM_USERID);
- Object uid = additionalParams.get(Parameters.PARAM_USERID);
- if (uid instanceof Integer) {
- userId = (Integer) uid;
- } else if (uid instanceof Long) {
- userId = ((Long) uid).intValue();
- }
- // if (userId == null) {
- // look for a passed request to get the user id from
- // userId = new
- // Integer(UserUtils.getUserId((HttpServletRequest)additionalParams.get(Parameters.PARAM_HTTP_REQUEST)));
- // }
- }
- _update(vo, userId);
- }
-
- /**
- * Creates or updates the specified virtual object. Uses the specified user
- * ID as the creator and modifier if a new object is created; uses ID only
- * as modifier if an object already exists.
- *
- * @param vo
- * @param userId
- * Ignored if value is zero.
- */
- protected final void _update(DomainVo vo, int userId) {
- Date timestamp = new Date();
-
- Session session = sessionFactory.getCurrentSession();
-
- if (vo.getId() == null || vo.getId().intValue() == 0) { // add new
- vo.setCreated(timestamp);
- vo.setModified(timestamp);
-
- if (userId != 0
- && userId != Integer.parseInt(SystemProperties.getProperty(SystemProperties.APPLICATION_USER_ID))) {
- vo.setCreatedId(new Long(userId));
- vo.setModifiedId(new Long(userId));
- }
- } else { // update existing
- vo.setModified(timestamp);
-
- if (userId != 0
- && userId != Integer.parseInt(SystemProperties.getProperty(SystemProperties.APPLICATION_USER_ID))) {
- vo.setModifiedId(new Long(userId));
- }
- }
-
- session.saveOrUpdate(vo);
- }
-
- /**
- * generic get list method
- *
- * @param domainClass
- * @param filterClause
- * @param fromIndex
- * @param toIndex
- * @param orderBy
- * @return
- */
- private List getListCommon(Class domainClass, String filterClause, Integer fromIndex, Integer toIndex,
- String orderBy) {
- List list = null;
- String className = domainClass.getName();
- Session session = sessionFactory.getCurrentSession();
-
- if (logger.isInfoEnabled()) {
- logger.info(EELFLoggerDelegate.debugLogger, "Getting " + className.toLowerCase() + " records"
- + ((fromIndex != null) ? " from rows " + fromIndex.toString() + " to " + toIndex.toString() : "")
- + "...");
- if (filterClause != null && filterClause.length() > 0)
- logger.info(EELFLoggerDelegate.debugLogger, "Filtering " + className + " by: " + filterClause);
- }
-
- list = session.createQuery("from " + className + Utilities.nvl(filterClause, "")
- + ((orderBy != null) ? " order by " + orderBy : "")).list();
- list = (fromIndex != null) ? list.subList(fromIndex.intValue() - 1, toIndex.intValue()) : list;
-
- if (orderBy == null && list != null)
- Collections.sort(list);
-
- return list;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#getList(java.lang.Class,
- * java.util.HashMap)
- */
- @Override
- public List getList(Class domainClass, HashMap additionalParams) {
- return getListCommon(domainClass, null, null, null, null);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#getList(java.lang.Class,
- * java.lang.String, java.lang.String, java.util.HashMap)
- */
- @Override
- public List getList(Class domainClass, String filter, String orderBy, HashMap additionalParams) {
- return getListCommon(domainClass, filter, null, null, orderBy);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#getList(java.lang.Class,
- * java.lang.String, int, int, java.lang.String, java.util.HashMap)
- */
- @Override
- public List getList(Class domainClass, String filter, int fromIndex, int toIndex, String orderBy,
- HashMap additionalParams) {
- return getListCommon(domainClass, filter, new Integer(fromIndex), new Integer(toIndex), orderBy);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#getList(java.lang.Class,
- * org.hibernate.criterion.ProjectionList, java.util.List, java.util.List)
- */
- @Override
- public List<?> getList(Class<?> domainClass, ProjectionList projectionsList, List<Criterion> restrictionsList,
- List<Order> orderByList) {
-
- Session session = sessionFactory.getCurrentSession();
-
- Criteria criteria = session.createCriteria(domainClass);
-
- if (projectionsList != null) {
- criteria.setProjection(projectionsList);
- }
-
- if (restrictionsList != null && !restrictionsList.isEmpty()) {
- for (Criterion criterion : restrictionsList)
- criteria.add(criterion);
- }
-
- if (orderByList != null && !orderByList.isEmpty()) {
- for (Order order : orderByList)
- criteria.addOrder(order);
- }
- /*
- * if(fetchModeMap!=null){ Iterator<String> itr =
- * fetchModeMap.keySet().iterator(); String key=null;
- * while(itr.hasNext()){ key = itr.next();
- * criteria.setFetchMode(key,fetchModeMap.get(key)); } }
- */
- return criteria.list();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#getLookupList(java.lang.
- * String, java.lang.String, java.lang.String, java.lang.String,
- * java.lang.String, java.util.HashMap)
- */
- @Override
- public List getLookupList(String dbTable, String dbValueCol, String dbLabelCol, String dbFilter, String dbOrderBy,
- HashMap additionalParams) {
- if (logger.isInfoEnabled())
- logger.info(EELFLoggerDelegate.debugLogger, "Retrieving " + dbTable + " lookup list...");
- String dbOrderByCol = dbOrderBy;
-
- Session session = sessionFactory.getCurrentSession();
-
- // default the orderBy if null;
- if (Utilities.nvl(dbOrderBy).length() == 0) {
- dbOrderByCol = dbLabelCol;
- dbOrderBy = dbLabelCol;
- } else {
- if (dbOrderBy.lastIndexOf(" ") > -1) {
- dbOrderByCol = dbOrderBy.substring(0, dbOrderBy.lastIndexOf(" "));
- }
- }
-
- StringBuffer sql = new StringBuffer();
-
- sql.append("select distinct ").append(dbLabelCol).append(" as lab, ").append(dbValueCol).append(" as val, ")
- .append(dbOrderByCol).append(" as sortOrder ").append("from ").append(dbTable).append(" ")
- .append((Utilities.nvl(dbFilter).length() == 0) ? "" : (" where " + dbFilter)).append(" order by ")
- .append(dbOrderBy);
-
- List list = null;
- try {
- list = session.createSQLQuery(sql.toString()).addEntity(Lookup.class).list();
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.debugLogger, "Failed to create SQL lookup query for [" + sql + "]" + e.getMessage());
- }
- return list;
- }
-
- /*
- * methods accepting a Map of additional params to passed to the DAO (for
- * extensibility, just in case)
- */
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#executeSQLQuery(java.lang.
- * String, java.lang.Class, java.util.HashMap)
- */
- @Override
- public List executeSQLQuery(String sql, Class domainClass, HashMap additionalParams) {
- return executeSQLQuery(sql, domainClass, null, null, additionalParams);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#executeSQLQuery(java.lang.
- * String, java.lang.Class, java.lang.Integer, java.lang.Integer,
- * java.util.HashMap)
- */
- @Override
- public List executeSQLQuery(String sql, Class domainClass, Integer fromIndex, Integer toIndex,
- HashMap additionalParams) {
- Session session = sessionFactory.getCurrentSession();
-
- SQLQuery query = session.createSQLQuery(sql).addEntity(domainClass.getName().toLowerCase(), domainClass);
-
- if (fromIndex != null && toIndex != null) {
- query.setFirstResult(fromIndex.intValue());
- int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1;
- query.setMaxResults(pageSize);
- }
-
- return query.list();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#executeQuery(java.lang.
- * String, java.util.HashMap)
- */
- @Override
- public List executeQuery(String sql, HashMap additionalParams) {
- return executeQuery(sql, null, null, additionalParams);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#executeQuery(java.lang.
- * String, java.lang.Integer, java.lang.Integer, java.util.HashMap)
- */
- @Override
- public List executeQuery(String sql, Integer fromIndex, Integer toIndex, HashMap additionalParams) {
- Session session = sessionFactory.getCurrentSession();
-
- Query query = session.createQuery(sql);
-
- if (fromIndex != null && toIndex != null) {
- query.setFirstResult(fromIndex.intValue());
- int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1;
- query.setMaxResults(pageSize);
- }
-
- return query.list();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#executeNamedQuery(java.lang
- * .String, java.lang.Integer, java.lang.Integer, java.util.HashMap)
- */
- @Override
- public List executeNamedQuery(String queryName, Integer fromIndex, Integer toIndex, HashMap additionalParams) {
- return executeNamedQuery(queryName, null, fromIndex, toIndex, additionalParams);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#executeNamedQuery(java.lang
- * .String, java.util.Map, java.util.HashMap)
- */
- @Override
- public List executeNamedQuery(String queryName, Map params, HashMap additionalParams) {
- return executeNamedQuery(queryName, params, null, null, additionalParams);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#executeNamedQuery(java.lang
- * .String, java.util.Map, java.lang.Integer, java.lang.Integer,
- * java.util.HashMap)
- */
- @Override
- public List executeNamedQuery(String queryName, Map params, Integer fromIndex, Integer toIndex,
- HashMap additionalParams) {
- Session session = sessionFactory.getCurrentSession();
- Query query = session.getNamedQuery(queryName);
- bindQueryParameters(query, params);
- if (fromIndex != null && toIndex != null) {
- query.setFirstResult(fromIndex.intValue());
- int pageSize = (toIndex.intValue() - fromIndex.intValue()) + 1;
- query.setMaxResults(pageSize);
- }
- return query.list();
- }
-
- /**
- * Stores parameters into the query using String keys from the map. Gives
- * special treatment to map values of Collection and array type.
- *
- * @param query
- * Query with parameters
- * @param params
- * Map of String to Object.
- */
- private void bindQueryParameters(Query query, Map params) {
- if (params != null) {
- for (Iterator i = params.entrySet().iterator(); i.hasNext();) {
- Map.Entry entry = (Map.Entry) i.next();
-
- Object parameterValue = entry.getValue();
-
- if (!(parameterValue instanceof Collection) && !(parameterValue instanceof Object[])) {
- query.setParameter((String) entry.getKey(), parameterValue);
- } else if (parameterValue instanceof Collection) {
- query.setParameterList((String) entry.getKey(), (Collection) parameterValue);
- } else if (parameterValue instanceof Object[]) {
- query.setParameterList((String) entry.getKey(), (Object[]) parameterValue);
- }
- }
- }
- }
-
- // With Where Clause & RAPTOR's ZK
-
- /*
- * (non-Javadoc)
- *
- * @see org.openecomp.portalsdk.core.service.DataAccessService#
- * executeNamedQueryWithOrderBy(java.lang.Class, java.lang.String,
- * java.util.Map, java.lang.String, boolean, java.lang.Integer,
- * java.lang.Integer, java.util.HashMap)
- */
- @Override
- public List executeNamedQueryWithOrderBy(Class entity, String queryName, Map params, String _orderBy, boolean asc,
- Integer fromIndex, Integer toIndex, HashMap additionalParams) {
- // TODO Auto-generated method stub
- logger.info(EELFLoggerDelegate.debugLogger, "Not implemented");
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#executeNamedCountQuery(java
- * .lang.Class, java.lang.String, java.lang.String, java.util.Map)
- */
- @Override
- public List executeNamedCountQuery(Class entity, String queryName, String whereClause, Map params) {
- // TODO Auto-generated method stub
- logger.info(EELFLoggerDelegate.debugLogger, "Not implemented");
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#executeNamedQuery(java.lang
- * .Class, java.lang.String, java.lang.String, java.util.Map,
- * java.lang.Integer, java.lang.Integer, java.util.HashMap)
- */
- @Override
- public List executeNamedQuery(Class entity, String queryName, String whereClause, Map params, Integer fromIndex,
- Integer toIndex, HashMap additionalParams) {
- // TODO Auto-generated method stub
- logger.info(EELFLoggerDelegate.debugLogger, "Not implemented");
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.openecomp.portalsdk.core.service.DataAccessService#
- * executeNamedQueryWithOrderBy(java.lang.Class, java.lang.String,
- * java.lang.String, java.util.Map, java.lang.String, boolean,
- * java.lang.Integer, java.lang.Integer, java.util.HashMap)
- */
- @Override
- public List executeNamedQueryWithOrderBy(Class entity, String queryName, String whereClause, Map params,
- String _orderBy, boolean asc, Integer fromIndex, Integer toIndex, HashMap additionalParams) {
- // TODO Auto-generated method stub
- logger.info(EELFLoggerDelegate.debugLogger, "Not implemented");
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#getList(java.lang.Class,
- * org.hibernate.criterion.ProjectionList, java.util.List, java.util.List,
- * java.util.HashMap)
- */
- @Override
- public List<?> getList(Class<?> domainClass, ProjectionList projectionsList, List<Criterion> restrictionsList,
- List<Order> orderByList, HashMap<String, FetchMode> fetchModeMap) {
- // TODO Auto-generated method stub
- logger.info(EELFLoggerDelegate.debugLogger, "Not implemented");
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#executeUpdateQuery(java.
- * lang.String, java.util.HashMap)
- */
- @Override
- public int executeUpdateQuery(String sql, HashMap additionalParams) throws RuntimeException {
- // TODO Auto-generated method stub
- logger.info(EELFLoggerDelegate.debugLogger, "Not implemented");
- return 0;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.openecomp.portalsdk.core.service.DataAccessService#executeNamedUpdateQuery(
- * java.lang.String, java.util.Map, java.util.HashMap)
- */
- @Override
- public int executeNamedUpdateQuery(String queryName, Map params, HashMap additionalParams) throws RuntimeException {
- // TODO Auto-generated method stub
- logger.info(EELFLoggerDelegate.debugLogger, "Not implemented");
- return 0;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.openecomp.portalsdk.core.service.DataAccessService#synchronize(java.util.
- * HashMap)
- */
- @Override
- public void synchronize(HashMap additionalParams) {
- // TODO Auto-generated method stub
- logger.info(EELFLoggerDelegate.debugLogger, "Not implemented");
- }
-
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementLinkService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementLinkService.java
deleted file mode 100644
index 948b635f..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementLinkService.java
+++ /dev/null
@@ -1,269 +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.service;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.openecomp.portalsdk.core.util.YamlUtils;
-
-
-
-public class ElementLinkService {
-
-
- public String main1(String[] args) throws Exception{
- String filePath;
- if(args[0].startsWith("custom")){
- filePath = SystemProperties.getProperty("customCallFlow_path");
- }else{
- filePath = SystemProperties.getProperty("element_map_file_path") + File.separator;
- }
-
- String callFlowBusinessYml = "";
- String callFlowStep = "";
-
- if(args != null && args.length > 0 ) {
-
- if( args[0] != null) {
- callFlowBusinessYml = args[0] + ".yml";
- }
-
- if( args[1] != null) {
- callFlowStep = args[1];
- }
- }
-
-
- ElementLinkService mapper = new ElementLinkService();
-
- return mapper.createLinkFile(filePath, callFlowBusinessYml, callFlowStep);
- }
-
- public String main2(String[] args) throws Exception{
-
- String filePath = SystemProperties.getProperty("element_map_file_path") + File.separator;
- String callFlowBusinessYml = "";
- String callFlowStep = "";
-
- if(args != null && args.length > 0 ) {
-
- if( args[0] != null) {
- callFlowBusinessYml = args[0] + "-Override.yml";
- }
-
- if( args[1] != null) {
- callFlowStep = args[1];
- }
- }
-
-
- ElementLinkService mapper = new ElementLinkService();
-
- return mapper.createLinkFileAdditional(filePath, callFlowBusinessYml, callFlowStep);
- }
-
-
- public static void main(String[] args) throws Exception{
-
- String filePath = "C:\\Users\\statta\\git\\D2Platform\\war\\WEB-INF\\resources\\trisim_files";
- String callFlowBusinessYml = "call_flow_hc-origination-termination-to-volteue-3.3.16-Override.yml";
-
-
- ElementLinkService mapper = new ElementLinkService();
- System.out.print(mapper.createLinkFileAdditional(filePath, callFlowBusinessYml, "Step_2"));
- }
-
- @SuppressWarnings("unchecked")
- protected String createLinkFile(String resourceFilePath, String callFLowBsFileName, String callFlowStep) throws Exception {
-
- Map<String, Object> callFlowBs = YamlUtils.readYamlFile(resourceFilePath, callFLowBsFileName);
-
- List<Map<String,Object>> callSteps = (List<Map<String,Object>>) callFlowBs.get("callSequenceSteps");
- String callFlowName = (String) callFlowBs.get("shortName");
- return addLinks( resourceFilePath, callFlowName, callSteps, callFlowStep);
-
-
- }
-
- @SuppressWarnings("unchecked")
- protected String createLinkFileAdditional(String resourceFilePath, String callFLowBsFileName, String callFlowStep) throws Exception {
-
- Map<String, Object> callFlowBs;
-
- try{
- callFlowBs = YamlUtils.readYamlFile(resourceFilePath, callFLowBsFileName);
-
- List<Map<String,Object>> callSteps = (List<Map<String,Object>>) callFlowBs.get("callSequenceSteps");
- String callFlowName = (String) callFlowBs.get("shortName");
- return addLinksAdditional( resourceFilePath, callFlowName, callSteps, callFlowStep);
-
- } catch (Exception e) {
-
- return "";
- }
-
-
- }
-
- @SuppressWarnings("unchecked")
- protected String addLinks(String filePath, String callFlowName,
- List<Map<String, Object>> callSteps, String callFlowStep) throws IOException {
-
- Map<String,List<String>> checkDuplicateMap = new HashMap<String,List<String>>();
-
- for(Map<String,Object> callStep : callSteps) {
-
- if(((String)callStep.get("name")).split(":")[0].trim().replace(" ", "_").equals(callFlowStep)) {
-
- List<Map<String,Object>> links = new ArrayList<Map<String,Object>>();
-
- List<Map<String,Object>> subSteps = (List<Map<String,Object>>)callStep.get("subSteps");
-
- for(Map<String,Object> subStep : subSteps) {
- Map<String,Object> link = new HashMap<String,Object>();
-
- String source = (String) subStep.get("source_tosca_id");
- String destination = (String) subStep.get("destination_tosca_id");
-
- if((checkDuplicateMap.get(source) == null || checkDuplicateMap.get(source).isEmpty() || !checkDuplicateMap.get(source).contains(destination)) && !source.equals(destination)) {
- if(checkDuplicateMap.get(destination) == null) {
- List<String> toscaList = new ArrayList<String>();
- checkDuplicateMap.put(destination, toscaList);
- }
-
- if(checkDuplicateMap.get(source) == null) {
- List<String> toscaList = new ArrayList<String>();
- checkDuplicateMap.put(source, toscaList);
- }
-
-
- List<String> toscaSourceList = checkDuplicateMap.get(destination);
- toscaSourceList.add(source);
-
- List<String> toscaDestinationList = checkDuplicateMap.get(source);
- toscaDestinationList.add(destination);
-
- link.put("s", source);
- link.put("d", destination);
- links.add(link);
-
- }
-
- }
-
- Map<String,Object> callFlowUI = new HashMap<String,Object>();
- callFlowUI.put("linkList", links);
-
- return YamlUtils.returnYaml(callFlowUI);
-
- }
-
-
- }
- return "";
- }
-
- protected String addLinksAdditional(String filePath, String callFlowName,
- List<Map<String, Object>> callSteps, String callFlowStep) throws IOException {
-
-
- for(Map<String,Object> callStep : callSteps) {
-
- if(((String)callStep.get("name")).split(":")[0].trim().replace(" ", "_").equals(callFlowStep)) {
-
- Map<String,Object> callFlowUI = new HashMap<String,Object>();
- try{
- List<Map<String, Object>> links = addLinkVertices(callStep);
- callFlowUI.put("linkList", links); }
- catch(Exception e) {}
- try{
- List<String> activeIds = addActiveNodes(callStep);
- callFlowUI.put("activeIds", activeIds);}
- catch(Exception e) {}
- try{
- List<Map<String, Object>> disconnectLinks = addDisconnectLinks(callStep);
- callFlowUI.put("disconnectLinks", disconnectLinks); }
- catch(Exception e) {}
-
- return YamlUtils.returnYaml(callFlowUI);
- }
- }
-
- return "";
- }
-
- @SuppressWarnings("unchecked")
- List<String> addActiveNodes(Map<String, Object> callStep) {
-
- List<String> activeIds = (List<String>)callStep.get("activeIds");
-
- return activeIds;
- }
-
- @SuppressWarnings("unchecked")
- List<Map<String,Object>> addDisconnectLinks(Map<String, Object> callStep) {
-
- List<Map<String,Object>> disconnectLinks = (List<Map<String,Object>>)callStep.get("disconnectLinks");
-
- return disconnectLinks;
- }
-
- @SuppressWarnings("unchecked")
- List<Map<String, Object>> addLinkVertices(Map<String, Object> callStep) {
- List<Map<String,Object>> links = new ArrayList<Map<String,Object>>();
-
- List<Map<String,Object>> vertices = (List<Map<String,Object>>)callStep.get("vertices");
-
- for(int i=0; i< vertices.size()-1;i++) {
- Map<String,Object> vertex = (Map<String,Object>) vertices.get(i);
- Map<String,Object> vertexNext = (Map<String,Object>) vertices.get(i+1);
-
- Integer sourceX = (Integer) vertex.get("x");
- Integer sourceY = (Integer) vertex.get("y");
- String sourceD = (String) vertex.get("D");
- String sourceL = (vertex.get("L") != null) ? (String) vertex.get("L") : "-";
-
- if(sourceX == -999) // there is a break in the linkage
- continue;
-
- Integer destinationX = (Integer) vertexNext.get("x");
- Integer destinationY = (Integer) vertexNext.get("y");
- String destinationD = (String) vertexNext.get("D");
-
- if(destinationX == -999) // there is a break in the linkage
- continue;
-
- Map<String,Object> link = new HashMap<String,Object>();
-
- link.put("s", sourceX + "," + sourceY +","+sourceD + "," + sourceL);
- link.put("d", destinationX + "," + destinationY +"," + destinationD);
- links.add(link);
- }
- return links;
- }
-}
-
-
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementMapService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementMapService.java
deleted file mode 100644
index d88213f3..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ElementMapService.java
+++ /dev/null
@@ -1,915 +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.service;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.apache.commons.lang.StringUtils;
-import org.openecomp.portalsdk.core.domain.support.Container;
-import org.openecomp.portalsdk.core.domain.support.Domain;
-import org.openecomp.portalsdk.core.domain.support.Element;
-import org.openecomp.portalsdk.core.domain.support.ElementDetails;
-import org.openecomp.portalsdk.core.domain.support.Layout;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.openecomp.portalsdk.core.util.YamlUtils;
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.nodes.Tag;
-import org.yaml.snakeyaml.representer.Representer;
-
-public class ElementMapService {
-
- public String convertToYAML(Layout layout) throws Exception{
- Map<String,Domain> resultDomain= layout.domainRowCol;
- Map<String,List<Domain>> domainMap = new HashMap<String, List<Domain>>();
- List<Domain> domainList = new ArrayList<Domain>();
- String pathToImg = SystemProperties.getProperty("element_map_icon_path"); //"static/img/map/icons/";
- for (Domain d : resultDomain.values()) {
-
- d.setWidth(10*d.computeSize().getWidth());
- d.setHeight(10*d.computeSize().getHeight());
- d.setLeft(10*d.getP().getX());
- d.setTop(10*d.getP().getY());
-
-
- List<Container> containerList = new ArrayList<Container>();
- for (Container c : d.getContainerRowCol().values()) {
- c.setWidth(10*c.computeSize().getWidth());
- c.setHeight(10*c.computeSize().getHeight());
- c.setLeft(10*c.getP().getX());
- c.setTop(10*c.getP().getY());
- Element ue = (Element)c.getElementRowCol().values().toArray()[0];
- if (ue.getName().equals("ue1") || ue.getName().equals("ue2") || ue.getName().equals("ue3") ||
- ue.getName().equals("ue4") || ue.getName().equals("ue5") || ue.getName().equals("ue6")) {
- c.setVisibilityType("invisible");
- }
-
- if (c.getContainerRowCol() != null) {
- List<Container> innerContainerList = new ArrayList<Container>();
- for (Container innerC : c.getContainerRowCol().values()) {
- innerC.setName(innerC.getName());
- innerC.setWidth(10*innerC.computeSize().getWidth());
- innerC.setHeight(10*innerC.computeSize().getHeight());
- innerC.setLeft(10*innerC.getP().getX());
- innerC.setTop(10*innerC.getP().getY());
-
- if (innerC.getElementRowCol() != null) {
- List<Element> innerContainerEList = new ArrayList<Element>();
- for (Element ele : innerC.getElementRowCol().values()) {
- ele.setWidth(10*ele.computeSize().getWidth());
- ele.setHeight(10*ele.computeSize().getHeight());
- ele.setLeft(10*ele.getP().getX());
- ele.setTop(10*ele.getP().getY()-10);
- ele.setImgFileName(pathToImg+ele.getImgFileName());
- if (ele.getBorderType().equals("V"))
- ele.setBorderType("dashed");
- else
- ele.setBorderType("solid");
-
- innerContainerEList.add(ele);
- }
- innerC.setElementList(innerContainerEList);
- }
- innerContainerList.add(innerC);
- }
- c.setInnerCList(innerContainerList);
- }
-
- if (c.getElementRowCol() != null) {
- List<Element> elementList = new ArrayList<Element>();
- for (Element e : c.getElementRowCol().values()) {
- e.setWidth(10*e.computeSize().getWidth());
- e.setHeight(10*e.computeSize().getHeight());
- e.setLeft(10*e.getP().getX());
- e.setTop(10*e.getP().getY()-10);
- e.setImgFileName(pathToImg+e.getImgFileName());
-
- if (e.getBorderType().equals("V"))
- e.setBorderType("dashed");
- else
- e.setBorderType("solid");
-
- if (e.getName().equals("ue1") || e.getName().equals("ue2") || e.getName().equals("ue3")
- || e.getName().equals("ue4") || e.getName().equals("ue5") || e.getName().equals("ue6"))
- e.setBgColor("white");
- elementList.add(e);
- }
- c.setElementList(elementList);
- }
- containerList.add(c);
- }
- d.setContainerList(containerList);
- domainList.add(d);
-
- }
- domainMap.put("domainList", domainList);
-
- List<Domain> collapsedDomains = new ArrayList<Domain>();
-
- //nline
- for (Domain collapsed : layout.getCollapsedDomainsNewList()) {
- collapsed.setWidth(10*collapsed.computeSize().getWidth());
- collapsed.setHeight(10*collapsed.computeSize().getHeight());
- collapsed.setLeft(10*collapsed.getP().getX());
- collapsed.setTop(10*collapsed.getP().getY());
- //nline
- collapsed.setNewXafterColl(10*collapsed.getNewXafterColl());
- collapsed.setYafterColl(10*collapsed.getYafterColl());
- collapsedDomains.add(collapsed);
- }
-
- domainMap.put("collapsedDomainList", collapsedDomains);
-
- Representer representer = new Representer();
- representer.addClassTag(Domain.class, Tag.MAP);
-
-
- Yaml yaml = new Yaml(representer);
- String output = yaml.dump(domainMap);
-
- return output;
-
-}
-
-
-
- public static HashMap<String, Object> toscaElementsMap = new HashMap<String, Object>();
- public static HashMap<String,Element> elementMap = new HashMap<String, Element>();
- public static HashMap<String,Element> miscElementMap = new HashMap<String, Element>();
- public static HashMap<String,Container> outercontainers = new HashMap<String, Container>();
- public static HashMap<String,Container> innercontainers = new HashMap<String, Container>();
- public static HashMap<String,Domain> domainMap = new HashMap<String, Domain>();
-
-
- static String filePath =
- SystemProperties.getProperty("element_map_file_path") ;
- static String callFlowBusinessYml = "call_flow_sip_digest.yml";
- static String networkToscaYml = null;//"NetworkMap_topology_composition.yml";
- static String networkLayoutYml = null;// "network_map_layout.yml";
-
-
- @SuppressWarnings({ "unchecked", "unused" })
- public String main1(String args[]) throws Exception{
-
-
- if(args != null && args.length > 0 ) {
-
- if( args[2] != null) {
- networkToscaYml = args[2] + ".yml";
- }
-
- if( args[3] != null) {
- networkLayoutYml = args[3] + ".yml";
- }
- }
-
- HashMap<String, Object> toscaYaml = (HashMap<String, Object>)YamlUtils.readYamlFile(filePath, networkToscaYml); //TrinityYAMLHelper.getToscaYaml();
- HashMap<String, Object> networkMapLayoutYaml = (HashMap<String, Object>)YamlUtils.readYamlFile(filePath, networkLayoutYml); //TrinityYAMLHelper.getNetworkMapLayoutYaml();
-
- toscaElementsMap = new HashMap<String, Object>();
- elementMap = new HashMap<String, Element>();
- domainMap = new HashMap<String, Domain>();
- outercontainers = new HashMap<String, Container>();
- innercontainers = new HashMap<String, Container>();
- miscElementMap = new HashMap<String, Element>();
-
- if(toscaYaml != null){
- for(String key : toscaYaml.keySet()){
- if("topology_template".equalsIgnoreCase(key) && toscaYaml.get(key) instanceof HashMap){
- HashMap<String, Object> toscaTopologyDetails = (HashMap<String, Object>) toscaYaml.get(key);
-
- for(String detailsKey: toscaTopologyDetails.keySet()){
-
- if("node_templates".equalsIgnoreCase(detailsKey) && toscaTopologyDetails.get(detailsKey) instanceof HashMap){
-
- toscaElementsMap = (HashMap<String, Object>) toscaTopologyDetails.get(detailsKey);
-
- for(String toscaElementKey: toscaElementsMap.keySet()){
- }
-
- }
- }
- }
-
- }
- }
-
- if(networkMapLayoutYaml != null){
- if(networkMapLayoutYaml.containsKey("toscaNetworkMapElementStyleList") && networkMapLayoutYaml.get("toscaNetworkMapElementStyleList") instanceof ArrayList){
-
- ArrayList<Object> elementlist = (ArrayList<Object>)networkMapLayoutYaml.get("toscaNetworkMapElementStyleList");
- String elementName;
- String elementID;
- String imgPath;
- String row;
- String column;
- String mapKey;
- int i=0;
-
- if(elementlist != null){
- for(Object eachElement: elementlist){
- if(eachElement != null && eachElement instanceof HashMap){
- HashMap<String, String> elementDetails = (HashMap<String, String>) eachElement;
- if(elementDetails != null){
- elementName = "NA"+i;
- elementID = "NA"+i;
- imgPath = "NA"+i;
- row = "0";
- column = "0";
- for(String detailsKey: elementDetails.keySet()){
- if ("tosca_id".equalsIgnoreCase(detailsKey)) elementName = elementDetails.get(detailsKey).toString();
- if ("id".equalsIgnoreCase(detailsKey)) {
- elementID = String.valueOf(elementDetails.get(detailsKey));
- }
- if ("row".equalsIgnoreCase(detailsKey)) {
- row = String.valueOf(elementDetails.get(detailsKey));
- }
- if ("column".equalsIgnoreCase(detailsKey)) {
- column = String.valueOf(elementDetails.get(detailsKey));
- }
- if ("icon".equalsIgnoreCase(detailsKey)) imgPath = elementDetails.get(detailsKey).toString();
- }
-
- if(elementMap.containsKey(elementName.concat("/").concat(row).concat(column))){
- if(elementMap.containsKey(elementName.concat("/").concat(String.valueOf(i)).concat(String.valueOf(i)))){
- mapKey = elementName;
- } else mapKey = elementName.concat("/").concat(String.valueOf(i)).concat(String.valueOf(i));
-
- } else mapKey = elementName.concat("/").concat(row).concat(column);
-
- elementMap.put(mapKey, fetchElementObject(elementID,elementName,imgPath));
- }
- }
- i++;
- }
- }
-
- for(String elementkey : elementMap.keySet()){
- Element c = (Element) elementMap.get(elementkey);
- }
-
- if(!elementMap.isEmpty()){
- miscElementMap = new HashMap<String, Element>(elementMap);
- }
- }
-
-
- if(networkMapLayoutYaml.containsKey("containerStyleList") && networkMapLayoutYaml.get("containerStyleList") instanceof ArrayList){
-
- ArrayList<Object> containerstylelist = (ArrayList<Object>)networkMapLayoutYaml.get("containerStyleList");
- String containerName;
- String containerID;
- String domain;
- String row;
- String column;
- String mapKey;
- int i=0;
-
- if(containerstylelist != null){
- //Inner Containers
- for(Object eachContainer: containerstylelist){
- if(eachContainer != null && eachContainer instanceof HashMap){
- HashMap<String, String> containerDetails = (HashMap<String, String>) eachContainer;
- if(containerDetails != null){
- containerName = "NA"+i;
- containerID = "NA"+i;
- domain = "NA"+i;
- row = "0";
- column = "0";
-
- for(String detailsKey: containerDetails.keySet()){
- if ("logical_group_name".equalsIgnoreCase(detailsKey)) containerName = containerDetails.get(detailsKey).toString();
- if ("id".equalsIgnoreCase(detailsKey)) {
- containerID = String.valueOf(containerDetails.get(detailsKey));
- }
- if("domain".equalsIgnoreCase(detailsKey)){
- domain = containerDetails.get(detailsKey).toString();
- }
- if ("row".equalsIgnoreCase(detailsKey)) {
- row = String.valueOf(containerDetails.get(detailsKey));
- }
- if ("column".equalsIgnoreCase(detailsKey)) {
- column = String.valueOf(containerDetails.get(detailsKey));
- }
- }
- if(containerName.contains("/")){
-
- if(innercontainers.containsKey((domain +":"+ containerName).concat("/").concat(row).concat(column))){
- if(elementMap.containsKey((domain +":"+ containerName).concat("/").concat(String.valueOf(i)).concat(String.valueOf(i)))){
- mapKey = (domain +":"+ containerName);
- } else mapKey = (domain +":"+ containerName).concat("/").concat(String.valueOf(i)).concat(String.valueOf(i));
-
- } else mapKey = (domain +":"+ containerName).concat("/").concat(row).concat(column);
-
- innercontainers.put(mapKey, fetchContainerObject(containerID,containerName.substring(containerName.indexOf("/")+1),true,containerName,domain));
- }
- }
- }
- i++;
- }
-
- //OuterContainers
- i=0;
- for(Object eachContainer: containerstylelist){
- if(eachContainer != null && eachContainer instanceof HashMap){
- HashMap<String, String> containerDetails = (HashMap<String, String>) eachContainer;
- if(containerDetails != null){
- containerName = "NA"+i;
- containerID = "NA"+i;
- domain = "NA"+i;
- row = "0";
- column = "0";
-
- for(String detailsKey: containerDetails.keySet()){
- if ("logical_group_name".equalsIgnoreCase(detailsKey)) containerName = containerDetails.get(detailsKey).toString();
- if ("id".equalsIgnoreCase(detailsKey)) {
- containerID = String.valueOf(containerDetails.get(detailsKey));
- }
- if("domain".equalsIgnoreCase(detailsKey)){
- domain = containerDetails.get(detailsKey).toString();
- }
- if ("row".equalsIgnoreCase(detailsKey)) {
- row = String.valueOf(containerDetails.get(detailsKey));
- }
- if ("column".equalsIgnoreCase(detailsKey)) {
- column = String.valueOf(containerDetails.get(detailsKey));
- }
- }
- if(!containerName.contains("/")){
- if(outercontainers.containsKey((domain +":"+ containerName).concat("/").concat(row).concat(column))){
- if(outercontainers.containsKey((domain +":"+ containerName).concat("/").concat(String.valueOf(i)).concat(String.valueOf(i)))){
- mapKey = (domain +":"+ containerName);
- } else mapKey = (domain +":"+ containerName).concat("/").concat(String.valueOf(i)).concat(String.valueOf(i));
-
- } else mapKey = (domain +":"+ containerName).concat("/").concat(row).concat(column);
- outercontainers.put(mapKey, fetchContainerObject(containerID,containerName,false,containerName,domain));
- }
-
- }
- }
- i++;
- }
- }
-
- for(String innerContainerkey : innercontainers.keySet()){
- Container c = (Container) innercontainers.get(innerContainerkey);
- }
-
- for(String outerContainerkey : outercontainers.keySet()){
- Container c = (Container) outercontainers.get(outerContainerkey);
- }
-
- }
-
- if(networkMapLayoutYaml.containsKey("domainList") && networkMapLayoutYaml.get("domainList") instanceof ArrayList){
-
- ArrayList<Object> domainlist = (ArrayList<Object>)networkMapLayoutYaml.get("domainList");
- String domainName;
- String domainID;
- String row;
- String column;
- String mapKey;
- int i=0;
-
- if(domainlist != null){
-
- Double leftPosition = 7d;
- HashMap<String,String> domainStagingMap = new HashMap<String, String>();
-
- for(Object eachDomain: domainlist){
- if(eachDomain != null && eachDomain instanceof HashMap){
- HashMap<String, String> domainDetails = (HashMap<String, String>) eachDomain;
- if(domainDetails != null){
- domainName = "NA"+i;
- domainID = "NA"+i;
- row = "0";
- column = "0";
- for(String detailsKey: domainDetails.keySet()){
- if ("name".equalsIgnoreCase(detailsKey)) domainName = domainDetails.get(detailsKey).toString();
- if ("id".equalsIgnoreCase(detailsKey)) {
- domainID = String.valueOf(domainDetails.get(detailsKey));
- }
- if ("row".equalsIgnoreCase(detailsKey)) {
- row = String.valueOf(domainDetails.get(detailsKey));
- }
- if ("column".equalsIgnoreCase(detailsKey)) {
- column = String.valueOf(domainDetails.get(detailsKey));
- }
- }
-
- if(domainStagingMap.containsKey(row.concat(column))){
- mapKey = domainName;
- } else mapKey = row.concat(column);
-
- domainStagingMap.put(mapKey, domainID+"%"+domainName);
- }
- }
- i++;
- }
-
- if(domainStagingMap != null && !domainStagingMap.isEmpty()){
- for(String domainsKey: new TreeSet<String>(domainStagingMap.keySet())){
- String value = domainStagingMap.get(domainsKey);
- if(value.contains("%")){
- domainMap.put(domainsKey, fetchDomainObject(value.substring(0,value.indexOf("%")),value.substring(value.indexOf("%")+1)));
- }
- }
- }
- }
-
- for(String domainkey : domainMap.keySet()){
- Domain c = (Domain) domainMap.get(domainkey);
- }
-
- }
-
-
- }
-
- Layout dynamicLayout = new Layout(domainMap, 2, 10, 1, 5);
-
- dynamicLayout.computeDomainPositionsModified();
- Map<String,Domain> resultDomain2= dynamicLayout.domainRowCol;
-
- for (String key : resultDomain2.keySet()) {
- if (resultDomain2.get(key).getP() !=null) {
-
- }
- }
-
- ElementMapService cm2 = new ElementMapService();
- try {
-
- if(args != null && args.length > 0 ) {
-
- if( args[0] != null) {
- String collapsedDomains[] = args[0].split(",");
- for(String collapsedDomain : collapsedDomains)
- dynamicLayout.collapseDomainNew(collapsedDomain);
- }
-
- if( args[1] != null) {
- String expandedDomains[] = args[1].split(",");
- for(String expandedDomain : expandedDomains)
- dynamicLayout.uncollapseDomainNew1(expandedDomain);
- }
-
- return cm2.convertToYAML(dynamicLayout);
-
- }
- }catch (Exception e) {
-
- e.printStackTrace();
- }
-
-
- return "";
-
-
- }
-
- private static int computeRows(Set<String> keys){
- int i = 0;
- if(keys!= null && !keys.isEmpty()){
- for(String s: keys){
- String r = s.substring(0, 1);
- if(StringUtils.isNumeric(r)){
- int j = Integer.parseInt(r);
- if(i<= j){
- i=j;
- }
-
- }
- }
-
- return i+1;
- }
-
- return 1;
- }
-
- private static int computeColumns(Set<String> keys){
- int i = 0;
- if(keys!= null && !keys.isEmpty()){
- for(String s: keys){
- String r = s.substring(1, 2);
- if(StringUtils.isNumeric(r)){
- int j = Integer.parseInt(r);
- if(i<= j){
- i=j;
- }
-
- }
- }
-
- return i+1;
- }
-
- return 1;
- }
-
- private static Container fetchContainerObject(String id, String name, boolean isInner, String logicalGroupName, String domain){
- Map<String,Element> containerElementsMap = new HashMap<String, Element>();
-
- containerElementsMap = fetchElementsMapForContainer(name, isInner, logicalGroupName, domain);
- int rows = 1;
- int columns = 1;
-
- if(isInner){
-
- if(containerElementsMap != null && !containerElementsMap.isEmpty()){
- rows = computeRows(containerElementsMap.keySet());
- columns = computeColumns(containerElementsMap.keySet());
- }
-
- Container thisContainer = new Container(id, name, rows, columns, 1, 4, 8, 12, 1, 2);
- thisContainer.setElements(containerElementsMap);
-
- return thisContainer;
- } else {
- Map<String,Container> innerContainersMap = fetchInnerContainersMapForOuter(name, isInner, logicalGroupName,domain);
-
- if(innerContainersMap != null && !innerContainersMap.isEmpty()){
- if(containerElementsMap != null && !containerElementsMap.isEmpty()){
- Set<String> keys = new HashSet<String>(innerContainersMap.keySet());
- keys.addAll(containerElementsMap.keySet());
- rows = computeRows(keys);
- columns = computeColumns(keys);
- } else {
- rows = computeRows(innerContainersMap.keySet());
- columns = computeColumns(innerContainersMap.keySet());
- }
- } else if(containerElementsMap != null && !containerElementsMap.isEmpty()){
- rows = computeRows(containerElementsMap.keySet());
- columns = computeColumns(containerElementsMap.keySet());
- }
-
- Container thisContainer = new Container(id, name, rows, columns,2 , 6, 2, 5, 0, 0);
- thisContainer.setElements(containerElementsMap);
- thisContainer.setInnerContainer(innerContainersMap);
-
-
- return thisContainer;
- }
-
- }
-
- private static Domain fetchDomainObject(String id, String name){
- HashMap<String,Container> domainContainersMap = fetchContainersForDomain(name);
-
- int rows = 1;
- int columns = 1;
- if(domainContainersMap != null && !domainContainersMap.isEmpty()){
- rows = computeRows(domainContainersMap.keySet());
- columns = computeColumns(domainContainersMap.keySet());
- }
-
- double domainWidth = 11;
- Domain thisDomain;
-
- if(domainMap != null && !domainMap.isEmpty()){
- int domainsCountSoFar = domainMap.size();
- switch(domainsCountSoFar){
- case 1: {domainWidth = 12.1; break;}
- case 2: {domainWidth = 13.3; break;}
- case 3: {domainWidth = 14.5; break;}
- case 4: {domainWidth = 15.6; break;}
- default: {domainWidth = 11; break;}
- }
-
- for(String domainsKey: new TreeSet<String>(domainMap.keySet())){
- Domain eachDomain = domainMap.get(domainsKey);
- domainWidth+= eachDomain.computeSize().getWidth();
- }
- thisDomain = new Domain(id, name, 2, 2, domainWidth, 10, 3, rows, columns);
- } else {
-
- thisDomain = new Domain(id, name, 2, 1, 11, 10, 3, rows, columns);
- }
-
- thisDomain.setContainers(domainContainersMap);
-
- thisDomain.computeConatinerPositions();
- if(domainContainersMap!= null && !domainContainersMap.isEmpty()){
- for(Container thisContainer : domainContainersMap.values()){
- thisContainer.computeSize();
- thisContainer.computeElementPositions();
- Map<String,Element> resultElementMap = thisContainer.elementRowCol;
- for (String key : resultElementMap.keySet()) {
- if(resultElementMap.get(key) == null || resultElementMap.get(key).getP() == null) {
- }
-
- }
-
- HashMap<String,Container> innerContainersMap = (HashMap<String, Container>) thisContainer.getContainerRowCol();
- if(innerContainersMap != null && !innerContainersMap.isEmpty()){
- for(Container thisInnerContainer : innerContainersMap.values()){
- thisInnerContainer.computeElementPositions();
- }
- }
- }
- }
-
- return thisDomain;
- }
-
- private static HashMap<String,Container> fetchContainersForDomain(String domain){
- HashMap<String,Container> domainContainersMap = new HashMap<String, Container>();
-
- domainContainersMap = fetchFromOuterContainers(domain);
-
- return domainContainersMap;
-
- }
-
- @SuppressWarnings("unchecked")
- private static Element fetchElementObject(String id, String name, String imgPath){
- String bgColor = "bgColor";
- String logical_group;
- String display_longname;
- String display_shortname;
- String description;
- String primary_function;
- String key_interfaces;
- String location;
- String vendor;
- String vendor_shortname;
- String enclosingContainer;
- String borderType;
- String network_function;
-
- if(toscaElementsMap.containsKey(name)){
-
- if(toscaElementsMap.get(name) != null && toscaElementsMap.get(name) instanceof HashMap){
- HashMap<String, Object> toscaElementDetails = (HashMap<String, Object>) toscaElementsMap.get(name);
-
- for(String detailsKey: toscaElementDetails.keySet()){
- if("properties".equalsIgnoreCase(detailsKey) && toscaElementDetails.get(detailsKey) instanceof HashMap){
- HashMap<String, String> elementDetails = (HashMap<String, String>) toscaElementDetails.get(detailsKey);
-
- if(elementDetails != null){
- logical_group = elementDetails.get("logical_group") == null? "" : elementDetails.get("logical_group").toString();
- display_longname = elementDetails.get("display_longname") == null? "" : elementDetails.get("display_longname").toString();
- display_shortname = elementDetails.get("display_shortname") == null? "" : elementDetails.get("display_shortname").toString();
- description = elementDetails.get("description") == null? "" : elementDetails.get("description").toString();
- primary_function = elementDetails.get("primary_function") == null? "" : elementDetails.get("primary_function").toString();
- key_interfaces = elementDetails.get("key_interfaces") == null? "" : elementDetails.get("key_interfaces").toString();
- location = elementDetails.get("location") == null? "" : elementDetails.get("location").toString();
- vendor = elementDetails.get("vendor") == null? "" : elementDetails.get("vendor").toString();
- vendor_shortname = elementDetails.get("vendor_shortname") == null? "" : elementDetails.get("vendor_shortname").toString();
- enclosingContainer = logical_group.replace("/", "-");
- network_function = elementDetails.get("network_function");
- borderType = elementDetails.get("network_function") == null? "P" : elementDetails.get("network_function").toString().toUpperCase();
- bgColor = elementDetails.get("background_color") == null? "bgColor" : elementDetails.get("background_color").toString();
-
- ElementDetails details = new ElementDetails(logical_group,display_longname,description,primary_function, network_function,
- key_interfaces,location,vendor,vendor_shortname,enclosingContainer);
-
- return new Element(name, display_shortname, imgPath, bgColor,borderType, details);
- }
-
- }
- }
-
- }
-
- } else {
- return new Element(id,name);
- }
-
- return new Element(id,name);
- }
-
- @SuppressWarnings("unchecked")
- private static String fetchDomainNameOfElement(String name){
- if(toscaElementsMap.containsKey(name)){
-
- if(toscaElementsMap.get(name) != null && toscaElementsMap.get(name) instanceof HashMap){
- HashMap<String, Object> toscaElementDetails = (HashMap<String, Object>) toscaElementsMap.get(name);
-
- for(String detailsKey: toscaElementDetails.keySet()){
- if("properties".equalsIgnoreCase(detailsKey) && toscaElementDetails.get(detailsKey) instanceof HashMap){
- HashMap<String, String> elementDetails = (HashMap<String, String>) toscaElementDetails.get(detailsKey);
-
- if(elementDetails != null){
- return elementDetails.get("domain") == null? "" : elementDetails.get("domain").toString();
- }
-
- }
- }
-
- }
-
- } else {
- return "";
- }
-
- return "";
- }
-
- private static HashMap<String, Container> fetchInnerContainersMapForOuter(String name, boolean isInner, String logicalGroupName, String domain){
- return fetchInnerContainersMap(name,logicalGroupName,domain);
- }
-
- private static HashMap<String, Element> fetchElementsMapForContainer(String name, boolean isInner, String logicalGroupName, String domain){
- return fetchElementsMap(logicalGroupName,domain);
- }
-
- private static HashMap<String, Container> fetchInnerContainersMap(String name, String logicalGroupName, String domain){
- HashMap<String,Container> containersMap = new HashMap<String, Container>();
- String rowColumnKey = "";
- int count = 0;
-
- if(innercontainers!=null && !innercontainers.isEmpty()){
- for(String key : innercontainers.keySet()){
-
-
- Container eachContainer = innercontainers.get(key);
-
- if(key.toUpperCase().contains((domain+":"+name).toUpperCase())){
- if(key.contains("/")){
- rowColumnKey = key.substring(key.lastIndexOf("/")+1);
- }
-
- if(rowColumnKey.isEmpty() || containersMap.containsKey(rowColumnKey)){
- count=0;
- while(count<=9){
- if(containersMap.containsKey(String.valueOf(count).concat(String.valueOf(count)))){
- count++;
- } else
- {
- rowColumnKey = String.valueOf(count).concat(String.valueOf(count));
- break;
- }
- }
-
-
- }
-
- containersMap.put(rowColumnKey,eachContainer);
- }
-
-
- }
- }
- return containersMap.isEmpty()?null:containersMap;
-
- }
-
- private static HashMap<String, Container> fetchFromOuterContainers(String domain){
- HashMap<String,Container> thisContainersMap = new HashMap<String, Container>();
- String rowColumnKey = "";
- int count = 0;
-
- if(outercontainers!=null && !outercontainers.isEmpty()){
- for(String key : outercontainers.keySet()){
- Container eachContainer = outercontainers.get(key);
-
- if(key.toUpperCase().contains((domain+":").toUpperCase())){
- if(key.contains("/")){
- rowColumnKey = key.substring(key.lastIndexOf("/")+1);
- }
-
- if(rowColumnKey.isEmpty() || thisContainersMap.containsKey(rowColumnKey)){
- count=0;
- while(count<=9){
- if(thisContainersMap.containsKey(String.valueOf(count).concat(String.valueOf(count)))){
- count++;
- } else
- {
- rowColumnKey = String.valueOf(count).concat(String.valueOf(count));
- break;
- }
- }
-
-
- }
-
- thisContainersMap.put(rowColumnKey,eachContainer);
- }
- }
-
- }
-
- //Misc Elements Containers
-
- if(miscElementMap!=null && !miscElementMap.isEmpty()){
- for(String key : miscElementMap.keySet()){
- Element eachElement = miscElementMap.get(key);
- String elementName = eachElement.getName();
- String domainName = fetchDomainNameOfElement(elementName);
-
- if(domain.equalsIgnoreCase(domainName)){
- Container eachContainer = new Container(domainName+":"+elementName, elementName, 1, 1, 3, 6, 2, 5, 0, 0);
- count=0;
- while(count<=9){
- if(thisContainersMap.containsKey(String.valueOf(count).concat(String.valueOf(count)))){
- count++;
- } else
- {
- rowColumnKey = String.valueOf(count).concat(String.valueOf(count));
- break;
- }
- }
-
- thisContainersMap.put(rowColumnKey,eachContainer);
- }
-
-
- }
-
- }
-
-
- return thisContainersMap.isEmpty()?null:thisContainersMap;
- }
-
-
-
- @SuppressWarnings("unused")
- private static HashMap<String,Container> addOuterContainersForMiscElements(String domain){
- HashMap<String,Container> containerElementsMap = new HashMap<String, Container>();
- if(miscElementMap!=null && !miscElementMap.isEmpty()){
- for(String key : miscElementMap.keySet()){
- Element eachElement = miscElementMap.get(key);
- String elementName = eachElement.getName();
- String domainName = fetchDomainNameOfElement(elementName);
-
- if(domain.equalsIgnoreCase(domainName)){
- Container newContainer = new Container(domainName+":"+elementName, elementName, 1, 1, 3, 6, 2, 5, 0, 0);
- containerElementsMap.put(domainName+":"+elementName, newContainer);
- }
-
-
- }
-
- }
- return containerElementsMap.isEmpty()? null:containerElementsMap;
- }
-
- private static HashMap<String, Element> fetchElementsMap(String logicalGroupName, String domain){
- HashMap<String,Element> innerElementMap = new HashMap<String, Element>();
- String rowColumnKey = "";
- int count = 0;
-
- if(elementMap!=null && !elementMap.isEmpty()){
- for(String key : elementMap.keySet()){
- Element eachElement = elementMap.get(key);
-
- String elementName = eachElement.getId();
- String elementLogicalGroup = eachElement.details == null ? "" : eachElement.details.logical_group;
- if(elementLogicalGroup.equalsIgnoreCase(logicalGroupName) && domain.equalsIgnoreCase(fetchDomainNameOfElement(elementName))){
- if(key.contains("/")){
- rowColumnKey = key.substring(key.indexOf("/")+1);
- }
-
- if(rowColumnKey.isEmpty() || innerElementMap.containsKey(rowColumnKey)){
- count=0;
- while(count<=9){
- if(innerElementMap.containsKey(String.valueOf(count).concat(String.valueOf(count)))){
- count++;
- } else
- {
- rowColumnKey = String.valueOf(count).concat(String.valueOf(count));
- break;
- }
- }
-
-
- }
-
- innerElementMap.put(rowColumnKey,eachElement);
- miscElementMap.remove(key);
- }
-
- }
- }
-
- return innerElementMap.isEmpty()?null:innerElementMap;
- }
-
-
-
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java
deleted file mode 100644
index 040c9d26..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuService.java
+++ /dev/null
@@ -1,46 +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.service;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.openecomp.portalsdk.core.domain.Menu;
-import org.openecomp.portalsdk.core.domain.MenuData;
-import org.openecomp.portalsdk.core.domain.RoleFunction;
-
-/**
- * Description: this java class is an interface of services for Admin to add/edit/delete menu items from FN_MENU
- */
-public interface FnMenuService {
- List<MenuData> getFnMenuItems();
- void saveFnMenuData(MenuData domainFnMenu);
- void saveFnMenu(Menu domainFnMenu);
- void removeMenuItem(MenuData domainFnMenu);
- MenuData getMenuItemRow(Long id);
- Menu getMenuItem(Long id);
- List<Long> getParentId(String label);
- @SuppressWarnings("rawtypes")
- List<List> getParentList();
- List<RoleFunction> getFunctionCDList();
- void removeMenuItem(Menu domainFnMenu);
- Map<String, List<MenuData>> setMenuDataStructure(List<List<MenuData>> childItemList, List<MenuData> parentList, Set<MenuData> menuResult) throws Exception;
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java
deleted file mode 100644
index b17be180..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/FnMenuServiceImpl.java
+++ /dev/null
@@ -1,145 +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.service;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.openecomp.portalsdk.core.domain.Menu;
-import org.openecomp.portalsdk.core.domain.MenuData;
-import org.openecomp.portalsdk.core.domain.RoleFunction;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * Description: this java class is an implementation of services for Admin to add/edit/delete menu items from FN_MENU
- */
-
-@Service("fnMenuService")
-@Transactional
-public class FnMenuServiceImpl implements FnMenuService{
-
- @Autowired
- private DataAccessService dataAccessService;
-
- @SuppressWarnings("unchecked")
- public List<MenuData> getFnMenuItems() {
- return getDataAccessService().getList(MenuData.class, null, "1", null);
-
- }
-
-
- public DataAccessService getDataAccessService() {
- return dataAccessService;
- }
-
-
- public void setDataAccessService(DataAccessService dataAccessService) {
- this.dataAccessService = dataAccessService;
- }
-
-
- @Override
- public void saveFnMenuData(MenuData domainFnMenu) {
- // TODO Auto-generated method stub
- getDataAccessService().saveDomainObject(domainFnMenu, null);
-
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public List<Long> getParentId(String label) {
- // TODO Auto-generated method stub
- Map<String, String> params = new HashMap<String, String>();
- params.put("paramLabel", label);
- return getDataAccessService().executeNamedQuery("IdForLabelList", params, null);
- }
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- @Override
- public List<List> getParentList() {
- // TODO Auto-generated method stub
-
- return getDataAccessService().executeNamedQuery("parentList", null, null);
-
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public List<RoleFunction> getFunctionCDList() {
- // TODO Auto-generated method stub
-
- return getDataAccessService().executeNamedQuery("functionCDlist", null, null);
-
- }
-
- @Override
- public void removeMenuItem(MenuData domainFnMenu) {
- getDataAccessService().deleteDomainObject(domainFnMenu, null);
- }
-
- @Override
- public void removeMenuItem(Menu domainFnMenu) {
- getDataAccessService().deleteDomainObject(domainFnMenu, null);
- }
-
- public MenuData getMenuItemRow(Long id) {
- return (MenuData)getDataAccessService().getDomainObject(MenuData.class, id, null);
- }
-
- @Override
- public Menu getMenuItem(Long id) {
- return (Menu)getDataAccessService().getDomainObject(Menu.class, id, null);
- }
-
- @Override
- public void saveFnMenu(Menu domainFnMenu) {
- // TODO Auto-generated method stub
- getDataAccessService().saveDomainObject(domainFnMenu, null);
-
- }
- @Override
- public Map<String, List<MenuData>> setMenuDataStructure(List<List<MenuData>> childItemList, List<MenuData> parentList, Set<MenuData> menuResult) throws Exception{
- for(MenuData menu: menuResult){
- MenuData parentData = new MenuData();
- parentData.setLabel(menu.getLabel());
- parentData.setAction(menu.getAction());
- parentData.setImageSrc(menu.getImageSrc());
- parentList.add(parentData);
- List<MenuData> tempList = new ArrayList<MenuData>();
- for(Object o:menu.getChildMenus()){
- MenuData m = (MenuData)o;
- MenuData data = new MenuData();
- data.setLabel(m.getLabel());
- data.setAction(m.getAction());
- data.setImageSrc(m.getImageSrc());
- tempList.add(data);
- }
- childItemList.add(tempList);
- }
- return null;
- }
-
-
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapService.java
deleted file mode 100644
index 9c790eb2..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapService.java
+++ /dev/null
@@ -1,31 +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.service;
-
-import org.openecomp.portalsdk.core.command.support.SearchResult;
-import org.openecomp.portalsdk.core.domain.support.DomainVo;
-
-
-public interface LdapService {
-
- // search POST for users based on the criteria selected in the Request
- SearchResult searchPost(DomainVo searchCriteria, String sortBy1, String sortBy2, String sortBy3, int pageNo, int dataSize, int userId) throws Exception;
-
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapServiceImpl.java
deleted file mode 100644
index d1176c1c..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LdapServiceImpl.java
+++ /dev/null
@@ -1,269 +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.service;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.SearchControls;
-
-import org.openecomp.portalsdk.core.command.support.SearchResult;
-import org.openecomp.portalsdk.core.domain.User;
-import org.openecomp.portalsdk.core.domain.support.DomainVo;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.service.support.FusionService;
-import org.openecomp.portalsdk.core.service.support.ServiceLocator;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-@Service("ldapService")
-@Transactional
-public class LdapServiceImpl extends FusionService implements LdapService {
-
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(LdapServiceImpl.class);
- @Autowired
- private ServiceLocator serviceLocator;
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public SearchResult searchPost(DomainVo searchCriteria, String sortBy1, String sortBy2, String sortBy3,
- int pageNo, int dataSize, int userId) throws Exception {
-
- // initialize the directory context to access POST
- DirContext dirContext = serviceLocator.getDirContext(SystemProperties.getProperty(SystemProperties.POST_INITIAL_CONTEXT_FACTORY),
- SystemProperties.getProperty(SystemProperties.POST_PROVIDER_URL),
- SystemProperties.getProperty(SystemProperties.POST_SECURITY_PRINCIPAL));
-
- SearchResult searchResult = new SearchResult();
-
- try {
-
- String[] postAttributes = {"nickname","givenName","initials","sn","employeeNumber","mail","telephoneNumber",
- "departmentNumber","a1","street","roomNumber","l","st","postalCode","zip4","physicalDeliveryOfficeName","bc",
- "friendlyCountryName","bd","bdname","bu","buname","jtname","mgrid","a2","compcode","compdesc",
- "costcenter","silo","b2"};
-
- SearchControls searchControls = new SearchControls();
- searchControls.setTimeLimit(5000);
- searchControls.setReturningAttributes(postAttributes);
-
- StringBuffer filterClause = new StringBuffer("(&(objectClass=*)");
-
- User user = (User)searchCriteria;
-
- if(Utilities.nvl(user.getFirstName()).length() > 0) {
- filterClause.append("(givenName=").append(user.getFirstName()).append("*)");
- }
- if(Utilities.nvl(user.getLastName()).length() > 0) {
- filterClause.append("(sn=").append(user.getLastName()).append("*)");
- }
- if(Utilities.nvl(user.getHrid()).length() > 0) {
- filterClause.append("(employeeNumber=").append(user.getHrid()).append("*)");
- }
- if(Utilities.nvl(user.getOrgManagerUserId()).length() > 0) {
- filterClause.append("(mgrid=").append(user.getOrgManagerUserId()).append("*)");
- }
- if(Utilities.nvl(user.getOrgCode()).length() > 0) {
- filterClause.append("(departmentNumber=").append(user.getOrgCode()).append("*)");
- }
- if(Utilities.nvl(user.getEmail()).length() > 0) {
- filterClause.append("(mail=").append(user.getEmail()).append("*)");
- }
- if(Utilities.nvl(user.getOrgUserId()).length() > 0) {
- filterClause.append("(a1=").append(user.getOrgUserId()).append("*)");
- }
- filterClause.append("(c3=N)"); // this has been added to filter CP09 entries on the LDAP server that are duplicates of existing individuals
- filterClause.append(")");
-
- List list = new ArrayList();
- if (!filterClause.toString().equals("(&(objectClass=*))")) {
- NamingEnumeration e = dirContext.search(SystemProperties.getProperty(SystemProperties.POST_PROVIDER_URL) + "/" +
- SystemProperties.getProperty(SystemProperties.POST_SECURITY_PRINCIPAL),
- filterClause.toString(),
- searchControls);
-
- list = processResults(e);
- }
-
- Collections.sort(list);
-
- searchResult = new SearchResult(list);
- searchResult.setPageNo(pageNo);
- if(dataSize >= 0) {
- searchResult.setDataSize(dataSize);
- }
- else {
- searchResult.setDataSize(list.size());
- } // else
-
- }
- catch(NamingException ne) {
- logger.error(EELFLoggerDelegate.errorLogger,ne.getMessage());
- }
- finally {
- dirContext.close();
- }
-
- return searchResult;
- }
-
-
- @SuppressWarnings({ "rawtypes", "unchecked" })
- private ArrayList processResults(NamingEnumeration e) throws NamingException {
- ArrayList results = new ArrayList();
- int count = 0;
-
- while (e.hasMore()) {
- javax.naming.directory.SearchResult searchResult = (javax.naming.directory.SearchResult)e.next();
- results.add(processAttributes(searchResult.getAttributes()));
- count++;
-
- if(count > Integer.parseInt(SystemProperties.getProperty(SystemProperties.POST_MAX_RESULT_SIZE))) {
- break;
- }
-
- }
-
- return results;
- }
-
-
- @SuppressWarnings("rawtypes")
- private DomainVo processAttributes(Attributes resultAttributes) throws NamingException {
- User user = new User();
-
- try {
- if (resultAttributes == null) {
- System.out.println("This result has no attributes");
- } else {
- for (NamingEnumeration e = resultAttributes.getAll(); e.hasMore();) { //why the nested loop?
- Attribute attribute = (Attribute)e.next();
- for (NamingEnumeration ie = attribute.getAll(); ie.hasMore();) {
- if (attribute.getID().equalsIgnoreCase("nickname")) {
- user.setFirstName((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("initials")) {
- user.setMiddleInitial((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("sn")) {
- user.setLastName((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("employeeNumber")) {
- user.setHrid((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("mail")) {
- user.setEmail((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("telephoneNumber")) {
- user.setPhone((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("departmentNumber")) {
- user.setOrgCode((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("a1")) {
- user.setOrgUserId((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("street")) {
- user.setAddress1((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("roomNumber")) {
- user.setAddress2((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("l")) {
- user.setCity((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("st")) {
- user.setState((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("postalCode")) {
- user.setZipCode((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("zip4")) {
- user.setZipCodeSuffix((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("physicalDeliveryOfficeName")) {
- user.setLocationClli((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("bc")) {
- user.setBusinessCountryCode((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("friendlyCountryName")) {
- user.setBusinessCountryName((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("bd")) {
- user.setDepartment((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("bdname")) {
- user.setDepartmentName((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("jtname")) {
- user.setJobTitle((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("mgrid")) {
- user.setOrgManagerUserId((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("a2")) {
- user.setCommandChain((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("compcode")) {
- user.setCompanyCode((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("compdesc")) {
- user.setCompany((String) ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("bu")) {
- user.setBusinessUnit((String)ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("buname")) {
- user.setBusinessUnitName((String)ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("silo")) {
- user.setSiloStatus((String)ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("costcenter")) {
- user.setCostCenter((String)ie.next());
- }
- else if (attribute.getID().equalsIgnoreCase("b2")) {
- user.setFinancialLocCode((String)ie.next());
- }
- else { //we don't care about returned attribute, let's move on
- ie.next();
- }
-
- }
- }
- }
- } catch (NamingException e) {
- logger.error(EELFLoggerDelegate.errorLogger, "An error occurred while processing the following user from POST with an ORGUSERID of " + user.getOrgUserId() + e.getMessage());
- } finally {
-
- }
- return user;
- }
-
-
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginService.java
deleted file mode 100644
index 113833bf..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginService.java
+++ /dev/null
@@ -1,36 +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.service;
-
-
-import java.util.HashMap;
-
-import org.openecomp.portalsdk.core.command.LoginBean;
-
-
-public interface LoginService {
-
- // validate user exists in the system
- @SuppressWarnings("rawtypes")
- LoginBean findUser(LoginBean bean, String menuPropertiesFilename, HashMap additionalParams) throws Exception;
-
- @SuppressWarnings("rawtypes")
- LoginBean findUser(LoginBean bean, String menuPropertiesFilename, HashMap additionalParams, boolean matchPassword) throws Exception;
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceImpl.java
deleted file mode 100644
index 7da427ba..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/LoginServiceImpl.java
+++ /dev/null
@@ -1,190 +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.service;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.openecomp.portalsdk.core.command.LoginBean;
-import org.openecomp.portalsdk.core.domain.Role;
-import org.openecomp.portalsdk.core.domain.User;
-import org.openecomp.portalsdk.core.menu.MenuBuilder;
-import org.openecomp.portalsdk.core.service.support.FusionService;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.openecomp.portalsdk.core.web.support.AppUtils;
-import org.openecomp.portalsdk.core.web.support.UserUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-@Service("loginService")
-@Transactional
-public class LoginServiceImpl extends FusionService implements LoginService {
-
- @SuppressWarnings("unused")
- private MenuBuilder menuBuilder;
-
- @Autowired
- private DataAccessService dataAccessService;
-
-
- @SuppressWarnings("rawtypes")
- public LoginBean findUser(LoginBean bean, String menuPropertiesFilename, HashMap additionalParams ) throws Exception {
- return findUser(bean, menuPropertiesFilename, additionalParams, true);
- }
-
- @SuppressWarnings("rawtypes")
- public LoginBean findUser(LoginBean bean, String menuPropertiesFilename, HashMap additionalParams, boolean matchPassword) throws Exception {
- User user = null;
- User userCopy = null;
-
- if (bean.getUserid() != null && bean.getUserid() != null) {
- user = (User)findUser(bean);
- }
- else {
- if (matchPassword)
- user = (User)findUser(bean.getLoginId(), bean.getLoginPwd());
- else
- user = (User)findUserWithoutPwd(bean.getLoginId());
- }
-
- if (user != null) {
-
- // raise an error if the application is locked and the user does not have system administrator privileges
- if (AppUtils.isApplicationLocked() && !UserUtils.hasRole(user, SystemProperties.getProperty(SystemProperties.SYS_ADMIN_ROLE_ID))) {
- bean.setLoginErrorMessage(SystemProperties.MESSAGE_KEY_LOGIN_ERROR_APPLICATION_LOCKED);
- }
-
- // raise an error if the user is inactive
- if (!user.getActive()) {
- bean.setLoginErrorMessage(SystemProperties.MESSAGE_KEY_LOGIN_ERROR_USER_INACTIVE);
- }
-
- if (!userHasActiveRoles(user)) {
- bean.setLoginErrorMessage(SystemProperties.MESSAGE_KEY_LOGIN_ERROR_USER_INACTIVE);
- }
- // only login the user if no errors have occurred
- if (bean.getLoginErrorMessage() == null) {
-
- // this will be a snapshot of the user's information as retrieved from the database
- userCopy = (User)user.clone();
-
- // update the last logged in date for the user
- user.setLastLoginDate(new Date());
- getDataAccessService().saveDomainObject(user, additionalParams);
-
- // update the audit log of the user
- //Check for the client device type and set log attributes appropriately
-
- // save the above changes to the User and their audit trail
-
- // create the application menu based on the user's privileges
- Set appMenu = getMenuBuilder().getMenu(SystemProperties.getProperty(SystemProperties.APPLICATION_MENU_SET_NAME),dataAccessService);
- bean.setMenu(appMenu != null?appMenu:new HashSet());
- Set businessDirectMenu = getMenuBuilder().getMenu(SystemProperties.getProperty(SystemProperties.BUSINESS_DIRECT_MENU_SET_NAME),dataAccessService);
- bean.setBusinessDirectMenu(businessDirectMenu != null?businessDirectMenu:new HashSet());
-
- bean.setUser(userCopy);
- }
-
- }
-
- return bean;
- }
-
- @SuppressWarnings("rawtypes")
- private boolean userHasActiveRoles(User user) {
- boolean hasActiveRole = false;
- Iterator roles = user.getRoles().iterator();
- while (roles.hasNext()) {
- Role role = (Role)roles.next();
- if (role.getActive()) {
- hasActiveRole = true;
- break;
- }
- }
- return hasActiveRole;
- }
-
-
- @SuppressWarnings("rawtypes")
- public User findUser(String loginId, String password) {
- List list = null;
-
- StringBuffer criteria = new StringBuffer();
- criteria.append(" where login_id = '").append(loginId).append("'")
- .append(" and login_pwd = '").append(password).append("'");
-
- list = getDataAccessService().getList(User.class, criteria.toString(), null, null);
-
- return (list == null || list.size() == 0) ? null : (User)list.get(0);
- }
-
- @SuppressWarnings("rawtypes")
- private User findUserWithoutPwd(String loginId) {
- List list = null;
-
- StringBuffer criteria = new StringBuffer();
- criteria.append(" where login_id = '").append(loginId).append("'");
-
- list = getDataAccessService().getList(User.class, criteria.toString(), null, null);
-
- return (list == null || list.size() == 0) ? null : (User)list.get(0);
- }
-
-
- @SuppressWarnings("rawtypes")
- public User findUser(LoginBean bean) {
- List list = null;
-
- StringBuffer criteria = new StringBuffer();
- criteria.append(" where org_user_id = '").append(bean.getUserid()).append("'");
-
- list = getDataAccessService().getList(User.class, criteria.toString(), null, null);
-
- return (list == null || list.size() == 0) ? null : (User)list.get(0);
- }
-
-
- public MenuBuilder getMenuBuilder() {
- return new 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/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsService.java
deleted file mode 100644
index 596ebed2..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsService.java
+++ /dev/null
@@ -1,34 +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.service;
-
-import java.util.List;
-
-import org.openecomp.portalsdk.core.command.PostDroolsBean;
-
-public interface PostDroolsService {
-
- String execute(String droolsFile, String className, String selectedRules);
-
- List<PostDroolsBean> fetchDroolBeans();
-
- String retrieveClass(String droolsFile);
-
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsServiceImpl.java
deleted file mode 100644
index 726d8973..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostDroolsServiceImpl.java
+++ /dev/null
@@ -1,179 +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.service;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.DirectoryIteratorException;
-import java.nio.file.DirectoryStream;
-import java.nio.file.FileSystems;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.kie.api.io.ResourceType;
-import org.kie.internal.KnowledgeBase;
-import org.kie.internal.KnowledgeBaseFactory;
-import org.kie.internal.builder.KnowledgeBuilder;
-import org.kie.internal.builder.KnowledgeBuilderFactory;
-import org.kie.internal.definition.KnowledgePackage;
-import org.kie.internal.io.ResourceFactory;
-import org.kie.internal.runtime.StatefulKnowledgeSession;
-import org.openecomp.portalsdk.core.command.PostDroolsBean;
-import org.openecomp.portalsdk.core.drools.DroolsRuleService;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-
-@Service("postDroolsService")
-@Transactional
-public class PostDroolsServiceImpl implements PostDroolsService{
-
- static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PostDroolsServiceImpl.class);
-
- @Override
- public String execute(String droolsFile, String className, String selectedRules) {
- logger.info(EELFLoggerDelegate.applicationLogger, "Executing Drools...");
- String resultsString = executeDemoRules(droolsFile, className, selectedRules);
- return resultsString;
- }
-
-
- public List<PostDroolsBean> fetchDroolBeans() {
-
- List<PostDroolsBean> beanList = new ArrayList<PostDroolsBean>();
- Path path = FileSystems.getDefault().getPath(SystemProperties.getProperty(SystemProperties.FILES_PATH));
- try (DirectoryStream<Path> stream = Files.newDirectoryStream(path,"*.{drl}")) {
- for (Path entry: stream) {
-
- PostDroolsBean postDroolsBean = new PostDroolsBean();
- String fileName = entry.getName(entry.getNameCount()-1).toString();
- postDroolsBean.setDroolsFile(fileName);//sample populated
- postDroolsBean.setClassName(retrieveClass(fileName));
- //postDroolsBean.setSelectedRules("[\"NJ\",\"NY\",\"KY\"]");
- beanList.add(postDroolsBean);
- }
- } catch (DirectoryIteratorException ex) {
- logger.error(EELFLoggerDelegate.errorLogger, ex.getMessage());
- } catch (IOException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage());
- }
- return beanList;
- }
-
- @Override
- public String retrieveClass(String fileName) {
- String resultsString = "";
- try {
- // load up the knowledge base
- final KnowledgeBuilder kbuilder = loadKBuilder(fileName);
- final Collection<KnowledgePackage> pkgs = kbuilder.getKnowledgePackages();
- return pkgs.iterator().next().getFactTypes().iterator().next().getFactClass().getName();
-
- } catch (Throwable t) {
- logger.error(EELFLoggerDelegate.errorLogger, t.getMessage());
- }
-
- return resultsString;
- }
-
- protected static KnowledgeBuilder loadKBuilder(String fileName) {
- final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
-
- // this will parse and compile in one step
- kbuilder.add(ResourceFactory.newFileResource(SystemProperties.getProperty(SystemProperties.FILES_PATH) + File.separator + fileName),
- ResourceType.DRL);
-
- if (kbuilder.hasErrors()) {
-
- logger.error(EELFLoggerDelegate.errorLogger, kbuilder.getErrors().toString());
-
- throw new RuntimeException("Unable to compile \".drl\".");
-
- }
- return kbuilder;
- }
-
-
- @SuppressWarnings({ "deprecation", "unchecked" })
- public static String executeDemoRules(String fileName, String className, String ruleValue) {
- String resultsString = "";
- try {
- // load up the knowledge base
- // KieServices ks = KieServices.Factory.get();
- // KieContainer kContainer = ks.getKieClasspathContainer();
- // KieSession kSession = kContainer.newKieSession("ksession-rules");
-
- final KnowledgeBuilder kbuilder = loadKBuilder(fileName);
-
- // get the compiled packages (which are serializable)
-
- final Collection<KnowledgePackage> pkgs = kbuilder.getKnowledgePackages();
-
- // add the packages to a knowledgebase (deploy the knowledge
- // packages).
-
- final KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
-
- kbase.addKnowledgePackages(pkgs);
-
- final StatefulKnowledgeSession kSession = kbase.newStatefulKnowledgeSession();
-
- ObjectMapper mapper = new ObjectMapper();
- if(ruleValue == null || ruleValue.equals("")) {
- resultsString = "Please enter valid rule";
- return resultsString;
- }
- List<String> selectedRules = mapper.readValue(ruleValue, List.class);
- List<String> ruleResponse = new ArrayList<String>();
-
- for(String rule : selectedRules){
- Class<DroolsRuleService> clazz = (Class<DroolsRuleService>) Class.forName(className);
- DroolsRuleService droolsIntroduction =clazz.newInstance();
- droolsIntroduction.init(rule);
- kSession.insert(droolsIntroduction);
- kSession.fireAllRules();
- ruleResponse.add(droolsIntroduction.getResultsString());
- }
-
- resultsString = mapper.writeValueAsString(ruleResponse);
-
-// kSession.insert(new DroolsRuleService("KY"));
-// kSession.fireAllRules();
-//
-// kSession.setGlobal("age", "25");
-// kSession.insert(new DroolsRuleService("NY"));
-// kSession.fireAllRules();
- } catch (Throwable t) {
- logger.error(EELFLoggerDelegate.errorLogger, t.getMessage());
- }
-
- return resultsString;
- }
-
-
-
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchService.java
deleted file mode 100644
index 55c9db3f..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchService.java
+++ /dev/null
@@ -1,30 +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.service;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.openecomp.portalsdk.core.command.PostSearchBean;
-
-public interface PostSearchService {
-
- void process(HttpServletRequest request, PostSearchBean postSearch);
-
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchServiceImpl.java
deleted file mode 100644
index 2ecedbea..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/PostSearchServiceImpl.java
+++ /dev/null
@@ -1,203 +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.service;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.openecomp.portalsdk.core.FusionObject.Parameters;
-import org.openecomp.portalsdk.core.command.PostSearchBean;
-import org.openecomp.portalsdk.core.domain.Lookup;
-import org.openecomp.portalsdk.core.domain.Role;
-import org.openecomp.portalsdk.core.domain.User;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.openecomp.portalsdk.core.web.support.FeedbackMessage;
-import org.openecomp.portalsdk.core.web.support.MessagesList;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-@Service("postSearchService")
-@Transactional
-public class PostSearchServiceImpl implements PostSearchService{
-
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PostSearchServiceImpl.class);
-
- @Autowired
- private DataAccessService dataAccessService;
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- @Override
- public void process(HttpServletRequest request, PostSearchBean postSearch) {
- HashMap additionalParams = new HashMap();
- additionalParams.put(Parameters.PARAM_HTTP_REQUEST, request);
-
- if (postSearch.getSelected() != null) {
- //sort the selected users for quick validation
-
- Arrays.sort(postSearch.getSelected());
- System.out.println("list - " + postSearch.getPostOrgUserId().length);
- // import the users that have been selected
- for(int i=0; i < postSearch.getPostOrgUserId().length; i++){
- if (Arrays.binarySearch(postSearch.getSelected(), postSearch.getPostOrgUserId()[i]) >= 0) {
- logger.info(EELFLoggerDelegate.debugLogger, "Adding ORGUSERID - " + postSearch.getPostOrgUserId()[i]);
- logger.info(EELFLoggerDelegate.auditLogger, "Import new user from webphone " + postSearch.getPostOrgUserId()[i]);
-
- User user = new User();
- user.setLastName(postSearch.getPostLastName()[i]);
- user.setFirstName(postSearch.getPostFirstName()[i]);
-
- if (postSearch.getPostHrid() != null && postSearch.getPostHrid().length > 0) {
- user.setHrid(postSearch.getPostHrid()[i]);
- }
-
- if (postSearch.getPostPhone() != null && postSearch.getPostPhone().length > 0) {
- user.setPhone(postSearch.getPostPhone()[i]);
- }
-
- if (postSearch.getPostEmail() != null && postSearch.getPostEmail().length > 0) {
- user.setEmail(postSearch.getPostEmail()[i]);
- }
-
- if (postSearch.getPostOrgUserId() != null && postSearch.getPostOrgUserId().length > 0) {
- user.setOrgUserId(postSearch.getPostOrgUserId()[i]);
- user.setLoginId(postSearch.getPostOrgUserId()[i]);
- }
-
- if (postSearch.getPostAddress1() != null && postSearch.getPostAddress1().length > 0) {
- user.setAddress1(postSearch.getPostAddress1()[i]);
- }
-
- if (postSearch.getPostAddress2() != null && postSearch.getPostAddress2().length > 0) {
- user.setAddress2(postSearch.getPostAddress2()[i]);
- }
-
- if (postSearch.getPostCity() != null && postSearch.getPostCity().length > 0) {
- user.setCity(postSearch.getPostCity()[i]);
- }
-
- if (postSearch.getPostState() != null && postSearch.getPostState().length > 0) {
- user.setState(postSearch.getPostState()[i]);
- }
-
- if (postSearch.getPostZipCode() != null && postSearch.getPostZipCode().length > 0) {
- user.setZipCode(postSearch.getPostZipCode()[i]);
- }
-
- if (postSearch.getPostLocationClli() != null && postSearch.getPostLocationClli().length > 0) {
- user.setLocationClli(postSearch.getPostLocationClli()[i]);
- }
-
- if (postSearch.getPostBusinessCountryCode() != null && postSearch.getPostBusinessCountryCode().length > 0) {
- user.setBusinessCountryCode(postSearch.getPostBusinessCountryCode()[i]);
- }
-
- if (postSearch.getPostBusinessCountryName() != null && postSearch.getPostBusinessCountryName().length > 0) {
-
- // find the country cd for the indicated country
- List countries = dataAccessService.getLookupList("fn_lu_country", "country_cd", "country", "country = '"
- + postSearch.getPostBusinessCountryName()[i] + "'", null, null);
-
- if (countries!=null&&countries.size() == 1) {
- Lookup country = (Lookup)countries.get(0);
- user.setCountry(country.getValue());
- }
- else {
- logger.info(EELFLoggerDelegate.debugLogger, "No countries or more than one country was found matching the country returned from WEBPHONE. " +
- "Therefore, no country was set for this user.");
- }
-
- }
-
- if (postSearch.getPostDepartment() != null && postSearch.getPostDepartment().length > 0) {
- user.setDepartment(postSearch.getPostDepartment()[i]);
- }
-
- if (postSearch.getPostDepartmentName() != null && postSearch.getPostDepartmentName().length > 0) {
- user.setDepartmentName(postSearch.getPostDepartmentName()[i]);
- }
-
- if (postSearch.getPostBusinessUnit() != null && postSearch.getPostBusinessUnit().length > 0) {
- user.setBusinessUnit(postSearch.getPostBusinessUnit()[i]);
- }
-
- if (postSearch.getPostBusinessUnitName() != null && postSearch.getPostBusinessUnitName().length > 0) {
- user.setBusinessUnitName(postSearch.getPostBusinessUnitName()[i]);
- }
-
- if (postSearch.getPostJobTitle() != null && postSearch.getPostJobTitle().length > 0) {
- user.setJobTitle(postSearch.getPostJobTitle()[i]);
- }
-
- if (postSearch.getPostOrgManagerUserId() != null && postSearch.getPostOrgManagerUserId().length > 0) {
- user.setOrgManagerUserId(postSearch.getPostOrgManagerUserId()[i]);
- }
-
- if (postSearch.getPostCommandChain() != null && postSearch.getPostCommandChain().length > 0) {
- user.setCommandChain(postSearch.getPostCommandChain()[i]);
- }
-
- if (postSearch.getPostCompanyCode() != null && postSearch.getPostCompanyCode().length > 0) {
- user.setCompanyCode(postSearch.getPostCompanyCode()[i]);
- }
-
- if (postSearch.getPostCompany() != null && postSearch.getPostCompany().length > 0) {
- user.setCompany(postSearch.getPostCompany()[i]);
- }
-
- if (postSearch.getPostCostCenter() != null && postSearch.getPostCostCenter().length > 0) {
- user.setCostCenter(postSearch.getPostCostCenter()[i]);
- }
-
- if (postSearch.getPostSiloStatus() != null && postSearch.getPostSiloStatus().length > 0) {
- user.setSiloStatus(postSearch.getPostSiloStatus()[i]);
- }
-
- if (postSearch.getPostFinancialLocCode() != null && postSearch.getPostFinancialLocCode().length > 0) {
- user.setFinancialLocCode(postSearch.getPostFinancialLocCode()[i]);
- }
-
- user.setActive(true);
-
- try {
- dataAccessService.saveDomainObject(user, additionalParams);
-
- Role role = (Role)dataAccessService.getDomainObject(Role.class,Long.valueOf(SystemProperties.getProperty(SystemProperties.POST_DEFAULT_ROLE_ID)), null);
- user.addRole(role);
- }
- catch (Exception e) {
- MessagesList messages = new MessagesList();
- messages.addExceptionMessage(new FeedbackMessage("An error occurred while attempting to import " + user.getFirstName() + " "
- + user.getLastName() + ": " + e.getMessage(), FeedbackMessage.MESSAGE_TYPE_ERROR));
-
- }
- }
- }
-
- }
-
- }
-
-
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileService.java
deleted file mode 100644
index 61bd3b6e..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileService.java
+++ /dev/null
@@ -1,36 +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.service;
-
-import java.util.List;
-
-import org.openecomp.portalsdk.core.domain.Profile;
-import org.openecomp.portalsdk.core.domain.User;
-
-
-public interface ProfileService {
- List<Profile> findAll();
-
- Profile getProfile(int id);
-
- User getUser(String id);
-
- void saveUser(User user);
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceImpl.java
deleted file mode 100644
index 3927d727..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/ProfileServiceImpl.java
+++ /dev/null
@@ -1,72 +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.service;
-
-import java.util.List;
-
-import org.openecomp.portalsdk.core.dao.ProfileDao;
-import org.openecomp.portalsdk.core.domain.Profile;
-import org.openecomp.portalsdk.core.domain.User;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-@Service("profileService")
-@Transactional
-public class ProfileServiceImpl implements ProfileService{
-
- @Autowired
- private ProfileDao profileDao;
-
- @Autowired
- private DataAccessService dataAccessService;
-
- @SuppressWarnings("unchecked")
- public List<Profile> findAll() {
- return getDataAccessService().getList(Profile.class, null);
- }
-
- public User getUser(String userId){
- return (User) getDataAccessService().getDomainObject(User.class, Long.parseLong(userId), null);
- }
-
- public void saveUser(User user){
-
- getDataAccessService().saveDomainObject(user, null);
- }
-
-
- public Profile getProfile(int id) {
- return profileDao.getProfile(id);
- }
-
-
- public DataAccessService getDataAccessService() {
- return dataAccessService;
- }
-
-
- public void setDataAccessService(DataAccessService dataAccessService) {
- this.dataAccessService = dataAccessService;
- }
-
-
-
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleService.java
deleted file mode 100644
index 01367ecd..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleService.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.service;
-
-import java.util.List;
-
-import org.openecomp.portalsdk.core.domain.Role;
-import org.openecomp.portalsdk.core.domain.RoleFunction;
-
-
-public interface RoleService {
- List<RoleFunction> getRoleFunctions();
-
- List<Role> getAvailableChildRoles(Long roleId);
-
- Role getRole(Long id);
-
- void saveRole(Role domainRole);
-
- void deleteRole(Role domainRole);
-
- List<Role> getAvailableRoles();
-
- List<Role> getActiveRoles();
-
- RoleFunction getRoleFunction(String code);
-
- void saveRoleFunction(RoleFunction domainRoleFunction);
-
- void deleteRoleFunction(RoleFunction domainRoleFunction);
-
- void deleteDependcyRoleRecord(Long id);
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceImpl.java
deleted file mode 100644
index e71e0c58..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceImpl.java
+++ /dev/null
@@ -1,171 +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.service;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
-import javax.sql.DataSource;
-
-import org.openecomp.portalsdk.core.domain.Role;
-import org.openecomp.portalsdk.core.domain.RoleFunction;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-@Service("roleService")
-@Transactional
-public class RoleServiceImpl implements RoleService{
-
- @Autowired
- private DataAccessService dataAccessService;
-
- DataSource dataSource;
-
- public DataSource getDataSource() {
- return dataSource;
- }
-
-
- @Autowired
- public void setDataSource(DataSource dataSource) {
- this.dataSource = dataSource;
- }
-
- @SuppressWarnings("unchecked")
- public List<RoleFunction> getRoleFunctions() {
- //List msgDB = getDataAccessService().getList(Profile.class, null);
- return getDataAccessService().getList(RoleFunction.class, null);
- }
-
- @SuppressWarnings("unchecked")
- public List<Role> getAvailableChildRoles(Long roleId) {
- List<Role> availableChildRoles = (List<Role>)getDataAccessService().getList(Role.class,null);
- if(roleId==null || roleId==0){
- return availableChildRoles;
- }
-
- Role currentRole = (Role)getDataAccessService().getDomainObject(Role.class,roleId,null);
- Set<Role> allParentRoles = new TreeSet<Role>();
- allParentRoles = getAllParentRolesAsList(currentRole, allParentRoles);
-
-
- Iterator<Role> availableChildRolesIterator = availableChildRoles.iterator();
- while (availableChildRolesIterator.hasNext()) {
- Role role = availableChildRolesIterator.next();
- if(!role.getActive() || allParentRoles.contains(role) || role.getId().equals(roleId)){
- availableChildRolesIterator.remove();
- }
- }
- return availableChildRoles;
- }
-
- @SuppressWarnings("unchecked")
- private Set<Role> getAllParentRolesAsList(Role role, Set<Role> allParentRoles) {
- Set<Role> parentRoles = role.getParentRoles();
- allParentRoles.addAll(parentRoles);
- Iterator<Role> parentRolesIterator = parentRoles.iterator();
- while (parentRolesIterator.hasNext()) {
- getAllParentRolesAsList(parentRolesIterator.next(),allParentRoles);
- }
- return allParentRoles;
- }
-
- public RoleFunction getRoleFunction(String code) {
- return (RoleFunction)getDataAccessService().getDomainObject(RoleFunction.class, code, null);
- }
-
- public void saveRoleFunction(RoleFunction domainRoleFunction) {
- getDataAccessService().saveDomainObject(domainRoleFunction, null);
- }
-
- public void deleteRoleFunction(RoleFunction domainRoleFunction) {
- getDataAccessService().deleteDomainObject(domainRoleFunction, null);
- }
-
- public Role getRole(Long id) {
- return (Role)getDataAccessService().getDomainObject(Role.class, id, null);
- }
-
- public void saveRole(Role domainRole) {
- getDataAccessService().saveDomainObject(domainRole, null);
- }
-
- public void deleteRole(Role domainRole) {
- getDataAccessService().deleteDomainObject(domainRole, null);
- }
-
- @SuppressWarnings("unchecked")
- public List<Role> getAvailableRoles() {
- return getDataAccessService().getList(Role.class, null);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public List<Role> getActiveRoles() {
- String filter = " where active_yn = 'Y' ";
- return getDataAccessService().getList(Role.class, filter, null,null);
- }
-
- public DataAccessService getDataAccessService() {
- return dataAccessService;
- }
-
-
- public void setDataAccessService(DataAccessService dataAccessService) {
- this.dataAccessService = dataAccessService;
- }
-
- @Override
- public void deleteDependcyRoleRecord(Long id) {
-
- Connection conn = null;
- Statement stmt = null;
-
- try {
- conn = getDataSource().getConnection();
- stmt = conn.createStatement();
- String sql = "delete from fn_user_role where role_id = '" + id + "'";
- stmt.executeUpdate(sql);
- stmt.close();
- conn.close();
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- try {
- if (stmt != null)
- stmt.close();
- } catch (SQLException se2) {}
- try {
- if (conn != null)
- conn.close();
- } catch (SQLException se) { se.printStackTrace();}
- }
-
- }
-
-
-
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceNonSpringImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceNonSpringImpl.java
deleted file mode 100644
index bd6796c1..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/RoleServiceNonSpringImpl.java
+++ /dev/null
@@ -1,122 +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.service;
-/*package org.openecomp.portalsdk.core.service;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import org.openecomp.portalsdk.core.domain.Role;
-import org.openecomp.portalsdk.core.domain.RoleFunction;
-
-@Service("roleService")
-@Transactional
-public class RoleServiceNonSpringImpl implements RoleService{
-
- @Autowired
- private DataAccessService dataAccessService;
-
- @SuppressWarnings("unchecked")
- public List<RoleFunction> getRoleFunctions() {
- //List msgDB = getDataAccessService().getList(Profile.class, null);
- return getDataAccessService().getList(RoleFunction.class, null);
- }
-
- @SuppressWarnings("unchecked")
- public List<Role> getAvailableChildRoles(Long roleId) {
- List<Role> availableChildRoles = (List<Role>)getDataAccessService().getList(Role.class,null);
- if(roleId==null || roleId==0){
- return availableChildRoles;
- }
-
- Role currentRole = (Role)getDataAccessService().getDomainObject(Role.class,roleId,null);
- Set<Role> allParentRoles = new TreeSet<Role>();
- allParentRoles = getAllParentRolesAsList(currentRole, allParentRoles);
-
-
- Iterator<Role> availableChildRolesIterator = availableChildRoles.iterator();
- while (availableChildRolesIterator.hasNext()) {
- Role role = availableChildRolesIterator.next();
- if(!role.getActive() || allParentRoles.contains(role) || role.getId().equals(roleId)){
- availableChildRolesIterator.remove();
- }
- }
- return availableChildRoles;
- }
-
- @SuppressWarnings("unchecked")
- private Set<Role> getAllParentRolesAsList(Role role, Set<Role> allParentRoles) {
- Set<Role> parentRoles = role.getParentRoles();
- allParentRoles.addAll(parentRoles);
- Iterator<Role> parentRolesIterator = parentRoles.iterator();
- while (parentRolesIterator.hasNext()) {
- getAllParentRolesAsList(parentRolesIterator.next(),allParentRoles);
- }
- return allParentRoles;
- }
-
- public RoleFunction getRoleFunction(String code) {
- return (RoleFunction)getDataAccessService().getDomainObject(RoleFunction.class, code, null);
- }
-
- public void saveRoleFunction(RoleFunction domainRoleFunction) {
- getDataAccessService().saveDomainObject(domainRoleFunction, null);
- }
-
- public void deleteRoleFunction(RoleFunction domainRoleFunction) {
- getDataAccessService().deleteDomainObject(domainRoleFunction, null);
- }
-
- public Role getRole(Long id) {
- return (Role)getDataAccessService().getDomainObject(Role.class, id, null);
- }
-
- public void saveRole(Role domainRole) {
- getDataAccessService().saveDomainObject(domainRole, null);
- }
-
- public void deleteRole(Role domainRole) {
- getDataAccessService().deleteDomainObject(domainRole, null);
- }
-
- @SuppressWarnings("unchecked")
- public List<Role> getAvailableRoles() {
- return getDataAccessService().getList(Role.class, null);
- }
-
- public DataAccessService getDataAccessService() {
- return dataAccessService;
- }
-
-
- public void setDataAccessService(DataAccessService dataAccessService) {
- this.dataAccessService = dataAccessService;
- }
-
-
-
-}
-*/
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileService.java
deleted file mode 100644
index 0cf3986b..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileService.java
+++ /dev/null
@@ -1,36 +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.service;
-
-import java.util.List;
-
-import org.openecomp.portalsdk.core.domain.User;
-
-
-public interface UserProfileService {
- List<User> findAll();
- User getUser(String id);
- User getUserByLoginId(String loginId);
- void saveUser(User user);
- public List<User> findAllUserWithOnOffline(String originOrgUserId);
- List<User> findAllActive();
- List<User> searchPost(User user, String sortBy1, String sortBy2, String sortBy3, int pageNo, int newDataSize,
- int intValue);
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceImpl.java
deleted file mode 100644
index e0899917..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/UserProfileServiceImpl.java
+++ /dev/null
@@ -1,210 +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.service;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.SortedSet;
-
-import org.hibernate.criterion.Criterion;
-import org.hibernate.criterion.Restrictions;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.openecomp.portalsdk.core.FusionObject.Utilities;
-import org.openecomp.portalsdk.core.domain.Role;
-import org.openecomp.portalsdk.core.domain.User;
-import org.openecomp.portalsdk.core.domain.support.CollaborateList;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-@Service("userProfileService")
-@Transactional
-public class UserProfileServiceImpl implements UserProfileService{
-
-
- @Autowired
- private DataAccessService dataAccessService;
-
- @SuppressWarnings("unchecked")
- public List<User> findAll() {
- return getDataAccessService().getList(User.class, null);
- }
-
- public User getUser(String userId){
- return (User) getDataAccessService().getDomainObject(User.class, Long.parseLong(userId), null);
- }
-
- @SuppressWarnings("unchecked")
- public User getUserByLoginId(String loginId){
- User user=null;
- List<Criterion> restrictionsList = new ArrayList<Criterion>();
- Criterion criterion1= Restrictions.eq("loginId",loginId);
- restrictionsList.add(criterion1);
- List<User> users = (List<User>) getDataAccessService().getList(User.class,null, restrictionsList, null);
- if(users!=null && users.size()==1)
- user = users.get(0);
- return user;
- }
-
- public void saveUser(User user){
-
- getDataAccessService().saveDomainObject(user, null);
- }
-
- public DataAccessService getDataAccessService() {
- return dataAccessService;
- }
-
-
- public void setDataAccessService(DataAccessService dataAccessService) {
- this.dataAccessService = dataAccessService;
- }
-
- @SuppressWarnings("unchecked")
- public List<User> findAllUserWithOnOffline(String originOrgUserId) {
- HashSet<String> onlineUser = CollaborateList.getInstance().getAllUserName();
- List<User> users = getDataAccessService().getList(User.class, null);
- for(User u:users){
- if(onlineUser.contains(u.getOrgUserId()))
- u.setOnline(true);
- if(u.getOrgUserId()!=null){
- if(originOrgUserId.compareTo(u.getOrgUserId()) > 0) {
- u.setChatId(originOrgUserId + "-" + u.getOrgUserId());
- } else u.setChatId(u.getOrgUserId() + "-" + originOrgUserId );
- }
- }
- return users;
-
- }
-
- @SuppressWarnings("unchecked")
- public List<User> findAllActive() {
- List<User> users = getDataAccessService().getList(User.class, null);
- Iterator<User> itr = users.iterator();
- while(itr.hasNext()){
- User u = (User) itr.next();
- if(!u.getActive())
- itr.remove();//if not active remove user from list
- else {
- SortedSet<Role> roles = u.getRoles();
- Iterator<Role> itrRoles = roles.iterator();
- while(itrRoles.hasNext()){
- Role role = (Role) itrRoles.next();
- if(!role.getActive())
- u.removeRole(role.getId());//if not active remove role from list
- }
- }
- }
- return users;
- }
-
-
- @Override
- public List<User> searchPost(User user, String sortBy1, String sortBy2, String sortBy3, int pageNo,
- int newDataSize, int intValue) {
-
- List<User> users=new ArrayList<User>();
- List<User> filterdUsers=new ArrayList<User>();
- BufferedReader in = null;
-
- try{
- String url = SystemProperties.getProperty(SystemProperties.AUTH_USER_SERVER);
- URL obj = new URL(url);
-
- HttpURLConnection con = (HttpURLConnection) obj.openConnection();
-
- // optional default is GET
- con.setRequestMethod("GET");
- con.setConnectTimeout(3000);
- con.setReadTimeout(8000);
-
- StringBuffer response = new StringBuffer();
-
-
-
- in = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8"));
- String inputLine;
- while ((inputLine = in.readLine()) != null)
- response.append(inputLine);
-
- JSONObject jObject = new JSONObject(response.toString()); // json
- JSONArray jsonUsers = jObject.getJSONArray("response"); // get data object
- for (int i = 0; i < jsonUsers.length(); i++) {
- JSONObject eachObject = jsonUsers.getJSONObject(i);
- User eachUser = new User();
- eachUser.setOrgUserId(eachObject.get("id").toString());// getString("id"));
- eachUser.setFirstName(eachObject.get("givenName").toString());
- eachUser.setLastName(eachObject.get("familyName").toString());
- eachUser.setEmail(eachObject.get("email").toString());
-
- users.add(eachUser);
- }
-
- for(int i = 0 ; i < users.size(); i ++){
-
- if(Utilities.nvl(user.getFirstName()).length() > 0){
- if(!user.getFirstName().equalsIgnoreCase(users.get(i).getFirstName())){
- continue;
- }
- }
- if(Utilities.nvl(user.getLastName()).length() > 0){
- if(!user.getLastName().equalsIgnoreCase(users.get(i).getLastName())){
- continue;
- }
- }
- if(Utilities.nvl(user.getOrgUserId()).length() > 0){
- if(!user.getOrgUserId().equalsIgnoreCase(users.get(i).getOrgUserId())){
- continue;
- }
- }
- if(Utilities.nvl(user.getEmail()).length() > 0){
- if(!user.getEmail().equalsIgnoreCase(users.get(i).getEmail())){
- continue;
- }
- }
-
- filterdUsers.add(users.get(i));
-
- }
-
- }catch (Exception e){
-
- }finally{
- try {
- in.close();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- return filterdUsers;
- }
-
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallService.java
deleted file mode 100644
index a7a5ad07..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallService.java
+++ /dev/null
@@ -1,26 +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.service;
-
-
-public interface WebServiceCallService {
- public boolean verifyRESTCredential(String secretKey, String requestAppName, String requestPassword)throws Exception;
- /*public String get(String restURL, String restPath);*/
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallServiceImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallServiceImpl.java
deleted file mode 100644
index 3e1a1a40..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/WebServiceCallServiceImpl.java
+++ /dev/null
@@ -1,189 +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.service;
-
-import java.util.List;
-
-import org.openecomp.portalsdk.core.domain.App;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.util.CipherUtil;
-import org.openecomp.portalsdk.core.util.SystemProperties;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-@Service("webServiceCallService")
-@Transactional
-public class WebServiceCallServiceImpl implements WebServiceCallService{
-
- @Autowired
- private DataAccessService dataAccessService;
-
- @Autowired
- AppService appService;
-
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WebServiceCallServiceImpl.class);
-
- /**
- * Verify REST Credential
- * @return true if the credential is accepted; else false.
- */
- @Override
- public boolean verifyRESTCredential(String secretKey, String requestAppName, String requestPassword)throws Exception {
- App app = appService.getDefaultApp();
- if (app!=null) {
- String encriptedPwdDB = app.getAppPassword();
- String appUserName = app.getUsername();
- String decreptedPwd = CipherUtil.decrypt(encriptedPwdDB, secretKey==null?SystemProperties.getProperty(SystemProperties.Decryption_Key):secretKey);
- if(decreptedPwd.equals(requestPassword) && appUserName.equals(requestAppName)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Getting App information from FN_APP table
- * @return App domain object, or null if not found.
- */
- public App findApp(){
- List<?> list = null;
- StringBuffer criteria = new StringBuffer();
- criteria.append(" where id = 1");
- list = getDataAccessService().getList(App.class, criteria.toString(), null, null);
- return (list == null || list.size() == 0) ? null : (App) list.get(0);
- }
-
- public DataAccessService getDataAccessService() {
- return dataAccessService;
- }
-
- public void setDataAccessService(DataAccessService dataAccessService) {
- this.dataAccessService = dataAccessService;
- }
-
- /*/
- @Override
- public String get(String restURL, String restPath) {
- String appUserName = "";
- String appUebKey = "";
- String decreptedPwd = "";
- String appName = "";
- String inputLine = "";
- String serviceName = "";
- String loginId = "";
- StringBuffer jsonResponse = new StringBuffer();
-
- StopWatch stopWatch = new StopWatch("WebServiceCallServiceImpl.get");
- stopWatch.start();
- try {
- logger.info(EELFLoggerDelegate.metricsLogger, "WebServiceCallServiceImpl.get (" + restPath + ") operation is started.");
- logger.debug(EELFLoggerDelegate.debugLogger, "WebServiceCallServiceImpl.get (" + restPath + ") operation is started.");
- loginId = MDC.get("LoginId");
- appUebKey = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY);
- App app = appService.getDefaultApp();
- if (app!=null) {
- appName = app.getName();
- appUserName = app.getUsername();
- try{
- decreptedPwd = CipherUtil.decrypt(app.getAppPassword(), SystemProperties.getProperty(SystemProperties.Decryption_Key));
- } catch(Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in WebServiceCallServiceImpl.get while decrypting the password. Details: " + e.getMessage());
- }
- } else {
- logger.warn(EELFLoggerDelegate.errorLogger, "Unable to locate the app information from the database.");
- appName = SystemProperties.SERVICE_NAME;
- }
-
- //Create the connection object
- URL obj = new URL(restURL + restPath);
- HttpURLConnection con = (HttpURLConnection) obj.openConnection();
- con.setRequestMethod("GET");
- con.setConnectTimeout(3000);
- con.setReadTimeout(8000);
-
- //add request header
- con.setRequestProperty("username", appUserName);
- con.setRequestProperty("password", decreptedPwd);
- con.setRequestProperty("uebkey", appUebKey);
- con.setRequestProperty(SystemProperties.LOGIN_ID, loginId);
- con.setRequestProperty(SystemProperties.USERAGENT_NAME, appName);
- con.setRequestProperty(SystemProperties.ECOMP_REQUEST_ID, MDC.get(MDC_KEY_REQUEST_ID));
-
- //set MDC context for outgoing audit logging
- serviceName = String.format("%s:%s.%s", appName, SystemProperties.ECOMP_PORTAL_BE, restPath);
- MDC.put(Configuration.MDC_SERVICE_NAME, serviceName);
- MDC.put(Configuration.MDC_REMOTE_HOST, restURL);
- MDC.put(SystemProperties.MDC_APPNAME, appName);
- MDC.put(SystemProperties.MDC_REST_PATH, restPath);
- MDC.put(SystemProperties.MDC_REST_METHOD, "GET");
-
- int responseCode = con.getResponseCode();
- logger.info(EELFLoggerDelegate.errorLogger, "Received the response code '" + responseCode + "' while getting the '" + restPath + "' for user: " + loginId);
-
- BufferedReader in = new BufferedReader(
- new InputStreamReader(con.getInputStream()));
-
- while ((inputLine = in.readLine()) != null) {
- jsonResponse.append(inputLine);
- }
- in.close();
-
- logSecurityMessage(RESULT_ENUM.SUCCESS);
- logger.debug(EELFLoggerDelegate.debugLogger, restPath + " response: " + jsonResponse.toString());
- logger.debug(EELFLoggerDelegate.debugLogger, "WebServiceCallServiceImpl.get (" + restPath + ") operation is started.");
- } catch(UrlAccessRestrictedException e) {
- logger.error(EELFLoggerDelegate.errorLogger, "Authentication exception occurred in WebServiceCallServiceImpl.get (" + restPath + "). Details: " + e.getMessage());
- logSecurityMessage(RESULT_ENUM.FAILURE);
- } catch(Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, "Exception occurred in WebServiceCallServiceImpl.get (" + restPath + "). Details: " + e.getMessage());
- logSecurityMessage(RESULT_ENUM.FAILURE);
- } finally {
- if (stopWatch.isRunning()) stopWatch.stop();
- MDC.put(SystemProperties.MDC_TIMER, stopWatch.getTotalTimeMillis() + "ms");
- logger.info(EELFLoggerDelegate.metricsLogger, "WebServiceCallServiceImpl.get (" + restPath + ") operation is completed.");
-
- //clear the temporary MDC context values
- MDC.remove(SystemProperties.MDC_TIMER);
- MDC.remove(SystemProperties.MDC_REST_METHOD);
- MDC.remove(SystemProperties.MDC_REST_PATH);
- MDC.remove(SystemProperties.MDC_APPNAME);
- MDC.remove(Configuration.MDC_REMOTE_HOST);
- MDC.remove(Configuration.MDC_SERVICE_NAME);
- }
-
- return jsonResponse.toString();
- }
-
- //Handles all the outgoing rest/ueb messages.
- public void logSecurityMessage(RESULT_ENUM isSuccess) {
- String additionalInfo = "";
- String protocol = "HTTP";
- String loginId = MDC.get("LoginId");
- additionalInfo = String.format("Rest API=%s, Rest Method=%s, App-Name=%s, Request-URL=%s",
- MDC.get(SystemProperties.MDC_REST_PATH), MDC.get(SystemProperties.MDC_REST_METHOD),
- MDC.get(SystemProperties.MDC_APPNAME), MDC.get(Configuration.MDC_REMOTE_HOST));
-
- logger.info(EELFLoggerDelegate.auditLogger, AuditLogFormatter.getInstance().createMessage(
- protocol, SecurityEventTypeEnum.OUTGOING_REST_MESSAGE.name(), loginId, SystemProperties.SERVICE_NAME,
- isSuccess.name(), additionalInfo));
- }
- /**/
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/FusionService.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/FusionService.java
deleted file mode 100644
index 34649ee1..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/FusionService.java
+++ /dev/null
@@ -1,27 +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.service.support;
-
-
-import org.openecomp.portalsdk.core.FusionObject;
-
-public class FusionService implements FusionObject {
- /** Logger for this class and subclasses */
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocator.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocator.java
deleted file mode 100644
index 5858c3fa..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocator.java
+++ /dev/null
@@ -1,27 +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.service.support;
-
-import javax.naming.directory.DirContext;
-
-
-public interface ServiceLocator {
- DirContext getDirContext(String initialContextFactory, String providerUrl, String securityPrincipal);
-}
diff --git a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocatorImpl.java b/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocatorImpl.java
deleted file mode 100644
index e7437835..00000000
--- a/ecomp-sdk/quantum/src/main/java/org/openecomp/portalsdk/core/service/support/ServiceLocatorImpl.java
+++ /dev/null
@@ -1,74 +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.service.support;
-
-import java.util.Properties;
-
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.InitialDirContext;
-import javax.naming.ldap.InitialLdapContext;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.springframework.stereotype.Service;
-
-/**
- * This class implements the J2EE service locator pattern. It provides lookup
- * facilities for various services. Currenttly LDAP (pre-v3) is supported
- */
-@Service("serviceLocator")
-public class ServiceLocatorImpl implements ServiceLocator {
-
- private Context context; // JNDI context (not currently in use)
- private Context rootContext; // Java env root context (not currently in use)
- private DirContext dirContext; // LDAP DIR context
- private InitialLdapContext ldapContext; // LDAP context LDAPv3-style (not currently in use)
-
-
- // cannot directly instantiate
- public ServiceLocatorImpl() {}
-
- // Get an LDAP directory context
- public DirContext getDirContext(String initialContextFactory, String providerUrl, String securityPrincipal) {
-
- if (dirContext == null) {
-
- Properties properties = new Properties();
- properties.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
- properties.put(Context.PROVIDER_URL, providerUrl);
- properties.put(Context.SECURITY_PRINCIPAL, securityPrincipal);
-
- try {
- dirContext = new InitialDirContext(properties);
- }
- catch (NamingException ne) {
- logger.error(EELFLoggerDelegate.errorLogger, "An error has occurred while creating an Initial Directory Context: " + ne.getMessage());
- logger.error(EELFLoggerDelegate.errorLogger, "Explanation: " + ne.getExplanation());
- }
- }
-
- return dirContext;
- }
-
- /** Logger for this class and subclasses */
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ServiceLocatorImpl.class);
-
-}