App Onboarding - Delete app not working
[portal.git] / ecomp-portal-BE-common / src / main / webapp / WEB-INF / fusion / orm / EP.hbm.xml
index 6017407..14156f4 100644 (file)
@@ -3,7 +3,7 @@
   ============LICENSE_START==========================================
   ONAP Portal
   ===================================================================
-  Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+  Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
   ===================================================================
  
   Unless otherwise specified, all software contained herein is licensed
  
   ============LICENSE_END============================================
  
-  ECOMP is a trademark and service mark of AT&T Intellectual Property.
+  
   -->
 <!DOCTYPE hibernate-mapping PUBLIC
         "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
         "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
 
-<!-- Publishes mappings and queries specific to the ECOMP Portal application. -->
+<!-- Publishes mappings and queries specific to the ONAP Portal application. -->
 <hibernate-mapping package="org.onap.portalapp.portal.domain">
 
+       <!-- multilanguage -->
+       <class name="Language" table="fn_language">
+               <id name="languageId" column="language_id">
+                       <generator class="native">
+                               <param name="sequence"></param>
+                       </generator>
+               </id>
+               <property name="languageName" column="language_name" />
+               <property name="languageAlias" column="language_alias" />
+       </class>
+       
+       <class name="DisplayText" table="fn_display_text">
+               <id name="id" column="id">
+                       <generator class="native">
+                               <param name="sequence"></param>
+                       </generator>
+               </id>
+               
+               <property name="languageId" column="language_id" />
+               <property name="textId" column="text_id" />
+               <property name="label" column="text_label" />
+       </class>
+
        <!-- Widget class mapping details -->
        <class name="Widget" table="FN_WIDGET">
                <id name="id" column="WIDGET_ID">
                <property name="createdId" column="created_id" />
                <property name="modifiedId" column="modified_id" />
                <property name="timeZoneId" column="timezone" />
+               <property name="systemUser" column="is_system_user" type="yes_no"/>
+               <property name="languageId" column="language_id" />
 
                <set name="EPUserApps" table="FN_USER_ROLE" lazy="false" sort="natural"
                        inverse="true">
                        <key-many-to-one name="role"
                                class="org.onap.portalapp.portal.domain.EPRole" column="role_id" />
                </composite-id>
-               <property name="priority" type="java.lang.Short">
-                       <column name="priority" precision="4" scale="0" />
+               <property name="priority">
+                       <column name="priority" default="1" precision="4" scale="0" />
                </property>
        </class>
 
                        <column name="app_name" not-null="true" default="?"></column>
                </property>
                <property name="imageUrl" column="app_image_url" />
-               <property name="description" column="app_description" />
-               <property name="notes" column="app_notes" />
-               <property name="url" column="app_url" />
-               <property name="alternateUrl" column="app_alternate_url" />
+               <property name="appDescription" column="app_description" />
+               <property name="appNotes" column="app_notes" />
+               <property name="landingPage" column="app_url" />
+               <property name="alternateLandingPage" column="app_alternate_url" />
                <property name="appRestEndpoint" column="app_rest_endpoint" />
                <property name="mlAppName" type="string">
                        <column name="ml_app_name" not-null="true" default="?"></column>
                        <column name="ml_app_admin_id" not-null="true" default="?"></column>
                </property>
                <property name="motsId" column="mots_id" />
-               <property name="appPassword" type="string">
+               <property name="appBasicAuthPassword" type="string">
                        <column name="app_password" not-null="true" default="?"></column>
                </property>
                <property name="thumbnail" column="thumbnail" />
-               <property name="username" type="string">
+               <property name="appBasicAuthUsername" type="string">
                        <column name="app_username" not-null="true" default="?"></column>
                </property>
                <property name="open" type="yes_no">
                <property name="appType" type="integer">
                        <column name="app_type"></column>
                </property>
-               <property name="centralAuth" type="yes_no">
+               <property name="rolesInAAF" type="yes_no">
                        <column name="auth_central"></column>
                </property>
                <property name="nameSpace" type="string">
                        <column name="auth_namespace"></column>
                </property>
+               <property name="modeOfIntegration" type="string">
+                       <column name="mode_of_integration"></column>
+               </property>
+               <property name="appAck" type="yes_no">
+                       <column name="ack_app"></column>
+               </property>
+               <property name="usesCadi" type="yes_no">
+                       <column name="uses_cadi"></column>
+               </property>
+
                <one-to-one name="contactUs" class="AppContactUs" cascade="save-update"></one-to-one>
 
        </class>
                </many-to-one>
        </class>
 
+       <!-- multilanguage -->
+       <query name="queryLanguage">
+               <![CDATA[
+                       from Language
+               ]]>
+       </query>
+       
+       <query name="displayText">
+               <![CDATA[
+                       from DisplayText where languageId = :language_id
+               ]]>
+       </query>
+       
+       <query name="queryLanguageByLanguageId">
+               <![CDATA[
+                       from Language where languageId = :language_id
+               ]]>
+       </query>
+       
+       <query name="getActiveUsersForApp">
+               <![CDATA[
+                       select distinct(u) from EPUser as u inner join fetch u.EPUserApps as apps inner join fetch apps.app as app inner join fetch apps.role as role where app.id = :id and u.active = :active and role.id is not null
+               ]]>
+       </query>
+
        <!-- show the current user plus related users -->
        <sql-query name="relatedUsers">
                <return-scalar column="org_user_id" type="java.lang.String" />
