mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merged V3.0 to HEAD
11410: Activity Service - iBatis mapping files for MS SQL Server (using AlfrescoSQLServerDialect) Can be Enterprised when dual build is set up 11414: Fix for missing servlet reference in repo web.xml 11415: Activity Service - iBatis mapping files for new Oracle dialects (using AlfrescoOracle10gDialect or AlfrescoOracle9iDialect) Can be Entperprised when dual build is up 11424: Remove conflicting java mail libraries. NOTE: Might affect 'CMIS web service implementation' 11426: Activity Service - use lower-case columns 11428: ETHREEOH-300: Site contributor can not delete his own blog posts 11431: Removed tutorial from Guest home 11432: ETHREEOH-198: SiteService is not MT enabled 11440: Close all ScrollableResults in try{} finally{} 11442: Fix for ETHREEOH-268, ETHREEOH-269, ETHREEOH-431, ETHREEOH-438, ETHREEOH-456, ETHREEOH-468, ETHREEOH-532 11443: Update to JSF client Help URL 11444: Build fix 11447: MT - fix ETHREEOH-530 11448: Fix for ETHREEOH-424: Edit Web Content: dojo.data.fromrfc3339 is not a function 11449: Fix for ETHREEOH-218: DM forms should be disabled git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12427 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -13,19 +13,19 @@
|
||||
table="alf_activity_post" >
|
||||
|
||||
<!-- auto-generated ID -->
|
||||
<id name="id" column="SEQUENCE_ID" type="long">
|
||||
<id name="id" column="sequence_id" type="long">
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
|
||||
<property name="postDate" column="POST_DATE" not-null="true" type="timestamp"/>
|
||||
<property name="status" column="STATUS" not-null="true" type="string" length="10"/>
|
||||
<property name="activityData" column="ACTIVITY_DATA" not-null="true" type="string" length="4000"/>
|
||||
<property name="userId" column="POST_USER_ID" not-null="true" type="string" length="255"/>
|
||||
<property name="jobTaskNode" column="JOB_TASK_NODE" not-null="true" type="integer"/>
|
||||
<property name="siteNetwork" column="SITE_NETWORK" type="string" length="255"/>
|
||||
<property name="appTool" column="APP_TOOL" type="string" length="36"/>
|
||||
<property name="activityType" column="ACTIVITY_TYPE" not-null="true" type="string" length="255"/>
|
||||
<property name="lastModified" column="LAST_MODIFIED" not-null="true" type="timestamp"/>
|
||||
<property name="postDate" column="post_date" not-null="true" type="timestamp"/>
|
||||
<property name="status" column="status" not-null="true" type="string" length="10"/>
|
||||
<property name="activityData" column="activity_data" not-null="true" type="string" length="4000"/>
|
||||
<property name="userId" column="post_user_id" not-null="true" type="string" length="255"/>
|
||||
<property name="jobTaskNode" column="job_task_node" not-null="true" type="integer"/>
|
||||
<property name="siteNetwork" column="site_network" type="string" length="255"/>
|
||||
<property name="appTool" column="app_tool" type="string" length="36"/>
|
||||
<property name="activityType" column="activity_type" not-null="true" type="string" length="255"/>
|
||||
<property name="lastModified" column="last_modified" not-null="true" type="timestamp"/>
|
||||
|
||||
</class>
|
||||
|
||||
@@ -34,20 +34,20 @@
|
||||
table="alf_activity_feed" >
|
||||
|
||||
<!-- auto-generated ID -->
|
||||
<id name="id" column="ID" type="long">
|
||||
<id name="id" column="id" type="long">
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
|
||||
<property name="postId" column="POST_ID" type="long"/>
|
||||
<property name="postDate" column="POST_DATE" not-null="true" type="timestamp"/>
|
||||
<property name="activitySummary" column="ACTIVITY_SUMMARY" type="string" length="4000"/>
|
||||
<property name="feedUserId" column="FEED_USER_ID" type="string" length="255"/>
|
||||
<property name="activityType" column="ACTIVITY_TYPE" not-null="true" type="string" length="255"/>
|
||||
<property name="activitySummaryFormat" column="ACTIVITY_FORMAT" type="string" length="10"/>
|
||||
<property name="siteNetwork" column="SITE_NETWORK" type="string" length="255"/>
|
||||
<property name="appTool" column="APP_TOOL" type="string" length="36"/>
|
||||
<property name="postUserId" column="POST_USER_ID" not-null="true" type="string" length="255"/>
|
||||
<property name="feedDate" column="FEED_DATE" not-null="true" type="timestamp"/>
|
||||
<property name="postId" column="post_id" type="long"/>
|
||||
<property name="postDate" column="post_date" not-null="true" type="timestamp"/>
|
||||
<property name="activitySummary" column="activity_summary" type="string" length="4000"/>
|
||||
<property name="feedUserId" column="feed_user_id" type="string" length="255"/>
|
||||
<property name="activityType" column="activity_type" not-null="true" type="string" length="255"/>
|
||||
<property name="activitySummaryFormat" column="activity_format" type="string" length="10"/>
|
||||
<property name="siteNetwork" column="site_network" type="string" length="255"/>
|
||||
<property name="appTool" column="app_tool" type="string" length="36"/>
|
||||
<property name="postUserId" column="post_user_id" not-null="true" type="string" length="255"/>
|
||||
<property name="feedDate" column="feed_date" not-null="true" type="timestamp"/>
|
||||
|
||||
</class>
|
||||
|
||||
@@ -56,14 +56,14 @@
|
||||
table="alf_activity_feed_control" >
|
||||
|
||||
<!-- auto-generated ID -->
|
||||
<id name="id" column="ID" type="long">
|
||||
<id name="id" column="id" type="long">
|
||||
<generator class="native"/>
|
||||
</id>
|
||||
|
||||
<property name="feedUserId" column="FEED_USER_ID" not-null="true" type="string" length="255"/>
|
||||
<property name="siteNetwork" column="SITE_NETWORK" type="string" length="255"/>
|
||||
<property name="appTool" column="APP_TOOL" type="string" length="36"/>
|
||||
<property name="lastModified" column="LAST_MODIFIED" not-null="true" type="timestamp"/>
|
||||
<property name="feedUserId" column="feed_user_id" not-null="true" type="string" length="255"/>
|
||||
<property name="siteNetwork" column="site_network" type="string" length="255"/>
|
||||
<property name="appTool" column="app_tool" type="string" length="36"/>
|
||||
<property name="lastModified" column="last_modified" not-null="true" type="timestamp"/>
|
||||
|
||||
</class>
|
||||
|
||||
|
@@ -1349,7 +1349,7 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
|
||||
StoreRef storeRef = AVMNodeConverter.ToStoreRef("main");
|
||||
SearchService searchService = fIndexerAndSearcher.getSearcher(storeRef, true);
|
||||
ResultSet results = searchService.query(storeRef, "lucene", "TEXT:\"tutorial\"");
|
||||
ResultSet results = searchService.query(storeRef, "lucene", "@" + LuceneQueryParser.escape(ContentModel.PROP_NAME.toString()) + ":\"guest\"");
|
||||
assertEquals(0, results.length());
|
||||
results.close();
|
||||
|
||||
@@ -1363,7 +1363,7 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
|
||||
fService.createSnapshot("main", null, null);
|
||||
searchService = fIndexerAndSearcher.getSearcher(storeRef, true);
|
||||
results = searchService.query(storeRef, "lucene", "TEXT:\"tutorial\"");
|
||||
results = searchService.query(storeRef, "lucene", "@" + LuceneQueryParser.escape(ContentModel.PROP_NAME.toString()) + ":\"guest\"");
|
||||
assertEquals(1, results.length());
|
||||
results.close();
|
||||
|
||||
|
@@ -162,11 +162,22 @@ class AVMNodeDAOHibernate extends HibernateDaoSupport implements
|
||||
public void getContentUrls(ContentUrlHandler handler)
|
||||
{
|
||||
Query query = getSession().getNamedQuery("PlainFileNode.GetContentUrls");
|
||||
ScrollableResults results = query.scroll(ScrollMode.FORWARD_ONLY);
|
||||
while (results.next())
|
||||
ScrollableResults results = null;
|
||||
try
|
||||
{
|
||||
String contentUrl = results.getText(0);
|
||||
handler.handle(contentUrl);
|
||||
results = query.scroll(ScrollMode.FORWARD_ONLY);
|
||||
while (results.next())
|
||||
{
|
||||
String contentUrl = results.getText(0);
|
||||
handler.handle(contentUrl);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (results != null)
|
||||
{
|
||||
results.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -73,11 +73,22 @@ public class HibernateContentUrlDAOImpl extends HibernateDaoSupport implements C
|
||||
return query.scroll(ScrollMode.FORWARD_ONLY);
|
||||
}
|
||||
};
|
||||
ScrollableResults results = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
while (results.next())
|
||||
ScrollableResults results = null;
|
||||
try
|
||||
{
|
||||
String contentUrl = results.getText(0);
|
||||
handler.handle(contentUrl);
|
||||
results = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
while (results.next())
|
||||
{
|
||||
String contentUrl = results.getText(0);
|
||||
handler.handle(contentUrl);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(results != null)
|
||||
{
|
||||
results.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -48,18 +48,31 @@ public class HibernateHelper
|
||||
*/
|
||||
public static int deleteDbAccessControlEntries(Session session, Query query)
|
||||
{
|
||||
ScrollableResults entities = query.scroll(ScrollMode.FORWARD_ONLY);
|
||||
ScrollableResults entities = null;
|
||||
int count = 0;
|
||||
while (entities.next())
|
||||
try
|
||||
{
|
||||
DbAccessControlEntry entry = (DbAccessControlEntry) entities.get(0);
|
||||
entry.delete();
|
||||
if (++count % 50 == 0)
|
||||
entities = query.scroll(ScrollMode.FORWARD_ONLY);
|
||||
|
||||
while (entities.next())
|
||||
{
|
||||
session.flush();
|
||||
session.clear();
|
||||
DbAccessControlEntry entry = (DbAccessControlEntry) entities.get(0);
|
||||
entry.delete();
|
||||
if (++count % 50 == 0)
|
||||
{
|
||||
session.flush();
|
||||
session.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(entities != null)
|
||||
{
|
||||
entities.close();
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
@@ -1362,16 +1362,26 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
||||
return query.scroll(ScrollMode.FORWARD_ONLY);
|
||||
}
|
||||
};
|
||||
ScrollableResults childNodeIds = (ScrollableResults) getHibernateTemplate().execute(getChildNodeIdsCallback);
|
||||
while (childNodeIds.next())
|
||||
ScrollableResults childNodeIds = null;
|
||||
try
|
||||
{
|
||||
Long childNodeId = childNodeIds.getLong(0);
|
||||
parentAssocsCache.remove(childNodeId);
|
||||
if (isDebugParentAssocCacheEnabled)
|
||||
childNodeIds = (ScrollableResults) getHibernateTemplate().execute(getChildNodeIdsCallback);
|
||||
|
||||
while (childNodeIds.next())
|
||||
{
|
||||
loggerParentAssocsCache.debug("\n" +
|
||||
"Parent associations cache - Removing entry: \n" +
|
||||
" Node: " + childNodeId);
|
||||
Long childNodeId = childNodeIds.getLong(0);
|
||||
parentAssocsCache.remove(childNodeId);
|
||||
if (isDebugParentAssocCacheEnabled)
|
||||
{
|
||||
loggerParentAssocsCache.debug("\n" + "Parent associations cache - Removing entry: \n" + " Node: " + childNodeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(childNodeIds != null)
|
||||
{
|
||||
childNodeIds.close();
|
||||
}
|
||||
}
|
||||
HibernateCallback deleteParentAssocsCallback = new HibernateCallback()
|
||||
@@ -1848,16 +1858,28 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
||||
return query.scroll(ScrollMode.FORWARD_ONLY);
|
||||
}
|
||||
};
|
||||
ScrollableResults queryResults = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
convertToChildAssocRefs(parentNode, queryResults, queryCallback);
|
||||
|
||||
// Now recurse, if required
|
||||
if (recurse)
|
||||
ScrollableResults queryResults = null;
|
||||
try
|
||||
{
|
||||
for (Long childNodeId : childNodeIds)
|
||||
queryResults = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
convertToChildAssocRefs(parentNode, queryResults, queryCallback);
|
||||
|
||||
// Now recurse, if required
|
||||
if (recurse)
|
||||
{
|
||||
getChildAssocs(childNodeId, resultsCallback, recurse);
|
||||
}
|
||||
for (Long childNodeId : childNodeIds)
|
||||
{
|
||||
getChildAssocs(childNodeId, resultsCallback, recurse);
|
||||
}
|
||||
}
|
||||
// Done
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (queryResults != null)
|
||||
{
|
||||
queryResults.close();
|
||||
}
|
||||
}
|
||||
// Done
|
||||
}
|
||||
@@ -1887,8 +1909,19 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
||||
return query.scroll(ScrollMode.FORWARD_ONLY);
|
||||
}
|
||||
};
|
||||
ScrollableResults queryResults = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
convertToChildAssocRefs(parentNode, queryResults, resultsCallback);
|
||||
ScrollableResults queryResults = null;
|
||||
try
|
||||
{
|
||||
queryResults = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
convertToChildAssocRefs(parentNode, queryResults, resultsCallback);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (queryResults != null)
|
||||
{
|
||||
queryResults.close();
|
||||
}
|
||||
}
|
||||
// Done
|
||||
}
|
||||
|
||||
@@ -1927,8 +1960,19 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
||||
return query.scroll(ScrollMode.FORWARD_ONLY);
|
||||
}
|
||||
};
|
||||
ScrollableResults queryResults = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
convertToChildAssocRefs(parentNode, queryResults, resultsCallback);
|
||||
ScrollableResults queryResults = null;
|
||||
try
|
||||
{
|
||||
queryResults = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
convertToChildAssocRefs(parentNode, queryResults, resultsCallback);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (queryResults != null)
|
||||
{
|
||||
queryResults.close();
|
||||
}
|
||||
}
|
||||
// Done
|
||||
}
|
||||
|
||||
@@ -1963,8 +2007,19 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
||||
return query.scroll(ScrollMode.FORWARD_ONLY);
|
||||
}
|
||||
};
|
||||
ScrollableResults queryResults = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
convertToChildAssocRefs(parentNode, queryResults, resultsCallback);
|
||||
ScrollableResults queryResults = null;
|
||||
try
|
||||
{
|
||||
queryResults = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
convertToChildAssocRefs(parentNode, queryResults, resultsCallback);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (queryResults != null)
|
||||
{
|
||||
queryResults.close();
|
||||
}
|
||||
}
|
||||
// Done
|
||||
}
|
||||
|
||||
@@ -2005,8 +2060,19 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
||||
return query.scroll(ScrollMode.FORWARD_ONLY);
|
||||
}
|
||||
};
|
||||
ScrollableResults queryResults = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
convertToChildAssocRefs(parentNode, queryResults, resultsCallback);
|
||||
ScrollableResults queryResults = null;
|
||||
try
|
||||
{
|
||||
queryResults = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
convertToChildAssocRefs(parentNode, queryResults, resultsCallback);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (queryResults != null)
|
||||
{
|
||||
queryResults.close();
|
||||
}
|
||||
}
|
||||
// Done
|
||||
}
|
||||
|
||||
@@ -2024,8 +2090,19 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
||||
return query.scroll(ScrollMode.FORWARD_ONLY);
|
||||
}
|
||||
};
|
||||
ScrollableResults queryResults = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
convertToChildAssocRefs(parentNode, queryResults, resultsCallback);
|
||||
ScrollableResults queryResults = null;
|
||||
try
|
||||
{
|
||||
queryResults = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
convertToChildAssocRefs(parentNode, queryResults, resultsCallback);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (queryResults != null)
|
||||
{
|
||||
queryResults.close();
|
||||
}
|
||||
}
|
||||
// Done
|
||||
}
|
||||
|
||||
@@ -2043,8 +2120,19 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
||||
return query.scroll(ScrollMode.FORWARD_ONLY);
|
||||
}
|
||||
};
|
||||
ScrollableResults queryResults = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
convertToChildAssocRefs(parentNode, queryResults, resultsCallback);
|
||||
ScrollableResults queryResults = null;
|
||||
try
|
||||
{
|
||||
queryResults = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
convertToChildAssocRefs(parentNode, queryResults, resultsCallback);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (queryResults != null)
|
||||
{
|
||||
queryResults.close();
|
||||
}
|
||||
}
|
||||
// Done
|
||||
}
|
||||
|
||||
@@ -2215,8 +2303,20 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
||||
return query.scroll(ScrollMode.FORWARD_ONLY);
|
||||
}
|
||||
};
|
||||
ScrollableResults queryResults = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
processNodeResults(queryResults, resultsCallback);
|
||||
ScrollableResults queryResults = null;
|
||||
try
|
||||
{
|
||||
queryResults = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
processNodeResults(queryResults, resultsCallback);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (queryResults != null)
|
||||
{
|
||||
queryResults.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Done
|
||||
}
|
||||
|
||||
@@ -2234,8 +2334,20 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
||||
return query.scroll(ScrollMode.FORWARD_ONLY);
|
||||
}
|
||||
};
|
||||
ScrollableResults queryResults = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
processNodeResults(queryResults, resultsCallback);
|
||||
ScrollableResults queryResults = null;
|
||||
try
|
||||
{
|
||||
queryResults = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
processNodeResults(queryResults, resultsCallback);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (queryResults != null)
|
||||
{
|
||||
queryResults.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Done
|
||||
}
|
||||
|
||||
@@ -2695,18 +2807,29 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
||||
return query.scroll(ScrollMode.FORWARD_ONLY);
|
||||
}
|
||||
};
|
||||
ScrollableResults results = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
// Callback with the results
|
||||
Session session = getSession();
|
||||
while (results.next())
|
||||
ScrollableResults results = null;
|
||||
try
|
||||
{
|
||||
Node node = (Node) results.get(0);
|
||||
NodeRef nodeRef = node.getNodeRef();
|
||||
QNameEntity nodeTypeQNameEntity = node.getTypeQName();
|
||||
QName nodeTypeQName = nodeTypeQNameEntity.getQName();
|
||||
handler.handle(nodeRef, nodeTypeQName, propertyQName, value);
|
||||
// Flush if required
|
||||
DirtySessionMethodInterceptor.flushSession(session);
|
||||
results = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
// Callback with the results
|
||||
Session session = getSession();
|
||||
while (results.next())
|
||||
{
|
||||
Node node = (Node) results.get(0);
|
||||
NodeRef nodeRef = node.getNodeRef();
|
||||
QNameEntity nodeTypeQNameEntity = node.getTypeQName();
|
||||
QName nodeTypeQName = nodeTypeQNameEntity.getQName();
|
||||
handler.handle(nodeRef, nodeTypeQName, propertyQName, value);
|
||||
// Flush if required
|
||||
DirtySessionMethodInterceptor.flushSession(session);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (results != null)
|
||||
{
|
||||
results.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2762,59 +2885,71 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
||||
return query.scroll(ScrollMode.FORWARD_ONLY);
|
||||
}
|
||||
};
|
||||
ScrollableResults results = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
// Loop through, extracting content URLs
|
||||
TypeConverter converter = DefaultTypeConverter.INSTANCE;
|
||||
int unflushedCount = 0;
|
||||
while(results.next())
|
||||
ScrollableResults results = null;
|
||||
try
|
||||
{
|
||||
Node node = (Node) results.get()[0];
|
||||
// loop through all the node properties
|
||||
Map<PropertyMapKey, NodePropertyValue> properties = node.getProperties();
|
||||
for (Map.Entry<PropertyMapKey, NodePropertyValue> entry : properties.entrySet())
|
||||
results = (ScrollableResults) getHibernateTemplate().execute(callback);
|
||||
|
||||
// Loop through, extracting content URLs
|
||||
TypeConverter converter = DefaultTypeConverter.INSTANCE;
|
||||
int unflushedCount = 0;
|
||||
while (results.next())
|
||||
{
|
||||
PropertyMapKey propertyKey = entry.getKey();
|
||||
NodePropertyValue propertyValue = entry.getValue();
|
||||
// ignore nulls
|
||||
if (propertyValue == null)
|
||||
Node node = (Node) results.get()[0];
|
||||
// loop through all the node properties
|
||||
Map<PropertyMapKey, NodePropertyValue> properties = node.getProperties();
|
||||
for (Map.Entry<PropertyMapKey, NodePropertyValue> entry : properties.entrySet())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Long propertyQNameId = propertyKey.getQnameId();
|
||||
// Get the actual value(s) as a collection
|
||||
Collection<Serializable> values = propertyValue.getCollection(DataTypeDefinition.ANY);
|
||||
// attempt to convert instance in the collection
|
||||
for (Serializable value : values)
|
||||
{
|
||||
// ignore nulls (null entries in collections)
|
||||
if (value == null)
|
||||
PropertyMapKey propertyKey = entry.getKey();
|
||||
NodePropertyValue propertyValue = entry.getValue();
|
||||
// ignore nulls
|
||||
if (propertyValue == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Serializable convertedValue = null;
|
||||
try
|
||||
Long propertyQNameId = propertyKey.getQnameId();
|
||||
// Get the actual value(s) as a collection
|
||||
Collection<Serializable> values = propertyValue.getCollection(DataTypeDefinition.ANY);
|
||||
// attempt to convert instance in the collection
|
||||
for (Serializable value : values)
|
||||
{
|
||||
convertedValue = (Serializable) converter.convert(actualDataTypeDefinition, value);
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
// The value can't be converted - forget it
|
||||
}
|
||||
if (convertedValue != null)
|
||||
{
|
||||
NodeRef nodeRef = node.getNodeRef();
|
||||
QName nodeTypeQName = node.getTypeQName().getQName();
|
||||
QName propertyQName = qnameDAO.getQName(propertyQNameId);
|
||||
handler.handle(nodeRef, nodeTypeQName, propertyQName, convertedValue);
|
||||
// ignore nulls (null entries in collections)
|
||||
if (value == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Serializable convertedValue = null;
|
||||
try
|
||||
{
|
||||
convertedValue = (Serializable) converter.convert(actualDataTypeDefinition, value);
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
// The value can't be converted - forget it
|
||||
}
|
||||
if (convertedValue != null)
|
||||
{
|
||||
NodeRef nodeRef = node.getNodeRef();
|
||||
QName nodeTypeQName = node.getTypeQName().getQName();
|
||||
QName propertyQName = qnameDAO.getQName(propertyQNameId);
|
||||
handler.handle(nodeRef, nodeTypeQName, propertyQName, convertedValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
unflushedCount++;
|
||||
if (unflushedCount >= 1000)
|
||||
{
|
||||
// evict all data from the session
|
||||
getSession().clear();
|
||||
unflushedCount = 0;
|
||||
}
|
||||
}
|
||||
unflushedCount++;
|
||||
if (unflushedCount >= 1000)
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (results != null)
|
||||
{
|
||||
// evict all data from the session
|
||||
getSession().clear();
|
||||
unflushedCount = 0;
|
||||
results.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -89,9 +89,6 @@ public class SiteServiceImpl implements SiteService, SiteModel
|
||||
private TaggingService taggingService;
|
||||
private AuthorityService authorityService;
|
||||
|
||||
/** The site root node reference */
|
||||
private NodeRef siteRootNodeRef;
|
||||
|
||||
/**
|
||||
* Set node service
|
||||
*
|
||||
@@ -351,26 +348,21 @@ public class SiteServiceImpl implements SiteService, SiteModel
|
||||
* @return NodeRef node reference
|
||||
*/
|
||||
private NodeRef getSiteRoot()
|
||||
{
|
||||
if (this.siteRootNodeRef == null)
|
||||
{
|
||||
// Get the root 'sites' folder
|
||||
ResultSet resultSet = this.searchService.query(SITE_STORE, SearchService.LANGUAGE_LUCENE, "TYPE:\"st:sites\"");
|
||||
if (resultSet.length() == 0)
|
||||
{
|
||||
// Get the root 'sites' folder
|
||||
ResultSet resultSet = this.searchService.query(SITE_STORE, SearchService.LANGUAGE_LUCENE, "TYPE:\"st:sites\"");
|
||||
if (resultSet.length() == 0)
|
||||
{
|
||||
// No root site folder exists
|
||||
throw new AlfrescoRuntimeException("No root sites folder exists");
|
||||
}
|
||||
else if (resultSet.length() != 1)
|
||||
{
|
||||
// More than one root site folder exits
|
||||
throw new AlfrescoRuntimeException("More than one root sites folder exists");
|
||||
}
|
||||
|
||||
this.siteRootNodeRef = resultSet.getNodeRef(0);
|
||||
// No root site folder exists
|
||||
throw new AlfrescoRuntimeException("No root sites folder exists");
|
||||
}
|
||||
|
||||
return this.siteRootNodeRef;
|
||||
else if (resultSet.length() != 1)
|
||||
{
|
||||
// More than one root site folder exits
|
||||
throw new AlfrescoRuntimeException("More than one root sites folder exists");
|
||||
}
|
||||
|
||||
return resultSet.getNodeRef(0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -664,7 +656,6 @@ public class SiteServiceImpl implements SiteService, SiteModel
|
||||
|
||||
// Get the current user
|
||||
String currentUserName = AuthenticationUtil.getCurrentUserName();
|
||||
String currentUserRole = getMembersRole(shortName, currentUserName);
|
||||
|
||||
// Get the user current role
|
||||
final String role = getMembersRole(shortName, userName);
|
||||
@@ -763,7 +754,6 @@ public class SiteServiceImpl implements SiteService, SiteModel
|
||||
// -- the member does not already have permissions
|
||||
// ... then we can set the permissions as system user
|
||||
final String currentUserName = AuthenticationUtil.getCurrentUserName();
|
||||
final String currentUserRole = getMembersRole(shortName, currentUserName);
|
||||
if ((permissionService.hasPermission(siteNodeRef, PermissionService.CHANGE_PERMISSIONS) == AccessStatus.ALLOWED)
|
||||
||
|
||||
(isPublic == true &&
|
||||
|
@@ -31,6 +31,7 @@ import java.util.List;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
@@ -96,26 +97,37 @@ public class RefreshTagScopeActionExecuter extends ActionExecuterAbstractBase
|
||||
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@Override
|
||||
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
|
||||
protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef)
|
||||
{
|
||||
if (this.nodeService.exists(actionedUponNodeRef) == true &&
|
||||
this.nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_TAGSCOPE) == true)
|
||||
{
|
||||
// Create a new list of tag details
|
||||
List<TagDetails> tags = new ArrayList<TagDetails>(10);
|
||||
// Run the update as the system user
|
||||
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
|
||||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object doWork() throws Exception
|
||||
{
|
||||
// Create a new list of tag details
|
||||
List<TagDetails> tags = new ArrayList<TagDetails>(10);
|
||||
|
||||
// Count the tags found in all the (primary) children of the node
|
||||
countTags(actionedUponNodeRef, tags);
|
||||
|
||||
// Order the list
|
||||
Collections.sort(tags);
|
||||
|
||||
// Write new content back to tag scope
|
||||
String tagContent = TaggingServiceImpl.tagDetailsToString(tags);
|
||||
ContentWriter contentWriter = contentService.getWriter(actionedUponNodeRef, ContentModel.PROP_TAGSCOPE_CACHE, true);
|
||||
contentWriter.setEncoding("UTF-8");
|
||||
contentWriter.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
||||
contentWriter.putContent(tagContent);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// Count the tags found in all the (primary) children of the node
|
||||
countTags(actionedUponNodeRef, tags);
|
||||
|
||||
// Order the list
|
||||
Collections.sort(tags);
|
||||
|
||||
// Write new content back to tag scope
|
||||
String tagContent = TaggingServiceImpl.tagDetailsToString(tags);
|
||||
ContentWriter contentWriter = this.contentService.getWriter(actionedUponNodeRef, ContentModel.PROP_TAGSCOPE_CACHE, true);
|
||||
contentWriter.setEncoding("UTF-8");
|
||||
contentWriter.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
||||
contentWriter.putContent(tagContent);
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -33,6 +33,7 @@ import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.action.ParameterDefinitionImpl;
|
||||
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
@@ -101,96 +102,105 @@ public class UpdateTagScopesActionExecuter extends ActionExecuterAbstractBase
|
||||
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@Override
|
||||
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
|
||||
protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
if (this.nodeService.exists(actionedUponNodeRef) == true)
|
||||
{
|
||||
// Get the parameter values
|
||||
Map<String, Boolean> tagUpdates = (Map<String, Boolean>)action.getParameterValue(PARAM_TAG_UPDATES);
|
||||
|
||||
// Get the tag scopes for the actioned upon node
|
||||
List<TagScope> tagScopes = this.taggingService.findAllTagScopes(actionedUponNodeRef);
|
||||
|
||||
// Update each tag scope
|
||||
for (TagScope tagScope : tagScopes)
|
||||
{
|
||||
if (this.nodeService.exists(actionedUponNodeRef) == true)
|
||||
{
|
||||
NodeRef tagScopeNodeRef = tagScope.getNodeRef();
|
||||
List<TagDetails> tags = null;
|
||||
|
||||
// Get the current tags
|
||||
ContentReader contentReader = this.contentService.getReader(tagScopeNodeRef, ContentModel.PROP_TAGSCOPE_CACHE);
|
||||
if (contentReader == null)
|
||||
// Run the update as the system user
|
||||
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
|
||||
{
|
||||
tags = new ArrayList<TagDetails>(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
tags = TaggingServiceImpl.readTagDetails(contentReader.getContentInputStream());
|
||||
}
|
||||
|
||||
for (String tagName : tagUpdates.keySet())
|
||||
{
|
||||
boolean isAdd = tagUpdates.get(tagName).booleanValue();
|
||||
|
||||
TagDetails currentTag = null;
|
||||
for (TagDetails tag : tags)
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object doWork() throws Exception
|
||||
{
|
||||
if (tag.getName().equals(tagName) == true)
|
||||
// Get the parameter values
|
||||
Map<String, Boolean> tagUpdates = (Map<String, Boolean>)action.getParameterValue(PARAM_TAG_UPDATES);
|
||||
|
||||
// Get the tag scopes for the actioned upon node
|
||||
List<TagScope> tagScopes = taggingService.findAllTagScopes(actionedUponNodeRef);
|
||||
|
||||
// Update each tag scope
|
||||
for (TagScope tagScope : tagScopes)
|
||||
{
|
||||
currentTag = tag;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isAdd == true)
|
||||
{
|
||||
if (currentTag == null)
|
||||
{
|
||||
tags.add(new TagDetailsImpl(tagName, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
((TagDetailsImpl)currentTag).incrementCount();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentTag != null)
|
||||
{
|
||||
int currentTagCount = currentTag.getCount();
|
||||
if (currentTagCount == 1)
|
||||
NodeRef tagScopeNodeRef = tagScope.getNodeRef();
|
||||
List<TagDetails> tags = null;
|
||||
|
||||
// Get the current tags
|
||||
ContentReader contentReader = contentService.getReader(tagScopeNodeRef, ContentModel.PROP_TAGSCOPE_CACHE);
|
||||
if (contentReader == null)
|
||||
{
|
||||
tags.remove(currentTag);
|
||||
tags = new ArrayList<TagDetails>(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
((TagDetailsImpl)currentTag).decrementCount();
|
||||
tags = TaggingServiceImpl.readTagDetails(contentReader.getContentInputStream());
|
||||
}
|
||||
|
||||
for (String tagName : tagUpdates.keySet())
|
||||
{
|
||||
boolean isAdd = tagUpdates.get(tagName).booleanValue();
|
||||
|
||||
TagDetails currentTag = null;
|
||||
for (TagDetails tag : tags)
|
||||
{
|
||||
if (tag.getName().equals(tagName) == true)
|
||||
{
|
||||
currentTag = tag;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isAdd == true)
|
||||
{
|
||||
if (currentTag == null)
|
||||
{
|
||||
tags.add(new TagDetailsImpl(tagName, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
((TagDetailsImpl)currentTag).incrementCount();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentTag != null)
|
||||
{
|
||||
int currentTagCount = currentTag.getCount();
|
||||
if (currentTagCount == 1)
|
||||
{
|
||||
tags.remove(currentTag);
|
||||
}
|
||||
else
|
||||
{
|
||||
((TagDetailsImpl)currentTag).decrementCount();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Order the list
|
||||
Collections.sort(tags);
|
||||
|
||||
// Write new content back to tag scope
|
||||
String tagContent = TaggingServiceImpl.tagDetailsToString(tags);
|
||||
ContentWriter contentWriter = contentService.getWriter(tagScopeNodeRef, ContentModel.PROP_TAGSCOPE_CACHE, true);
|
||||
contentWriter.setEncoding("UTF-8");
|
||||
contentWriter.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
||||
contentWriter.putContent(tagContent);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Order the list
|
||||
Collections.sort(tags);
|
||||
|
||||
// Write new content back to tag scope
|
||||
String tagContent = TaggingServiceImpl.tagDetailsToString(tags);
|
||||
ContentWriter contentWriter = this.contentService.getWriter(tagScopeNodeRef, ContentModel.PROP_TAGSCOPE_CACHE, true);
|
||||
contentWriter.setEncoding("UTF-8");
|
||||
contentWriter.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
||||
contentWriter.putContent(tagContent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
}
|
||||
}
|
||||
catch (RuntimeException exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
throw exception;
|
||||
throw new RuntimeException("Unable to update the tag scopes.", exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -85,16 +85,20 @@ public class MultiTDemoTest extends TestCase
|
||||
private TenantService tenantService;
|
||||
private AuthorityService authorityService;
|
||||
private CategoryService categoryService;
|
||||
|
||||
public static final String TEST_TENANT_DOMAIN1 = "yyy.com";
|
||||
public static final String TEST_TENANT_DOMAIN2 = "zzz.com";
|
||||
|
||||
private static List<String> tenants;
|
||||
public static int NUM_TENANTS = 11;
|
||||
|
||||
public static final String TEST_TENANT_DOMAIN = "my.test";
|
||||
public static final String TEST_TENANT_DOMAIN2 = TEST_TENANT_DOMAIN+"2";
|
||||
|
||||
public static List<String> tenants;
|
||||
|
||||
static {
|
||||
tenants = new ArrayList<String>(2);
|
||||
tenants.add(TEST_TENANT_DOMAIN1);
|
||||
tenants.add(TEST_TENANT_DOMAIN2);
|
||||
tenants = new ArrayList<String>(NUM_TENANTS);
|
||||
for (int i = 1; i <= NUM_TENANTS; i++)
|
||||
{
|
||||
tenants.add(TEST_TENANT_DOMAIN+i);
|
||||
}
|
||||
}
|
||||
|
||||
public static final String ROOT_DIR = "./tenantstores";
|
||||
@@ -487,31 +491,33 @@ public class MultiTDemoTest extends TestCase
|
||||
{
|
||||
logger.info("Test get property");
|
||||
|
||||
final String tenantDomain = TEST_TENANT_DOMAIN1;
|
||||
String tenantAdminName = tenantService.getDomainUser(TenantService.ADMIN_BASENAME, tenantDomain);
|
||||
|
||||
AuthenticationUtil.runAs(new RunAsWork<Object>()
|
||||
for (final String tenantDomain : tenants)
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
String tenantAdminName = tenantService.getDomainUser(TenantService.ADMIN_BASENAME, tenantDomain);
|
||||
|
||||
AuthenticationUtil.runAs(new RunAsWork<Object>()
|
||||
{
|
||||
NodeRef personNodeRef = createUser(TEST_USER4, tenantDomain, "welcome");
|
||||
|
||||
// Test nodeRef property
|
||||
NodeRef homeFolderNodeRef = (NodeRef)nodeService.getProperty(personNodeRef, ContentModel.PROP_HOMEFOLDER);
|
||||
assertFalse(homeFolderNodeRef.toString().contains(tenantDomain));
|
||||
|
||||
Map<QName, Serializable> props = (Map<QName, Serializable>)nodeService.getProperties(personNodeRef);
|
||||
assertFalse(props.get(ContentModel.PROP_HOMEFOLDER).toString().contains(tenantDomain));
|
||||
|
||||
// Test "store-identifier" property
|
||||
String storeId = (String)nodeService.getProperty(personNodeRef, ContentModel.PROP_STORE_IDENTIFIER);
|
||||
assertFalse(storeId.contains(tenantDomain));
|
||||
|
||||
assertFalse(props.get(ContentModel.PROP_STORE_IDENTIFIER).toString().contains(tenantDomain));
|
||||
|
||||
return null;
|
||||
}
|
||||
}, tenantAdminName);
|
||||
public Object doWork() throws Exception
|
||||
{
|
||||
NodeRef personNodeRef = createUser(TEST_USER4, tenantDomain, "welcome");
|
||||
|
||||
// Test nodeRef property
|
||||
NodeRef homeFolderNodeRef = (NodeRef)nodeService.getProperty(personNodeRef, ContentModel.PROP_HOMEFOLDER);
|
||||
assertFalse(homeFolderNodeRef.toString().contains(tenantDomain));
|
||||
|
||||
Map<QName, Serializable> props = (Map<QName, Serializable>)nodeService.getProperties(personNodeRef);
|
||||
assertFalse(props.get(ContentModel.PROP_HOMEFOLDER).toString().contains(tenantDomain));
|
||||
|
||||
// Test "store-identifier" property
|
||||
String storeId = (String)nodeService.getProperty(personNodeRef, ContentModel.PROP_STORE_IDENTIFIER);
|
||||
assertFalse(storeId.contains(tenantDomain));
|
||||
|
||||
assertFalse(props.get(ContentModel.PROP_STORE_IDENTIFIER).toString().contains(tenantDomain));
|
||||
|
||||
return null;
|
||||
}
|
||||
}, tenantAdminName);
|
||||
}
|
||||
}
|
||||
|
||||
private void createGroup(String shortName, String parentShortName)
|
||||
|
Reference in New Issue
Block a user