summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller')
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppCatalogController.java40
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppContactUsController.java40
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsController.java42
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequest.java40
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AuditLogController.java64
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BEPropertyReaderController.java40
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthAccountController.java37
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthenticationController.java40
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/CommonWidgetController.java40
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ConsulClientController.java40
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardController.java40
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultController.java40
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAccessRolesController.java274
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulController.java40
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/FunctionalMenuController.java99
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/GetAccessController.java44
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/HealthCheckController.java48
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ManifestController.java43
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceController.java40
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceProxyController.java47
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PolicyController.java100
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java74
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RoleManageController.java40
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RolesApprovalSystemController.java40
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SchedulerController.java40
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SharedContextRestController.java40
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/TicketEventController.java40
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserController.java37
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserNotificationController.java40
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRolesController.java44
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppController.java40
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogController.java210
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupController.java40
33 files changed, 1295 insertions, 628 deletions
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppCatalogController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppCatalogController.java
index 5260a47d..35390b19 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppCatalogController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppCatalogController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppContactUsController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppContactUsController.java
index 7e781049..611e1bb0 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppContactUsController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppContactUsController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsController.java
index 2c1da820..e9a1a951 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
@@ -65,7 +83,7 @@ import org.springframework.web.bind.annotation.RestController;
@EnableAspectJAutoProxy
@EPAuditLog
public class AppsController extends EPRestrictedBaseController {
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AppsController.class);
+ private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AppsController.class);
@Autowired
private AdminRolesService adminRolesService;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequest.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequest.java
index 00cf627e..d7295041 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequest.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AppsControllerExternalRequest.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AuditLogController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AuditLogController.java
index 14ba94f2..aa8d7bfd 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AuditLogController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/AuditLogController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
@@ -52,17 +70,21 @@ public class AuditLogController extends EPRestrictedBaseController {
* Store audit log of the specified access type.
*
* @param request
+ * HttpServletRequest
* @param affectedAppId
+ * App ID
* @param type
+ * Access type
* @param comment
+ * Comment
*/
@RequestMapping(value = "/store", method = RequestMethod.GET, produces = "application/json")
public void auditLog(HttpServletRequest request, @RequestParam String affectedAppId, @RequestParam String type,
@RequestParam String comment) {
- logger.debug(EELFLoggerDelegate.debugLogger, "auditLog: appId {}, type {], comment {}",
- affectedAppId, type, comment);
+ logger.debug(EELFLoggerDelegate.debugLogger, "auditLog: appId {}, type {], comment {}", affectedAppId, type,
+ comment);
String cd_type = null;
- try {
+ try {
EPUser user = EPUserUtils.getUserSession(request);
/* Check type of Activity CD */
if (type.equals("app")) {
@@ -74,15 +96,15 @@ public class AuditLogController extends EPRestrictedBaseController {
} else if (type.equals("leftMenu")) {
cd_type = AuditLog.CD_ACTIVITY_LEFT_MENU_ACCESS;
} else {
- logger.error(EELFLoggerDelegate.errorLogger, "Storing auditLog failed! Activity CD type is not correct.");
+ logger.error(EELFLoggerDelegate.errorLogger,
+ "Storing auditLog failed! Activity CD type is not correct.");
}
/* Store the audit log only if it contains valid Activity CD */
if (cd_type != null) {
AuditLog auditLog = new AuditLog();
auditLog.setActivityCode(cd_type);
/*
- * Check affectedAppId and comment and see if these two values are
- * valid
+ * Check affectedAppId and comment and see if these two values are valid
*/
if (comment != null && !comment.equals("") && !comment.equals("undefined"))
auditLog.setComments(EcompPortalUtils.truncateString(comment, PortalConstants.AUDIT_LOG_COMMENT_SIZE));
@@ -93,10 +115,10 @@ public class AuditLogController extends EPRestrictedBaseController {
auditService.logActivity(auditLog, null);
// Log file
- MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP,EPEELFLoggerAdvice.getCurrentDateTimeUTC());
- MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP,EPEELFLoggerAdvice.getCurrentDateTimeUTC());
- logger.info(EELFLoggerDelegate.auditLogger, EPLogUtil.formatAuditLogMessage("AuditLogController.auditLog",
- cd_type, user.getOrgUserId(), affectedAppId, comment));
+ MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC());
+ MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC());
+ logger.info(EELFLoggerDelegate.auditLogger, EPLogUtil.formatAuditLogMessage(
+ "AuditLogController.auditLog", cd_type, user.getOrgUserId(), affectedAppId, comment));
MDC.remove(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP);
MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP);
}
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BEPropertyReaderController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BEPropertyReaderController.java
index 5be6614c..2d8fd182 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BEPropertyReaderController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BEPropertyReaderController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthAccountController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthAccountController.java
index c16fa78f..6004d698 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthAccountController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthAccountController.java
@@ -1,3 +1,40 @@
+/*-
+ * ============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
+ *
+ * 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.controller;
import java.util.ArrayList;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthenticationController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthenticationController.java
index 874edad0..ad0829f3 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthenticationController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/BasicAuthenticationController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/CommonWidgetController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/CommonWidgetController.java
index 7faea5d9..9d046cb4 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/CommonWidgetController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/CommonWidgetController.java
@@ -1,21 +1,39 @@
/*
- * ================================================================================
- * 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.controller;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ConsulClientController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ConsulClientController.java
index 808220c5..e1b39f38 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ConsulClientController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ConsulClientController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardController.java
index 1c22576d..aaeea44c 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultController.java
index fe31066d..313ae683 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/DashboardSearchResultController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAccessRolesController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAccessRolesController.java
index 1e9c83e7..5770d163 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAccessRolesController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAccessRolesController.java
@@ -1,6 +1,42 @@
+/*-
+ * ============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
+ *
+ * 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.controller;
-
import java.util.ArrayList;
import java.util.List;
@@ -53,7 +89,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
@Autowired
private AuditService auditService;
-
+
private static final String UEBKEY = "uebkey";
private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ExternalAccessRolesController.class);
@@ -61,34 +97,33 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
@Autowired
private ExternalAccessRolesService externalAccessRolesService;
- @ApiOperation(value = "Gets user role for an application.", response = String.class, responseContainer="List")
- @RequestMapping(value = {
- "/user/{loginId}" }, method = RequestMethod.GET, produces = "application/json")
- public String getUser(HttpServletRequest request, HttpServletResponse response, @PathVariable("loginId") String loginId) throws Exception {
-
+ @ApiOperation(value = "Gets user role for an application.", response = String.class, responseContainer = "List")
+ @RequestMapping(value = { "/user/{loginId}" }, method = RequestMethod.GET, produces = "application/json")
+ public String getUser(HttpServletRequest request, HttpServletResponse response,
+ @PathVariable("loginId") String loginId) throws Exception {
+
String answer = null;
try {
answer = externalAccessRolesService.getUserWithRoles(loginId, request.getHeader(UEBKEY));
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "getUser failed", e);
}
- return answer;
+ return answer;
}
-
- @ApiOperation(value = "Gets roles for an application.", response = CentralRole.class, responseContainer="Json")
- @RequestMapping(value = {
- "/roles" }, method = RequestMethod.GET, produces = "application/json")
+
+ @ApiOperation(value = "Gets roles for an application.", response = CentralRole.class, responseContainer = "Json")
+ @RequestMapping(value = { "/roles" }, method = RequestMethod.GET, produces = "application/json")
public List<CentralRole> getRolesForApp(HttpServletRequest request, HttpServletResponse response) throws Exception {
logger.debug(EELFLoggerDelegate.debugLogger, "Request received for getRolesForApp");
- List<EPApp> applicationList=new ArrayList<>();
+ List<EPApp> applicationList = new ArrayList<>();
applicationList = externalAccessRolesService.getApp(request.getHeader(UEBKEY));
EPApp app = applicationList.get(0);
- externalAccessRolesService.syncApplicationRolesWithEcompDB(app);
+ externalAccessRolesService.syncApplicationRolesWithEcompDB(app);
List<CentralRole> answer = null;
try {
answer = externalAccessRolesService.getRolesForApp(request.getHeader(UEBKEY));
} catch (HttpClientErrorException e) {
- if("Application not found".equalsIgnoreCase(e.getMessage())){
+ if ("Application not found".equalsIgnoreCase(e.getMessage())) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
}
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
@@ -98,10 +133,10 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
return answer;
}
- @ApiOperation(value = "Gets all role functions for an application.", response = CentralRoleFunction.class, responseContainer="Json")
- @RequestMapping(value = {
- "/functions" }, method = RequestMethod.GET, produces = "application/json")
- public List<CentralRoleFunction> getRoleFunctionsList(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ @ApiOperation(value = "Gets all role functions for an application.", response = CentralRoleFunction.class, responseContainer = "Json")
+ @RequestMapping(value = { "/functions" }, method = RequestMethod.GET, produces = "application/json")
+ public List<CentralRoleFunction> getRoleFunctionsList(HttpServletRequest request, HttpServletResponse response)
+ throws Exception {
List<CentralRoleFunction> answer = null;
logger.debug(EELFLoggerDelegate.debugLogger, "Request received for getRoleFunctionsList");
try {
@@ -112,12 +147,12 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
}
logger.debug(EELFLoggerDelegate.debugLogger, "Request completed for getRoleFunctionsList");
return answer;
- }
-
- @ApiOperation(value = "Gets role information for an application.", response = CentralRole.class, responseContainer="Json")
- @RequestMapping(value = {
- "/role/{role_id}" }, method = RequestMethod.GET, produces = "application/json")
- public CentralRole getRoleInfo(HttpServletRequest request, HttpServletResponse response, @PathVariable("role_id") Long roleId) throws Exception {
+ }
+
+ @ApiOperation(value = "Gets role information for an application.", response = CentralRole.class, responseContainer = "Json")
+ @RequestMapping(value = { "/role/{role_id}" }, method = RequestMethod.GET, produces = "application/json")
+ public CentralRole getRoleInfo(HttpServletRequest request, HttpServletResponse response,
+ @PathVariable("role_id") Long roleId) throws Exception {
CentralRole answer = null;
logger.debug(EELFLoggerDelegate.debugLogger, "Request received for getRoleInfo");
@@ -130,7 +165,7 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
logger.debug(EELFLoggerDelegate.debugLogger, "Request completed for getRoleInfo");
return answer;
}
-
+
@ApiOperation(value = "Gets role information for an application provided by function code.", response = CentralRoleFunction.class, responseContainer = "Json")
@RequestMapping(value = { "/function/{code}" }, method = RequestMethod.GET, produces = "application/json")
public CentralRoleFunction getRoleFunction(HttpServletRequest request, HttpServletResponse response,
@@ -155,40 +190,46 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
EPApp requestedApp = applicationList.get(0);
Long appId = requestedApp.getId();
try {
- String data = roleFunc;
+ String data = roleFunc;
CentralRoleFunction availableRoleFunction = mapper.readValue(data, CentralRoleFunction.class);
availableRoleFunction.setAppId(appId);
- boolean saveOrUpdateResponse = externalAccessRolesService.saveCentralRoleFunction(availableRoleFunction, requestedApp);
- if(saveOrUpdateResponse){
+ boolean saveOrUpdateResponse = externalAccessRolesService.saveCentralRoleFunction(availableRoleFunction,
+ requestedApp);
+ if (saveOrUpdateResponse) {
EPUser user = externalAccessRolesService.getUser(request.getHeader(LOGIN_ID)).get(0);
EPApp app = externalAccessRolesService.getApp(request.getHeader(UEBKEY)).get(0);
- CentralRoleFunction function = externalAccessRolesService.getRoleFunction(availableRoleFunction.getCode(), request.getHeader(UEBKEY));
- String activityCode = (function.getCode() == null) ? EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_ADD_FUNCTION: EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_UPDATE_FUNCTION;
+ CentralRoleFunction function = externalAccessRolesService
+ .getRoleFunction(availableRoleFunction.getCode(), request.getHeader(UEBKEY));
+ String activityCode = (function.getCode() == null)
+ ? EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_ADD_FUNCTION
+ : EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_UPDATE_FUNCTION;
logger.info(EELFLoggerDelegate.applicationLogger, "saveRoleFunction: succeeded for app {}, function {}",
app.getId(), availableRoleFunction.getCode());
AuditLog auditLog = new AuditLog();
auditLog.setUserId(user.getId());
auditLog.setActivityCode(activityCode);
- auditLog.setComments(EcompPortalUtils.truncateString("saveRoleFunction role for app:"+app.getId()+" and function:'"+availableRoleFunction.getCode()+"'", PortalConstants.AUDIT_LOG_COMMENT_SIZE));
+ auditLog.setComments(
+ EcompPortalUtils.truncateString(
+ "saveRoleFunction role for app:" + app.getId() + " and function:'"
+ + availableRoleFunction.getCode() + "'",
+ PortalConstants.AUDIT_LOG_COMMENT_SIZE));
auditLog.setAffectedRecordId(user.getOrgUserId());
auditService.logActivity(auditLog, null);
- MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP,
- EPEELFLoggerAdvice.getCurrentDateTimeUTC());
- MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP,
- EPEELFLoggerAdvice.getCurrentDateTimeUTC());
+ MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC());
+ MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC());
EcompPortalUtils.calculateDateTimeDifferenceForLog(
MDC.get(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP),
MDC.get(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP));
logger.info(EELFLoggerDelegate.auditLogger,
- EPLogUtil.formatAuditLogMessage("ExternalAccessRolesController.saveRoleFunction",
- activityCode, String.valueOf(user.getId()),
- user.getOrgUserId(), availableRoleFunction.getCode()));
+ EPLogUtil.formatAuditLogMessage("ExternalAccessRolesController.saveRoleFunction", activityCode,
+ String.valueOf(user.getId()), user.getOrgUserId(), availableRoleFunction.getCode()));
MDC.remove(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP);
MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP);
MDC.remove(SystemProperties.MDC_TIMER);
- } else{
+ } else {
logger.error(EELFLoggerDelegate.errorLogger, "saveRoleFunction failed");
- return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to saveRoleFunction for '"+availableRoleFunction.getCode()+"'", "Failed");
+ return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR,
+ "Failed to saveRoleFunction for '" + availableRoleFunction.getCode() + "'", "Failed");
}
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "saveRoleFunction failed", e);
@@ -196,27 +237,28 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
}
return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully Saved", "Success");
}
-
+
@ApiOperation(value = "Deletes role function for an application.", response = PortalRestResponse.class, responseContainer = "Json")
@RequestMapping(value = { "/roleFunction/{code}" }, method = RequestMethod.DELETE, produces = "application/json")
- public PortalRestResponse<String> deleteRoleFunction(HttpServletRequest request, HttpServletResponse response, @PathVariable("code") String code) throws Exception {
+ public PortalRestResponse<String> deleteRoleFunction(HttpServletRequest request, HttpServletResponse response,
+ @PathVariable("code") String code) throws Exception {
try {
EPUser user = externalAccessRolesService.getUser(request.getHeader(LOGIN_ID)).get(0);
EPApp app = externalAccessRolesService.getApp(request.getHeader(UEBKEY)).get(0);
boolean getDelFuncResponse = externalAccessRolesService.deleteCentralRoleFunction(code, app);
- if(getDelFuncResponse){
+ if (getDelFuncResponse) {
logger.info(EELFLoggerDelegate.applicationLogger, "deleteRoleFunction: succeeded for app {}, role {}",
app.getId(), code);
AuditLog auditLog = new AuditLog();
auditLog.setUserId(user.getId());
auditLog.setActivityCode(EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_DELETE_FUNCTION);
- auditLog.setComments(EcompPortalUtils.truncateString("Deleted function for app:"+app.getId()+" and function code:'"+code+"'", PortalConstants.AUDIT_LOG_COMMENT_SIZE));
+ auditLog.setComments(EcompPortalUtils.truncateString(
+ "Deleted function for app:" + app.getId() + " and function code:'" + code + "'",
+ PortalConstants.AUDIT_LOG_COMMENT_SIZE));
auditLog.setAffectedRecordId(user.getOrgUserId());
auditService.logActivity(auditLog, null);
- MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP,
- EPEELFLoggerAdvice.getCurrentDateTimeUTC());
- MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP,
- EPEELFLoggerAdvice.getCurrentDateTimeUTC());
+ MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC());
+ MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC());
EcompPortalUtils.calculateDateTimeDifferenceForLog(
MDC.get(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP),
MDC.get(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP));
@@ -227,19 +269,21 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
MDC.remove(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP);
MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP);
MDC.remove(SystemProperties.MDC_TIMER);
- } else{
+ } else {
logger.error(EELFLoggerDelegate.errorLogger, "deleteRoleFunction failed");
- return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to deleteRoleFunction for '"+code+"'", "Failed");
+ return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR,
+ "Failed to deleteRoleFunction for '" + code + "'", "Failed");
}
} catch (HttpClientErrorException e) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
logger.error(EELFLoggerDelegate.errorLogger, "deleteRoleFunction failed", e);
- return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, "Failed to deleteRoleFunction for '"+code+"'", "Failed");
+ return new PortalRestResponse<>(PortalRestStatusEnum.ERROR,
+ "Failed to deleteRoleFunction for '" + code + "'", "Failed");
}
return new PortalRestResponse<>(PortalRestStatusEnum.OK, "Successfully Deleted", "Success");
- }
-
+ }
+
@ApiOperation(value = "Saves role for an application.", response = PortalRestResponse.class, responseContainer = "Json")
@RequestMapping(value = { "/role" }, method = RequestMethod.POST, produces = "application/json")
public PortalRestResponse<String> saveRole(HttpServletRequest request, HttpServletResponse response,
@@ -256,7 +300,9 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
AuditLog auditLog = new AuditLog();
auditLog.setUserId(user.getId());
auditLog.setActivityCode(activityCode);
- auditLog.setComments(EcompPortalUtils.truncateString("saveRole role for app:" + app.getId() + " and role:'" + role.getName()+"'", PortalConstants.AUDIT_LOG_COMMENT_SIZE));
+ auditLog.setComments(EcompPortalUtils.truncateString(
+ "saveRole role for app:" + app.getId() + " and role:'" + role.getName() + "'",
+ PortalConstants.AUDIT_LOG_COMMENT_SIZE));
auditLog.setAffectedRecordId(user.getOrgUserId());
auditService.logActivity(auditLog, null);
MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC());
@@ -272,7 +318,8 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
MDC.remove(SystemProperties.MDC_TIMER);
} else {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
- return new PortalRestResponse<>(PortalRestStatusEnum.ERROR, "Failed to saveRole for '"+role.getName()+"'", "Failed");
+ return new PortalRestResponse<>(PortalRestStatusEnum.ERROR,
+ "Failed to saveRole for '" + role.getName() + "'", "Failed");
}
} catch (Exception e) {
@@ -282,14 +329,15 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
}
return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully Saved", "Success");
}
-
+
@ApiOperation(value = "Deletes role for an application.", response = PortalRestResponse.class, responseContainer = "Json")
@RequestMapping(value = { "/deleteRole/{code}" }, method = RequestMethod.DELETE, produces = "application/json")
- public PortalRestResponse<String> deleteRole(HttpServletRequest request, HttpServletResponse response,
+ public PortalRestResponse<String> deleteRole(HttpServletRequest request, HttpServletResponse response,
@PathVariable String code) throws Exception {
try {
- boolean deleteResponse = externalAccessRolesService.deleteRoleForApplication(code, request.getHeader(UEBKEY));
- if(deleteResponse){
+ boolean deleteResponse = externalAccessRolesService.deleteRoleForApplication(code,
+ request.getHeader(UEBKEY));
+ if (deleteResponse) {
EPUser user = externalAccessRolesService.getUser(request.getHeader(LOGIN_ID)).get(0);
EPApp app = externalAccessRolesService.getApp(request.getHeader(UEBKEY)).get(0);
logger.info(EELFLoggerDelegate.applicationLogger, "deleteRole: succeeded for app {}, role {}",
@@ -297,13 +345,13 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
AuditLog auditLog = new AuditLog();
auditLog.setUserId(user.getId());
auditLog.setActivityCode(EcompAuditLog.CD_ACTIVITY_EXTERNAL_AUTH_DELETE_ROLE);
- auditLog.setComments(EcompPortalUtils.truncateString("Deleted role for app:"+app.getId()+" and role:'"+code+"'", PortalConstants.AUDIT_LOG_COMMENT_SIZE));
+ auditLog.setComments(EcompPortalUtils.truncateString(
+ "Deleted role for app:" + app.getId() + " and role:'" + code + "'",
+ PortalConstants.AUDIT_LOG_COMMENT_SIZE));
auditLog.setAffectedRecordId(user.getOrgUserId());
auditService.logActivity(auditLog, null);
- MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP,
- EPEELFLoggerAdvice.getCurrentDateTimeUTC());
- MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP,
- EPEELFLoggerAdvice.getCurrentDateTimeUTC());
+ MDC.put(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC());
+ MDC.put(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP, EPEELFLoggerAdvice.getCurrentDateTimeUTC());
EcompPortalUtils.calculateDateTimeDifferenceForLog(
MDC.get(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP),
MDC.get(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP));
@@ -314,9 +362,10 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
MDC.remove(EPCommonSystemProperties.AUDITLOG_BEGIN_TIMESTAMP);
MDC.remove(EPCommonSystemProperties.AUDITLOG_END_TIMESTAMP);
MDC.remove(SystemProperties.MDC_TIMER);
- } else{
+ } else {
logger.error(EELFLoggerDelegate.errorLogger, "deleteRole failed");
- return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to deleteRole for '"+code+"'", "Failed");
+ return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR,
+ "Failed to deleteRole for '" + code + "'", "Failed");
}
} catch (Exception e) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
@@ -326,10 +375,10 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully Deleted", "Success");
}
-
+
@ApiOperation(value = "Gets active roles for an application.", response = CentralRole.class, responseContainer = "Json")
@RequestMapping(value = { "/activeRoles" }, method = RequestMethod.GET, produces = "application/json")
- public List<CentralRole> getActiveRoles(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public List<CentralRole> getActiveRoles(HttpServletRequest request, HttpServletResponse response) throws Exception {
List<CentralRole> cenRole = null;
try {
cenRole = externalAccessRolesService.getActiveRoles(request.getHeader(UEBKEY));
@@ -338,13 +387,14 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
logger.error(EELFLoggerDelegate.errorLogger, "getActiveRoles failed", e);
}
return cenRole;
-
+
}
-
+
@ApiOperation(value = "deletes user roles for an application.", response = PortalRestResponse.class, responseContainer = "Json")
- @RequestMapping(value = { "/deleteDependcyRoleRecord/{roleId}" }, method = RequestMethod.DELETE, produces = "application/json")
- public PortalRestResponse<String> deleteDependencyRoleRecord(HttpServletRequest request, HttpServletResponse response,
- @PathVariable("roleId") Long roleId) throws Exception {
+ @RequestMapping(value = {
+ "/deleteDependcyRoleRecord/{roleId}" }, method = RequestMethod.DELETE, produces = "application/json")
+ public PortalRestResponse<String> deleteDependencyRoleRecord(HttpServletRequest request,
+ HttpServletResponse response, @PathVariable("roleId") Long roleId) throws Exception {
try {
boolean deleteResponse = externalAccessRolesService.deleteDependencyRoleRecord(roleId,
request.getHeader(UEBKEY), request.getHeader(LOGIN_ID));
@@ -361,24 +411,27 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
}
return new PortalRestResponse<>(PortalRestStatusEnum.OK, "Successfully Deleted", "Success");
}
-
+
@ApiOperation(value = "Bulk upload functions for an application.", response = PortalRestResponse.class, responseContainer = "Json")
@RequestMapping(value = { "/upload/portal/functions" }, method = RequestMethod.POST, produces = "application/json")
- public PortalRestResponse<String> bulkUploadFunctions(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public PortalRestResponse<String> bulkUploadFunctions(HttpServletRequest request, HttpServletResponse response)
+ throws Exception {
Integer result = 0;
try {
result = externalAccessRolesService.bulkUploadFunctions(request.getHeader(UEBKEY));
} catch (HttpClientErrorException e) {
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadFunctions failed", e);
- return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadFunctions", "Failed");
+ return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadFunctions",
+ "Failed");
}
- return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: "+result, "Success");
+ return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: " + result, "Success");
}
-
+
@ApiOperation(value = "Bulk upload roles for an application.", response = PortalRestResponse.class, responseContainer = "Json")
@RequestMapping(value = { "/upload/portal/roles" }, method = RequestMethod.POST, produces = "application/json")
- public PortalRestResponse<String> bulkUploadRoles(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public PortalRestResponse<String> bulkUploadRoles(HttpServletRequest request, HttpServletResponse response)
+ throws Exception {
Integer result = 0;
try {
result = externalAccessRolesService.bulkUploadRoles(request.getHeader(UEBKEY));
@@ -387,53 +440,61 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRoles failed", e);
return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadRoles", "Failed");
}
- return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: "+result, "Success");
+ return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: " + result, "Success");
}
-
+
@ApiOperation(value = "Bulk upload role functions for an application.", response = PortalRestResponse.class, responseContainer = "Json")
- @RequestMapping(value = { "/upload/portal/roleFunctions" }, method = RequestMethod.POST, produces = "application/json")
- public PortalRestResponse<String> bulkUploadRoleFunctions(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ @RequestMapping(value = {
+ "/upload/portal/roleFunctions" }, method = RequestMethod.POST, produces = "application/json")
+ public PortalRestResponse<String> bulkUploadRoleFunctions(HttpServletRequest request, HttpServletResponse response)
+ throws Exception {
Integer result = 0;
try {
result = externalAccessRolesService.bulkUploadRolesFunctions(request.getHeader(UEBKEY));
} catch (HttpClientErrorException e) {
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRoleFunctions failed", e);
- return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadRoleFunctions", "Failed");
+ return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadRoleFunctions",
+ "Failed");
}
- return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: "+result, "Success");
+ return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: " + result, "Success");
}
-
+
@ApiOperation(value = "Bulk upload user roles for an application.", response = PortalRestResponse.class, responseContainer = "Json")
@RequestMapping(value = { "/upload/portal/userRoles" }, method = RequestMethod.POST, produces = "application/json")
- public PortalRestResponse<String> bulkUploadUserRoles(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public PortalRestResponse<String> bulkUploadUserRoles(HttpServletRequest request, HttpServletResponse response)
+ throws Exception {
Integer result = 0;
try {
result = externalAccessRolesService.bulkUploadUserRoles(request.getHeader(UEBKEY));
} catch (HttpClientErrorException e) {
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadUserRoles failed", e);
- return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadUserRoles", "Failed");
+ return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadUserRoles",
+ "Failed");
}
- return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: "+result, "Success");
+ return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added: " + result, "Success");
}
-
+
@ApiOperation(value = "Bulk upload functions for an partner application.", response = PortalRestResponse.class, responseContainer = "Json")
@RequestMapping(value = { "/upload/partner/functions" }, method = RequestMethod.POST, produces = "application/json")
- public PortalRestResponse<String> bulkUploadPartnerFunctions(HttpServletRequest request, HttpServletResponse response, @RequestBody List<RoleFunction> upload) throws Exception {
+ public PortalRestResponse<String> bulkUploadPartnerFunctions(HttpServletRequest request,
+ HttpServletResponse response, @RequestBody List<RoleFunction> upload) throws Exception {
try {
externalAccessRolesService.bulkUploadPartnerFunctions(request.getHeader(UEBKEY), upload);
} catch (HttpClientErrorException e) {
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadFunctions failed", e);
- return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadFunctions", "Failed");
+ return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadFunctions",
+ "Failed");
}
return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added", "Success");
}
-
+
@ApiOperation(value = "Bulk upload roles for an partner application.", response = PortalRestResponse.class, responseContainer = "Json")
@RequestMapping(value = { "/upload/partner/roles" }, method = RequestMethod.POST, produces = "application/json")
- public PortalRestResponse<String> bulkUploadPartnerRoles(HttpServletRequest request, HttpServletResponse response, @RequestBody List<Role> upload) throws Exception {
+ public PortalRestResponse<String> bulkUploadPartnerRoles(HttpServletRequest request, HttpServletResponse response,
+ @RequestBody List<Role> upload) throws Exception {
try {
externalAccessRolesService.bulkUploadPartnerRoles(request.getHeader(UEBKEY), upload);
} catch (HttpClientErrorException e) {
@@ -443,23 +504,26 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
}
return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added", "Success");
}
-
+
@ApiOperation(value = "Bulk upload role functions for an partner application.", response = PortalRestResponse.class, responseContainer = "Json")
- @RequestMapping(value = { "/upload/partner/roleFunctions" }, method = RequestMethod.POST, produces = "application/json")
- public PortalRestResponse<String> bulkUploadPartnerRoleFunctions(HttpServletRequest request, HttpServletResponse response, @RequestBody List<Role> upload) throws Exception {
+ @RequestMapping(value = {
+ "/upload/partner/roleFunctions" }, method = RequestMethod.POST, produces = "application/json")
+ public PortalRestResponse<String> bulkUploadPartnerRoleFunctions(HttpServletRequest request,
+ HttpServletResponse response, @RequestBody List<Role> upload) throws Exception {
try {
externalAccessRolesService.bulkUploadPartnerRoleFunctions(request.getHeader(UEBKEY), upload);
} catch (HttpClientErrorException e) {
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
logger.error(EELFLoggerDelegate.errorLogger, "bulkUploadRoles failed", e);
- return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "Failed to bulkUploadPartnerRoleFunctions", "Failed");
+ return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR,
+ "Failed to bulkUploadPartnerRoleFunctions", "Failed");
}
return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "Successfully added", "Success");
}
-
+
@ApiOperation(value = "Gets all functions along with global functions", response = List.class, responseContainer = "Json")
@RequestMapping(value = { "/menuFunctions" }, method = RequestMethod.GET, produces = "application/json")
- public List<String> getMenuFunctions(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public List<String> getMenuFunctions(HttpServletRequest request, HttpServletResponse response) throws Exception {
List<String> functionsList = null;
try {
functionsList = externalAccessRolesService.getMenuFunctionsList(request.getHeader(UEBKEY));
@@ -469,15 +533,15 @@ public class ExternalAccessRolesController implements BasicAuthenticationControl
}
return functionsList;
}
-
-
+
@ApiOperation(value = "Gets all active Users of application", response = String.class, responseContainer = "Json")
@RequestMapping(value = { "/users" }, method = RequestMethod.GET, produces = "application/json")
- public List<EcompUser> getUsersOfApplication(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public List<EcompUser> getUsersOfApplication(HttpServletRequest request, HttpServletResponse response)
+ throws Exception {
List<EcompUser> users = null;
try {
users = externalAccessRolesService.getAllAppUsers(request.getHeader(UEBKEY));
- } catch (Exception e) {
+ } catch (Exception e) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
logger.error(EELFLoggerDelegate.errorLogger, "getUsersOfApplication failed", e);
throw new Exception(e.getMessage());
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulController.java
index ac1b9254..c30b41a7 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ExternalAppsRestfulController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/FunctionalMenuController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/FunctionalMenuController.java
index 21a6e8ef..5243cad3 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/FunctionalMenuController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/FunctionalMenuController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
@@ -102,8 +120,7 @@ public class FunctionalMenuController extends EPRestrictedBaseController {
functionalMenuService.assignHelpURLs(menuItems);
EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/functionalMenu", "result =", menuItems);
} catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger,
- "Exception occurred while calling functionalMenu. Details: " + EcompPortalUtils.getStackTrace(e));
+ logger.error(EELFLoggerDelegate.errorLogger, "getMenuItems failed", e);
}
return menuItems;
}
@@ -132,9 +149,9 @@ public class FunctionalMenuController extends EPRestrictedBaseController {
}
/**
- * RESTful service method to fetch all the FunctionalMenuItems, both active
- * and inactive, for the EditFunctionalMenu feature. Can only be accessed by
- * the portal admin.
+ * RESTful service method to fetch all the FunctionalMenuItems, both active and
+ * inactive, for the EditFunctionalMenu feature. Can only be accessed by the
+ * portal admin.
*
* @param request
* HttpServletRequest
@@ -157,16 +174,14 @@ public class FunctionalMenuController extends EPRestrictedBaseController {
EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/functionalMenuForEditing", "result =",
menuItems);
} catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger,
- "Exception occurred while calling functionalMenuForEditing. Details: "
- + EcompPortalUtils.getStackTrace(e));
+ logger.error(EELFLoggerDelegate.errorLogger, "getMenuItemsForEditing failed", e);
}
return menuItems;
}
/**
- * RESTful service method to fetch all the FunctionalMenuItems, active , for
- * the Functional menu in notification Tree feature.
+ * RESTful service method to fetch all the FunctionalMenuItems, active , for the
+ * Functional menu in notification Tree feature.
*
* @param request
* HttpServletRequest
@@ -186,21 +201,17 @@ public class FunctionalMenuController extends EPRestrictedBaseController {
EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/functionalMenuForNotificationTree", "result =",
menuItems);
} catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger,
- "Exception occurred while calling functionalMenuForNotifications. Details: "
- + EcompPortalUtils.getStackTrace(e));
+ logger.error(EELFLoggerDelegate.errorLogger, "getMenuItemsForNotifications failed", e);
}
return menuItems;
}
/**
- * RESTful service method to fetch all FunctionalMenuItems associated with
- * an application.
+ * RESTful service method to fetch all FunctionalMenuItems associated with an
+ * application.
*
* @param request
* HttpServletRequest
- * @param response
- * HttpServletResponse
* @param appId
* application ID
* @return List of FunctionalMenuItem objects
@@ -217,16 +228,14 @@ public class FunctionalMenuController extends EPRestrictedBaseController {
EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/functionalMenuForApp/" + appId, "result =",
menuItems);
} catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger,
- "Exception occurred while calling functionalMenuForApp. Details: "
- + EcompPortalUtils.getStackTrace(e));
+ logger.error(EELFLoggerDelegate.errorLogger, "getMenuItemsForApp failed", e);
}
return menuItems;
}
/**
- * RESTful service method to fetch all FunctionalMenuItems associated with
- * the applications and roles that a user has access to.
+ * RESTful service method to fetch all FunctionalMenuItems associated with the
+ * applications and roles that a user has access to.
*
* @param request
* HttpServletRequest
@@ -246,17 +255,15 @@ public class FunctionalMenuController extends EPRestrictedBaseController {
EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/functionalMenuForUser/" + orgUserId, "result =",
menuItems);
} catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger,
- "Exception occurred while calling functionalMenuForUser. Details: "
- + EcompPortalUtils.getStackTrace(e));
+ logger.error(EELFLoggerDelegate.errorLogger, "getMenuItemsForUser failed", e);
}
return menuItems;
}
/**
- * RESTful service method to fetch all FunctionalMenuItems associated with
- * the applications and roles that the authenticated user has access to.
+ * RESTful service method to fetch all FunctionalMenuItems associated with the
+ * applications and roles that the authenticated user has access to.
*
* @param request
* HttpServletRequest
@@ -284,9 +291,7 @@ public class FunctionalMenuController extends EPRestrictedBaseController {
}
functionalMenuService.assignHelpURLs(menuItems);
} catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger,
- "Exception occurred while calling getMenuItemsForAuthUser. Details: "
- + EcompPortalUtils.getStackTrace(e));
+ logger.error(EELFLoggerDelegate.errorLogger, "getMenuItemsForAuthUser failed", e);
}
return menuItems;
}
@@ -320,9 +325,7 @@ public class FunctionalMenuController extends EPRestrictedBaseController {
"result =", menuItem);
}
} catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger,
- "Exception occurred while calling functionalMenuItemDetails. Details: "
- + EcompPortalUtils.getStackTrace(e));
+ logger.error(EELFLoggerDelegate.errorLogger, "getFunctionalMenuItemDetails failed", e);
}
return menuItem;
@@ -471,8 +474,8 @@ public class FunctionalMenuController extends EPRestrictedBaseController {
}
/**
- * RESTful service to get favorites for the current user as identified in
- * the session
+ * RESTful service to get favorites for the current user as identified in the
+ * session
*
* @param request
* HttpServletRequest
@@ -523,8 +526,8 @@ public class FunctionalMenuController extends EPRestrictedBaseController {
* user ID, email and last-login. (Actually has nothing to do with the real
* functional menu.) First attempts to get the information from the Tomcat
* session (i.e., the CSP cookie); if that fails, calls the shared context
- * service to read the information from the database. Gives back what it
- * found, any of which may be null, as a JSON collection.
+ * service to read the information from the database. Gives back what it found,
+ * any of which may be null, as a JSON collection.
*
* @param request
* HttpServletRequest
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/GetAccessController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/GetAccessController.java
index 7856dc43..71f745a9 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/GetAccessController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/GetAccessController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
@@ -47,10 +65,10 @@ import org.openecomp.portalapp.util.EPUserUtils;
@EPAuditLog
public class GetAccessController extends EPUnRestrictedBaseController {
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(GetAccessController.class);
+ private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(GetAccessController.class);
@Autowired
- GetAccessService getAccessService;
+ private GetAccessService getAccessService;
/**
* Sorts the list by ECOMP function name.
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/HealthCheckController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/HealthCheckController.java
index ee5e5eea..ddb3a315 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/HealthCheckController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/HealthCheckController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
@@ -52,6 +70,8 @@ import com.google.gson.Gson;
@EPAuditLog
public class HealthCheckController extends EPUnRestrictedBaseController {
+ private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HealthCheckController.class);
+
private class HealthStatus {
public int statusCode;
@SuppressWarnings("unused")
@@ -97,8 +117,6 @@ public class HealthCheckController extends EPUnRestrictedBaseController {
private final String statusDown = "DOWN";
private final String statusOk = "OK";
- private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HealthCheckController.class);
-
@RequestMapping(value = { "/portalApi/healthCheck" }, method = RequestMethod.GET, produces = "application/json")
public HealthStatus healthCheck(HttpServletRequest request, HttpServletResponse response) {
HealthStatus healthStatus = new HealthStatus(500, "");
@@ -187,9 +205,7 @@ public class HealthCheckController extends EPUnRestrictedBaseController {
}
MDC.put(EPCommonSystemProperties.RESPONSE_CODE, Integer.toString(healthStatus.statusCode));
} catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger,
- "Exception occurred while performing the healthcheck. Details: "
- + EcompPortalUtils.getStackTrace(e));
+ logger.error(EELFLoggerDelegate.errorLogger, "healthCheck failed", e);
}
EcompPortalUtils.logAndSerializeObject(logger, "/portalApi/healthCheck", "GET result =", response.getStatus());
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ManifestController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ManifestController.java
index 7b4d51f5..a40c3dc0 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ManifestController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/ManifestController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
@@ -55,12 +73,13 @@ public class ManifestController extends RestrictedBaseController {
private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ManifestController.class);
@Autowired
- ManifestService manifestService;
+ private ManifestService manifestService;
/**
* Gets the webapp manifest contents as a JSON object.
*
* @param request
+ * HttpServletRequest
* @return A map of key-value pairs. On success:
*
* <pre>
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceController.java
index 42a62b5f..44e3223e 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceProxyController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceProxyController.java
index 6313822a..8655deb0 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceProxyController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/MicroserviceProxyController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
@@ -38,21 +56,19 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.HttpClientErrorException;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-@SuppressWarnings("unchecked")
@RestController
@org.springframework.context.annotation.Configuration
@EnableAspectJAutoProxy
@EPAuditLog
public class MicroserviceProxyController extends EPUnRestrictedBaseController {
+ private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MicroserviceProxyController.class);
+
@Autowired
private MicroserviceProxyService microserviceProxyService;
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MicroserviceProxyController.class);
-
@RequestMapping(value = { "/portalApi/microservice/proxy/{serviceId}" }, method = {
RequestMethod.GET }, produces = "application/json")
public String getMicroserviceProxy(HttpServletRequest request, HttpServletResponse response,
@@ -92,6 +108,7 @@ public class MicroserviceProxyController extends EPUnRestrictedBaseController {
mapper.readTree(response);
return true;
} catch (IOException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, "isValidJSON failed", e);
return false;
}
}
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PolicyController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PolicyController.java
index 5f691d2d..2fb5e9ad 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PolicyController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PolicyController.java
@@ -1,24 +1,42 @@
/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
+ *
+ * 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.controller;
+package org.openecomp.portalapp.portal.controller;
import java.util.UUID;
@@ -37,11 +55,6 @@ import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.openecomp.portalsdk.core.util.SystemProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
-/*import org.openecomp.vid.policy.PolicyProperties;
-import org.openecomp.vid.policy.PolicyResponseWrapper;
-import org.openecomp.vid.policy.PolicyRestInterfaceFactory;
-import org.openecomp.vid.policy.PolicyRestInterfaceIfc;
-import org.openecomp.vid.policy.PolicyUtil;*/
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
@@ -49,8 +62,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
-
-
/**
* Controller to handle Policy requests.
*/
@@ -60,46 +71,51 @@ import org.springframework.web.bind.annotation.RestController;
@Configuration
@EnableAspectJAutoProxy
@EPAuditLog
-public class PolicyController implements BasicAuthenticationController{
-
+public class PolicyController implements BasicAuthenticationController {
+
/** The logger. */
- static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PolicyController.class);
-
- @RequestMapping(value="/get_policy",method = RequestMethod.POST)
- public ResponseEntity<String> getPolicyInfo( HttpServletRequest request, @RequestBody JSONObject policy_request) throws Exception {
-
- logger.debug(EELFLoggerDelegate.debugLogger, "#####################POLICY API CALL STARTED ###############"+ PolicyProperties.POLICY_GET_CONFIG_VAL);
- logger.debug(EELFLoggerDelegate.debugLogger, "#####################Policy Request ###############"+policy_request.toString());
+ private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PolicyController.class);
+
+ @RequestMapping(value = "/get_policy", method = RequestMethod.POST)
+ public ResponseEntity<String> getPolicyInfo(HttpServletRequest request, @RequestBody JSONObject policy_request)
+ throws Exception {
+
+ logger.debug(EELFLoggerDelegate.debugLogger, "#####################POLICY API CALL STARTED ###############"
+ + PolicyProperties.POLICY_GET_CONFIG_VAL);
+ logger.debug(EELFLoggerDelegate.debugLogger,
+ "#####################Policy Request ###############" + policy_request.toString());
String path = SystemProperties.getProperty(PolicyProperties.POLICY_GET_CONFIG_VAL);
- PolicyResponseWrapper policyResWrapper = getPolicyConfig(policy_request,path);
-
- logger.debug(EELFLoggerDelegate.debugLogger, "$$$$$$$$$$$$$$$$$$$$$$ " + new ResponseEntity<String>(policyResWrapper.getResponse(), HttpStatus.OK).toString());
+ PolicyResponseWrapper policyResWrapper = getPolicyConfig(policy_request, path);
+
+ logger.debug(EELFLoggerDelegate.debugLogger, "$$$$$$$$$$$$$$$$$$$$$$ "
+ + new ResponseEntity<String>(policyResWrapper.getResponse(), HttpStatus.OK).toString());
- return ( new ResponseEntity<String>(policyResWrapper.getResponse(), HttpStatus.valueOf(policyResWrapper.getStatus())) );
+ return (new ResponseEntity<String>(policyResWrapper.getResponse(),
+ HttpStatus.valueOf(policyResWrapper.getStatus())));
}
-
+
protected static PolicyResponseWrapper getPolicyConfig(JSONObject request, String path) throws Exception {
String methodName = "getPolicyConfig";
String uuid = UUID.randomUUID().toString();
- logger.debug(EELFLoggerDelegate.debugLogger, "starting getPolicyConfig ");
+ logger.debug(EELFLoggerDelegate.debugLogger, "starting getPolicyConfig ");
try {
- //STARTING REST API CALL AS AN FACTORY INSTACE
- PolicyRestInterfaceIfc policyRestController = PolicyRestInterfaceFactory.getInstance();
-
+ // STARTING REST API CALL AS AN FACTORY INSTACE
+ PolicyRestInterfaceIfc policyRestController = PolicyRestInterfaceFactory.getInstance();
+
RestObject<String> restObjStr = new RestObject<String>();
String str = new String();
restObjStr.set(str);
- policyRestController.<String>Post(str, request, uuid, path, restObjStr );
- PolicyResponseWrapper policyRespWrapper = PolicyUtil.wrapResponse (restObjStr);
+ policyRestController.<String>Post(str, request, uuid, path, restObjStr);
+ PolicyResponseWrapper policyRespWrapper = PolicyUtil.wrapResponse(restObjStr);
logger.debug(EELFLoggerDelegate.debugLogger, "<== " + methodName + " w=" + policyRespWrapper.getResponse());
return policyRespWrapper;
- } catch (Exception e) {
- logger.debug(EELFLoggerDelegate.debugLogger, "EXCEPTION in getPolicyConfig <== " + "." + methodName + e.toString());
+ } catch (Exception e) {
+ logger.debug(EELFLoggerDelegate.debugLogger,
+ "EXCEPTION in getPolicyConfig <== " + "." + methodName + e.toString());
throw e;
}
}
}
-
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java
index 7bb6c45d..29c3aed4 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/PortalAdminController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
@@ -24,19 +42,6 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.EnableAspectJAutoProxy;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import org.openecomp.portalsdk.core.domain.AuditLog;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.portalsdk.core.service.AuditService;
-import org.openecomp.portalsdk.core.util.SystemProperties;
import org.openecomp.portalapp.controller.EPRestrictedBaseController;
import org.openecomp.portalapp.portal.domain.EPRole;
import org.openecomp.portalapp.portal.domain.EPUser;
@@ -51,6 +56,18 @@ import org.openecomp.portalapp.portal.transport.PortalAdmin;
import org.openecomp.portalapp.portal.utils.EPCommonSystemProperties;
import org.openecomp.portalapp.portal.utils.EcompPortalUtils;
import org.openecomp.portalapp.util.EPUserUtils;
+import org.openecomp.portalsdk.core.domain.AuditLog;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.service.AuditService;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
@RestController
@org.springframework.context.annotation.Configuration
@@ -89,8 +106,11 @@ public class PortalAdminController extends EPRestrictedBaseController {
/**
* RESTful service method to create a new portal admin. Requirement: you
* must be the Ecomp portal super admin user.
+ * @param request
+ * @param userId
+ * @param response
+ * @return FieldsValidator
*/
-
@RequestMapping(value = { "/portalApi/portalAdmin" }, method = RequestMethod.POST)
public FieldsValidator createPortalAdmin(HttpServletRequest request, @RequestBody String userId,
HttpServletResponse response) {
@@ -201,9 +221,7 @@ public class PortalAdminController extends EPRestrictedBaseController {
rolesByApp = adminRolesService.getRolesByApp(user, appId);
}
} catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger,
- "Exception occurred while performing getRolesByApp operation, Details: "
- + EcompPortalUtils.getStackTrace(e));
+ logger.error(EELFLoggerDelegate.errorLogger, "getRolesByApp failed", e);
}
return rolesByApp;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RoleManageController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RoleManageController.java
index 02f237d7..7c4a4e8d 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RoleManageController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RoleManageController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RolesApprovalSystemController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RolesApprovalSystemController.java
index 3dba301a..c9abc3b0 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RolesApprovalSystemController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/RolesApprovalSystemController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SchedulerController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SchedulerController.java
index 54e95ae0..c2d54c6b 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SchedulerController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SchedulerController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SharedContextRestController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SharedContextRestController.java
index 08a0d49b..352912aa 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SharedContextRestController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/SharedContextRestController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/TicketEventController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/TicketEventController.java
index 7a5196ca..76154c6a 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/TicketEventController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/TicketEventController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserController.java
index 4cf7ca63..0db19e1c 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserController.java
@@ -1,3 +1,40 @@
+/*-
+ * ============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
+ *
+ * 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.controller;
import javax.servlet.http.HttpServletRequest;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserNotificationController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserNotificationController.java
index 24b698e8..3b5ba0c7 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserNotificationController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserNotificationController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRolesController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRolesController.java
index c5cd5c90..b907909e 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRolesController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/UserRolesController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.
+ * ============LICENSE_START==========================================
+ * ONAP Portal SDK
+ * ===================================================================
+ * 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.controller;
@@ -416,9 +434,7 @@ public class UserRolesController extends EPRestrictedBaseController {
List<UserApplicationRoles> appUsers = userRolesService.getUsersFromAppEndpoint(appId);
return appUsers;
} catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger,
- "Exception occurred while performing UserRolesController.getUsersFromAppEndpoint. Details: "
- + EcompPortalUtils.getStackTrace(e));
+ logger.error(EELFLoggerDelegate.errorLogger, "getUsersFromAppEndpoint failed", e);
return new ArrayList<UserApplicationRoles>();
}
}
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppController.java
index 44a5dcdf..23b0e49e 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WebAnalyticsExtAppController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogController.java
index 84150b54..229ef1f3 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;
@@ -44,7 +62,6 @@ import org.openecomp.portalapp.portal.logging.aop.EPAuditLog;
import org.openecomp.portalapp.portal.service.ConsulHealthService;
import org.openecomp.portalapp.portal.service.MicroserviceService;
import org.openecomp.portalapp.portal.service.WidgetParameterService;
-import org.openecomp.portalapp.portal.utils.CustomLoggingFilter;
import org.openecomp.portalapp.portal.utils.EcompPortalUtils;
import org.openecomp.portalapp.util.EPUserUtils;
import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
@@ -78,9 +95,13 @@ import org.springframework.web.multipart.commons.CommonsMultipartResolver;
@EPAuditLog
public class WidgetsCatalogController extends EPRestrictedBaseController {
- EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetsCatalogController.class);
- RestTemplate template = new RestTemplate();
- String whatService = "widgets-service";
+ private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetsCatalogController.class);
+
+ private static final String MS_WIDGET_LOCAL_PORT = "microservices.widget.local.port";
+
+ private RestTemplate template = new RestTemplate();
+
+ private String whatService = "widgets-service";
@Autowired
private ConsulHealthService consulHealthService;
@@ -99,26 +120,24 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
static {
// for localhost testing only
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(new javax.net.ssl.HostnameVerifier() {
-
public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
- if (hostname.equals("localhost")) {
+ if ("localhost".equals(hostname))
return true;
- }
return false;
}
- });
+ });
}
@RequestMapping(value = { "/portalApi/microservices/widgetCatalog/{loginName}" }, method = RequestMethod.GET)
- public List<WidgetCatalog> getUserWidgetCatalog(HttpServletRequest request, HttpServletResponse response,
- @PathVariable("loginName") String loginName) throws RestClientException, Exception {
+ public List<WidgetCatalog> getUserWidgetCatalog(@PathVariable("loginName") String loginName) {
List<WidgetCatalog> widgets = new ArrayList<>();
- try {CustomLoggingFilter d;
- ResponseEntity<ArrayList> ans = template.exchange(
- EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
- SystemProperties.getProperty("microservices.widget.local.port"))
+ try {
+ ResponseEntity<List> ans = template.exchange(
+ EcompPortalUtils.widgetMsProtocol() + "://"
+ + consulHealthService.getServiceLocation(whatService,
+ SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT))
+ "/widget/microservices/widgetCatalog/" + loginName,
- HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), ArrayList.class);
+ HttpMethod.GET, new HttpEntity<>(WidgetServiceHeaders.getInstance()), List.class);
widgets = ans.getBody();
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "getUserWidgetCatalog failed", e);
@@ -130,17 +149,15 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
}
@RequestMapping(value = { "/portalApi/microservices/widgetCatalog" }, method = RequestMethod.GET)
- public List<WidgetCatalog> getWidgetCatalog(HttpServletRequest request, HttpServletResponse response)
- throws RestClientException, Exception {
+ public List<WidgetCatalog> getWidgetCatalog() {
List<WidgetCatalog> widgets = new ArrayList<>();
-
- String p = EcompPortalUtils.widgetMsProtocol();
try {
- ResponseEntity<ArrayList> ans = template.exchange(
- EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
- SystemProperties.getProperty("microservices.widget.local.port"))
+ ResponseEntity<List> ans = template.exchange(
+ EcompPortalUtils.widgetMsProtocol() + "://"
+ + consulHealthService.getServiceLocation(whatService,
+ SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT))
+ "/widget/microservices/widgetCatalog",
- HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), ArrayList.class);
+ HttpMethod.GET, new HttpEntity<>(WidgetServiceHeaders.getInstance()), List.class);
widgets = ans.getBody();
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "getWidgetCatalog failed", e);
@@ -153,52 +170,55 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
@RequestMapping(value = {
"/portalApi/microservices/widgetCatalog/{widgetId}" }, method = RequestMethod.PUT, produces = "application/json")
- public void updateWidgetCatalog(HttpServletRequest request, HttpServletResponse response,
- @RequestBody WidgetCatalog newWidgetCatalog, @PathVariable("widgetId") long widgetId)
- throws RestClientException, Exception {
+ public void updateWidgetCatalog(@RequestBody WidgetCatalog newWidgetCatalog, @PathVariable("widgetId") long widgetId) throws Exception {
template.exchange(
- EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
- SystemProperties.getProperty("microservices.widget.local.port"))
+ EcompPortalUtils.widgetMsProtocol() + "://"
+ + consulHealthService.getServiceLocation(whatService,
+ SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT))
+ "/widget/microservices/widgetCatalog/" + widgetId,
- HttpMethod.PUT, new HttpEntity(newWidgetCatalog, WidgetServiceHeaders.getInstance()), String.class);
+ HttpMethod.PUT, new HttpEntity<>(newWidgetCatalog, WidgetServiceHeaders.getInstance()), String.class);
}
@RequestMapping(value = { "/portalApi/microservices/widgetCatalog/{widgetId}" }, method = RequestMethod.DELETE)
- public void deleteOnboardingWidget(HttpServletRequest request, HttpServletResponse response,
- @PathVariable("widgetId") long widgetId) throws RestClientException, Exception {
+ public void deleteOnboardingWidget(@PathVariable("widgetId") long widgetId) throws Exception {
template.exchange(
- EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
- SystemProperties.getProperty("microservices.widget.local.port"))
+ EcompPortalUtils.widgetMsProtocol() + "://"
+ + consulHealthService.getServiceLocation(whatService,
+ SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT))
+ "/widget/microservices/widgetCatalog/" + widgetId,
- HttpMethod.DELETE, new HttpEntity(WidgetServiceHeaders.getInstance()), String.class);
+ HttpMethod.DELETE, new HttpEntity<>(WidgetServiceHeaders.getInstance()), String.class);
}
@RequestMapping(value = { "/portalApi/microservices/widgetCatalog/{widgetId}" }, method = RequestMethod.POST)
- public String updateWidgetCatalogWithFiles(HttpServletRequest request, HttpServletResponse response,
+ public String updateWidgetCatalogWithFiles(HttpServletRequest request,
@PathVariable("widgetId") long widgetId) throws RestClientException, Exception {
MultipartHttpServletRequest mRequest;
MultiValueMap<String, Object> multipartRequest = new LinkedMultiValueMap<>();
String fileName;
- String tmp_folder = "/tmp/";
+ String tmpFolderName = "/tmp/";
String respond = null;
FileOutputStream fo = null;
try {
mRequest = (MultipartHttpServletRequest) request;
MultipartFile mFile = mRequest.getFile("file");
fileName = mFile.getOriginalFilename();
- fo = new FileOutputStream(tmp_folder + fileName);
+ fo = new FileOutputStream(tmpFolderName + fileName);
fo.write(mFile.getBytes());
+ // silence sonar scan by calling close here
+ fo.close();
+ fo = null;
HttpHeaders header = new HttpHeaders();
header.setContentType(MediaType.MULTIPART_FORM_DATA);
- multipartRequest.add("file", new FileSystemResource(tmp_folder + fileName));
+ multipartRequest.add("file", new FileSystemResource(tmpFolderName + fileName));
multipartRequest.add("widget", request.getParameter("newWidget"));
respond = template.postForObject(
- EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
- SystemProperties.getProperty("microservices.widget.local.port"))
+ EcompPortalUtils.widgetMsProtocol() + "://"
+ + consulHealthService.getServiceLocation(whatService,
+ SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT))
+ "/widget/microservices/widgetCatalog/" + widgetId,
new HttpEntity<>(multipartRequest, WidgetServiceHeaders.getInstance()), String.class);
- File f = new File(tmp_folder + fileName);
+ File f = new File(tmpFolderName + fileName);
f.delete();
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "updateWidgetCatalogWithFiles failed", e);
@@ -214,32 +234,36 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
}
@RequestMapping(value = { "/portalApi/microservices/widgetCatalog" }, method = RequestMethod.POST)
- public String createWidgetCatalog(HttpServletRequest request, HttpServletResponse response)
- throws RestClientException, Exception {
+ public String createWidgetCatalog(HttpServletRequest request)
+ throws Exception {
MultipartHttpServletRequest mRequest;
MultiValueMap<String, Object> multipartRequest = new LinkedMultiValueMap<>();
String fileName;
- String tmp_folder = "/tmp/";
+ String tmpFolderName = "/tmp/";
String respond = null;
FileOutputStream fo = null;
try {
mRequest = (MultipartHttpServletRequest) request;
MultipartFile mFile = mRequest.getFile("file");
fileName = mFile.getOriginalFilename();
- fo = new FileOutputStream(tmp_folder + fileName);
+ fo = new FileOutputStream(tmpFolderName + fileName);
fo.write(mFile.getBytes());
+ // silence sonar scan by calling close here
+ fo.close();
+ fo = null;
HttpHeaders header = new HttpHeaders();
header.setContentType(MediaType.MULTIPART_FORM_DATA);
- multipartRequest.add("file", new FileSystemResource(tmp_folder + fileName));
+ multipartRequest.add("file", new FileSystemResource(tmpFolderName + fileName));
multipartRequest.add("widget", request.getParameter("newWidget"));
respond = template.postForObject(
- EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
- SystemProperties.getProperty("microservices.widget.local.port"))
+ EcompPortalUtils.widgetMsProtocol() + "://"
+ + consulHealthService.getServiceLocation(whatService,
+ SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT))
+ "/widget/microservices/widgetCatalog",
new HttpEntity<>(multipartRequest, WidgetServiceHeaders.getInstance()), String.class);
- File f = new File(tmp_folder + fileName);
+ File f = new File(tmpFolderName + fileName);
f.delete();
} catch (Exception e) {
logger.error(EELFLoggerDelegate.errorLogger, "createWidgetCatalog failed", e);
@@ -255,46 +279,44 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
}
@RequestMapping(value = "/portalApi/microservices/{widgetId}/framework.js", method = RequestMethod.GET)
- public String getWidgetFramework(HttpServletRequest request, HttpServletResponse response,
- @PathVariable("widgetId") long widgetId) throws RestClientException, Exception {
+ public String getWidgetFramework(@PathVariable("widgetId") long widgetId) throws Exception {
return template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://"
+ consulHealthService.getServiceLocation(whatService,
- SystemProperties.getProperty("microservices.widget.local.port"))
+ SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT))
+ "/widget/microservices/" + widgetId + "/framework.js", String.class,
WidgetServiceHeaders.getInstance());
}
@RequestMapping(value = "/portalApi/microservices/{widgetId}/controller.js", method = RequestMethod.GET)
- public String getWidgetController(HttpServletRequest request, HttpServletResponse response,
- @PathVariable("widgetId") long widgetId) throws RestClientException, Exception {
+ public String getWidgetController(@PathVariable("widgetId") long widgetId) throws Exception {
return template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://"
+ consulHealthService.getServiceLocation(whatService,
- SystemProperties.getProperty("microservices.widget.local.port"))
+ SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT))
+ "/widget/microservices/" + widgetId + "/controller.js", String.class,
WidgetServiceHeaders.getInstance());
}
@RequestMapping(value = "/portalApi/microservices/{widgetId}/style.css", method = RequestMethod.GET)
- public String getWidgetCSS(HttpServletRequest request, HttpServletResponse response,
- @PathVariable("widgetId") long widgetId) throws RestClientException, Exception {
+ public String getWidgetCSS(@PathVariable("widgetId") long widgetId) throws Exception {
return template.getForObject(EcompPortalUtils.widgetMsProtocol() + "://"
+ consulHealthService.getServiceLocation(whatService,
- SystemProperties.getProperty("microservices.widget.local.port"))
+ SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT))
+ "/widget/microservices/" + widgetId + "/styles.css", String.class,
WidgetServiceHeaders.getInstance());
}
@RequestMapping(value = { "/portalApi/microservices/parameters/{widgetId}" }, method = RequestMethod.GET)
public PortalRestResponse<List<WidgetParameterResult>> getWidgetParameterResult(HttpServletRequest request,
- HttpServletResponse response, @PathVariable("widgetId") long widgetId) throws Exception {
+ @PathVariable("widgetId") long widgetId) throws Exception {
EPUser user = EPUserUtils.getUserSession(request);
List<WidgetParameterResult> list = new ArrayList<>();
Long serviceId = template.exchange(
- EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
- SystemProperties.getProperty("microservices.widget.local.port"))
+ EcompPortalUtils.widgetMsProtocol() + "://"
+ + consulHealthService.getServiceLocation(whatService,
+ SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT))
+ "/widget/microservices/widgetCatalog/parameters/" + widgetId,
- HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), Long.class).getBody();
+ HttpMethod.GET, new HttpEntity<>(WidgetServiceHeaders.getInstance()), Long.class).getBody();
if (serviceId == null) {
// return ok/sucess and no service parameter for this widget
return new PortalRestResponse<List<WidgetParameterResult>>(PortalRestStatusEnum.WARN,
@@ -302,46 +324,47 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
} else {
List<MicroserviceParameter> defaultParam = microserviceService.getParametersById(serviceId);
for (MicroserviceParameter param : defaultParam) {
- WidgetParameterResult user_result = new WidgetParameterResult();
- user_result.setParam_id(param.getId());
- user_result.setDefault_value(param.getPara_value());
- user_result.setParam_key(param.getPara_key());
+ WidgetParameterResult userResult = new WidgetParameterResult();
+ userResult.setParam_id(param.getId());
+ userResult.setDefault_value(param.getPara_value());
+ userResult.setParam_key(param.getPara_key());
WidgetCatalogParameter userValue = widgetParameterService.getUserParamById(widgetId, user.getId(),
param.getId());
if (userValue == null)
- user_result.setUser_value(param.getPara_value());
+ userResult.setUser_value(param.getPara_value());
else {
- user_result.setUser_value(userValue.getUser_value());
+ userResult.setUser_value(userValue.getUser_value());
}
- list.add(user_result);
+ list.add(userResult);
}
}
return new PortalRestResponse<List<WidgetParameterResult>>(PortalRestStatusEnum.OK, "SUCCESS", list);
}
@RequestMapping(value = { "/portalApi/microservices/services/{paramId}" }, method = RequestMethod.GET)
- public List<WidgetCatalogParameter> getUserParameterById(HttpServletRequest request, HttpServletResponse response,
- @PathVariable("paramId") long paramId) throws Exception {
+ public List<WidgetCatalogParameter> getUserParameterById( @PathVariable("paramId") long paramId) {
List<WidgetCatalogParameter> list = widgetParameterService.getUserParameterById(paramId);
return list;
}
@RequestMapping(value = { "/portalApi/microservices/services/{paramId}" }, method = RequestMethod.DELETE)
- public void deleteUserParameterById(HttpServletRequest request, HttpServletResponse response,
- @PathVariable("paramId") long paramId) throws Exception {
+ public void deleteUserParameterById(@PathVariable("paramId") long paramId) {
widgetParameterService.deleteUserParameterById(paramId);
}
@RequestMapping(value = { "/portalApi/microservices/download/{widgetId}" }, method = RequestMethod.GET)
public void doDownload(HttpServletRequest request, HttpServletResponse response,
- @PathVariable("widgetId") long widgetId) throws RestClientException, Exception {
+ @PathVariable("widgetId") long widgetId) throws Exception {
ServletContext context = request.getServletContext();
- byte[] byteFile = template.exchange(
- EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
- SystemProperties.getProperty("microservices.widget.local.port"))
- + "/widget/microservices/download/" + widgetId,
- HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), byte[].class).getBody();
+ byte[] byteFile = template
+ .exchange(
+ EcompPortalUtils.widgetMsProtocol() + "://"
+ + consulHealthService.getServiceLocation(whatService,
+ SystemProperties.getProperty(MS_WIDGET_LOCAL_PORT))
+ + "/widget/microservices/download/" + widgetId,
+ HttpMethod.GET, new HttpEntity<>(WidgetServiceHeaders.getInstance()), byte[].class)
+ .getBody();
File downloadFile = File.createTempFile("temp", ".zip");
FileOutputStream stream = new FileOutputStream(downloadFile.getPath());
@@ -363,7 +386,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
OutputStream outStream = response.getOutputStream();
byte[] buffer = new byte[32 * 1024];
- int bytesRead = -1;
+ int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
outStream.write(buffer, 0, bytesRead);
}
@@ -373,8 +396,8 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
}
@RequestMapping(value = { "/portalApi/microservices/parameters" }, method = RequestMethod.POST)
- public PortalRestResponse<String> saveWidgetParameter(HttpServletRequest request, HttpServletResponse response,
- @RequestBody WidgetCatalogParameter widgetParameters) throws Exception {
+ public PortalRestResponse<String> saveWidgetParameter(HttpServletRequest request,
+ @RequestBody WidgetCatalogParameter widgetParameters) {
EPUser user = EPUserUtils.getUserSession(request);
widgetParameters.setUserId(user.getId());
try {
@@ -386,6 +409,7 @@ public class WidgetsCatalogController extends EPRestrictedBaseController {
widgetParameterService.saveUserParameter(widgetParameters);
} catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "saveWidgetParameter failed", e);
return new PortalRestResponse<String>(PortalRestStatusEnum.ERROR, "FAILURE", e.getMessage());
}
return new PortalRestResponse<String>(PortalRestStatusEnum.OK, "SUCCESS", "");
diff --git a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupController.java b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupController.java
index e8bd9622..aefc3d07 100644
--- a/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupController.java
+++ b/ecomp-portal-BE-common/src/main/java/org/openecomp/portalapp/portal/controller/WidgetsCatalogMarkupController.java
@@ -1,21 +1,39 @@
/*-
- * ================================================================================
- * 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.controller;