+
+ <!-- Gets list of role functions and it requires two parameters appId and roleId-->
+ <sql-query name="getAppRoleFunctionList">
+ <return alias="appRoleFunctionList"
+ class="org.onap.portalapp.portal.domain.CentralV2RoleFunction" />
+ <![CDATA[
+
+ SELECT DISTINCT f.app_id , f.function_cd, f.function_name from ep_app_role_function rf, ep_app_function f
+ where rf.role_id =:roleId and rf.app_id =:appId and rf.app_id = f.app_id and rf.function_cd = f.function_cd
+ ;
+
+ ]]>
+ </sql-query>
+
+ <!-- Gets list of all role functions -->
+ <sql-query name="getAllRoleFunctions">
+ <return alias="allRoleFunctions"
+ class="org.onap.portalapp.portal.domain.CentralV2RoleFunction" />
+ <![CDATA[
+
+ SELECT * from ep_app_function where app_id =:appId
+ ;
+
+ ]]>
+ </sql-query>
+
+ <!-- Get ep_app_function records provided by single parameter -->
+ <sql-query name="getRoleFunction">
+ <return alias="RoleFunction"
+ class="org.onap.portalapp.portal.domain.CentralV2RoleFunction" />
+ <![CDATA[
+
+ SELECT * from ep_app_function where function_cd like CONCAT('%', :functionCode,'%') and app_id =:appId
+ ;
+
+ ]]>
+ </sql-query>
+
+ <!-- Gets the current user app roles records and requires two parameters -->
+ <sql-query name="getUserAppCurrentRoles">
+ <return alias="userAppCurrentRoles"
+ 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
+ ;
+ ]]>
+ </sql-query>
+
+ <!-- Gets the current user app roles along with account administrator and requires two parameters -->
+ <sql-query name="getUserAppExistingRoles">
+ <return alias="userAppExistingRoles"
+ class="org.onap.portalapp.portal.transport.EcompUserAppRoles" />
+ <![CDATA[
+ select fr.role_name, fu.app_id, fu.user_id, fu.priority, fu.role_id from fn_user_role fu
+ left outer join fn_role fr on fu.role_id = fr.role_id
+ where fu.user_id =:userId and fu.app_id =:appId
+ ;
+ ]]>
+ </sql-query>
+
+ <!-- Gets the current user app roles records and requires two parameters -->
+ <sql-query name="getAllFunctions">
+ <return alias="allFunctions"
+ class="org.onap.portalsdk.core.domain.RoleFunction" />
+ <![CDATA[
+ select * from fn_function
+ ;
+ ]]>
+ </sql-query>
+
+ <!-- Gets the all role functions and requires one parameters -->
+ <sql-query name="uploadAllRoleFunctions">
+ <return alias="allRoleFunctions"
+ class="org.onap.portalapp.portal.transport.BulkUploadRoleFunction" />
+ <![CDATA[
+ select fr.function_cd, fn.function_name from fn_role_function fr left outer join fn_function fn on fr.function_cd = fn.function_cd where role_id =:roleId
+ ;
+ ]]>
+ </sql-query>
+
+ <sql-query name="getRoletoUpdateInExternalAuthSystem">
+ <return alias="roletoUpdateInExternalAuthSystem" class="org.onap.portalapp.portal.domain.EPRole" />
+ <![CDATA[
+ SELECT * FROM fn_role where role_name =:appRoleName and app_id =:appId
+ ;
+ ]]>
+ </sql-query>
+
+ <sql-query name="getBulkUserRoles">
+ <return alias="bulkUserRoles" class="org.onap.portalapp.portal.transport.BulkUploadUserRoles" />
+ <![CDATA[
+ select fr.role_name, fu.org_user_id, fa.auth_namespace from fn_user_role fur
+ left outer join fn_role fr on fr.role_id = fur.role_id
+ left outer join fn_app fa on fa.app_id = fur.app_id
+ left outer join fn_user fu on fu.user_id = fur.user_id where fa.ueb_key =:uebKey
+ ;
+ ]]>
+ </sql-query>
+
+ <sql-query name="getBulkUsersForSingleRole">
+ <return alias="bulkUsersForSingleRole" class="org.onap.portalapp.portal.transport.BulkUploadUserRoles" />
+ <![CDATA[
+ select fr.role_name, fu.org_user_id, fa.auth_namespace from fn_user_role fur
+ left outer join fn_role fr on fr.role_id = fur.role_id
+ left outer join fn_app fa on fa.app_id = fur.app_id
+ left outer join fn_user fu on fu.user_id = fur.user_id where fa.ueb_key =:uebKey and fr.role_id =:roleId
+ ;
+ ]]>
+ </sql-query>
+
+ <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';
+ ;
+ ]]>
+ </sql-query>
+
+ <sql-query name="getUserRoles">
+ <return alias="getUserRolesList" class="org.onap.portalapp.portal.domain.UserRole" />
+ <![CDATA[
+
+ SELECT DISTINCT user.USER_ID, role.ROLE_ID, user.org_user_id, user.FIRST_NAME, user.LAST_NAME, role.ROLE_NAME FROM fn_user_role userrole INNER JOIN fn_user user ON user.USER_ID = userrole.USER_ID INNER JOIN fn_role role ON role.ROLE_ID = userrole.ROLE_ID WHERE user.org_user_id =:org_user_id and userrole.app_id = 1
+ ;
+ ]]>
+ </sql-query>
+ <sql-query name="getRoleFunctionsOfUser">
+ <![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 ep.app_id = 1
+ and ea.function_cd = ep.function_cd
+ 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="getUserRolesForLeftMenu">
+ <return alias="getUserRolesListForLeftMenu" class="org.onap.portalapp.portal.domain.UserRole" />
+
+ <![CDATA[
+ SELECT DISTINCT user.USER_ID, role.ROLE_ID, user.org_user_id, user.FIRST_NAME, user.LAST_NAME, role.ROLE_NAME FROM fn_user_role userrole
+ INNER JOIN fn_user user ON user.USER_ID = userrole.USER_ID
+ INNER JOIN fn_app app ON app.app_id= userrole.app_id
+ INNER JOIN fn_role role ON role.ROLE_ID = userrole.ROLE_ID
+ WHERE user.org_user_id =:org_user_id and (userrole.app_id = 1 or role.role_id = 999) and (app.enabled='Y' or app.app_id=1)
+ ;
+ ]]>
+ </sql-query>
+
+ <sql-query name="getRolesForLeftMenu">
+ <return alias="getUserRolesListForLeftMenu" class="org.onap.portalapp.portal.domain.UserRole" />
+
+ <![CDATA[
+ SELECT DISTINCT user.USER_ID, role.ROLE_ID, user.org_user_id, user.FIRST_NAME, user.LAST_NAME, role.ROLE_NAME FROM fn_user_role userrole
+ INNER JOIN fn_user user ON user.USER_ID = userrole.USER_ID
+ INNER JOIN fn_app app ON app.app_id= userrole.app_id
+ INNER JOIN fn_role role ON role.ROLE_ID = userrole.ROLE_ID
+ WHERE user.org_user_id =:org_user_id and (userrole.app_id = 1 or role.role_id = 999) and ((app.enabled='Y' and auth_central='Y' ) or app.app_id=1)
+ ;
+ ]]>
+ </sql-query>
+
+ <!-- Gets all functions for an application along with global functions and requires single parameter -->
+ <sql-query name="getMenuFunctions">
+ <![CDATA[
+ select f.function_cd from ep_app_function f
+ where f.app_id =:appId
+ UNION
+ select epa.function_cd from fn_role fnr, ep_app_role_function epr, ep_app_function epa where epr.role_id = fnr.role_id
+ and epa.function_cd = epr.function_cd and fnr.role_name like 'global%' and fnr.app_id is null and epr.app_id = 1
+ ;
+ ]]>
+ </sql-query>
+
+ <sql-query name="getRequestIdsForApp">
+ <return alias="getRequestIdsForApp" class="org.onap.portalapp.portal.domain.EPUserAppRolesRequest" />
+ <![CDATA[
+ select * from ep_user_roles_request where app_id =:app_id
+ ;
+ ]]>
+ </sql-query>
+
+ <sql-query name="ApplicationUserRoles">
+ <return alias="ApplicationUserRoles" class="org.onap.portalapp.portal.transport.EcompUserRoles" />
+ <![CDATA[
+ select distinct fu.org_id, fu.manager_id, fu.first_name, fu.middle_name, fu.last_name, fu.phone, fu.email, fu.hrid, fu.org_user_id, fu.org_code, fu.org_manager_userid, fu.job_title, fu.login_id,
+ fu.active_yn , fr.app_role_id, fr.role_name
+ from fn_user fu, fn_role fr, fn_user_role fur
+ where fu.user_id = fur.user_id and fu.active_yn='Y' and fur.role_id = fr.role_id and fr.app_id =:appId and fr.active_yn='Y'
+ union
+ select distinct fu.org_id, fu.manager_id, fu.first_name, fu.middle_name, fu.last_name, fu.phone, fu.email, fu.hrid, fu.org_user_id, fu.org_code, fu.org_manager_userid, fu.job_title, fu.login_id, fu.active_yn , fr.role_id, fr.role_name
+ from fn_user fu, fn_role fr, fn_user_role fur
+ where fu.user_id = fur.user_id and fu.active_yn='Y' and fur.app_id=:appId and fr.role_name like 'global%' and fr.active_yn='Y'
+ ;
+ ]]>
+ </sql-query>
+
+ <sql-query name="getCurrentAppRoleFunctions">
+ <return alias="ApplicationUserRoles" class="org.onap.portalapp.portal.transport.LocalRole" />
+ <![CDATA[
+ select distinct fr.role_id, fr.role_name from fn_role fr, ep_app_function ef, ep_app_role_function epr where fr.role_id = epr.role_id and epr.function_cd = ef.function_cd
+ and ef.function_cd =:functionCd and epr.app_id =:appId
+ ;
+ ]]>
+ </sql-query>
+
+ <sql-query name="deleteUserWidgetPlacement">
+ <![CDATA[
+ DELETE FROM ep_pers_user_widget_placement WHERE user_id =:userId AND widget_id =:widgetId
+ ;
+ ]]>
+ </sql-query>
+
+ <sql-query name="getCentralizedAppsOfUser">
+ <return alias="CentralizedAppsForRoles" class="org.onap.portalapp.portal.domain.CentralizedApp" />
+ <![CDATA[
+
+ select distinct fa.app_id, fa.app_name
+ from fn_role fr, fn_user_role fur, fn_app fa, fn_user fu
+ Where fu.user_id = fur.user_id and fur.role_id = fr.role_id and fa.app_id = fur.app_id
+ and fu.org_user_id = :userId and (fur.role_id = 999 or fur.role_id = 1) and fr.active_yn='Y' and ((fa.enabled = 'Y' and fa.auth_central='Y') or fa.app_id =1)
+ ;
+
+ ]]>
+ </sql-query>
+
+ <query name="getEPUserByOrgUserId">
+ <![CDATA[
+ FROM EPUser WHERE orgUserId = :org_user_id
+ ]]>
+ </query>