@@ -1117,7 +1177,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
        <sql-query name="getAppsAdmins">
                <return alias="adminUserApp" class="org.onap.portalapp.portal.domain.AdminUserApp" />   
        <![CDATA[
-       SELECT apps.APP_NAME, apps.APP_ID, user.USER_ID, user.FIRST_NAME, user.LAST_NAME, user.org_user_id FROM fn_user_role userrole INNER JOIN fn_user user ON user.USER_ID = userrole.USER_ID INNER JOIN fn_app apps ON apps.APP_ID = userrole.APP_ID  WHERE user.active_yn='Y' AND userrole.ROLE_ID = :accountAdminRoleId AND (apps.ENABLED = 'Y' OR apps.APP_ID=1)      
+       SELECT apps.APP_NAME, apps.APP_ID, user.USER_ID, user.FIRST_NAME, user.LAST_NAME, user.org_user_id FROM fn_user_role userrole INNER JOIN fn_user user ON user.USER_ID = userrole.USER_ID INNER JOIN fn_app apps ON apps.APP_ID = userrole.APP_ID  WHERE user.active_yn='Y' AND userrole.ROLE_ID = :accountAdminRoleId       
        ]]>
        </sql-query>
        
@@ -1198,7 +1258,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                a.ML_APP_NAME           , a.ML_APP_ADMIN_ID , a.MOTS_ID                         , a.APP_PASSWORD ,
                        a.THUMBNAIL             , a.APP_USERNAME        , a.OPEN                                , a.ENABLED , 
                                a.UEB_TOPIC_NAME        , a.UEB_KEY             , a.UEB_SECRET                  , a.APP_TYPE          , a.AUTH_CENTRAL ,
-                               a.AUTH_NAMESPACE
+                               a.AUTH_NAMESPACE        , a.MODE_OF_INTEGRATION, a.ACK_APP                      , a.USES_CADI
                    from FN_APP a
                    -- Portal assigns role 999 to app administrator                 
                        left outer join FN_USER_ROLE         r ON a.APP_ID = r.APP_ID and r.USER_ID = :userId and r.ROLE_ID != 999
@@ -1211,6 +1271,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                or
                                (a.OPEN = 'N' and r.ROLE_ID is null and p.STATUS_CD = 'S')
                        )
+                       and a.app_type != 3 
                        union
                select distinct  -- multiple roles yield multiple rows
                            b.APP_ID                    , b.APP_NAME            , b.APP_IMAGE_URL               ,b.APP_DESCRIPTION , 
@@ -1218,7 +1279,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                b.ML_APP_NAME           , b.ML_APP_ADMIN_ID , b.MOTS_ID                         , b.APP_PASSWORD ,
                        b.THUMBNAIL             , b.APP_USERNAME        , b.OPEN                                , b.ENABLED , 
           b.UEB_TOPIC_NAME     , b.UEB_KEY             , b.UEB_SECRET                  , b.APP_TYPE         , b.AUTH_CENTRAL ,
-          b.AUTH_NAMESPACE
+          b.AUTH_NAMESPACE     , b.MODE_OF_INTEGRATION         , b.ACK_APP             , b.USES_CADI
           from fn_user_role a, fn_app b, ep_app_role_function c   , fn_role d , ep_app_function e
           where a.user_id =:userId  and b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and a.role_id = d.role_id and e.app_id = c.app_id
                  order by app_name
@@ -1239,7 +1300,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                a.ML_APP_NAME           , a.ML_APP_ADMIN_ID , a.MOTS_ID                         , a.APP_PASSWORD ,
                        a.THUMBNAIL             , a.APP_USERNAME        , a.OPEN                                , a.ENABLED , 
                                a.UEB_TOPIC_NAME        , a.UEB_KEY             , a.UEB_SECRET                  , a.APP_TYPE         , a.AUTH_CENTRAL ,
-                               a.AUTH_NAMESPACE
+                               a.AUTH_NAMESPACE        , a.MODE_OF_INTEGRATION, a.ACK_APP                      , a.USES_CADI
                    from FN_APP a
                    -- Portal assigns role 999 to app administrator                 
                        left outer join FN_USER_ROLE         r ON a.APP_ID = r.APP_ID and r.USER_ID = :userId and r.ROLE_ID != 999
@@ -1250,6 +1311,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                        or
                                (a.OPEN = 'N' and r.USER_ID is not null and (p.STATUS_CD is null or p.STATUS_CD != 'H'))
                        )
+                       and a.app_type != 3 
                        union
                select distinct  -- multiple roles yield multiple rows
                            b.APP_ID                    , b.APP_NAME            , b.APP_IMAGE_URL               ,b.APP_DESCRIPTION , 
@@ -1257,7 +1319,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                b.ML_APP_NAME           , b.ML_APP_ADMIN_ID , b.MOTS_ID                         , b.APP_PASSWORD ,
                        b.THUMBNAIL             , b.APP_USERNAME        , b.OPEN                                , b.ENABLED , 
           b.UEB_TOPIC_NAME     , b.UEB_KEY             , b.UEB_SECRET                  , b.APP_TYPE         , b.AUTH_CENTRAL ,
-          b.AUTH_NAMESPACE
+          b.AUTH_NAMESPACE     , b.MODE_OF_INTEGRATION, b.ACK_APP                      , b.USES_CADI
           from fn_user_role a, fn_app b, ep_app_role_function c   , fn_role d , ep_app_function e
           where a.user_id =:userId  and b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and a.role_id = d.role_id and e.app_id = c.app_id
                order by app_name
