summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-BE-common/src/main
diff options
context:
space:
mode:
authorSudarshan Kumar <sudarshan.kumar@att.com>2020-07-27 19:48:32 +0530
committerSudarshan Kumar <sudarshan.kumar@att.com>2020-07-27 19:50:14 +0530
commitc1cda6283174db9ab610ce7142222c8a00be5bc9 (patch)
tree004faa0fdad9939f02fc1c2d634415a65ba678ed /ecomp-portal-BE-common/src/main
parent7945565f9363846d0a8864217c2f77401960208c (diff)
App Onboarding - Delete app not working
App Onboarding - Delete app not working Issue-ID: PORTAL-963 Change-Id: I6ec10fc4266b4d66d5393925411a90d0245b3e72 Signed-off-by: Sudarshan Kumar <sudarshan.kumar@att.com>
Diffstat (limited to 'ecomp-portal-BE-common/src/main')
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAppCommonServiceImpl.java11
-rw-r--r--ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml7
2 files changed, 18 insertions, 0 deletions
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAppCommonServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAppCommonServiceImpl.java
index 54510d2c..a4463c7f 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAppCommonServiceImpl.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/EPAppCommonServiceImpl.java
@@ -75,6 +75,7 @@ import org.onap.portalapp.portal.domain.EPUserAppsManualSortPreference;
import org.onap.portalapp.portal.domain.EPUserAppsSortPreference;
import org.onap.portalapp.portal.domain.EPWidgetsManualSortPreference;
import org.onap.portalapp.portal.domain.EcompApp;
+import org.onap.portalapp.portal.domain.MicroserviceData;
import org.onap.portalapp.portal.domain.UserRole;
import org.onap.portalapp.portal.domain.UserRoles;
import org.onap.portalapp.portal.ecomp.model.AppCatalogItem;
@@ -975,6 +976,16 @@ public class EPAppCommonServiceImpl implements EPAppService {
}
final Map<String, Long> params = new HashMap<>();
params.put("app_id", appid);
+
+ //Checking if App is associated with any exiting microservices- ep_microservice:
+ final Map<String, Long> queryparams = new HashMap<>();
+ queryparams.put("applicationId", appid);
+ List<MicroserviceData> microservicesList = dataAccessService.executeNamedQuery( "getMicroservicesByAppId", queryparams, null);
+ if(microservicesList!=null && microservicesList.size()>0) {
+ fieldsValidator.httpStatusCode = new Long(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
+ return fieldsValidator;
+ }
+
List<EPUserAppRolesRequest> EPUserAppRolesRequestList= new ArrayList<>();
EPUserAppRolesRequestList = dataAccessService.executeNamedQuery( "getRequestIdsForApp", params, null);
for(int i=0;i<EPUserAppRolesRequestList.size();i++)
diff --git a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml
index 5909036e..14156f46 100644
--- a/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml
+++ b/ecomp-portal-BE-common/src/main/webapp/WEB-INF/fusion/orm/EP.hbm.xml
@@ -2609,4 +2609,11 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
UPDATE fn_user fu SET fu.language_id=:language_id WHERE fu.login_id=:login_id
]]>
</sql-query>
+
+ <sql-query name="getMicroservicesByAppId">
+ <return alias="getMicroservicesByAppId" class="org.onap.portalapp.portal.domain.MicroserviceData" />
+ <![CDATA[
+ SELECT * FROM ep_microservice WHERE appId =:applicationId
+ ]]>
+ </sql-query>
</hibernate-mapping>