mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Activity Service:
- fix user feed controls - add support for Derby dialect, including sample config - add derby.jar (10.4.1.3) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9572 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<!DOCTYPE sqlMap
|
||||
PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
|
||||
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
|
||||
|
||||
<sqlMap namespace="ActivityFeed">
|
||||
|
||||
<typeAlias alias="ActivityFeed" type="org.alfresco.repo.activities.feed.ActivityFeedDAO"/>
|
||||
|
||||
<resultMap id="ActivityFeedResult" class="ActivityFeed">
|
||||
<result property="id" column="ID"/>
|
||||
<result property="feedUserId" column="FEED_USER_ID"/>
|
||||
<result property="postUserId" column="POST_USER_ID"/>
|
||||
<result property="postDate" column="POST_DATE"/>
|
||||
<result property="postId" column="POST_ID"/> <!-- not an explicit FK constraint, can dangle if and when activity post is deleted -->
|
||||
<result property="siteNetwork" column="SITE_NETWORK"/>
|
||||
<result property="activityType" column="ACTIVITY_TYPE"/>
|
||||
<result property="activitySummary" column="ACTIVITY_SUMMARY"/>
|
||||
<result property="activitySummaryFormat" column="ACTIVITY_FORMAT"/>
|
||||
<result property="feedDate" column="FEED_DATE"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="select.activity.feed.for.feeduser" parameterClass="ActivityFeed" resultClass="ActivityFeed">
|
||||
<![CDATA[
|
||||
select id as id, activity_type as activityType, activity_format as activitySummaryFormat, activity_summary as activitySummary, feed_user_id as feedUserId, post_user_id as postUserId, site_network as siteNetwork, post_date postDate
|
||||
from alf_activity_feed
|
||||
where feed_user_id = #feedUserId#
|
||||
and post_user_id != #feedUserId#
|
||||
and activity_format = #activitySummaryFormat#
|
||||
order by post_date desc
|
||||
]]>
|
||||
</select>
|
||||
|
||||
<select id="select.activity.feed.for.feeduser.and.site" parameterClass="ActivityFeed" resultClass="ActivityFeed">
|
||||
<![CDATA[
|
||||
select id as id, activity_type as activityType, activity_format as activitySummaryFormat, activity_summary as activitySummary, feed_user_id as feedUserId, post_user_id as postUserId, site_network as siteNetwork, post_date postDate
|
||||
from alf_activity_feed
|
||||
where feed_user_id = #feedUserId#
|
||||
and post_user_id != #feedUserId#
|
||||
and site_network = #siteNetwork#
|
||||
and activity_format = #activitySummaryFormat#
|
||||
order by post_date desc
|
||||
]]>
|
||||
</select>
|
||||
|
||||
<select id="select.activity.feed.for.site" parameterClass="ActivityFeed" resultClass="ActivityFeed">
|
||||
<![CDATA[
|
||||
select id as id, activity_type as activityType, activity_format as activitySummaryFormat, activity_summary as activitySummary, post_user_id as postUserId, site_network as siteNetwork, post_date postDate
|
||||
from alf_activity_feed
|
||||
where feed_user_id = ''
|
||||
and site_network = #siteNetwork#
|
||||
and activity_format = #activitySummaryFormat#
|
||||
order by post_date desc
|
||||
]]>
|
||||
</select>
|
||||
|
||||
<insert id="insert.activity.feed" parameterClass="ActivityFeed">
|
||||
insert into alf_activity_feed (id, activity_type, activity_summary, activity_format, feed_user_id, post_user_id, post_date, post_id, site_network, app_tool, feed_date)
|
||||
values (DEFAULT, #activityType#, #activitySummary#, #activitySummaryFormat#, #feedUserId#, #postUserId#, #postDate#, #postId#, #siteNetwork#, #appTool#, #feedDate#)
|
||||
|
||||
<!-- optionally return auto-generated primary key - only required for debug (can be commented out) -->
|
||||
<selectKey resultClass="long" keyProperty="id" type="post">
|
||||
values IDENTITY_VAL_LOCAL()
|
||||
</selectKey>
|
||||
</insert>
|
||||
|
||||
<delete id="delete.activity.feed.entries.older.than.date" parameterClass="Date">
|
||||
<![CDATA[
|
||||
delete from alf_activity_feed where post_date < #keepdate#
|
||||
]]>
|
||||
</delete>
|
||||
|
||||
</sqlMap>
|
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<!DOCTYPE sqlMap
|
||||
PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
|
||||
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
|
||||
|
||||
<sqlMap namespace="ActivityFeedControl">
|
||||
|
||||
<typeAlias alias="FeedControl" type="org.alfresco.repo.activities.feed.control.FeedControlDAO"/>
|
||||
|
||||
<resultMap id="FeedControlResult" class="FeedControl">
|
||||
<result property="id" column="ID"/>
|
||||
<result property="feedUserId" column="FEED_USER_ID"/>
|
||||
<result property="siteNetwork" column="SITE_NETWORK"/>
|
||||
<result property="appTool" column="APP_TOOL"/>
|
||||
<result property="lastModified" column="LAST_MODIFIED"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="select.activity.feedcontrols.for.user" parameterClass="FeedControl" resultClass="FeedControl">
|
||||
<![CDATA[
|
||||
select id as id, feed_user_id as feedUserId, site_network as siteNetwork, app_tool as appTool
|
||||
from alf_activity_feed_control
|
||||
where feed_user_id = #feedUserId#
|
||||
]]>
|
||||
</select>
|
||||
|
||||
<select id="select.activity.feedcontrol" parameterClass="FeedControl" resultClass="long">
|
||||
<![CDATA[
|
||||
select id as id
|
||||
from alf_activity_feed_control
|
||||
where feed_user_id = #feedUserId#
|
||||
and site_network = #siteNetwork#
|
||||
and app_tool = #appTool#
|
||||
]]>
|
||||
</select>
|
||||
|
||||
<insert id="insert.activity.feedcontrol" parameterClass="FeedControl">
|
||||
insert into alf_activity_feed_control (id, feed_user_id, site_network, app_tool, last_modified)
|
||||
values (DEFAULT, #feedUserId#, #siteNetwork#, #appTool#, #lastModified#)
|
||||
|
||||
<!-- optionally return auto-generated primary key - only required for debug (can be commented out) -->
|
||||
<selectKey resultClass="long" keyProperty="id" type="post">
|
||||
values IDENTITY_VAL_LOCAL()
|
||||
</selectKey>
|
||||
</insert>
|
||||
|
||||
<delete id="delete.activity.feedcontrol" parameterClass="FeedControl">
|
||||
<![CDATA[
|
||||
delete from alf_activity_feed_control
|
||||
where feed_user_id = #feedUserId#
|
||||
and site_network = #siteNetwork#
|
||||
and app_tool = #appTool#
|
||||
]]>
|
||||
</delete>
|
||||
|
||||
</sqlMap>
|
113
config/alfresco/activities/org.hibernate.dialect.DerbyDialect/ActivityPost.xml
Executable file
113
config/alfresco/activities/org.hibernate.dialect.DerbyDialect/ActivityPost.xml
Executable file
@@ -0,0 +1,113 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<!DOCTYPE sqlMap
|
||||
PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
|
||||
"http://ibatis.apache.org/dtd/sql-map-2.dtd">
|
||||
|
||||
<sqlMap namespace="ActivityPost">
|
||||
|
||||
<typeAlias alias="ActivityPost" type="org.alfresco.repo.activities.post.ActivityPostDAO"/>
|
||||
|
||||
<resultMap id="ActivityPostResult" class="ActivityPost">
|
||||
<result property="id" column="SEQUENCE_ID"/>
|
||||
<result property="activityData" column="ACTIVITY_DATA"/>
|
||||
<result property="activityType" column="ACTIVITY_TYPE"/>
|
||||
<result property="userId" column="POST_USER_ID"/>
|
||||
<result property="postDate" column="POST_DATE"/>
|
||||
<result property="jobTaskNode" column="JOB_TASK_NODE"/>
|
||||
<result property="siteNetwork" column="SITE_NETWORK"/>
|
||||
<result property="appTool" column="APP_TOOL"/>
|
||||
<result property="status" column="STATUS"/>
|
||||
<result property="lastModified" column="LAST_MODIFIED"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="select.activity.posts" parameterClass="ActivityPost" resultClass="ActivityPost">
|
||||
<![CDATA[
|
||||
select
|
||||
sequence_id as id,
|
||||
activity_data as activityData,
|
||||
activity_type as activityType,
|
||||
post_user_id as userId,
|
||||
post_date as postDate,
|
||||
job_task_node as jobTaskNode,
|
||||
site_network as siteNetwork,
|
||||
app_tool as appTool,
|
||||
status as status
|
||||
from
|
||||
alf_activity_post
|
||||
where
|
||||
job_task_node = #jobTaskNode# and
|
||||
sequence_id >= #minId# and
|
||||
sequence_id <= #maxId# and
|
||||
status = #status#
|
||||
]]>
|
||||
</select>
|
||||
|
||||
<select id="select.activity.posts.by.status.only" parameterClass="ActivityPost" resultClass="ActivityPost">
|
||||
<![CDATA[
|
||||
select
|
||||
sequence_id as id,
|
||||
activity_data as activityData,
|
||||
activity_type as activityType,
|
||||
post_user_id as userId,
|
||||
post_date as postDate,
|
||||
job_task_node as jobTaskNode,
|
||||
site_network as siteNetwork,
|
||||
app_tool as appTool,
|
||||
status as status
|
||||
from
|
||||
alf_activity_post
|
||||
where
|
||||
status = #status#
|
||||
]]>
|
||||
</select>
|
||||
|
||||
<select id="select.activity.post.max.seq" resultClass="long">
|
||||
select max(sequence_id) as maxId
|
||||
from alf_activity_post
|
||||
where status = 'POSTED'
|
||||
</select>
|
||||
|
||||
<select id="select.activity.post.min.seq" resultClass="long">
|
||||
select min(sequence_id) as minId
|
||||
from alf_activity_post
|
||||
where status = 'POSTED'
|
||||
</select>
|
||||
|
||||
<select id="select.activity.post.max.jobtasknode" resultClass="int">
|
||||
select max(job_task_node) as maxJobTaskNode
|
||||
from alf_activity_post
|
||||
where status = 'POSTED'
|
||||
</select>
|
||||
|
||||
<insert id="insert.activity.post" parameterClass="ActivityPost">
|
||||
insert into alf_activity_post (sequence_id, status, activity_data, post_user_id, post_date, activity_type, site_network, app_tool, job_task_node, last_modified)
|
||||
values (DEFAULT, #status#, #activityData#, #userId#, #postDate#, #activityType#, #siteNetwork#, #appTool#, #jobTaskNode#, #lastModified#)
|
||||
|
||||
<!-- optionally return auto-generated primary key - only required for debug (can be commented out) -->
|
||||
<selectKey resultClass="long" keyProperty="id" type="post">
|
||||
values IDENTITY_VAL_LOCAL()
|
||||
</selectKey>
|
||||
</insert>
|
||||
|
||||
<delete id="delete.activity.posts.older.than.date" parameterClass="ActivityPost">
|
||||
<![CDATA[
|
||||
delete from alf_activity_post
|
||||
where post_date < #postDate#
|
||||
and status = #status#
|
||||
]]>
|
||||
</delete>
|
||||
|
||||
<update id="update.activity.post.data" parameterClass="ActivityPost">
|
||||
update alf_activity_post set status = #status#, activity_data=#activityData#, site_network=#siteNetwork#, last_modified=#lastModified#
|
||||
where sequence_id = #id#
|
||||
and status != #status#
|
||||
</update>
|
||||
|
||||
<update id="update.activity.post.status" parameterClass="ActivityPost">
|
||||
update alf_activity_post set status = #status#, last_modified=#lastModified#
|
||||
where sequence_id = #id#
|
||||
and status != #status#
|
||||
</update>
|
||||
|
||||
</sqlMap>
|
@@ -0,0 +1,71 @@
|
||||
--
|
||||
-- Title: Activities Schema
|
||||
-- Database: Derby
|
||||
-- Since: V3.0.0 Schema
|
||||
--
|
||||
-- Note: The Activities schema is NOT managed by Hibernate
|
||||
--
|
||||
|
||||
|
||||
CREATE TABLE alf_activity_post (
|
||||
sequence_id bigint generated by default as identity (start with 1),
|
||||
post_date timestamp NOT NULL,
|
||||
status varchar(10) NOT NULL,
|
||||
activity_data varchar(4000) NOT NULL,
|
||||
post_user_id varchar(255) NOT NULL,
|
||||
job_task_node integer NOT NULL,
|
||||
site_network varchar(255) default NULL,
|
||||
app_tool varchar(36) default NULL,
|
||||
activity_type varchar(255) NOT NULL,
|
||||
last_modified timestamp NOT NULL,
|
||||
primary key (sequence_id)
|
||||
);
|
||||
|
||||
CREATE INDEX jobtasknode_idx on alf_activity_post(job_task_node);
|
||||
CREATE INDEX status_idx on alf_activity_post(status);
|
||||
|
||||
|
||||
CREATE TABLE alf_activity_feed (
|
||||
id bigint generated by default as identity (start with 1),
|
||||
post_id bigint default NULL,
|
||||
post_date timestamp NOT NULL,
|
||||
activity_summary varchar(4000) default NULL,
|
||||
feed_user_id varchar(255) NOT NULL,
|
||||
activity_type varchar(255) NOT NULL,
|
||||
activity_format varchar(10) default NULL,
|
||||
site_network varchar(255) default NULL,
|
||||
app_tool varchar(36) default NULL,
|
||||
post_user_id varchar(255) NOT NULL,
|
||||
feed_date timestamp NOT NULL,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE INDEX postdate_idx ON alf_activity_feed(post_date);
|
||||
CREATE INDEX feeduserid_idx ON alf_activity_feed(feed_user_id);
|
||||
CREATE INDEX postuserid_idx ON alf_activity_feed(post_user_id);
|
||||
CREATE INDEX sitenetwork_idx ON alf_activity_feed(site_network);
|
||||
CREATE INDEX activityformat_idx ON alf_activity_feed(activity_format);
|
||||
|
||||
|
||||
CREATE TABLE alf_activity_feed_control (
|
||||
id bigint generated by default as identity (start with 1),
|
||||
feed_user_id varchar(255) NOT NULL,
|
||||
site_network varchar(255) NOT NULL,
|
||||
app_tool varchar(36) default NULL,
|
||||
last_modified timestamp NOT NULL,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
CREATE INDEX feedcontroluserid_idx ON alf_activity_feed_control(feed_user_id);
|
||||
|
||||
--
|
||||
-- Record script finish
|
||||
--
|
||||
DELETE FROM alf_applied_patch WHERE id = 'patch.db-V3.0-0-CreateActivitiesTables';
|
||||
INSERT INTO alf_applied_patch
|
||||
(id, description, fixes_from_schema, fixes_to_schema, applied_to_schema, target_schema, applied_on_date, applied_to_server, was_executed, succeeded, report)
|
||||
VALUES
|
||||
(
|
||||
'patch.db-V3.0-0-CreateActivitiesTables', 'Executed script create V3.0: Created activities tables',
|
||||
0, 125, -1, 126, CURRENT_TIMESTAMP, 'UNKNOWN', 1, 1, 'Script completed'
|
||||
);
|
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<!DOCTYPE sqlMapConfig
|
||||
PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
|
||||
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
|
||||
|
||||
<sqlMapConfig>
|
||||
|
||||
<!-- NOTE: although we use iBatis here rather than Hibernate, for consistency we make use of single SQL dialect property (hibernate.dialect) for consistency -->
|
||||
<properties resource="alfresco/extension/custom-hibernate-dialect.properties" />
|
||||
|
||||
<!-- SQL Map XML files loaded from the classpath -->
|
||||
|
||||
<!-- note: dialect property is set in properties resource above -->
|
||||
<sqlMap resource="alfresco/activities/${hibernate.dialect}/ActivityPost.xml"/>
|
||||
<sqlMap resource="alfresco/activities/${hibernate.dialect}/ActivityFeed.xml"/>
|
||||
<sqlMap resource="alfresco/activities/${hibernate.dialect}/ActivityFeedControl.xml"/>
|
||||
|
||||
</sqlMapConfig>
|
@@ -0,0 +1,11 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
|
||||
|
||||
<beans>
|
||||
|
||||
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean" singleton="true">
|
||||
<property name="configLocation"><value>classpath:alfresco/extension/custom-activities-SqlMapConfig.xml</value></property>
|
||||
<property name="dataSource" ref="iBatisDataSource"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
@@ -2,6 +2,11 @@
|
||||
# Sample Hibernate configuration for changing Database dialect
|
||||
# For a full list: http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#configuration-optional-dialects
|
||||
#
|
||||
|
||||
#
|
||||
# Derby dialect
|
||||
#
|
||||
#hibernate.dialect=org.hibernate.dialect.DerbyDialect
|
||||
|
||||
#
|
||||
# HSQL dialect
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# Sample custom content and index data location
|
||||
#
|
||||
#dir.root=/srv/alfresco/data
|
||||
#dir.root=/srv/alfresco/alf_data
|
||||
|
||||
#
|
||||
# Sample database connection properties
|
||||
@@ -27,6 +27,12 @@
|
||||
# upgrading to a new version, this can be disabled.
|
||||
#
|
||||
#db.schema.update=true
|
||||
|
||||
#
|
||||
# Derby connection
|
||||
#
|
||||
#db.driver=org.apache.derby.jdbc.EmbeddedDriver
|
||||
#db.url=jdbc:derby:/srv/alfresco/alf_data/derby_data/alfresco;create=true
|
||||
|
||||
#
|
||||
# HSQL connection
|
||||
|
Reference in New Issue
Block a user