@@ -1281,7 +1343,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                a.ML_APP_NAME           , a.ML_APP_ADMIN_ID , a.MOTS_ID                         , a.APP_PASSWORD ,
                        a.THUMBNAIL             , a.APP_USERNAME        , a.OPEN                                , a.ENABLED , 
                                a.UEB_TOPIC_NAME        , a.UEB_KEY             , a.UEB_SECRET                  , a.APP_TYPE          , a.AUTH_CENTRAL ,
-                               a.AUTH_NAMESPACE
+                               a.AUTH_NAMESPACE        , a.MODE_OF_INTEGRATION, a.ACK_APP                      , a.USES_CADI
                    from FN_APP a
                    -- Portal assigns role 999 to app administrator                 
                        left outer join FN_USER_ROLE         r ON a.APP_ID = r.APP_ID and r.USER_ID = :userId and r.ROLE_ID != 999
@@ -1294,6 +1356,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                or
                                (a.OPEN = 'N' and r.ROLE_ID is null and p.STATUS_CD = 'S')
                        )
+                       and a.app_type != 3
                        union
                  select distinct  -- multiple roles yield multiple rows
                            b.APP_ID                    , b.APP_NAME            , b.APP_IMAGE_URL               ,b.APP_DESCRIPTION , 
@@ -1301,14 +1364,17 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                b.ML_APP_NAME           , b.ML_APP_ADMIN_ID , b.MOTS_ID                         , b.APP_PASSWORD ,
                        b.THUMBNAIL             , b.APP_USERNAME        , b.OPEN                                , b.ENABLED , 
           b.UEB_TOPIC_NAME     , b.UEB_KEY             , b.UEB_SECRET                  , b.APP_TYPE         , b.AUTH_CENTRAL ,
-          b.AUTH_NAMESPACE
+          b.AUTH_NAMESPACE     , b.MODE_OF_INTEGRATION, b.ACK_APP                      , b.USES_CADI
           from fn_user_role a, fn_app b, ep_app_role_function c   , fn_role d , ep_app_function e
           where a.user_id =:userId  and b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and a.role_id = d.role_id and e.app_id = c.app_id
                        ) A 
                left outer join
-                       (select  distinct
-                       c.AFFECTED_RECORD_ID, c.AUDIT_DATE 
-                       from FN_AUDIT_LOG c
+                       (select  FN_AUDIT_LOG.AFFECTED_RECORD_ID, max(FN_AUDIT_LOG.AUDIT_DATE) AS AUDIT_DATE 
+                       from FN_APP LEFT JOIN FN_AUDIT_LOG 
+                       on FN_APP.APP_ID = FN_AUDIT_LOG.AFFECTED_RECORD_ID  
+                       where FN_APP.ENABLED = 'Y' and FN_AUDIT_LOG.user_id=:userId
+                       and (audit_date) BETWEEN (CURDATE() - INTERVAL 90 DAY) and CURDATE() 
+                       group by  FN_AUDIT_LOG.AFFECTED_RECORD_ID
                         )B
                        on A.app_id = B.Affected_record_id
                        order by AUDIT_DATE DESC;
@@ -1326,7 +1392,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                a.ML_APP_NAME           , a.ML_APP_ADMIN_ID , a.MOTS_ID                         , a.APP_PASSWORD ,
                        a.THUMBNAIL             , a.APP_USERNAME        , a.OPEN                                , a.ENABLED , 
                                a.UEB_TOPIC_NAME        , a.UEB_KEY             , a.UEB_SECRET                  , a.APP_TYPE         , a.AUTH_CENTRAL ,
-                               a.AUTH_NAMESPACE
+                               a.AUTH_NAMESPACE        , a.MODE_OF_INTEGRATION, a.ACK_APP                      , a.USES_CADI
                    from FN_APP a
                    -- Portal assigns role 999 to app administrator                 
                        left outer join FN_USER_ROLE         r ON a.APP_ID = r.APP_ID and r.USER_ID = :userId and r.ROLE_ID != 999
@@ -1336,22 +1402,27 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                (a.OPEN = 'Y' and p.STATUS_CD = 'S')
                        or
                                (a.OPEN = 'N' and r.USER_ID is not null and (p.STATUS_CD is null or p.STATUS_CD != 'H'))
-                       )union
+                       )
+                       and a.app_type != 3
+                       union
                select distinct  -- multiple roles yield multiple rows
                            b.APP_ID                    , b.APP_NAME            , b.APP_IMAGE_URL               ,b.APP_DESCRIPTION , 
                        b.APP_NOTES             , b.APP_URL             , b.APP_ALTERNATE_URL   , b.APP_REST_ENDPOINT ,
                                b.ML_APP_NAME           , b.ML_APP_ADMIN_ID , b.MOTS_ID                         , b.APP_PASSWORD ,
                        b.THUMBNAIL             , b.APP_USERNAME        , b.OPEN                                , b.ENABLED , 
           b.UEB_TOPIC_NAME     , b.UEB_KEY             , b.UEB_SECRET                  , b.APP_TYPE         , b.AUTH_CENTRAL ,
-          b.AUTH_NAMESPACE
+          b.AUTH_NAMESPACE     , b.MODE_OF_INTEGRATION, b.ACK_APP                      , b.USES_CADI
           from fn_user_role a, fn_app b, ep_app_role_function c   , fn_role d , ep_app_function e
           where a.user_id =:userId  and b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and a.role_id = d.role_id and e.app_id = c.app_id
                        
                        ) A 
                left outer join
