/*-
- * ================================================================================
- * ECOMP Portal
- * ================================================================================
- * 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.
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the “License”);
+ * you may not use this software except in compliance with the License.
* You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * 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.
- * ================================================================================
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.openecomp.portalapp.portal.service;
import org.openecomp.portalapp.portal.domain.AppsResponse;
import org.openecomp.portalapp.portal.domain.EPApp;
import org.openecomp.portalapp.portal.domain.EPUser;
+import org.openecomp.portalapp.portal.domain.EPUserAppRolesRequest;
+import org.openecomp.portalapp.portal.domain.EPUserAppRolesRequestDetail;
import org.openecomp.portalapp.portal.domain.EPUserAppsManualSortPreference;
import org.openecomp.portalapp.portal.domain.EPUserAppsSortPreference;
import org.openecomp.portalapp.portal.domain.EPWidgetsManualSortPreference;
@Autowired
private AdminRolesService adminRolesService;
@Autowired
- private SessionFactory sessionFactory;
+ protected SessionFactory sessionFactory;
@Autowired
private DataAccessService dataAccessService;
@Autowired
ecompApp.setUebKey(app.getUebKey());
ecompApp.setUebSecret(app.getUebSecret());
ecompApp.setEnabled(app.getEnabled());
+ ecompApp.setCentralAuth(app.getCentralAuth());
+ ecompApp.setNameSpace(app.getNameSpace());
ecompApp.setRestrictedApp(app.isRestrictedApp());
ecompAppList.add(ecompApp);
}
@Override
public UserRoles getUserProfile(String loginId) {
- String format = "SELECT DISTINCT user.USER_ID, role.ROLE_ID, user.org_user_id, user.FIRST_NAME, user.LAST_NAME, role.ROLE_NAME FROM fn_user_role userrole "
- + "INNER JOIN fn_user user ON user.USER_ID = userrole.USER_ID "
- + "INNER JOIN fn_role role ON role.ROLE_ID = userrole.ROLE_ID "
- + "WHERE user.org_user_id = \"%s\" and (userrole.app_id = 1 or role.role_id = " + ACCOUNT_ADMIN_ROLE_ID
- + ") ";
- String sql = String.format(format, loginId);
- logQuery(sql);
+ final Map<String, String> params = new HashMap<>();
+ params.put("org_user_id", loginId);
@SuppressWarnings("unchecked")
- List<UserRole> userRoleList = dataAccessService.executeSQLQuery(sql, UserRole.class, null);
+ List<UserRole> userRoleList = dataAccessService.executeNamedQuery( "getUserRoles", params, null);
ArrayList<UserRoles> usersRolesList = aggregateUserProfileRowsResultsByRole(userRoleList);
if (usersRolesList == null || usersRolesList.size() < 1)
return null;
public List<LocalRole> getAppRoles(Long appId) {
String sql = "";
if (isRestrictedApp(appId)) {
- sql = "SELECT ROLE_ID, ROLE_NAME from FN_ROLE where ROLE_ID = '" + RESTRICTED_APP_ROLE_ID + "'";
- } else {
- sql = "SELECT ROLE_ID, ROLE_NAME from FN_ROLE where APP_ID = '" + appId + "'";
+ sql = "SELECT ROLE_ID, ROLE_NAME from FN_ROLE where UPPER(ACTIVE_YN) = 'Y' AND ROLE_ID = '" + RESTRICTED_APP_ROLE_ID + "'";
+ }else if(appId == 1){
+ sql = "SELECT ROLE_ID, ROLE_NAME from FN_ROLE where UPPER(ACTIVE_YN) = 'Y' AND APP_ID IS NULL";
+ }else{
+ sql = "SELECT ROLE_ID, ROLE_NAME from FN_ROLE where UPPER(ACTIVE_YN) = 'Y' AND APP_ID = '" + appId + "'";
}
logQuery(sql);
@SuppressWarnings("unchecked")
* (non-Javadoc)
*
* @see
- * org.openecomp.portalapp.portal.service.EPAppService#getAppCatalog(com.att
- * .fusionapp.ecomp.portal.domain.EPUser)
+ * org.openecomp.portalapp.portal.service.EPAppService#getAppCatalog(
+ * org.openecomp.portalapp.portal.domain.EPUser)
*/
@Override
public List<AppCatalogItem> getUserAppCatalog(EPUser user) {
return fieldsValidator;
}
+ @SuppressWarnings("unchecked")
@Override
public FieldsValidator deleteOnboardingApp(EPUser user, Long appid) {
FieldsValidator fieldsValidator = new FieldsValidator();
fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_FORBIDDEN);
return fieldsValidator;
}
+ final Map<String, Long> params = new HashMap<>();
+ params.put("app_id", appid);
+ List<EPUserAppRolesRequest> EPUserAppRolesRequestList= new ArrayList<>();
+ EPUserAppRolesRequestList = dataAccessService.executeNamedQuery( "getRequestIdsForApp", params, null);
+ for(int i=0;i<EPUserAppRolesRequestList.size();i++)
+ {
+ dataAccessService.deleteDomainObjects(EPUserAppRolesRequestDetail.class , "req_id=" + EPUserAppRolesRequestList.get(i).getId(),null);
+
+ }
+
Boolean result = false;
Session localSession = null;
Transaction transaction = null;
logQuery(sql);
query = localSession.createSQLQuery(sql);
query.executeUpdate();
+
+
+ // Remove all roles, rolefunctions, appid records from ep_app_role_function
+ // that are associated with this app
+ sql = "DELETE FROM ep_app_role_function WHERE app_id='" + appid + "'";
+ logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql);
+ query = localSession.createSQLQuery(sql);
+ query.executeUpdate();
+
+ //Remove all rolefunctions, appid records from ep_app_function
+ // that are associated with this app
+ sql = "DELETE FROM ep_app_function WHERE app_id='" + appid + "'";
+ logger.debug(EELFLoggerDelegate.debugLogger, "Executing query: " + sql);
+ query = localSession.createSQLQuery(sql);
+ query.executeUpdate();
// Remove all records from fn_user_role associated with this app
sql = "delete from fn_user_role where app_id='" + appid + "'";
// An app has been enabled/disabled. Must enable/disable all associated
// functional menu items.
- private void setFunctionalMenuItemsEnabled(Session localSession, Boolean enabled, Long appId) {
+ protected void setFunctionalMenuItemsEnabled(Session localSession, Boolean enabled, Long appId) {
String active_yn = enabled ? "Y" : "N";
String sql = "SELECT m.menu_id, m.column_num, m.text, m.parent_menu_id, m.url, m.active_yn "
+ "FROM fn_menu_functional m, fn_menu_functional_roles r " + "WHERE m.menu_id = r.menu_id "
// Attention! If (appId == null) we use this function to create application
// otherwise we use it to modify existing application
- private void updateApp(Long appId, OnboardingApp onboardingApp, FieldsValidator fieldsValidator, EPUser user) {
+ protected void updateApp(Long appId, OnboardingApp onboardingApp, FieldsValidator fieldsValidator, EPUser user) {
logger.debug(EELFLoggerDelegate.debugLogger, "LR: entering updateApp");
// Separate out the code for a restricted app, since it doesn't need any
// of the UEB code.
transaction.commit();
result = true;
} catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "updateApp failed", e);
EcompPortalUtils.rollbackTransaction(transaction,
- "updateApp rollback, exception = " + EcompPortalUtils.getStackTrace(e));
+ "updateApp rollback, exception = " + e.toString());
} finally {
EcompPortalUtils.closeLocalSession(localSession, "updateApp");
}
}
} else {
- synchronized (syncRests) {
- boolean result = false;
- Session localSession = null;
- Transaction transaction = null;
- try {
- localSession = sessionFactory.openSession();
- transaction = localSession.beginTransaction();
- EPApp app;
- if (appId == null) {
- app = new EPApp();
- // -------------------------------------------------------------------------------------------
- // Register this App with the UEB communication server.
- // Save
- // the App's unique mailbox/topic
- // name and keys to the FN_APP table. The App's mailbox
- // and
- // keys will be visible to the
- // admin on the ECOMP portal.
- // -------------------------------------------------------------------------------------------
- TopicManager topicManager = new TopicManager() {
-
- EPAppCommonServiceImpl service;
-
- public void init(EPAppCommonServiceImpl _service) {
- service = _service;
- }
-
- public void createTopic(String key, String secret, String topicName,
- String topicDescription) throws HttpException, CambriaApiException, IOException {
-
- init(EPAppCommonServiceImpl.this);
- final LinkedList<String> urlList = Helper.uebUrlList();
- if (logger.isInfoEnabled()) {
- logger.info("==> createTopic");
- logger.info("topicName: " + topicName);
- logger.info("topicDescription: " + topicDescription);
- }
- CambriaTopicManager tm = null;
- try {
- tm = service.getTopicManager(urlList, key, secret);
- } catch (Exception e) {
- logger.error("pub.build Exception ", e);
- throw new CambriaApiException(topicName);
- }
- tm.createTopic(topicName, topicDescription, 1, 1);
- }
-
- public void addPublisher(String topicOwnerKey, String topicOwnerSecret, String publisherKey,
- String topicName) throws HttpException, CambriaApiException, IOException {
- logger.info("==> addPublisher to topic " + topicName);
- final LinkedList<String> urlList = Helper.uebUrlList();
- CambriaTopicManager tm = null;
- try {
- tm = service.getTopicManager(urlList, topicOwnerKey, topicOwnerSecret);
- } catch (Exception e) {
- logger.error("pub.build Exception ", e);
- throw new CambriaApiException(topicName);
- }
- tm.allowProducer(topicName, publisherKey);
- }
+ updateRestrictedApp(appId, onboardingApp, fieldsValidator, user);
+
+ }
+ }
- };
- final CambriaIdentityManager im = new CambriaClientBuilders.IdentityManagerBuilder()
- .usingHosts(Helper.uebUrlList()).build();
- com.att.nsa.apiClient.credentials.ApiCredential credential = im.createApiKey(user.getEmail(),
- "ECOMP Portal Owner");
- String appKey = credential.getApiKey();
- String appSecret = credential.getApiSecret();
- String appMailboxName = null;
+ protected void updateRestrictedApp(Long appId, OnboardingApp onboardingApp, FieldsValidator fieldsValidator,
+ EPUser user) {
+ synchronized (syncRests) {
+ boolean result = false;
+ Session localSession = null;
+ Transaction transaction = null;
+ try {
+ localSession = sessionFactory.openSession();
+ transaction = localSession.beginTransaction();
+ EPApp app;
+ if (appId == null) {
+ app = new EPApp();
+ // -------------------------------------------------------------------------------------------
+ // Register this App with the UEB communication server.
+ // Save
+ // the App's unique mailbox/topic
+ // name and keys to the FN_APP table. The App's mailbox
+ // and
+ // keys will be visible to the
+ // admin on the ECOMP portal.
+ // -------------------------------------------------------------------------------------------
+ TopicManager topicManager = new TopicManager() {
+
+ EPAppCommonServiceImpl service;
+
+ public void init(EPAppCommonServiceImpl _service) {
+ service = _service;
+ }
- int maxNumAttemptsToCreateATopic = 3;
- boolean successfullyCreatedMailbox = false;
- for (int i = 0; i < maxNumAttemptsToCreateATopic; i++) {
- appMailboxName = "ECOMP-PORTAL-OUTBOX-" + (int) (Math.random() * 100000.0);
+ public void createTopic(String key, String secret, String topicName,
+ String topicDescription) throws HttpException, CambriaApiException, IOException {
+ init(EPAppCommonServiceImpl.this);
+ final LinkedList<String> urlList = Helper.uebUrlList();
+ if (logger.isInfoEnabled()) {
+ logger.info("==> createTopic");
+ logger.info("topicName: " + topicName);
+ logger.info("topicDescription: " + topicDescription);
+ }
+ CambriaTopicManager tm = null;
try {
- topicManager.createTopic(
- PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY),
- PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_SECRET),
- appMailboxName, "ECOMP outbox for app" + onboardingApp.name);
- successfullyCreatedMailbox = true;
- logger.debug(EELFLoggerDelegate.debugLogger,
- "Successfully created " + appMailboxName + " for App " + onboardingApp.name);
- logger.debug(EELFLoggerDelegate.debugLogger, " Key = " + appKey + " Secret = "
- + appSecret + " generated using = " + user.getEmail());
- break;
- } catch (HttpException e) {
- EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeUebConnectionError, e);
- if (e.getStatusCode() == 409) {
- logger.error(EELFLoggerDelegate.errorLogger, "Topic/mailbox " + appMailboxName
- + " already exists. Will try using a different name", e);
- } else {
- logger.error(EELFLoggerDelegate.errorLogger, "HttpException when onboarding App: ",
- e);
- }
+ tm = service.getTopicManager(urlList, key, secret);
+ } catch (Exception e) {
+ logger.error("pub.build Exception ", e);
+ throw new CambriaApiException(topicName);
}
+ tm.createTopic(topicName, topicDescription, 1, 1);
}
- if (successfullyCreatedMailbox) {
- onboardingApp.setUebTopicName(appMailboxName);
- onboardingApp.setUebKey(appKey);
- onboardingApp.setUebSecret(appSecret);
-
+ public void addPublisher(String topicOwnerKey, String topicOwnerSecret, String publisherKey,
+ String topicName) throws HttpException, CambriaApiException, IOException {
+ logger.info("==> addPublisher to topic " + topicName);
+ final LinkedList<String> urlList = Helper.uebUrlList();
+ CambriaTopicManager tm = null;
try {
- /*
- * EP is a publisher to this App's new mailbox
- */
- topicManager.addPublisher(
- PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY),
- PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_SECRET),
- PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY),
- appMailboxName);
-
- /*
- * This App is a subscriber of its own mailbox
- */
- topicManager.addSubscriber(
- PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY),
- PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_SECRET), appKey,
- appMailboxName);
-
- /*
- * This App is a publisher to EP
- */
- topicManager.addPublisher(
- PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY),
- PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_SECRET), appKey,
- PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME));
- } catch (HttpException | CambriaApiException | IOException e) {
- EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeUebRegisterOnboardingAppError, e);
- logger.error(EELFLoggerDelegate.errorLogger,
- "Error when configuring Publisher/Subscriber for App's new mailbox", e);
- transaction.commit();
- localSession.close();
- fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_CONFLICT);
- return;
+ tm = service.getTopicManager(urlList, topicOwnerKey, topicOwnerSecret);
+ } catch (Exception e) {
+ logger.error("pub.build Exception ", e);
+ throw new CambriaApiException(topicName);
+ }
+ tm.allowProducer(topicName, publisherKey);
+ }
+
+ };
+ final CambriaIdentityManager im = new CambriaClientBuilders.IdentityManagerBuilder()
+ .usingHosts(Helper.uebUrlList()).build();
+ com.att.nsa.apiClient.credentials.ApiCredential credential = im.createApiKey(user.getEmail(),
+ "ECOMP Portal Owner");
+ String appKey = credential.getApiKey();
+ String appSecret = credential.getApiSecret();
+ String appMailboxName = null;
+
+ int maxNumAttemptsToCreateATopic = 3;
+ boolean successfullyCreatedMailbox = false;
+ for (int i = 0; i < maxNumAttemptsToCreateATopic; i++) {
+ appMailboxName = "ECOMP-PORTAL-OUTBOX-" + (int) (Math.random() * 100000.0);
+
+ try {
+ topicManager.createTopic(
+ PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY),
+ PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_SECRET),
+ appMailboxName, "ECOMP outbox for app" + onboardingApp.name);
+ successfullyCreatedMailbox = true;
+ logger.debug(EELFLoggerDelegate.debugLogger,
+ "Successfully created " + appMailboxName + " for App " + onboardingApp.name);
+ logger.debug(EELFLoggerDelegate.debugLogger, " Key = " + appKey + " Secret = "
+ + appSecret + " generated using = " + user.getEmail());
+ break;
+ } catch (HttpException e) {
+ EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeUebConnectionError, e);
+ if (e.getStatusCode() == 409) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Topic/mailbox " + appMailboxName
+ + " already exists. Will try using a different name", e);
+ } else {
+ logger.error(EELFLoggerDelegate.errorLogger, "HttpException when onboarding App: ",
+ e);
}
- } else {
+ }
+ }
+
+ if (successfullyCreatedMailbox) {
+ onboardingApp.setUebTopicName(appMailboxName);
+ onboardingApp.setUebKey(appKey);
+ onboardingApp.setUebSecret(appSecret);
+
+ try {
+ /*
+ * EP is a publisher to this App's new mailbox
+ */
+ topicManager.addPublisher(
+ PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY),
+ PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_SECRET),
+ PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY),
+ appMailboxName);
+
+ /*
+ * This App is a subscriber of its own mailbox
+ */
+ topicManager.addSubscriber(
+ PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY),
+ PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_SECRET), appKey,
+ appMailboxName);
+
+ /*
+ * This App is a publisher to EP
+ */
+ topicManager.addPublisher(
+ PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY),
+ PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_SECRET), appKey,
+ PortalApiProperties.getProperty(PortalApiConstants.ECOMP_PORTAL_INBOX_NAME));
+ } catch (HttpException | CambriaApiException | IOException e) {
+ EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeUebRegisterOnboardingAppError, e);
+ logger.error(EELFLoggerDelegate.errorLogger,
+ "Error when configuring Publisher/Subscriber for App's new mailbox", e);
transaction.commit();
localSession.close();
fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_CONFLICT);
return;
}
} else {
- app = (EPApp) localSession.get(EPApp.class, appId);
- if (app == null || app.getId() == null) {
- // App is already deleted!
- transaction.commit();
- localSession.close();
- fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
+ transaction.commit();
+ localSession.close();
+ fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_CONFLICT);
+ return;
+ }
+ } else {
+ app = (EPApp) localSession.get(EPApp.class, appId);
+ if (app == null || app.getId() == null) {
+ // App is already deleted!
+ transaction.commit();
+ localSession.close();
+ fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_NOT_FOUND);
+ return;
}
- logger.debug(EELFLoggerDelegate.debugLogger, "LR: about to call createAppFromOnboarding");
- createAppFromOnboarding(app, onboardingApp, localSession);
- logger.debug(EELFLoggerDelegate.debugLogger,
- "LR: updateApp: finished calling createAppFromOnboarding");
- localSession.saveOrUpdate(app);
- logger.debug(EELFLoggerDelegate.debugLogger,
- "LR: updateApp: finished calling localSession.saveOrUpdate");
- // Enable or disable all menu items associated with this app
- setFunctionalMenuItemsEnabled(localSession, onboardingApp.isEnabled, appId);
- logger.debug(EELFLoggerDelegate.debugLogger,
- "LR: updateApp: finished calling setFunctionalMenuItemsEnabled");
- transaction.commit();
- logger.debug(EELFLoggerDelegate.debugLogger, "LR: updateApp: finished calling transaction.commit");
- epUebHelper.addPublisher(app);
- logger.debug(EELFLoggerDelegate.debugLogger,
- "LR: updateApp: finished calling epUebHelper.addPublisher");
- result = true;
- } catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, "updateApp failed", e);
- EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeUebRegisterOnboardingAppError, e);
- EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e);
- EcompPortalUtils.rollbackTransaction(transaction,
- "updateApp rollback, exception = " + EcompPortalUtils.getStackTrace(e));
- } finally {
- EcompPortalUtils.closeLocalSession(localSession, "updateApp");
- }
- if (!result) {
- fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
+ logger.debug(EELFLoggerDelegate.debugLogger, "LR: about to call createAppFromOnboarding");
+ createAppFromOnboarding(app, onboardingApp, localSession);
+ logger.debug(EELFLoggerDelegate.debugLogger,
+ "LR: updateApp: finished calling createAppFromOnboarding");
+ localSession.saveOrUpdate(app);
+ logger.debug(EELFLoggerDelegate.debugLogger,
+ "LR: updateApp: finished calling localSession.saveOrUpdate");
+ // Enable or disable all menu items associated with this app
+ setFunctionalMenuItemsEnabled(localSession, onboardingApp.isEnabled, appId);
+ logger.debug(EELFLoggerDelegate.debugLogger,
+ "LR: updateApp: finished calling setFunctionalMenuItemsEnabled");
+ transaction.commit();
+ logger.debug(EELFLoggerDelegate.debugLogger, "LR: updateApp: finished calling transaction.commit");
+ epUebHelper.addPublisher(app);
+ logger.debug(EELFLoggerDelegate.debugLogger,
+ "LR: updateApp: finished calling epUebHelper.addPublisher");
+ result = true;
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "updateApp failed", e);
+ EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeUebRegisterOnboardingAppError, e);
+ EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e);
+ EcompPortalUtils.rollbackTransaction(transaction,
+ "updateApp rollback, exception = " + e.toString());
+ } finally {
+ EcompPortalUtils.closeLocalSession(localSession, "updateApp");
+ }
+ if (!result) {
+ fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
}
+
}
- public CambriaTopicManager getTopicManager(LinkedList<String> urlList, String key, String secret)
+ public CambriaTopicManager getTopicManager(List<String> urlList, String key, String secret)
throws GeneralSecurityException, Exception {
throw new Exception("This method can only be invoked from child class");
}
onboardingApp.uebTopicName = app.getUebTopicName();
onboardingApp.uebKey = app.getUebKey();
onboardingApp.uebSecret = app.getUebSecret();
+ onboardingApp.isCentralAuth = app.getCentralAuth();
+ onboardingApp.nameSpace = app.getNameSpace();
onboardingApp.setRestrictedApp(app.isRestrictedApp());
// if (app.getThumbnail() != null)
// onboardingApp.thumbnail = new
app.setUebTopicName(onboardingApp.uebTopicName);
app.setUebKey(onboardingApp.uebKey);
app.setUebSecret(onboardingApp.uebSecret);
+ app.setCentralAuth(onboardingApp.isCentralAuth);
+ app.setNameSpace(onboardingApp.nameSpace);
app.setRestrictedApp(onboardingApp.restrictedApp);
if (!StringUtils.isEmpty(onboardingApp.thumbnail)) {
logger.debug(EELFLoggerDelegate.debugLogger, "createAppFromOnboarding: onboarding thumbnail is NOT empty");
public List<EPApp> getUserRemoteApps(String id) {
throw new RuntimeException(" Cannot be called from parent class");
}
+
+ @Override
+ public UserRoles getUserProfileForLeftMenu(String loginId) {
+ final Map<String, String> params = new HashMap<>();
+ params.put("org_user_id", loginId);
+ @SuppressWarnings("unchecked")
+ List<UserRole> userRoleList = dataAccessService.executeNamedQuery( "getUserRolesForLeftMenu", params, null);
+ ArrayList<UserRoles> usersRolesList = aggregateUserProfileRowsResultsByRole(userRoleList);
+ if (usersRolesList == null || usersRolesList.size() < 1)
+ return null;
+
+ return usersRolesList.get(0);
+ }
+
+
+ @Override
+ public UserRoles getUserProfileNormalizedForLeftMenu(EPUser user) {
+ // Check database.
+ UserRoles userAndRoles = getUserProfileForLeftMenu(user.getLoginId());
+ // If no roles are defined, treat this user as a guest.
+ if (user.isGuest() || userAndRoles == null) {
+ logger.debug(EELFLoggerDelegate.debugLogger, "getUserProfileForLeftMenu: treating user {} as guest",
+ user.getLoginId());
+ UserRole userRole = new UserRole();
+ userRole.setUser_Id(user.getId());
+ userRole.setOrgUserId(user.getLoginId());
+ userRole.setFirstName(user.getFirstName());
+ userRole.setLastName(user.getLastName());
+ userRole.setRoleId(-1L);
+ userRole.setRoleName("Guest");
+ userRole.setUser_Id(-1L);
+ userAndRoles = new UserRoles(userRole);
+ }
+
+ return userAndRoles;
+ }
+
}