Atleap是使用AppFuse为框架的CMS(内容管理系统)。
● hibernate对应表关系
Ø com.blandware.atleap.model.core.ContentLocale.对应locale表
Ø com.blandware.atleap.model.core.ResourceData. 对应resource_data表
Ø com.blandware.atleap.model.core.ContentField. 对应field表
Ø com.blandware.atleap.model.core.User. 对应app_user表
Ø com.blandware.atleap.model.core.ContentFieldValue. 对应field_value表
Ø com.blandware.atleap.model.core.Localizable. 对应localizable表
com.blandware.atleap.model.core.MailTemplate对应mail_template表
com.blandware.atleap.model.core.MenuItem对应menu_item表
com.blandware.atleap.model.core.Page对应page表
com.blandware.atleap.model.core.ActionPage对应action_page表
com.blandware.atleap.model.core.ContentPage对应content_page表
com.blandware.atleap.model.news.NewsItem对应news_item表
com.blandware.atleap.model.core.Layout对应layout表
Ø com.blandware.atleap.model.core.Role. 对应role表
Ø com.blandware.atleap.model.core.ContentResource. 对应resource表
com.blandware.atleap.model.core.ContentImage对应image表
com.blandware.atleap.model.core.ContentDocument对应document表
Ø com.blandware.atleap.model.core.UserCookie. 对应user_cookie表
Ø com.blandware.atleap.model.core.GlobalProperty. 对应global_property表
● 主要表结构
1>ContentField
table="field"
+----------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+-------+
| id | bigint(20) | | PRI | 0 | |主键
| version | bigint(20) | | | 0 | |锁键
| identifier | varchar(255) | | | | |
| localizable_id | bigint(20) | | MUL | 0 | |owner many-to-one
| type | tinyint(4) | | | 0 | |
| internal | char(1) | | | | |
+----------------+--------------+------+-----+---------+-------+
注:在POJO类ContentField中出现了add、update、delete等DAO应该处理的方法,不好。
2>ContentFieldValue
table="field_value"
和(1)ContentResource组成多对多关系,field_value是主控制方
和(2)Page组成多对多关系,field_value是主控制方
+-------------------+--------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+--------------+------+-----+---------------------+-------+
| id | bigint(20) | | PRI | 0 | |key
| version | bigint(20) | | | 0 | |
| locale_identifier | varchar(255) | YES | MUL | NULL | |many-to-one
| value | mediumblob | YES | | NULL | |
| simple_value | varchar(255) | YES | | NULL | |
| field_id | bigint(20) | YES | MUL | NULL | |many-to-one
| last_updated | datetime | | | 0000-00-00 00:00:00 | |
+-------------------+--------------+------+-----+---------------------+-------+
中间表1
+----------------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+------------+------+-----+---------+-------+
| field_value_id | bigint(20) | | MUL | 0 | |关联键
| resource_id | bigint(20) | | MUL | 0 | |关联键
+----------------+------------+------+-----+---------+-------+
中间表2
+----------------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+------------+------+-----+---------+-------+
| field_value_id | bigint(20) | | MUL | 0 | |关联键
| page_id | bigint(20) | | MUL | 0 | |关联键
+----------------+------------+------+-----+---------+-------+
3>ContentLocale
table="locale"
和field_value表组成one-to-many,field_value是主控制方
和document表组成one-to-many,document是主控制方
+------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------+--------------+------+-----+---------+-------+
| identifier | varchar(255) | | PRI | | |key
| version | bigint(20) | | | 0 | |
| name | varchar(255) | | UNI | | |
| default_instance | char(1) | | | | |
| active | char(1) | | | | |
+------------------+--------------+------+-----+---------+-------+
4>ContentResource
table="resource"
和resource_data组成one-to-one
和(1)role表组成many-to-many,resource表为主控制方
和(2)field_value表组成many-to-many, resource表为主控制方
和(3)MenuItem表组成many-to-many, resource表为主控制方
+---------------+--------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------------------+-------+
| id | bigint(20) | | PRI | 0 | |key
| version | bigint(20) | | | 0 | |
| identifier | varchar(255) | | UNI | | |
| description | varchar(255) | YES | | NULL | |
| size | bigint(20) | | | 0 | |
| mimetype | varchar(255) | | | | |
| type | varchar(255) | | | | |
| usage_counter | int(11) | YES | | NULL | |
| last_updated | datetime | | | 0000-00-00 00:00:00 | |
+---------------+--------------+------+-----+---------------------+-------+
中间表1
+-------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+-------+
| resource_id | bigint(20) | | MUL | 0 | |
| rolename | varchar(20) | | MUL | | |
+-------------+-------------+------+-----+---------+-------+
中间表2:field_value_resource
+----------------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+------------+------+-----+---------+-------+
| field_value_id | bigint(20) | | MUL | 0 | |
| resource_id | bigint(20) | | MUL | 0 | |
+----------------+------------+------+-----+---------+-------+
中间表3
+--------------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+------------+------+-----+---------+-------+
| resource_id | bigint(20) | | MUL | 0 | |
| menu_item_id | bigint(20) | | MUL | 0 | |
+--------------+------------+------+-----+---------+-------+
5>GlobalProperty
table="global_property"
+----------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+-------+
| property_name | varchar(255) | | PRI | | |
| version | bigint(20) | | | 0 | |
| property_value | varchar(255) | YES | | NULL | |
+----------------+--------------+------+-----+---------+-------+
6>Localizable
table="localizable"
和ContentField组成one-to-many,ContentField为主控制方
和MenuItem组成one-to-many,MenuItem为主控制方
+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| id | bigint(20) | | PRI | 0 | |
| version | bigint(20) | | | 0 | |
| class_name | varchar(255) | YES | | NULL | |
+------------+--------------+------+-----+---------+-------+
7>ResourceData
table="resource_data"
+----------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+------------+------+-----+---------+-------+
| id | bigint(20) | | PRI | 0 | |
| raw_data | mediumblob | | | | |
+----------+------------+------+-----+---------+-------+
1>次表
ContentDocument
table:document
joined-subclass
+-------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+--------------+------+-----+---------+-------+
| resource_id | bigint(20) | | PRI | 0 | |主键
| locale_identifier | varchar(255) | YES | MUL | NULL | |关联表外键:many-to-one:column="locale_identifier"
| charset | varchar(255) | | | | |
+-------------------+--------------+------+-----+---------+-------+
2>ContentImage
table="image"
joined-subclass
+-------------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+------------+------+-----+---------+-------+
| resource_id | bigint(20) | | PRI | 0 | |
| width | int(11) | | | 0 | |
| height | int(11) | | | 0 | |
+-------------+------------+------+-----+---------+-------+
3>ContentPage
table="content_page"
+-----------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+------------+------+-----+---------+-------+
| page_id | bigint(20) | | PRI | 0 | |
| layout_id | bigint(20) | | MUL | 0 | |many-to-one
+-----------+------------+------+-----+---------+-------+
3>Layout
table="layout"
和content_page组成content_page,content_page为主控制方
+----------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+-------+
| localizable_id | bigint(20) | | PRI | 0 | |
| definition | varchar(255) | | UNI | | |
| cpDefinition | varchar(255) | YES | | NULL | |
| name | varchar(255) | | UNI | | |
+----------------+--------------+------+-----+---------+-------+
4>MailTemplate
table="mail_template"
+----------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+-------+
| localizable_id | bigint(20) | | PRI | 0 | |
| identifier | varchar(255) | | UNI | | |
| mime_type | varchar(255) | | | | |
+----------------+--------------+------+-----+---------+-------+
5>MenuItem
table="menu_item"
+----------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+-------+
| localizable_id | bigint(20) | | PRI | 0 | |
| parent_id | bigint(20) | YES | MUL | NULL | |
| identifier | varchar(255) | YES | | NULL | |
| align | varchar(255) | YES | | NULL | |
| height | int(11) | YES | | NULL | |
| width | int(11) | YES | | NULL | |
| image | varchar(255) | YES | | NULL | |
| alt_image | varchar(255) | YES | | NULL | |
| action | varchar(255) | YES | | NULL | |
| forward | varchar(255) | YES | | NULL | |
| location | varchar(255) | YES | | NULL | |
| page | varchar(255) | YES | | NULL | |
| target | varchar(255) | YES | | NULL | |
| visibility | tinyint(4) | | | 0 | |
| position | int(11) | YES | | NULL | |
| js_onclick | varchar(255) | YES | | NULL | |
| js_onmouseover | varchar(255) | YES | | NULL | |
| js_onmouseout | varchar(255) | YES | | NULL | |
| orig_id | bigint(20) | YES | MUL | NULL | |
| owner_id | bigint(20) | YES | MUL | NULL | |
+----------------+--------------+------+-----+---------+-------+
6>Page
table="page"
+----------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+-------+
| localizable_id | bigint(20) | | PRI | 0 | |
| uri | varchar(255) | YES | MUL | NULL | |
| usage_counter | int(11) | YES | | NULL | |
| active | char(1) | | | | |
+----------------+--------------+------+-----+---------+-------+
● 主要表内容
Field表:(页面布局元素信息):
Ø optimistic-lock="version":该表加有乐观索,乐观锁版本为version字段
Ø Field表和field_value表是一对多关系,以field_id为关联字段,field_value是主
控制方。采用延迟(lazy)数据加载,级联delete操作。
Ø Field表和localizable表形成多对一关系,以localizable_id为管理字段。
+-----+---------+-------------+----------------+------+----------+
| id | version | identifier | localizable_id | type | internal |
+-----+---------+-------------+----------------+------+----------+
| 122 | 0 | from | 53 | 0 | T |
| 123 | 0 | subject | 53 | 0 | T |
| 124 | 0 | body | 53 | 1 | T |
| 125 | 0 | charset | 53 | 0 | T |
| 126 | 0 | title | 54 | 0 | T |
| 127 | 0 | description | 54 | 0 | T |
+-----+---------+-------------+----------------+------+----------+
● Field_value表:(具体页面元素信息)
Ø Field_value表和locale表是多对一关系,以identifier为关联键;
Ø Field_value表和field表是多对一关系,以field_id为关联键;
Ø Field_value表和page表是多对多关系,以field_value_page表为中间表。
Field_value表为主控制方。不级联。
Ø Field_value表和resource表是多对多关系,以field_value_resource表为中间表。
Ø field_value_page表(中间表)结构
+----------------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+------------+------+-----+---------+-------+
| field_value_id | bigint(20) | | MUL | 0 | |
| page_id | bigint(20) | | MUL | 0 | |
+----------------+------------+------+-----+---------+-------+
Ø field_value_resource表(中间表)结构
+----------------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+------------+------+-----+---------+-------+
| field_value_id | bigint(20) | | MUL | 0 | |
| resource_id | bigint(20) | | MUL | 0 | |
+----------------+------------+------+-----+---------+-------+
Ø resource表
● locale表
Ø locale表和Field_value表是一对多关系
+------------+---------+----------------+------------------+--------+
| identifier | version | name | default_instance | active |
+------------+---------+----------------+------------------+--------+
| en | 0 | English | T | T |
| ru | 0 | 袪褍褋褋泻懈泄 | F | T |
+------------+---------+----------------+------------------+--------+
Ødocument表(中间表)
locale表和document表是一对多关系
+-------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+--------------+------+-----+---------+-------+
| resource_id | bigint(20) | | PRI | 0 | |
| locale_identifier | varchar(255) | YES | MUL | NULL | |
| charset | varchar(255) | | | | |
+-------------------+--------------+------+-----+---------+-------+
● Localizable表
+----+---------+----------------------------------------------+
| id | version | class_name |
+----+---------+----------------------------------------------+
| 0 | 0 | com.blandware.atleap.model.core.Layout |
| 2 | 0 | com.blandware.atleap.model.core.ActionPage |
| 3 | 0 | com.blandware.atleap.model.core.ActionPage |
| 4 | 1 | com.blandware.atleap.model.core.ContentPage |
| 11 | 9 | com.blandware.atleap.model.core.MenuItem |
| 12 | 9 | com.blandware.atleap.model.core.MenuItem |
| 13 | 9 | com.blandware.atleap.model.core.MenuItem |
● resource_data表
+----------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+------------+------+-----+---------+-------+
| id | bigint(20) | | PRI | 0 | |
| raw_data | mediumblob | | | | |
+----------+------------+------+-----+---------+-------+