-                       (select  distinct
-                       c.AFFECTED_RECORD_ID, c.AUDIT_DATE 
-                       from FN_AUDIT_LOG c
+                       (select  FN_AUDIT_LOG.AFFECTED_RECORD_ID, max(FN_AUDIT_LOG.AUDIT_DATE) AS AUDIT_DATE 
+                       from FN_APP LEFT JOIN FN_AUDIT_LOG 
+                       on FN_APP.APP_ID = FN_AUDIT_LOG.AFFECTED_RECORD_ID  
+                       where FN_APP.ENABLED = 'Y' and FN_AUDIT_LOG.user_id=:userId
+                       and (audit_date) BETWEEN (CURDATE() - INTERVAL 90 DAY) and CURDATE() 
+                       group by  FN_AUDIT_LOG.AFFECTED_RECORD_ID 
                         )B
                        on A.app_id = B.Affected_record_id
                        order by AUDIT_DATE DESC;
@@ -1375,7 +1446,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                a.ML_APP_NAME           , a.ML_APP_ADMIN_ID , a.MOTS_ID                         , a.APP_PASSWORD ,
                        a.THUMBNAIL             , a.APP_USERNAME        , a.OPEN                                , a.ENABLED , 
                                a.UEB_TOPIC_NAME        , a.UEB_KEY             , a.UEB_SECRET                  , a.APP_TYPE         , a.AUTH_CENTRAL ,
-                               a.AUTH_NAMESPACE
+                               a.AUTH_NAMESPACE        , a.MODE_OF_INTEGRATION, a.ACK_APP                      , a.USES_CADI
                    from FN_APP a
                    -- Portal assigns role 999 to app administrator                 
                        left outer join FN_USER_ROLE         r ON a.APP_ID = r.APP_ID and r.USER_ID = :userId and r.ROLE_ID != 999
@@ -1387,14 +1458,16 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                (a.OPEN = 'N' and r.ROLE_ID is not null and (p.STATUS_CD is null or p.STATUS_CD != 'H'))
                                or
                                (a.OPEN = 'N' and r.ROLE_ID is null and p.STATUS_CD = 'S')
-                       )union
+                       )
+                       and a.app_type != 3
+                       union
                   select distinct  -- multiple roles yield multiple rows
                            b.APP_ID                    , b.APP_NAME            , b.APP_IMAGE_URL               ,b.APP_DESCRIPTION , 
                        b.APP_NOTES             , b.APP_URL             , b.APP_ALTERNATE_URL   , b.APP_REST_ENDPOINT ,
                                b.ML_APP_NAME           , b.ML_APP_ADMIN_ID , b.MOTS_ID                         , b.APP_PASSWORD ,
                        b.THUMBNAIL             , b.APP_USERNAME        , b.OPEN                                , b.ENABLED , 
           b.UEB_TOPIC_NAME     , b.UEB_KEY             , b.UEB_SECRET                  , b.APP_TYPE         , b.AUTH_CENTRAL ,
-          b.AUTH_NAMESPACE
+          b.AUTH_NAMESPACE     , b.MODE_OF_INTEGRATION, b.ACK_APP                      , b.USES_CADI
           from fn_user_role a, fn_app b, ep_app_role_function c   , fn_role d , ep_app_function e
           where a.user_id =:userId  and b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and a.role_id = d.role_id and e.app_id = c.app_id
                        ) A 
@@ -1425,7 +1498,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                a.ML_APP_NAME           , a.ML_APP_ADMIN_ID , a.MOTS_ID                         , a.APP_PASSWORD ,
                        a.THUMBNAIL             , a.APP_USERNAME        , a.OPEN                                , a.ENABLED , 
                                a.UEB_TOPIC_NAME        , a.UEB_KEY             , a.UEB_SECRET                  , a.APP_TYPE             , a.AUTH_CENTRAL ,
-                               a.AUTH_NAMESPACE
+                               a.AUTH_NAMESPACE        , a.MODE_OF_INTEGRATION, a.ACK_APP                      , a.USES_CADI
                    from FN_APP a
                    -- Portal assigns role 999 to app administrator                 
                        left outer join FN_USER_ROLE         r ON a.APP_ID = r.APP_ID and r.USER_ID = :userId and r.ROLE_ID != 999
@@ -1435,14 +1508,16 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                (a.OPEN = 'Y' and p.STATUS_CD = 'S')
                        or
                                (a.OPEN = 'N' and r.USER_ID is not null and (p.STATUS_CD is null or p.STATUS_CD != 'H'))
-                       )union
+                       )
+                       and a.app_type != 3
+                       union
                  select distinct  -- multiple roles yield multiple rows
                            b.APP_ID                    , b.APP_NAME            , b.APP_IMAGE_URL               ,b.APP_DESCRIPTION , 
                        b.APP_NOTES             , b.APP_URL             , b.APP_ALTERNATE_URL   , b.APP_REST_ENDPOINT ,
                                b.ML_APP_NAME           , b.ML_APP_ADMIN_ID , b.MOTS_ID                         , b.APP_PASSWORD ,
                        b.THUMBNAIL             , b.APP_USERNAME        , b.OPEN                                , b.ENABLED , 
           b.UEB_TOPIC_NAME     , b.UEB_KEY             , b.UEB_SECRET                  , b.APP_TYPE         , b.AUTH_CENTRAL ,
-          b.AUTH_NAMESPACE
+          b.AUTH_NAMESPACE     , b.MODE_OF_INTEGRATION, b.ACK_APP                      , b.USES_CADI
           from fn_user_role a, fn_app b, ep_app_role_function c   , fn_role d, ep_app_function e
           where a.user_id =:userId  and b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and a.role_id = d.role_id and e.app_id = c.app_id
                        )A 
