Added Junits
[portal.git] / ecomp-portal-BE-common / src / main / webapp / WEB-INF / fusion / orm / Fusion.hbm.xml
1 <?xml version="1.0"?>
2 <!--
3   ============LICENSE_START==========================================
4   ONAP Portal
5   ===================================================================
6   Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
7   ===================================================================
8  
9   Unless otherwise specified, all software contained herein is licensed
10   under the Apache License, Version 2.0 (the "License");
11   you may not use this software except in compliance with the License.
12   You may obtain a copy of the License at
13  
14               http://www.apache.org/licenses/LICENSE-2.0
15  
16   Unless required by applicable law or agreed to in writing, software
17   distributed under the License is distributed on an "AS IS" BASIS,
18   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19   See the License for the specific language governing permissions and
20   limitations under the License.
21  
22   Unless otherwise specified, all documentation contained herein is licensed
23   under the Creative Commons License, Attribution 4.0 Intl. (the "License");
24   you may not use this documentation except in compliance with the License.
25   You may obtain a copy of the License at
26  
27               https://creativecommons.org/licenses/by/4.0/
28  
29   Unless required by applicable law or agreed to in writing, documentation
30   distributed under the License is distributed on an "AS IS" BASIS,
31   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32   See the License for the specific language governing permissions and
33   limitations under the License.
34  
35   ============LICENSE_END============================================
36  
37   ECOMP is a trademark and service mark of AT&T Intellectual Property.
38   -->
39
40 <!DOCTYPE hibernate-mapping PUBLIC
41         "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
42         "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
43
44 <!-- 
45 Publishes mappings and queries for EP SDK library features ONLY.
46 Portal app mappings and features are in EP.hbm.xml.
47 -->
48 <hibernate-mapping package="org.onap.portalsdk.core.domain">
49
50      <!-- User class mapping details -->
51     <class name="User" table="FN_USER">
52         <id name="id" column="user_id" > 
53           <generator class="native">
54              <param name="sequence">seq_fn_user</param> 
55           </generator>
56         </id>
57
58         <property name="orgId"         column="org_id"/>
59         <property name="managerId"     column="manager_id"/>
60         <property name="firstName"     column="first_name"/>
61         <property name="middleInitial" column="middle_name"/>
62         <property name="lastName"      column="last_name"/>
63         <property name="phone"         column="phone"/>
64         <property name="fax"           column="fax"/>
65         <property name="cellular"      column="cellular"/>
66         <property name="email"         column="email"/>
67         <property name="addressId"     column="address_id"/>
68         <property name="alertMethodCd" column="alert_method_cd"/>
69
70         <property name="address1"      column="address_line_1"/>
71         <property name="address2"      column="address_line_2"/>
72         <property name="city"          column="city"/>
73         <property name="state"         column="state_cd"/>
74         <property name="zipCode"       column="zip_code"/>
75         <property name="country"       column="country_cd"/>
76
77         <property name="hrid"          column="hrid"/>
78         <property name="orgUserId"     column="org_user_id"/>
79         <property name="orgCode"       column="org_code"/>
80         <property name="loginId"       column="login_id"/>
81         <property name="loginPwd"      column="login_pwd"/>
82         <property name="lastLoginDate" column="last_login_date"  type="timestamp"/>
83
84         <property name="locationClli"  column="location_clli" />
85         <property name="orgManagerUserId" column="org_manager_userid" />
86         <property name="company"       column="company" />
87         <property name="department"    column="department" />
88         <property name="departmentName"         column="department_name" />
89         <property name="businessUnit"           column="business_unit" />
90         <property name="businessUnitName"   column="business_unit_name" />
91         <property name="jobTitle"               column="job_title" />
92         <property name="siloStatus"             column="silo_status" />
93         <property name="financialLocCode"   column="fin_loc_code" />
94
95         <property name="active"        column="active_yn"       type="yes_no"/>
96         <property name="internal"      column="is_internal_yn"  type="yes_no"/>
97
98         <property name="created"  type="timestamp" column="created_date"  />
99         <property name="modified" type="timestamp" column="modified_date" />
100
101         <property name="createdId"  column="created_id" />
102         <property name="modifiedId" column="modified_id" />
103                 <property name="timeZoneId" column="timezone" />
104                 
105         <set name="userApps" table="FN_USER_ROLE" lazy="false" sort="natural" inverse="true" cascade="all-delete-orphan">
106             <key column="user_id"/>
107             <one-to-many class="org.onap.portalsdk.core.domain.UserApp" />
108         </set>
109
110         <set name="pseudoRoles" table="FN_USER_PSEUDO_ROLE" lazy="false" sort="natural">
111             <key column="user_id"/>
112             <many-to-many column="pseudo_role_id" class="org.onap.portalsdk.core.domain.Role" />
113         </set>
114     </class>
115
116         <class name="UserApp" table="fn_user_role">
117         <composite-id>
118             <key-property name="userId" type="long">
119                 <column name="user_id" precision="11" scale="0" />
120             </key-property>
121                 <key-many-to-one name="app" class="org.onap.portalsdk.core.domain.App" column="app_id" />
122                 <key-many-to-one name="role" class="org.onap.portalsdk.core.domain.Role" column="role_id" />
123         </composite-id>
124         <property name="priority" type="java.lang.Short">
125             <column name="priority" precision="4" scale="0" />
126         </property>
127     </class>
128
129     <!-- User App class mapping details -->
130     <class name="App" table="fn_app">
131         <id name="id" column="app_id"/>
132         <property name="name"      column="app_name"/>
133         <property name="appPassword"      column="app_password"/>
134         <property name="username"      column="app_username"/>        
135         
136     </class>
137
138     <!-- User Role class mapping details -->
139     <class name="Role" table="FN_ROLE_V">
140         <id name="id" column="role_id">
141            <generator class="native">
142              <param name="sequence">seq_fn_role</param> 
143           </generator>
144         </id>
145
146         <property name="name"      column="role_name"/>
147         <property name="priority"  column="priority" />
148         <property name="active"    column="active_yn"  type="yes_no"/>
149
150         <set name="roleFunctions" table="FN_ROLE_FUNCTION" lazy="false" sort="natural">
151             <key column="role_id"/>
152             <many-to-many column="function_cd" class="org.onap.portalsdk.core.domain.RoleFunction"/>
153         </set>
154
155         <set name="childRoles" table="FN_ROLE_COMPOSITE" lazy="false" sort="natural">
156             <key column="parent_role_id"/>
157             <many-to-many column="child_role_id" class="org.onap.portalsdk.core.domain.Role"/>
158         </set>
159         
160         <set name="parentRoles" table="FN_ROLE_COMPOSITE" lazy="false" sort="natural">
161             <key column="child_role_id"/>
162             <many-to-many column="parent_role_id" class="org.onap.portalsdk.core.domain.Role"/>
163         </set>
164
165     </class>
166     
167  
168
169     <!-- User Role Function class mapping details -->
170     <class name="RoleFunction" table="FN_FUNCTION">
171         <id        name="code"  column="function_cd"   />
172         <property  name="name"  column="function_name" />
173     </class>
174     
175     <!-- Menu class mapping details -->
176     <class name="Menu" table="FN_MENU">
177         <id name="id" column="menu_id">
178           <generator class="native">
179              <param name="sequence">seq_fn_menu</param> 
180           </generator>
181         </id>
182
183          <property name="menuLevel"   column="level-1"/>
184          <property name="label"       column="label"/>
185          <property name="parentId"    column="parent_id"/>
186          <property name="action"      column="action"/>
187          <property name="functionCd"  column="function_cd"/>
188          <property name="sortOrder"   column="sort_order"/>
189          <property name="servlet"     column="servlet"/>
190          <property name="queryString" column="query_string"/>
191          <property name="externalUrl" column="external_url"/>
192          <property name="target"      column="target"/>
193          <property name="active"      column="active_yn"    type="yes_no"/>
194          <property name="separator"   column="separator_yn" type="yes_no"/>
195          <property name="imageSrc"    column="image_src" />
196     </class>
197
198     <class name="MenuData" table="FN_MENU">
199         <!--  <id       name="id"          column="menu_id"/> -->
200         <id name="id" column="menu_id">
201           <generator class="native">
202              <param name="sequence">seq_fn_menu</param> 
203           </generator>
204         </id>
205         <property name="label"       column="label"/>
206         <property name="action"      column="action"/>
207         <property name="functionCd"  column="function_cd"/>
208         <property name="sortOrder"   column="sort_order"/>
209         <property name="servlet"     column="servlet"/>
210         <property name="queryString" column="query_string"/>
211         <property name="externalUrl" column="external_url"/>
212         <property name="target"      column="target"/>
213         <property name="active"      column="active_yn"    type="yes_no"/>
214         <property name="separator"   column="separator_yn" type="yes_no"/>
215         <property name="imageSrc"    column="image_src" />
216         <property name="menuSetCode" column="menu_set_cd"  />
217
218         <many-to-one name="parentMenu" column="parent_id" class="MenuData"/>
219
220         <set name="childMenus" lazy="false" sort="natural" inverse="true" where="active_yn = 'Y'">
221             <key column="parent_id"/>
222             <one-to-many class="MenuData"/>
223         </set>
224     </class>
225     
226     <!-- Broadcast Message class mapping details -->
227     <class name="BroadcastMessage" table="fn_broadcast_message">
228         <id name="id" column="message_id">
229             <generator class="native">
230               <param name="sequence">seq_fn_broadcast_message</param>
231             </generator>
232         </id>
233         <property name="messageText" column="message_text"/>
234         <property name="locationId"  column="message_location_id"/>
235
236         <property name="startDate"   column="broadcast_start_date"  type="timestamp"/>
237         <property name="endDate"     column="broadcast_end_date"    type="timestamp"/>
238
239         <property name="sortOrder"   column="sort_order"/>
240         <property name="active"      column="active_yn"             type="yes_no"/>
241
242         <property name="siteCd"      column="broadcast_site_cd"    />
243     </class>
244         
245     <!-- State Lookup class mapping details -->
246     <class name="LuState" table="FN_LU_STATE">
247         <id       name="abbr"  column="state_cd" />
248         <property name="state"                   />
249     </class>
250     
251     <!-- Country Lookup class mapping details -->
252     <class name="LuCountry" table="FN_LU_COUNTRY">
253         <id       name="abbr"  column="country_cd" />
254         <property name="country"                   />
255         <property name="fullName" column="full_name" />
256         <property name="webphoneCountryLabel" column="fullwebphone_country_label_name" />
257     </class>
258     
259     <class name="LuTimeZone" table="FN_LU_TIMEZONE">
260         <id       name="timezoneId"  column="timezone_id" />
261         <property name="name" column="timezone_name" />
262         <property name="value" column="timezone_value" />
263     </class>
264
265         <!-- Audit Log class mapping details -->
266     <class name="AuditLog" table="fn_audit_log">
267         <id name="id" column="log_id">
268           <generator class="native">
269                         <param name="sequence">seq_fn_audit_log</param>
270                   </generator>
271         </id>
272         <property name="activityCode"      column="activity_cd"/>
273         <property name="affectedRecordId"  column="affected_record_id"  />
274         <property name="comments"          column="comments"  />
275         <property name="userId"         column="user_id" />
276     </class>
277     
278     <!-- Lookup (id/value bean) class mapping details -->
279     <class name="Lookup">
280         <composite-id  name="nameValueId" class="org.onap.portalsdk.core.domain.support.NameValueId">
281           <key-property name="val"/>
282           <key-property name="lab" />
283         </composite-id>
284     </class>
285
286         <class name="UrlsAccessible" table="V_URL_ACCESS">
287       <composite-id  name="urlsAccessibleKey" class="org.onap.portalsdk.core.domain.UrlsAccessibleKey">
288         <key-property   name="url"      column="url"/>
289         <key-property   name="functionCd"       column="function_cd"/>
290       </composite-id>
291     </class>
292     
293         <query name="functionCDlist">
294       select distinct functionCd from MenuData 
295     </query>
296     
297         <query name="menuData">
298       from MenuData where menuSetCode = :menu_set_cd and parentMenu is null
299     </query>
300         <query name="restrictedUrls">
301       FROM UrlsAccessible A where upper(A.urlsAccessibleKey.url) = upper(:current_url)
302     </query>
303
304     <query name="getUserNameById">
305       select firstName, lastName from User where id = :user_id
306     </query>
307
308     <query name="getUserEmail">
309       select email from User where id = :user_id
310     </query>
311
312     <query name="getAppPassword">
313       select id,appPassword from App
314     </query>
315     
316     <query name="getAllUsers">
317       select id, firstName, lastName from User where active = true order by lastName, firstName
318     </query>
319         
320     <query name="getRoleNameById">
321       select name from Role where id = :role_id
322     </query>
323
324     <query name="getAllRoles">
325       select id, name from Role order by name
326     </query>
327     
328         <sql-query name="getBytesPublishedDelivered">
329                 <return-scalar column="Published" type="java.lang.String"/>
330                 <return-scalar column="Delivered" type="java.lang.String"/>
331                 <![CDATA[
332         select concat(Round(sum(bytespublished)/(1024*1024*1024*1024), 0), ' Pb') 'Published', concat(Round(sum(bytesdelivered)/(1024*1024*1024*1024), 0), ' Pb') ' Delivered' from kpi_drvolumes where day = (select max(day) from kpi_drvolumes)
333                 ]]>
334         </sql-query>
335         
336         <sql-query name="getDataRouterFeedStats">
337                 <return-scalar column="TOTAL_FEEDS" type="java.lang.Long"/>
338                 <return-scalar column="ACTIVE_FEEDS" type="java.lang.Long"/>
339                 <return-scalar column="ACTIVE_SUBS" type="java.lang.Long"/>
340                 <![CDATA[
341         SELECT SUM(TOTALFEEDS) TOTAL_FEEDS, SUM(ACTIVEFEEDS) ACTIVE_FEEDS, SUM(ACTIVESUBS) ACTIVE_SUBS FROM kpi_drsumm where day = (select max(day) from kpi_drvolumes)
342                 ]]>
343         </sql-query>    
344
345         <sql-query name="getLOCStatsCat">
346         <![CDATA[
347                 select CATEGORY1 CATEGORY from demo_kpi_sourcecode_stats group by category1
348         ]]>
349         </sql-query>
350
351         <sql-query name="getLOCStats">
352         <![CDATA[
353                 select sum(total_lines) TOTAL_LINES from demo_kpi_sourcecode_stats group by category1
354         ]]>
355         </sql-query>
356
357 </hibernate-mapping>