summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/EPAppServiceImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/EPAppServiceImpl.java')
-rw-r--r--ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/EPAppServiceImpl.java123
1 files changed, 70 insertions, 53 deletions
diff --git a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/EPAppServiceImpl.java b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/EPAppServiceImpl.java
index 41e51be6..ea92ca51 100644
--- a/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/EPAppServiceImpl.java
+++ b/ecomp-portal-BE-os/src/main/java/org/openecomp/portalapp/portal/service/EPAppServiceImpl.java
@@ -1,25 +1,43 @@
/*-
- * ================================================================================
- * 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 java.net.MalformedURLException;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.LinkedList;
@@ -59,34 +77,28 @@ public class EPAppServiceImpl extends EPAppCommonServiceImpl implements EPAppSer
private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EPAppServiceImpl.class);
private static Object syncRests = new Object();
-
+
@Autowired
private DataAccessService dataAccessService;
-
+
@Override
public List<EPApp> getUserRemoteApps(String id) {
-
- StringBuilder query = new StringBuilder();
-
- query.append("SELECT * FROM FN_APP join FN_USER_ROLE ON FN_USER_ROLE.APP_ID = FN_APP.APP_ID where ");
- query.append(
- "FN_USER_ROLE.USER_ID = " + id + " AND FN_USER_ROLE.ROLE_ID != " + SUPER_ADMIN_ROLE_ID);
- query.append(" AND FN_APP.ENABLED = 'Y'");
-
- TreeSet<EPApp> distinctApps = new TreeSet<EPApp>();
-
- @SuppressWarnings("unchecked")
- List<EPApp> adminApps = dataAccessService.executeSQLQuery(query.toString(), EPApp.class, null);
- for (EPApp app : adminApps) {
- distinctApps.add(app);
- }
-
- List<EPApp> userApps = new ArrayList<EPApp>();
- userApps.addAll(distinctApps);
- return userApps;
-
+ StringBuilder query = new StringBuilder();
+ query.append("SELECT * FROM FN_APP join FN_USER_ROLE ON FN_USER_ROLE.APP_ID = FN_APP.APP_ID where ");
+ query.append("FN_USER_ROLE.USER_ID = " + id + " AND FN_USER_ROLE.ROLE_ID != " + SUPER_ADMIN_ROLE_ID);
+ query.append(" AND FN_APP.ENABLED = 'Y'");
+ TreeSet<EPApp> distinctApps = new TreeSet<EPApp>();
+ @SuppressWarnings("unchecked")
+ List<EPApp> adminApps = dataAccessService.executeSQLQuery(query.toString(), EPApp.class, null);
+ for (EPApp app : adminApps) {
+ distinctApps.add(app);
+ }
+ List<EPApp> userApps = new ArrayList<EPApp>();
+ userApps.addAll(distinctApps);
+ return userApps;
}
-
+
+ @Override
protected void updateRestrictedApp(Long appId, OnboardingApp onboardingApp, FieldsValidator fieldsValidator,
EPUser user) {
synchronized (syncRests) {
@@ -99,11 +111,13 @@ public class EPAppServiceImpl extends EPAppCommonServiceImpl implements EPAppSer
EPApp app;
if (appId == null) {
app = new EPApp();
-
- // In the parent class, the UEB code is responsible for generating the keys/secret/mailbox but UEB Messaging
- // is not actually being used currently; may be used in future at which point we can just remove this method and
- // depend on parent class's method
- // So, using UUID generator to generate the unique key instead.
+ /*
+ * In the parent class, the UEB code is responsible for generating the
+ * keys/secret/mailbox but UEB Messaging is not actually being used currently;
+ * may be used in future at which point we can just remove this method and
+ * depend on parent class's method So, using UUID generator to generate the
+ * unique key instead.
+ */
String uuidStr = UUID.randomUUID().toString();
String appKey = uuidStr;
String appSecret = uuidStr;
@@ -111,8 +125,7 @@ public class EPAppServiceImpl extends EPAppCommonServiceImpl implements EPAppSer
onboardingApp.setUebTopicName(appMailboxName);
onboardingApp.setUebKey(appKey);
onboardingApp.setUebSecret(appSecret);
-
- }else {
+ } else {
app = (EPApp) localSession.get(EPApp.class, appId);
if (app == null || app.getId() == null) {
// App is already deleted!
@@ -122,28 +135,30 @@ public class EPAppServiceImpl extends EPAppCommonServiceImpl implements EPAppSer
return;
}
}
- logger.debug(EELFLoggerDelegate.debugLogger, "LR: about to call createAppFromOnboarding");
+ logger.debug(EELFLoggerDelegate.debugLogger,
+ "updateRestrictedApp: about to call createAppFromOnboarding");
createAppFromOnboarding(app, onboardingApp, localSession);
logger.debug(EELFLoggerDelegate.debugLogger,
- "LR: updateApp: finished calling createAppFromOnboarding");
+ "updateRestrictedApp: finished calling createAppFromOnboarding");
localSession.saveOrUpdate(app);
logger.debug(EELFLoggerDelegate.debugLogger,
- "LR: updateApp: finished calling localSession.saveOrUpdate");
+ "updateRestrictedApp: 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");
+ "updateRestrictedApp: finished calling setFunctionalMenuItemsEnabled");
transaction.commit();
- logger.debug(EELFLoggerDelegate.debugLogger, "LR: updateApp: finished calling transaction.commit");
+ logger.debug(EELFLoggerDelegate.debugLogger,
+ "updateRestrictedApp: finished calling transaction.commit");
result = true;
} catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, "updateApp failed", e);
+ logger.error(EELFLoggerDelegate.errorLogger, "updateRestrictedApp failed", e);
EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeUebRegisterOnboardingAppError, e);
EPLogUtil.logEcompError(logger, EPAppMessagesEnum.BeDaoSystemError, e);
EcompPortalUtils.rollbackTransaction(transaction,
- "updateApp rollback, exception = " + EcompPortalUtils.getStackTrace(e));
+ "updateRestrictedApp rollback, exception = " + e.toString());
} finally {
- EcompPortalUtils.closeLocalSession(localSession, "updateApp");
+ EcompPortalUtils.closeLocalSession(localSession, "updateRestrictedApp");
}
if (!result) {
fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
@@ -151,9 +166,11 @@ public class EPAppServiceImpl extends EPAppCommonServiceImpl implements EPAppSer
}
}
-
- public CambriaTopicManager getTopicManager(LinkedList<String> urlList, String key, String secret) throws GeneralSecurityException, Exception{
- return CambriaClientFactory.createTopicManager( null, urlList, key, secret);
+
+ @Override
+ public CambriaTopicManager getTopicManager(List<String> urlList, String key, String secret)
+ throws MalformedURLException, GeneralSecurityException {
+ return CambriaClientFactory.createTopicManager(null, urlList, key, secret);
}
} \ No newline at end of file