@@ -1472,7 +1547,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                a.ML_APP_NAME           , a.ML_APP_ADMIN_ID , a.MOTS_ID                         , a.APP_PASSWORD ,
                        a.THUMBNAIL             , a.APP_USERNAME        , a.OPEN                                , a.ENABLED , 
                                a.UEB_TOPIC_NAME        , a.UEB_KEY             , a.UEB_SECRET                  , a.APP_TYPE        , a.AUTH_CENTRAL ,
-                               a.AUTH_NAMESPACE
+                               a.AUTH_NAMESPACE        , a.MODE_OF_INTEGRATION, a.ACK_APP                      , a.USES_CADI
                    from FN_APP a
                    -- Portal assigns role 999 to app administrator                 
                        left outer join FN_USER_ROLE         r ON a.APP_ID = r.APP_ID and r.USER_ID = :userId and r.ROLE_ID != 999
@@ -1484,14 +1559,16 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                (a.OPEN = 'N' and r.ROLE_ID is not null and (p.STATUS_CD is null or p.STATUS_CD != 'H'))
                                or
                                (a.OPEN = 'N' and r.ROLE_ID is null and p.STATUS_CD = 'S')
-                       )union
+                       )
+                       and a.app_type != 3
+                       union
                select distinct  -- multiple roles yield multiple rows
                            b.APP_ID                    , b.APP_NAME            , b.APP_IMAGE_URL               ,b.APP_DESCRIPTION , 
                        b.APP_NOTES             , b.APP_URL             , b.APP_ALTERNATE_URL   , b.APP_REST_ENDPOINT ,
                                b.ML_APP_NAME           , b.ML_APP_ADMIN_ID , b.MOTS_ID                         , b.APP_PASSWORD ,
                        b.THUMBNAIL             , b.APP_USERNAME        , b.OPEN                                , b.ENABLED , 
           b.UEB_TOPIC_NAME     , b.UEB_KEY             , b.UEB_SECRET                  , b.APP_TYPE         , b.AUTH_CENTRAL ,
-          b.AUTH_NAMESPACE
+          b.AUTH_NAMESPACE     , b.MODE_OF_INTEGRATION, b.ACK_APP                      , b.USES_CADI
           from fn_user_role a, fn_app b, ep_app_role_function c   , fn_role d, ep_app_function e
           where a.user_id =:userId  and b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and a.role_id = d.role_id and e.app_id = c.app_id
                        ) A
@@ -1519,7 +1596,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                a.ML_APP_NAME           , a.ML_APP_ADMIN_ID , a.MOTS_ID                         , a.APP_PASSWORD ,
                        a.THUMBNAIL             , a.APP_USERNAME        , a.OPEN                                , a.ENABLED , 
                                a.UEB_TOPIC_NAME        , a.UEB_KEY             , a.UEB_SECRET                  , a.APP_TYPE        , a.AUTH_CENTRAL ,
-                               a.AUTH_NAMESPACE
+                               a.AUTH_NAMESPACE        , a.MODE_OF_INTEGRATION, a.ACK_APP                      , a.USES_CADI
                    from FN_APP a
                    -- Portal assigns role 999 to app administrator                 
                        left outer join FN_USER_ROLE         r ON a.APP_ID = r.APP_ID and r.USER_ID = :userId and r.ROLE_ID != 999
@@ -1529,14 +1606,16 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                (a.OPEN = 'Y' and p.STATUS_CD = 'S')
                        or
                                (a.OPEN = 'N' and r.USER_ID is not null and (p.STATUS_CD is null or p.STATUS_CD != 'H'))
-                       )union
+                       )
+                       and a.app_type != 3
+                       union
                select distinct  -- multiple roles yield multiple rows
                            b.APP_ID                    , b.APP_NAME            , b.APP_IMAGE_URL               ,b.APP_DESCRIPTION , 
                        b.APP_NOTES             , b.APP_URL             , b.APP_ALTERNATE_URL   , b.APP_REST_ENDPOINT ,
                                b.ML_APP_NAME           , b.ML_APP_ADMIN_ID , b.MOTS_ID                         , b.APP_PASSWORD ,
                        b.THUMBNAIL             , b.APP_USERNAME        , b.OPEN                                , b.ENABLED , 
           b.UEB_TOPIC_NAME     , b.UEB_KEY             , b.UEB_SECRET                  , b.APP_TYPE         , b.AUTH_CENTRAL ,
-          b.AUTH_NAMESPACE
+          b.AUTH_NAMESPACE     , b.MODE_OF_INTEGRATION, b.ACK_APP                      , b.USES_CADI
           from fn_user_role a, fn_app b, ep_app_role_function c   , fn_role d, ep_app_function e
           where a.user_id =:userId  and b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and a.role_id = d.role_id and e.app_id = c.app_id
                        ) A
@@ -1591,8 +1670,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
             left outer join FN_USER_ROLE         r ON a.APP_ID = r.APP_ID and r.USER_ID = :userId and r.ROLE_ID != 999
                        left outer join FN_PERS_USER_APP_SEL p ON a.APP_ID = p.APP_ID and p.USER_ID = :userId
       left outer join EP_USER_ROLES_REQUEST q ON a.APP_ID = q.APP_ID and q.USER_ID = :userId and q.request_status = 'P'
-      where a.ENABLED = 'Y'
-      
+      where a.ENABLED = 'Y' and a.app_type != 3
                        -- Show accessible apps first, then the rest; sort by name within each set.
             order by access desc, app_name asc
                    ;
