diff --git a/config/alfresco/cache-context.xml b/config/alfresco/cache-context.xml
index 7e5bbf522f..af8ce63be2 100644
--- a/config/alfresco/cache-context.xml
+++ b/config/alfresco/cache-context.xml
@@ -1,984 +1,1009 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- classpath:alfresco/ehcache-transactional.xml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.qnameEntityCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.qnameEntityTransactionalCache
-
-
- 500
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.namespaceEntityCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.namespaceEntityTransactionalCache
-
-
- 100
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.localeIdCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.localeEntityTransactionalCache
-
-
- 100
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.mimetypeEntityCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.mimetypeEntityTransactionalCache
-
-
- 100
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.encodingEntityCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.encodingEntityTransactionalCache
-
-
- 100
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.immutableEntityCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.immutableEntityTransactionalCache
-
-
- 10000
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.storeAndNodeIdCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.storeAndNodeIdTransactionalCache
-
-
- 10000
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.parentAssocsCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.parentAssocsTransactionalCache
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ classpath:alfresco/ehcache-transactional.xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.qnameEntityCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.qnameEntityTransactionalCache
+
+
+ 500
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.namespaceEntityCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.namespaceEntityTransactionalCache
+
+
+ 100
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.localeIdCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.localeEntityTransactionalCache
+
+
+ 100
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.mimetypeEntityCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.mimetypeEntityTransactionalCache
+
+
+ 100
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.encodingEntityCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.encodingEntityTransactionalCache
+
+
+ 100
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.immutableEntityCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.immutableEntityTransactionalCache
+
+
+ 10000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.storeAndNodeIdCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.storeAndNodeIdTransactionalCache
+
+
+ 10000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.parentAssocsCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.parentAssocsTransactionalCache
+
+
80000
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.userToAuthorityCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.userToAuthorityTransactionalCache
-
-
- 100
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.permissionsAccessCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.permissionsAccessTransactionalCache
-
-
- 10000
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.nodeOwnerCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.nodeOwnerTransactionalCache
-
-
- 10000
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.personCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.personTransactionalCache
-
-
- 1000
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.ticketsCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.ticketsTransactionalCache
-
-
- 10
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.avmStoreTransactionalCache
-
-
- 1000
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.avm.avmEntityCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.avmEntityTransactionalCache
-
-
- 5000
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.avm.avmVersionRootEntityCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.avmVersionRootEntityTransactionalCache
-
-
- 100
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.avm.avmNodeCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.avmNodeTransactionalCache
-
-
- 5000
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.avm.avmNodeAspectsCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.avmNodeAspectsTransactionalCache
-
-
- 5000
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.repo.webservices.querySessionSharedCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.repo.webservices.querySessionTransactionalCache
-
-
- 50
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.aclCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.aclTransactionalCache
-
-
- 10000
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.resourceBundleBaseNamesCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.resourceBundleBaseNamesTransactionalCache
-
-
- 100
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.loadedResourceBundlesCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.loadedResourceBundlesTransactionalCache
-
-
- 100
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.messagesCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.messagesTransactionalCache
-
-
- 100
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.compiledModelsCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.compiledModelsTransactionalCache
-
-
- 100
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.prefixesCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.prefixesTransactionalCache
-
-
- 100
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.webScriptsRegistryCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.webScriptsRegistryTransactionalCache
-
-
- 100
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.cache.routingContentStoreSharedCache
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.alfresco.routingContentStoreTransactionalCache
-
-
- 1000
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.nodeRulesTransactionalCache
+
+
+ 2000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.userToAuthorityCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.userToAuthorityTransactionalCache
+
+
+ 100
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.permissionsAccessCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.permissionsAccessTransactionalCache
+
+
+ 10000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.nodeOwnerCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.nodeOwnerTransactionalCache
+
+
+ 10000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.personCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.personTransactionalCache
+
+
+ 1000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.ticketsCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.ticketsTransactionalCache
+
+
+ 10
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.avmStoreTransactionalCache
+
+
+ 1000
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.avm.avmEntityCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.avmEntityTransactionalCache
+
+
+ 5000
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.avm.avmVersionRootEntityCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.avmVersionRootEntityTransactionalCache
+
+
+ 100
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.avm.avmNodeCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.avmNodeTransactionalCache
+
+
+ 5000
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.avm.avmNodeAspectsCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.avmNodeAspectsTransactionalCache
+
+
+ 5000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.repo.webservices.querySessionSharedCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.repo.webservices.querySessionTransactionalCache
+
+
+ 50
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.aclCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.aclTransactionalCache
+
+
+ 10000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.resourceBundleBaseNamesCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.resourceBundleBaseNamesTransactionalCache
+
+
+ 100
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.loadedResourceBundlesCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.loadedResourceBundlesTransactionalCache
+
+
+ 100
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.messagesCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.messagesTransactionalCache
+
+
+ 100
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.compiledModelsCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.compiledModelsTransactionalCache
+
+
+ 100
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.prefixesCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.prefixesTransactionalCache
+
+
+ 100
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.webScriptsRegistryCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.webScriptsRegistryTransactionalCache
+
+
+ 100
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.cache.routingContentStoreSharedCache
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.alfresco.routingContentStoreTransactionalCache
+
+
+ 1000
+
+
+
\ No newline at end of file
diff --git a/config/alfresco/ibatis/org.hibernate.dialect.Dialect/activities-common-SqlMap.xml b/config/alfresco/ibatis/org.hibernate.dialect.Dialect/activities-common-SqlMap.xml
index 1fee1bd1ef..c1bb816998 100644
--- a/config/alfresco/ibatis/org.hibernate.dialect.Dialect/activities-common-SqlMap.xml
+++ b/config/alfresco/ibatis/org.hibernate.dialect.Dialect/activities-common-SqlMap.xml
@@ -1,7 +1,7 @@
-
@@ -9,7 +9,7 @@
-
+
@@ -22,7 +22,7 @@
-
+
@@ -30,7 +30,7 @@
-
+
@@ -170,14 +170,14 @@
where feed_user_id = #feedUserId#
]]>
-
+
@@ -185,11 +185,11 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
update alf_activity_post set status = #status#, activity_data=#activityData#, site_network=#siteNetwork#, last_modified=#lastModified#
where sequence_id = #id#
and status != #status#
-
+
update alf_activity_post set status = #status#, last_modified=#lastModified#
where sequence_id = #id#
and status != #status#
-
+
\ No newline at end of file
diff --git a/config/alfresco/ibatis/org.hibernate.dialect.Dialect/avm-common-SqlMap.xml b/config/alfresco/ibatis/org.hibernate.dialect.Dialect/avm-common-SqlMap.xml
index d1c2a68942..93f450d9b2 100644
--- a/config/alfresco/ibatis/org.hibernate.dialect.Dialect/avm-common-SqlMap.xml
+++ b/config/alfresco/ibatis/org.hibernate.dialect.Dialect/avm-common-SqlMap.xml
@@ -181,7 +181,7 @@
-
+
@@ -195,7 +195,7 @@
-
+
@@ -697,6 +697,7 @@
avm_version_roots
where
avm_store_id = ?
+ order by version_id
@@ -720,7 +721,7 @@
where
avm_store_id = ? and
create_date >= ?
- order by version_id;
+ order by version_id
diff --git a/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/avm-insert-SqlMap.xml b/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/avm-insert-SqlMap.xml
index a6919cc645..756666a00b 100755
--- a/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/avm-insert-SqlMap.xml
+++ b/config/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/avm-insert-SqlMap.xml
@@ -15,7 +15,7 @@
-
+
diff --git a/config/alfresco/node-services-context.xml b/config/alfresco/node-services-context.xml
index 86cf177465..973f08b217 100644
--- a/config/alfresco/node-services-context.xml
+++ b/config/alfresco/node-services-context.xml
@@ -196,9 +196,6 @@
-
diff --git a/config/alfresco/rule-services-context.xml b/config/alfresco/rule-services-context.xml
index 6718f04ceb..abf2a404b3 100644
--- a/config/alfresco/rule-services-context.xml
+++ b/config/alfresco/rule-services-context.xml
@@ -5,7 +5,7 @@
-
+
@@ -21,9 +21,15 @@
+
+
+
+
+
+
false
diff --git a/source/java/org/alfresco/repo/action/ActionModel.java b/source/java/org/alfresco/repo/action/ActionModel.java
index 036e380e52..cb983294bc 100644
--- a/source/java/org/alfresco/repo/action/ActionModel.java
+++ b/source/java/org/alfresco/repo/action/ActionModel.java
@@ -6,6 +6,7 @@ public interface ActionModel
{
static final String ACTION_MODEL_URI = "http://www.alfresco.org/model/action/1.0";
static final String ACTION_MODEL_PREFIX = "act";
+ static final QName TYPE_ACTION_BASE = QName.createQName(ACTION_MODEL_URI, "actionbase");
static final QName TYPE_ACTION = QName.createQName(ACTION_MODEL_URI, "action");
static final QName PROP_DEFINITION_NAME = QName.createQName(ACTION_MODEL_URI, "definitionName");
static final QName PROP_ACTION_TITLE = QName.createQName(ACTION_MODEL_URI, "actionTitle");
diff --git a/source/java/org/alfresco/repo/activities/ActivityPostServiceImpl.java b/source/java/org/alfresco/repo/activities/ActivityPostServiceImpl.java
index 1a8df8647d..c3093ef581 100644
--- a/source/java/org/alfresco/repo/activities/ActivityPostServiceImpl.java
+++ b/source/java/org/alfresco/repo/activities/ActivityPostServiceImpl.java
@@ -48,12 +48,6 @@ public class ActivityPostServiceImpl implements ActivityPostService
{
private static final Log logger = LogFactory.getLog(ActivityServiceImpl.class);
- private static final int MAX_LEN_USER_ID = 255; // needs to match schema: feed_user_id, post_user_id
- private static final int MAX_LEN_SITE_ID = 255; // needs to match schema: site_network
- private static final int MAX_LEN_ACTIVITY_TYPE = 255; // needs to match schema: activity_type
- private static final int MAX_LEN_ACTIVITY_DATA = 4000; // needs to match schema: activity_data
- private static final int MAX_LEN_APP_TOOL_ID = 36; // needs to match schema: app_tool
-
private ActivityPostDAO postDAO;
private TenantService tenantService;
private int estGridSize = 1;
@@ -148,9 +142,9 @@ public class ActivityPostServiceImpl implements ActivityPostService
{
siteId = "";
}
- else if (siteId.length() > MAX_LEN_SITE_ID)
+ else if (siteId.length() > ActivityPostDAO.MAX_LEN_SITE_ID)
{
- throw new AlfrescoRuntimeException("Invalid siteId - exceeds " + MAX_LEN_SITE_ID + " chars: " + siteId);
+ throw new IllegalArgumentException("Invalid siteId - exceeds " + ActivityPostDAO.MAX_LEN_SITE_ID + " chars: " + siteId);
}
// optional - default to empty string
@@ -158,17 +152,17 @@ public class ActivityPostServiceImpl implements ActivityPostService
{
appTool = "";
}
- else if (appTool.length() > MAX_LEN_APP_TOOL_ID)
+ else if (appTool.length() > ActivityPostDAO.MAX_LEN_APP_TOOL_ID)
{
- throw new AlfrescoRuntimeException("Invalid app tool - exceeds " + MAX_LEN_APP_TOOL_ID + " chars: " + appTool);
+ throw new IllegalArgumentException("Invalid app tool - exceeds " + ActivityPostDAO.MAX_LEN_APP_TOOL_ID + " chars: " + appTool);
}
// required
ParameterCheck.mandatoryString("activityType", activityType);
- if (activityType.length() > MAX_LEN_ACTIVITY_TYPE)
+ if (activityType.length() > ActivityPostDAO.MAX_LEN_ACTIVITY_TYPE)
{
- throw new AlfrescoRuntimeException("Invalid activity type - exceeds " + MAX_LEN_ACTIVITY_TYPE + " chars: " + activityType);
+ throw new IllegalArgumentException("Invalid activity type - exceeds " + ActivityPostDAO.MAX_LEN_ACTIVITY_TYPE + " chars: " + activityType);
}
// optional - default to empty string
@@ -176,24 +170,24 @@ public class ActivityPostServiceImpl implements ActivityPostService
{
activityData = "";
}
- else if (activityType.length() > MAX_LEN_ACTIVITY_DATA)
+ else if (activityData.length() > ActivityPostDAO.MAX_LEN_ACTIVITY_DATA)
{
- throw new AlfrescoRuntimeException("Invalid activity data - exceeds " + MAX_LEN_ACTIVITY_DATA + " chars: " + activityData);
+ throw new IllegalArgumentException("Invalid activity data - exceeds " + ActivityPostDAO.MAX_LEN_ACTIVITY_DATA + " chars: " + activityData);
}
// required
ParameterCheck.mandatoryString("currentUser", currentUser);
- if (currentUser.length() > MAX_LEN_USER_ID)
+ if (currentUser.length() > ActivityPostDAO.MAX_LEN_USER_ID)
{
- throw new AlfrescoRuntimeException("Invalid user - exceeds " + MAX_LEN_USER_ID + " chars: " + currentUser);
+ throw new IllegalArgumentException("Invalid user - exceeds " + ActivityPostDAO.MAX_LEN_USER_ID + " chars: " + currentUser);
}
}
- catch (AlfrescoRuntimeException e)
+ catch (IllegalArgumentException e)
{
// log error and throw exception
logger.error(e);
- throw e;
+ throw new IllegalArgumentException("Failed to post activity: " + e, e);
}
try
diff --git a/source/java/org/alfresco/repo/activities/feed/FeedTaskProcessor.java b/source/java/org/alfresco/repo/activities/feed/FeedTaskProcessor.java
index da1d286ab8..7ae6d78c1a 100644
--- a/source/java/org/alfresco/repo/activities/feed/FeedTaskProcessor.java
+++ b/source/java/org/alfresco/repo/activities/feed/FeedTaskProcessor.java
@@ -45,6 +45,7 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
+import org.alfresco.repo.domain.activities.ActivityFeedDAO;
import org.alfresco.repo.domain.activities.ActivityFeedEntity;
import org.alfresco.repo.domain.activities.ActivityPostEntity;
import org.alfresco.repo.domain.activities.FeedControlEntity;
@@ -113,7 +114,7 @@ public abstract class FeedTaskProcessor
Map> siteConnectedUsers = new TreeMap>();
Map templateCache = new TreeMap();
-
+
// for each activity post ...
for (ActivityPostEntity activityPost : activityPosts)
{
@@ -179,7 +180,7 @@ public abstract class FeedTaskProcessor
}
}
}
-
+
if (fmTemplates.size() == 0)
{
logger.error(">>> Skipping activity post " + activityPost.getId() + " since no specific/generic templates for activityType: " + activityType );
@@ -199,18 +200,17 @@ public abstract class FeedTaskProcessor
continue;
}
+ String thisSite = activityPost.getSiteNetwork();
+
model.put("activityType", activityPost.getActivityType());
- model.put("siteNetwork", activityPost.getSiteNetwork());
+ model.put("siteNetwork", thisSite);
model.put("userId", activityPost.getUserId());
model.put("id", activityPost.getId());
model.put("date", activityPost.getPostDate()); // post date rather than time that feed is generated
model.put("xmldate", new ISO8601DateFormatMethod());
model.put("repoEndPoint", ctx.getRepoEndPoint());
- // Get the members of this site
- String thisSite = activityPost.getSiteNetwork();
-
- // Save hammering the repository by reusing cached site members
+ // Get the members of this site - save hammering the repository by reusing cached site members
Set connectedUsers = siteConnectedUsers.get(thisSite);
if (connectedUsers == null)
{
@@ -237,7 +237,7 @@ public abstract class FeedTaskProcessor
}
}
}
-
+
try
{
startTransaction();
@@ -258,15 +258,15 @@ public abstract class FeedTaskProcessor
}
// filter based on opt-out feed controls (if any)
- if (! acceptActivity(activityPost, feedControls))
- {
- excludedConnections++;
- }
- else
- {
+ if (! acceptActivity(activityPost, feedControls))
+ {
+ excludedConnections++;
+ }
+ else
+ {
for (String fmTemplate : fmTemplates)
{
- // determine format - based on template naming convention
+ // determine format - based on template naming convention
String formatFound = null;
for (String format : formats)
{
@@ -275,7 +275,7 @@ public abstract class FeedTaskProcessor
formatFound = format;
break;
}
- }
+ }
if (formatFound == null)
{
@@ -283,48 +283,55 @@ public abstract class FeedTaskProcessor
logger.warn("Unknown format for: " + fmTemplate + " default to '"+formatFound+"'");
}
- ActivityFeedEntity feed = new ActivityFeedEntity();
-
- // Generate activity feed summary
- feed.setFeedUserId(connectedUser);
- feed.setPostUserId(postingUserId);
- feed.setActivityType(activityType);
-
- if (formatFound.equals("json"))
- {
- // allows generic JSON template to simply pass straight through
- model.put("activityData", activityPost.getActivityData());
- }
-
- String activitySummary = processFreemarker(templateCache, fmTemplate, cfg, model);
- if (! activitySummary.equals(""))
- {
- feed.setActivitySummary(activitySummary);
- feed.setActivitySummaryFormat(formatFound);
- feed.setSiteNetwork(thisSite);
- feed.setAppTool(activityPost.getAppTool());
- feed.setPostDate(activityPost.getPostDate());
- feed.setPostId(activityPost.getId());
- feed.setFeedDate(new Date());
-
- // Insert activity feed
- insertFeedEntry(feed); // ignore returned feedId
-
- totalGenerated++;
- }
- else
- {
- if (logger.isDebugEnabled())
+ ActivityFeedEntity feed = new ActivityFeedEntity();
+
+ // Generate activity feed summary
+ feed.setFeedUserId(connectedUser);
+ feed.setPostUserId(postingUserId);
+ feed.setActivityType(activityType);
+
+ if (formatFound.equals("json"))
+ {
+ // allows generic JSON template to simply pass straight through
+ model.put("activityData", activityPost.getActivityData());
+ }
+
+ String activitySummary = processFreemarker(templateCache, fmTemplate, cfg, model);
+ if (! activitySummary.equals(""))
+ {
+ if (activitySummary.length() > ActivityFeedDAO.MAX_LEN_ACTIVITY_SUMMARY)
+ {
+ logger.warn("Skip feed entry (activity post " + activityPost.getId() + ") since activity summary - exceeds " + ActivityFeedDAO.MAX_LEN_ACTIVITY_SUMMARY + " chars: " + activitySummary);
+ }
+ else
+ {
+ feed.setActivitySummary(activitySummary);
+ feed.setActivitySummaryFormat(formatFound);
+ feed.setSiteNetwork(thisSite);
+ feed.setAppTool(activityPost.getAppTool());
+ feed.setPostDate(activityPost.getPostDate());
+ feed.setPostId(activityPost.getId());
+ feed.setFeedDate(new Date());
+
+ // Insert activity feed
+ insertFeedEntry(feed); // ignore returned feedId
+
+ totalGenerated++;
+ }
+ }
+ else
+ {
+ if (logger.isDebugEnabled())
{
logger.debug("Empty template result for activityType '" + activityType + "' using format '" + formatFound + "' hence skip feed entry (activity post " + activityPost.getId() + ")");
}
- }
+ }
}
- }
+ }
}
updatePostStatus(activityPost.getId(), ActivityPostEntity.STATUS.PROCESSED);
-
+
commitTransaction();
if (logger.isDebugEnabled())
@@ -366,21 +373,21 @@ public abstract class FeedTaskProcessor
protected String callWebScript(String urlString, String ticket) throws MalformedURLException, URISyntaxException, IOException
{
- URL url = new URL(urlString);
-
- if (logger.isDebugEnabled())
- {
- logger.debug(">>> Request URI: " + url.toURI());
- }
+ URL url = new URL(urlString);
+
+ if (logger.isDebugEnabled())
+ {
+ logger.debug(">>> Request URI: " + url.toURI());
+ }
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setRequestMethod("GET");
-
+
if (ticket != null)
{
- // add Base64 encoded authorization header
+ // add Base64 encoded authorization header
// refer to: http://wiki.alfresco.com/wiki/Web_Scripts_Framework#HTTP_Basic_Authentication
- conn.addRequestProperty("Authorization", "Basic " + Base64.encodeBytes(ticket.getBytes()));
+ conn.addRequestProperty("Authorization", "Basic " + Base64.encodeBytes(ticket.getBytes()));
}
String result = null;
@@ -389,34 +396,35 @@ public abstract class FeedTaskProcessor
try
{
- is = conn.getInputStream();
- br = new BufferedReader(new InputStreamReader(is));
-
- String line = null;
- StringBuffer sb = new StringBuffer();
- while(((line = br.readLine()) !=null)) {
- sb.append(line);
- }
-
- result = sb.toString();
-
- if (logger.isDebugEnabled())
- {
- int responseCode = conn.getResponseCode();
- logger.debug(">>> Response code: " + responseCode);
- }
+ is = conn.getInputStream();
+ br = new BufferedReader(new InputStreamReader(is));
+
+ String line = null;
+ StringBuffer sb = new StringBuffer();
+ while(((line = br.readLine()) !=null))
+ {
+ sb.append(line);
+ }
+
+ result = sb.toString();
+
+ if (logger.isDebugEnabled())
+ {
+ int responseCode = conn.getResponseCode();
+ logger.debug(">>> Response code: " + responseCode);
+ }
}
finally
{
- if (br != null) { br.close(); };
- if (is != null) { is.close(); };
+ if (br != null) { br.close(); };
+ if (is != null) { is.close(); };
}
-
+
return result;
}
-
+
protected Set getSiteMembers(RepoCtx ctx, String siteId) throws Exception
- {
+ {
Set members = new HashSet();
if ((siteId != null) && (siteId.length() != 0))
{
@@ -516,10 +524,10 @@ public abstract class FeedTaskProcessor
return activityTemplates;
}
-
+
protected Configuration getFreemarkerConfiguration(RepoCtx ctx)
- {
- Configuration cfg = new Configuration();
+ {
+ Configuration cfg = new Configuration();
cfg.setObjectWrapper(new DefaultObjectWrapper());
// custom template loader
@@ -670,7 +678,7 @@ public abstract class FeedTaskProcessor
catch (Exception e)
{
throw new RuntimeException(e);
- }
+ }
}
}
}
diff --git a/source/java/org/alfresco/repo/activities/post/lookup/PostLookup.java b/source/java/org/alfresco/repo/activities/post/lookup/PostLookup.java
index 9a2d8ed804..b732dfbc61 100644
--- a/source/java/org/alfresco/repo/activities/post/lookup/PostLookup.java
+++ b/source/java/org/alfresco/repo/activities/post/lookup/PostLookup.java
@@ -128,20 +128,23 @@ public class PostLookup
for (final ActivityPostEntity activityPost : activityPosts)
{
- try
+ final String postUserId = activityPost.getUserId();
+
+ // MT share
+ String tenantDomain = tenantService.getUserDomain(postUserId);
+
+ AuthenticationUtil.runAs(new RunAsWork