Property DAO support for date (yyyy-mm-dd)

- Avoided nasty timezone issues by using Epoch millisecond time


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@15665 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-08-10 19:08:23 +00:00
parent ce6ea6eced
commit aeef3a5af8
9 changed files with 584 additions and 35 deletions

View File

@@ -13,6 +13,7 @@
<typeAlias alias="PropertyClass" type="org.alfresco.repo.domain.propval.PropertyClassEntity"/>
<typeAlias alias="PropertyStringValue" type="org.alfresco.repo.domain.propval.PropertyStringValueEntity"/>
<typeAlias alias="PropertyDoubleValue" type="org.alfresco.repo.domain.propval.PropertyDoubleValueEntity"/>
<typeAlias alias="PropertyDateValue" type="org.alfresco.repo.domain.propval.PropertyDateValueEntity"/>
<typeAlias alias="PropertyValue" type="org.alfresco.repo.domain.propval.PropertyValueEntity"/>
<!-- -->
@@ -33,6 +34,19 @@
<result property="id" column="id" jdbcType="BIGINT" javaType="java.lang.Long"/>
<result property="doubleValue" column="double_value" jdbcType="DOUBLE" javaType="java.lang.Double"/>
</resultMap>
<resultMap id="result.PropertyDateValue" class="PropertyDateValue">
<!-- date_value is the PK as well -->
<result property="dateValue" column="date_value" jdbcType="BIGINT" javaType="long"/>
<result property="fullYear" column="full_year" jdbcType="TINYINT" javaType="short"/>
<result property="halfOfYear" column="half_of_year" jdbcType="TINYINT" javaType="short"/>
<result property="quarterOfYear" column="quarter_of_year" jdbcType="TINYINT" javaType="short"/>
<result property="monthOfYear" column="month_of_year" jdbcType="TINYINT" javaType="short"/>
<result property="weekOfYear" column="week_of_year" jdbcType="TINYINT" javaType="short"/>
<result property="weekOfMonth" column="week_of_month" jdbcType="TINYINT" javaType="short"/>
<result property="dayOfYear" column="day_of_year" jdbcType="TINYINT" javaType="short"/>
<result property="dayOfMonth" column="day_of_month" jdbcType="TINYINT" javaType="short"/>
<result property="dayOfWeek" column="day_of_week" jdbcType="TINYINT" javaType="short"/>
</resultMap>
<resultMap id="result.PropertyValue" class="PropertyValue">
<result property="id" column="id" jdbcType="BIGINT" javaType="java.lang.Long"/>
<result property="actualTypeId" column="actual_type_id" jdbcType="BIGINT" javaType="java.lang.Long"/>
@@ -76,6 +90,25 @@
values (#doubleValue#)
</sql>
<sql id="insert.PropertyDateValue">
insert into alf_prop_date_value
(
date_value,
full_year, half_of_year, quarter_of_year,
month_of_year,
week_of_year, week_of_month,
day_of_year, day_of_month, day_of_week
)
values
(
#dateValue#,
#fullYear#, #halfOfYear#, #quarterOfYear#,
#monthOfYear#,
#weekOfYear#, #weekOfMonth#,
#dayOfYear#, #dayOfMonth#, #dayOfWeek#
)
</sql>
<sql id="insert.PropertyValue.AutoIncrement">
insert into alf_prop_value (actual_type_id, persisted_type, long_value)
values (#actualTypeId#, #persistedType#, #longValue#)
@@ -146,6 +179,45 @@
double_value = #doubleValue#
</select>
<insert id="insert.PropertyDateValue" parameterClass="PropertyDateValue" >
insert into alf_prop_date_value
(
date_value,
full_year, half_of_year, quarter_of_year,
month_of_year,
week_of_year, week_of_month,
day_of_year, day_of_month, day_of_week
)
values
(
#dateValue#,
#fullYear#, #halfOfYear#, #quarterOfYear#,
#monthOfYear#,
#weekOfYear#, #weekOfMonth#,
#dayOfYear#, #dayOfMonth#, #dayOfWeek#
)
</insert>
<!-- Get a property date value by ID -->
<select id="select.PropertyDateValueByID" parameterClass="java.lang.Long" resultMap="result.PropertyDateValue">
select
*
from
alf_prop_date_value
where
id = #dateValue#
</select>
<!-- Get the property date value by value -->
<select id="select.PropertyDateValueByValue" parameterClass="java.lang.Long" resultMap="result.PropertyDateValue">
select
*
from
alf_prop_date_value
where
date_value = #dateValue#
</select>
<!-- Get the property value by value in alf_prop_value -->
<select id="select.PropertyValueByLocalValue" parameterClass="PropertyValue" resultMap="result.PropertyValue">
select