@@ -1841,7 +1919,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
             left outer join FN_USER_ROLE         r ON a.APP_ID = r.APP_ID and r.USER_ID = :userId and r.ROLE_ID != 999
                        left outer join FN_PERS_USER_APP_SEL p ON a.APP_ID = p.APP_ID and p.USER_ID = :userId
                        left outer join EP_USER_ROLES_REQUEST q ON a.APP_ID = q.APP_ID and q.USER_ID = :userId and q.request_status = 'P'
-                       where a.ENABLED = 'Y'
+                       where a.ENABLED = 'Y' and a.app_type != 3
                        -- Show accessible apps first, then the rest; sort by name within each set.
             order by access desc, app_name asc
                    ;
@@ -1941,7 +2019,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                        class="org.onap.portalapp.portal.transport.EPUserAppCurrentRoles" />
                        <![CDATA[
                        
-                       select distinct fu.role_id, fr.user_id, fu.role_name, fu.priority from fn_role fu left outer join fn_user_role fr ON fu.role_id = fr.role_id and fu.app_id = fr.app_id and fr.role_id != 999 where fu.app_id =:appId and fr.user_id =:userId
+                       select distinct fu.role_id, fr.user_id, fu.role_name, fu.priority from fn_role fu left outer join fn_user_role fr ON fu.role_id = fr.role_id and fu.app_id = fr.app_id and fr.role_id != 999 where fu.app_id =:appId and fr.user_id =:userId and fu.active_yn='Y' 
                        ;               
                        ]]>
        </sql-query>
@@ -1958,7 +2036,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                        ]]>
        </sql-query>
        
-       <!-- Gets the current user app roles records and requires two parameters  -->
+       <!-- Gets all functions of portal app -->
        <sql-query name="getAllFunctions">
                <return alias="allFunctions"
                        class="org.onap.portalsdk.core.domain.RoleFunction" />
@@ -1967,7 +2045,17 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                        ;               
                        ]]>
        </sql-query>
-
+       
+       <!-- Gets the current user app roles records and requires two parameters  -->
+       <sql-query name="getPartnerAppFunctions">
+               <return alias="partnerAppFunctions"
+                       class="org.onap.portalapp.portal.domain.CentralV2RoleFunction" />
+                       <![CDATA[       
+                       select * from ep_app_function where app_id =:appId
+                       ;               
+                       ]]>
+       </sql-query>
+       
        <!-- Gets the  all role functions and requires one parameters -->
        <sql-query name="uploadAllRoleFunctions">
                <return alias="allRoleFunctions"
@@ -1977,6 +2065,16 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                                ;               
                        ]]>
        </sql-query>
+       
+               <!-- Gets the  all application role functions from ep_app_function table and requires one parameters -->
+       <sql-query name="uploadPartnerRoleFunctions">
+               <return alias="partnerRoleFunctions"
+                       class="org.onap.portalapp.portal.transport.BulkUploadRoleFunction" />
+                       <![CDATA[       
+                               select distinct eprf.function_cd, epfn.function_name from ep_app_role_function eprf left outer join ep_app_function epfn on eprf.function_cd = epfn.function_cd where eprf.role_id =:roleId
+                               ;       
+                       ]]>
+       </sql-query>
 
        <sql-query name="getRoletoUpdateInExternalAuthSystem">
                <return alias="roletoUpdateInExternalAuthSystem" class="org.onap.portalapp.portal.domain.EPRole" />
@@ -2020,7 +2118,7 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
        <sql-query name="getCentralizedApps">
                <return alias="centralizedApps" class="org.onap.portalapp.portal.domain.EPApp" />
                        <![CDATA[
-                       select * from fn_app where auth_central = 'Y' and open = 'N';
+                       select * from fn_app where auth_central = 'Y' and open = 'N' and auth_namespace is not null
                        ;       
                        ]]>
        </sql-query>
@@ -2052,6 +2150,51 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                        ]]>
        </sql-query>
        
