Merge "use docker-compose healtcheck for DB"
[portal.git] / ecomp-portal-BE-common / src / main / webapp / WEB-INF / fusion / orm / EP.hbm.xml
index 342a6e8..8fe369f 100644 (file)
@@ -1,22 +1,40 @@
 <?xml version="1.0"?>
 <!--
-  ================================================================================
-  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.
   -->
 <!DOCTYPE hibernate-mapping PUBLIC
         "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        </class>
 
        <!-- User Role class mapping details -->
-       <class name="EPRole" table="FN_ROLE">
+       <class name="EPRole" table="FN_ROLE" >
                <id name="id" column="role_id">
                        <generator class="native">
                                <param name="sequence">seq_fn_role</param>
@@ -1800,22 +1818,11 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                        class="org.openecomp.portalapp.portal.domain.CentralRoleFunction" />
                        <![CDATA[
                        
-                       SELECT * from ep_app_function where function_cd = :functionCode and app_id =:appId
+                       SELECT * from ep_app_function where function_cd like CONCAT('%', :functionCode,'%') and app_id =:appId
                        ;
                        
                        ]]>
        </sql-query>
-       
-       <!-- Gets the record from ep_app_function table and requires two parameters  -->
-       <sql-query name="getAppFunctionDetails">
-               <return alias="appFunctionDetails"
-                       class="org.openecomp.portalapp.portal.domain.CentralRoleFunction" />
-                       <![CDATA[
-                       
-                                       select * from ep_app_function where app_id =:appId and function_cd =:functionCd
-                       ;               
-                       ]]>
-       </sql-query>
                
        <!-- Gets the current user app roles records and requires two parameters  -->
        <sql-query name="getUserAppCurrentRoles">
@@ -1911,9 +1918,12 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                        <return alias="getUserRolesListForLeftMenu" class="org.openecomp.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 or role.role_id =   999)   
-         ;
+               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>
        
@@ -1937,4 +1947,37 @@ where fn_role.app_id = fn_app.app_id and fn_app.enabled='Y' and fn_role.active_y
                ]]>
        </sql-query>
        
+       <sql-query name="ApplicationUserRoles">
+               <return alias="ApplicationUserRoles" class="org.openecomp.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>
+       
+    <query name="getEPUserByOrgUserId">
+       <![CDATA[
+               FROM EPUser WHERE orgUserId = :org_user_id
+       ]]>
+    </query>
+
+       <query name="getEPUserByLoginId">
+       <![CDATA[
+               FROM EPUser WHERE loginId = :login_id
+       ]]>
+    </query>
+
+    <query name="getEPUserByLoginIdLoginPwd">
+       <![CDATA[
+               FROM EPUser WHERE loginId = :login_id and loginPwd = :login_pwd         
+       ]]>
+    </query>
+
 </hibernate-mapping>