+       <sql-query name="getRoleFunctionsOfUserforAlltheApplications">
+                       <![CDATA[
+                       select distinct ep.function_cd from fn_user_role fu, ep_app_role_function ep, ep_app_function ea
+                       where fu.role_id = ep.role_id 
+                       and fu.app_id = ep.app_id
+                       and fu.user_id =:userId 
+                       and ea.function_cd = ep.function_cd
+                       and exists
+                       (
+                       select fa.app_id from fn_user fu, fn_user_role ur, fn_app fa where fu.user_id =:userId and fu.user_id = ur.user_id
+                       and ur.app_id = fa.app_id and fa.enabled = 'Y'
+                       );
+                       ]]>
+       </sql-query>
+       
+       <sql-query name="getApplicationsofTheUserwithAdminAndRoleAdmin">
+       <return alias="getApplicationsofTheUserwithAdminAndRoleAdmin" class="org.onap.portalapp.portal.domain.AppIdAndNameTransportModel" />
+                       <![CDATA[
+                       SELECT app.APP_ID, app.APP_NAME, app.APP_TYPE FROM FN_APP app 
+                       inner join FN_USER_ROLE userrole ON userrole.APP_ID=app.APP_ID 
+                       where userrole.USER_ID = :userId AND userrole.ROLE_ID=999 AND (app.ENABLED = 'Y' OR app.APP_ID=1)
+                       UNION
+                       SELECT DISTINCT app.APP_ID, app.app_name, app.APP_TYPE FROM fn_user user 
+                                       INNER JOIN fn_user_role user_role ON user.USER_ID = user_role.USER_ID 
+                                        INNER JOIN fn_role role ON role.ROLE_ID = user_role.ROLE_ID  
+                       INNER JOIN fn_app app ON app.app_id= user_role.app_id and (app.enabled='Y'  or app.app_id=1) 
+                       INNER JOIN ep_app_role_function appfunction ON  appfunction.app_id = app.app_id and appfunction.role_id=role.ROLE_ID and (appfunction.function_cd like '%APPROVER%')
+                       WHERE user.user_id = :userId ;
+                       ]]>
+       </sql-query>
+       
+       <sql-query name="getApplicationsofTheUserContainsApprover">
+       <return alias="getApplicationsofTheUserContainsApprover" class="org.onap.portalapp.portal.domain.AppIdAndNameTransportModel" />
+                       <![CDATA[
+                       SELECT DISTINCT app.APP_ID, app.APP_TYPE, app.app_name FROM fn_user user 
+                                       INNER JOIN fn_user_role user_role ON user.USER_ID = user_role.USER_ID 
+                                        INNER JOIN fn_role role ON role.ROLE_ID = user_role.ROLE_ID  
+                       INNER JOIN fn_app app ON app.app_id= user_role.app_id and (app.enabled='Y'  or app.app_id=1) 
+                       INNER JOIN ep_app_role_function appfunction ON  appfunction.app_id = app.app_id and appfunction.role_id=role.ROLE_ID and (appfunction.function_cd like '%APPROVER%')
+                       WHERE user.user_id = :userId ;
+                       ]]>
+       </sql-query>
+       
+       
+       
        <sql-query name="getUserRolesForLeftMenu">
                        <return alias="getUserRolesListForLeftMenu" class="org.onap.portalapp.portal.domain.UserRole" />
        
@@ -2164,12 +2307,10 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
     <sql-query name="getGlobalRoleWithApplicationRoleFunctions">       
                <return alias="getGlobalRoleWithApplicationRoleFunctions" class="org.onap.portalapp.portal.transport.GlobalRoleWithApplicationRoleFunction" />          
                <![CDATA[
-               
                select distinct  d.role_id, d.role_name , c.function_cd , e.function_name , d.active_yn , d.priority , c.app_id, c.role_app_id
                from fn_user_role a, fn_app b, ep_app_role_function c , fn_role d , ep_app_function e
                where b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and e.function_cd = c.function_cd and c.app_id= :appId and e.app_id=c.app_id
                ;
                ]]>
        </sql-query>
        
@@ -2200,15 +2341,23 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
        <sql-query name="getGlobalRoleForRequestedApp"> 
                <return alias="getGlobalRoleForRequestedApp" class="org.onap.portalapp.portal.transport.GlobalRoleWithApplicationRoleFunction" />       
                <![CDATA[
-               
                select distinct  d.role_id, d.role_name , c.function_cd , e.function_name , d.active_yn , d.priority , c.app_id, c.role_app_id
         from fn_user_role a, fn_app b, ep_app_role_function c , fn_role d , ep_app_function e
         where b.app_id = c.app_id and a.app_id = c.role_app_id and b.enabled = 'Y' and c.role_id = d.role_id and d.active_yn='Y' and e.function_cd = c.function_cd and c.app_id=:requestedAppId and c.role_id =:roleId and e.app_id = c.app_id
         ;
                ]]>
        </sql-query>
        
+       <sql-query name="getBulkUploadPartnerGlobalRoleFunctions">      
+               <return alias="bulkUploadPartnerGlobalRoleFunctions" class="org.onap.portalapp.portal.transport.GlobalRoleWithApplicationRoleFunction" />       
+               <![CDATA[
+               select distinct fr.role_id, fr.role_name, fr.active_yn, fr.priority, epr.function_cd, ep.function_name, ep.app_id, epr.role_app_id
+               from fn_role fr, ep_app_function ep, ep_app_role_function epr
+               where fr.role_id = epr.role_id and ep.function_cd = epr.function_cd and ep.app_id = epr.app_id and  epr.app_id = :appId and epr.role_app_id = 1 
+               ;
+               ]]>
+       </sql-query>
+       
        <sql-query name="updateMenuFunctionalAndRoles"> 
                <![CDATA[
                  UPDATE fn_menu_functional m, fn_menu_functional_roles mr SET m.url='' WHERE m.menu_id=mr.menu_id AND mr.app_id=:app_id        
@@ -2341,23 +2490,130 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
        <sql-query name="getUserRoleOnUserIdAndRoleIdAndAppId"> 
                <return alias="getUserRoleOnUserIdAndRoleIdAndAppId" class="org.onap.portalapp.portal.domain.EPUserApp" />      
                <![CDATA[
-               
                select * from fn_user_role where user_id= :userId 
                and role_id= :roleId 
                and app_id= :appId
                ; 
                ]]>
        </sql-query>
-    
-    <sql-query name="userAppGlobalRoles">
-      <return alias="userAppGlobalRoles" class="org.onap.portalapp.portal.domain.EPRole" />
+
+       <sql-query name="userAppGlobalRoles">
+               <return alias="userAppGlobalRoles"
+                       class="org.onap.portalapp.portal.domain.EPRole" />
        <![CDATA[ 
         select fr.role_id , fr.role_name ,fr.active_yn, fr.priority, fr.app_id, fr.app_role_id 
         from fn_user_role a, fn_role fr, fn_user fu 
         where a.role_id in (select b.role_id from ep_app_role_function b where b.role_app_id = 1 and b.app_id =:appId) and a.user_id =fu.user_id and a.role_id = fr.role_id and fr.active_yn='Y' and fu.active_yn='Y' and fu.user_id =:userId
         ;             
-         ]]>
-       </sql-query>
-    
+       ]]>
+       </sql-query>
+
+       <sql-query name="getAllCentralizedAppsRoles">
+               <return alias="allCentralizedAppsRoles"
+                       class="org.onap.portalapp.portal.transport.CentralizedAppRoles" />
+       <![CDATA[ 
+        select distinct fa.app_id, fa.auth_namespace, fr.role_name, fr.role_id from fn_app fa,  fn_role fr where fa.auth_central = 'Y' and fa.auth_namespace is not null
+               and (fa.app_id = fr.app_id or COALESCE(fr.app_id,1) = fa.app_id) and fr.active_yn = 'Y' order by fa.app_id ;          
+       ]]>
+       </sql-query>
+
+       <sql-query name="getUserCentralizedAppRoles">
+               <return alias="userCentralizedAppRoles"
+                       class="org.onap.portalapp.portal.transport.CentralizedAppRoles" />
+       <![CDATA[ 
+               select distinct fur.app_id, fa.auth_namespace, fr.role_name, fur.role_id from fn_user_role fur, fn_app fa, fn_role fr, fn_user fu 
+               where fa.app_id = fur.app_id 
+               and fr.role_id = fur.role_id
+               and fu.user_id = fur.user_id 
+               and fu.ORG_USER_ID = :orgUserId
+               and fa.auth_namespace is not null
+               and fr.active_yn = 'Y'
+               order by role_id;
+               ]]>
+       </sql-query>
+       <sql-query name="getAprroverRoleFunctionsOfUser">
+               <![CDATA[
+               select distinct ep.function_cd from fn_user_role fu, ep_app_role_function ep, ep_app_function ea
+               where fu.role_id = ep.role_id
+               and fu.app_id = ep.app_id
+               and fu.user_id =:userId
+               and ea.function_cd = ep.function_cd and ea.function_cd like 'approver|%'
+               and exists
+               (
+               select fa.app_id from fn_user fu, fn_user_role ur, fn_app fa where fu.user_id =:userId and fu.user_id = ur.user_id
+               and ur.app_id = fa.app_id and fa.enabled = 'Y'
+               );
+               ]]>
+</sql-query>
+<sql-query name="getUserApproverRoles">
+               <![CDATA[
+               select distinct fr.role_name from fn_user_role fu, ep_app_role_function ep, ep_app_function ea, fn_role fr
+               where fu.role_id = ep.role_id
+               and fu.app_id = ep.app_id
+               and fu.user_id = :userId
+               and fu.role_id = fr.role_id and fr.active_yn='Y'
+               and ea.function_cd = ep.function_cd and ea.function_cd like 'approver|%'
+               and exists
+               (
+               select fa.app_id from fn_user fu, fn_user_role ur, fn_app fa where fu.user_id =:userId and fu.user_id = ur.user_id
+               and ur.app_id = fa.app_id and fa.enabled = 'Y'
+               );
+               ]]>
+</sql-query>
+<sql-query name="getAdminAppsForTheUser">
+               <![CDATA[
+               select fa.app_id  from fn_user_role ur,fn_app fa where ur.user_id =:userId and ur.app_id=fa.app_id and ur.role_id= 999 and (fa.enabled = 'Y' || fa.app_id=1)
+
+       
+               ]]>
+</sql-query>
+
+
+<sql-query name="getUserRoleOnUserIdAndAppId"> 
+               <return alias="getUserRoleOnUserIdAndAppId" class="org.onap.portalapp.portal.domain.EPRole" />          
+               <![CDATA[
+               
+               select fr.role_id , fr.role_name ,fr.active_yn, fr.priority, fr.app_id, fr.app_role_id  FROM fn_role fr, fn_user_role fur WHERE fr.role_id = fur.role_id AND fur.user_id= :userId AND fur.app_id = :appId AND fr.active_yn='Y'
+               
+               ]]>
+       </sql-query>
+       
+       <sql-query name="getAllAdminAppsofTheUser">
+               <![CDATA[
+               select fa.app_id  from fn_user_role ur,fn_app fa where ur.user_id =:userId and ur.app_id=fa.app_id and ur.role_id= 999
+
+               ]]>
+    </sql-query>
+       <sql-query name="getAllAppsFunctionsOfUser">
+                       <![CDATA[
+                       select distinct ep.function_cd from fn_user_role fu, ep_app_role_function ep, ep_app_function ea, fn_app fa , fn_role fr
+                       where fu.role_id = ep.role_id 
+                       and fu.app_id = ep.app_id
+                       and fu.user_id =:userId
+                       and ea.function_cd = ep.function_cd
+            and ((fu.app_id = fa.app_id  and fa.enabled = 'Y' ) or (fa.app_id = 1))
+            and fr.role_id = fu.role_id and fr.active_yn='Y' 
+                   union
+            select distinct app_r_f.function_cd from ep_app_role_function app_r_f, ep_app_function a_f
+                       where role_id = 999
+                       and app_r_f.function_cd = a_f.function_cd
+                       and exists
+                       (
+                       select fa.app_id from fn_user fu, fn_user_role ur, fn_app fa where fu.user_id =:userId and fu.user_id = ur.user_id
+                       and ur.role_id = 999 and ur.app_id = fa.app_id and fa.enabled = 'Y'
+                       );
+                       ]]>
+       </sql-query>
+       <sql-query name="updateFnUser">
+               <![CDATA[
+                       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>