mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merged V3.2 to HEAD
17620: Merged DEV_TEMPORARY to V3.2 17599: Fix for ETHREEOH-3308: xf:switch cannot be used in repeating field type 17634: Put back AVM concurrency checks (reverse r17405) 17644: Fixed up some comments and added return value to in-txn recording of deleted nodes 17647: Fixed read-only detection of ContentStoreCleaner 17648: Merged DEV fixes for ETHREEOH-3473 and ETHREEOH-3454 - DB script and iBatis-related changes 17649: Fixed problem after merge-in: ETHREEOH-3641: build 270: cannot install on PostgreSQL 17652: Fix ETHREEOH-3376 - Reindexer failure: requires rollback (Cluster) 17658: Removed failing concurrency test for split person cleanup 17659: Merged V3.1 to V3.2 17308: Fixed ETHREEOH-2310: Upgrade from 2.1 E Sp7 to 3.1.1 E build 225 - Duplicate alf_node_status entries detected Fixes ETHREEOH-3606 (same as CHK-10454) 17661: Fixed DB2 iBatis problems related to http://issues.apache.org/jira/browse/IBATIS-536 17666: ETHREEOH-3376 / ETHREEOH-3637 - reindexer failure in a cluster (dictionary repo bootstrap) 17678: Follow-on to r17666 (for RM custom model) 17685: Merged DEV_TEMPORARY to V3.2 17676: ETHREEOH-3187: Creating Web Content based on Web Form with most elements-read-only/default failed 17695: Temporarily comment-out testSubmitChangedAssets1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /alfresco/BRANCHES/DEV/BELARUS/V3.2-2009_11_24:r17632,17636,17676 Merged /alfresco/BRANCHES/DEV/BELARUS/V3.2-2009_11_09:r17599 Merged /alfresco/BRANCHES/V3.1:r17308 Merged /alfresco/BRANCHES/V3.2:r17620,17634,17644,17647-17649,17652,17658-17659,17661,17666,17678,17685,17695 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18165 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -167,26 +167,25 @@
|
||||
<bean id="dictionaryRepositoryBootstrap" class="org.alfresco.repo.dictionary.DictionaryRepositoryBootstrap">
|
||||
|
||||
<property name="dictionaryDAO" ref="dictionaryDAO"/>
|
||||
<property name="contentService" ref="ContentService"/>
|
||||
<property name="searchService" ref="SearchService"/>
|
||||
<property name="contentService" ref="ContentService"/>
|
||||
<property name="transactionService" ref="transactionService"/>
|
||||
<property name="namespaceService" ref="namespaceService"/>
|
||||
<property name="nodeService" ref="NodeService"/>
|
||||
<property name="messageService" ref="messageService"/>
|
||||
<property name="tenantAdminService" ref="tenantAdminService"/>
|
||||
|
||||
|
||||
<property name="repositoryModelsLocations">
|
||||
<list>
|
||||
<ref bean="customModelsRepositoryLocation" />
|
||||
</list>
|
||||
</list>
|
||||
</property>
|
||||
|
||||
|
||||
<property name="repositoryMessagesLocations">
|
||||
<list>
|
||||
<ref bean="customMessagesRepositoryLocation" />
|
||||
</list>
|
||||
</list>
|
||||
</property>
|
||||
|
||||
|
||||
</bean>
|
||||
|
||||
<!-- Bootstrap Data: Concrete instances for the basic Alfresco bootstrap -->
|
||||
|
@@ -201,39 +201,6 @@
|
||||
<parameter property="qnameId" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
</parameterMap>
|
||||
|
||||
<parameterMap id="parameter_AVMStore" class="AVMStore">
|
||||
<parameter property="nextVersion" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
<parameter property="name" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||
<parameter property="rootNodeId" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
<parameter property="aclId" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
<parameter property="vers" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
<parameter property="id" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
</parameterMap>
|
||||
|
||||
<parameterMap id="parameter_AVMNode" class="AVMNode">
|
||||
<parameter property="storeNewId" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
<parameter property="aclId" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
<parameter property="layerId" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
<parameter property="version" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
<parameter property="classType" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||
<parameter property="deletedType" jdbcType="INTEGER" javaType="java.lang.Integer"/>
|
||||
<parameter property="owner" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||
<parameter property="modifiedDate" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
<parameter property="accessDate" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
<parameter property="isRoot" jdbcType="BIT" javaType="java.lang.Boolean"/>
|
||||
<parameter property="modifier" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||
<parameter property="indirection" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||
<parameter property="indirectionVersion" jdbcType="INTEGER" javaType="java.lang.Integer"/>
|
||||
<parameter property="primaryIndirection" jdbcType="BIT" javaType="java.lang.Boolean"/>
|
||||
<parameter property="opacity" jdbcType="BIT" javaType="java.lang.Boolean"/>
|
||||
<parameter property="contentUrl" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||
<parameter property="mimetype" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||
<parameter property="encoding" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||
<parameter property="length" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
<parameter property="guid" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||
<parameter property="vers" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
<parameter property="id" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
</parameterMap>
|
||||
|
||||
<!-- -->
|
||||
<!-- SQL Snippets -->
|
||||
@@ -288,12 +255,7 @@
|
||||
insert into avm_version_layered_node_entry (version_root_id, md5sum, path)
|
||||
values (#versionRootId#, #md5sum#, #path#)
|
||||
</insert>
|
||||
|
||||
<insert id="insert_AVMNodeProperty" parameterMap="parameter_NodePropertyPatternMap">
|
||||
insert into avm_node_properties (actual_type_n, persisted_type_n, multi_valued, boolean_value, long_value, float_value, double_value, string_value, serializable_value, node_id, qname_id)
|
||||
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
</insert>
|
||||
|
||||
|
||||
<!-- -->
|
||||
<!-- AVM Store Statements -->
|
||||
<!-- -->
|
||||
@@ -337,17 +299,20 @@
|
||||
</select>
|
||||
|
||||
<!-- Optimistic update of the store -->
|
||||
<update id="update_AVMStore" parameterMap="parameter_AVMStore">
|
||||
<update id="update_AVMStore" parameterClass="AVMStore">
|
||||
update
|
||||
avm_stores
|
||||
set
|
||||
next_version_id = ?,
|
||||
name = ?,
|
||||
current_root_id = ?,
|
||||
acl_id = ?,
|
||||
vers = ?
|
||||
next_version_id = #nextVersion#,
|
||||
name = #name#,
|
||||
current_root_id = #rootNodeId#,
|
||||
acl_id = #aclId#,
|
||||
vers = #vers#
|
||||
where
|
||||
id = ?
|
||||
id = #id#
|
||||
<isGreaterThan property="vers" compareValue="1">
|
||||
and vers = (#vers#-1)
|
||||
</isGreaterThan>
|
||||
</update>
|
||||
|
||||
<!-- Delete AVMStore -->
|
||||
@@ -391,7 +356,7 @@
|
||||
join alf_namespace ns on (ns.id = qn.ns_id)
|
||||
where
|
||||
ns.uri like ? and
|
||||
upper(qn.local_name) like upper(?)
|
||||
qn.local_name like ?
|
||||
</select>
|
||||
|
||||
<select id="select_AVMStorePropertiesByStoreAndKeyPattern" parameterMap="parameter_IdAndKeyPattern" resultMap="result_AVMStoreProperty">
|
||||
@@ -404,7 +369,7 @@
|
||||
where
|
||||
asp.avm_store_id = ? and
|
||||
ns.uri like ? and
|
||||
upper(qn.local_name) like upper(?)
|
||||
qn.local_name like ?
|
||||
</select>
|
||||
|
||||
<!-- Optimistic update of the store property -->
|
||||
@@ -533,33 +498,36 @@
|
||||
</update>
|
||||
|
||||
<!-- Optimistic update of the node -->
|
||||
<update id="update_AVMNode" parameterMap="parameter_AVMNode">
|
||||
<update id="update_AVMNode" parameterClass="AVMNode">
|
||||
update
|
||||
avm_nodes
|
||||
set
|
||||
store_new_id = ?,
|
||||
acl_id = ?,
|
||||
layer_id = ?,
|
||||
version_id = ?,
|
||||
class_type = ?,
|
||||
deletedType = ?,
|
||||
owner = ?,
|
||||
modDate = ?,
|
||||
accessDate = ?,
|
||||
is_root = ?,
|
||||
lastModifier = ?,
|
||||
indirection = ?,
|
||||
indirection_version = ?,
|
||||
primary_indirection = ?,
|
||||
opacity = ?,
|
||||
content_url = ?,
|
||||
mime_type = ?,
|
||||
encoding = ?,
|
||||
length = ?,
|
||||
guid = ?,
|
||||
vers = ?
|
||||
store_new_id = #storeNewId#,
|
||||
acl_id = #aclId#,
|
||||
layer_id = #layerId#,
|
||||
version_id = #version#,
|
||||
class_type = #classType#,
|
||||
deletedType = #deletedType#,
|
||||
owner = #owner#,
|
||||
modDate = #modifiedDate#,
|
||||
accessDate = #accessDate#,
|
||||
is_root = #isRoot#,
|
||||
lastModifier = #modifier#,
|
||||
indirection = #indirection#,
|
||||
indirection_version = #indirectionVersion#,
|
||||
primary_indirection = #primaryIndirection#,
|
||||
opacity = #opacity#,
|
||||
content_url = #contentUrl#,
|
||||
mime_type = #mimetype#,
|
||||
encoding = #encoding#,
|
||||
length = #length#,
|
||||
guid = #guid#,
|
||||
vers = #vers#
|
||||
where
|
||||
id = ?
|
||||
id = #id#
|
||||
<isGreaterThan property="vers" compareValue="1">
|
||||
and vers = (#vers#-1)
|
||||
</isGreaterThan>
|
||||
</update>
|
||||
|
||||
<update id="update_AVMNode_modTimeAndGuid" parameterClass="AVMNode">
|
||||
|
@@ -65,6 +65,14 @@
|
||||
<parameter property="qnameId" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
</parameterMap>
|
||||
|
||||
<parameterMap id="parameter_ContentUrl" class="ContentUrl">
|
||||
<parameter property="contentUrl" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||
<parameter property="contentUrlShort" jdbcType="VARCHAR" javaType="java.lang.String"/>
|
||||
<parameter property="contentUrlCrc" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
<parameter property="size" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
<parameter property="orphanTime" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
</parameterMap>
|
||||
|
||||
<parameterMap id="parameter_ContentData" class="ContentData">
|
||||
<parameter property="version" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
<parameter property="contentUrlId" jdbcType="BIGINT" javaType="java.lang.Long"/>
|
||||
@@ -89,7 +97,7 @@
|
||||
|
||||
<sql id="insert_ContentUrl_AutoIncrement">
|
||||
insert into alf_content_url (content_url, content_url_short, content_url_crc, content_size, orphan_time)
|
||||
values (#contentUrl#, #contentUrlShort#, #contentUrlCrc#, #size#, #orphanTime#)
|
||||
values (?, ?, ?, ?, ?)
|
||||
</sql>
|
||||
|
||||
<sql id="insert_ContentData_AutoIncrement">
|
||||
|
@@ -34,4 +34,9 @@
|
||||
</selectKey>
|
||||
</insert>
|
||||
|
||||
<insert id="insert_AVMNodeProperty" parameterMap="parameter_NodePropertyPatternMap">
|
||||
insert into avm_node_properties (actual_type_n, persisted_type_n, multi_valued, boolean_value, long_value, float_value, double_value, string_value, serializable_value, node_id, qname_id)
|
||||
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
</insert>
|
||||
|
||||
</sqlMap>
|
@@ -20,7 +20,7 @@
|
||||
</selectKey>
|
||||
</insert>
|
||||
|
||||
<insert id="insert_ContentUrl" parameterClass="ContentUrl" >
|
||||
<insert id="insert_ContentUrl" parameterMap="parameter_ContentUrl" >
|
||||
<include refid="alfresco.content.insert_ContentUrl_AutoIncrement"/>
|
||||
<selectKey resultClass="long" keyProperty="id" type="post">
|
||||
KEY_COLUMN:GENERATED_KEY
|
||||
|
@@ -50,4 +50,9 @@
|
||||
|
||||
</insert>
|
||||
|
||||
<insert id="insert_AVMNodeProperty" parameterClass="AVMNodeProperty">
|
||||
insert into avm_node_properties (actual_type_n, persisted_type_n, multi_valued, boolean_value, long_value, float_value, double_value, string_value, serializable_value, node_id, qname_id)
|
||||
values (#actualType#, #persistedType#, #isMultiValued#, #booleanValue#, #longValue#, #floatValue#, #doubleValue#, #stringValue#, #serializableValue#, #nodeId#, #qnameId#)
|
||||
</insert>
|
||||
|
||||
</sqlMap>
|
@@ -12,7 +12,7 @@
|
||||
|
||||
<bean id="repoAdminService" class="org.alfresco.repo.admin.RepoAdminServiceImpl">
|
||||
|
||||
<property name="dictionaryDAO" ref="dictionaryDAO"/>
|
||||
<property name="dictionaryDAO" ref="dictionaryDAO"/>
|
||||
<property name="searchService" ref="SearchService"/>
|
||||
<property name="nodeService" ref="NodeService"/>
|
||||
<property name="contentService" ref="ContentService"/>
|
||||
@@ -41,7 +41,7 @@
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- Load any additional models/messages from repo into data dictionary -->
|
||||
<!-- Load any additional models/messages from repo into data dictionary -->
|
||||
<!-- note: needs to match boostrap-context.xml locations (customModelsSpace.acp and customMessagesSpace.xml) -->
|
||||
|
||||
<bean id="customModelsRepositoryLocation" class="org.alfresco.repo.dictionary.RepositoryLocation">
|
||||
@@ -50,18 +50,18 @@
|
||||
<value>/app:company_home/app:dictionary/app:models</value>
|
||||
</property>
|
||||
<property name="queryLanguage">
|
||||
<value>xpath</value>
|
||||
</property>
|
||||
<value>path</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="customMessagesRepositoryLocation" class="org.alfresco.repo.dictionary.RepositoryLocation">
|
||||
<!-- other properties will be defaulted, but can be overriden here -->
|
||||
<property name="path">
|
||||
<value>/app:company_home/app:dictionary/app:messages</value>
|
||||
</property>
|
||||
<property name="queryLanguage">
|
||||
<value>xpath</value>
|
||||
<value>path</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
@@ -269,6 +269,13 @@ public class ContentStoreCleaner
|
||||
public void execute()
|
||||
{
|
||||
checkProperties();
|
||||
|
||||
// Bypass if the system is in read-only mode
|
||||
if (transactionService.isReadOnly())
|
||||
{
|
||||
logger.debug("Content store cleanup bypassed; the system is read-only.");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@@ -145,13 +145,11 @@ public class DictionaryModelTypeTest extends BaseAlfrescoSpringTest
|
||||
this.dictionaryDAO = (DictionaryDAO)this.applicationContext.getBean("dictionaryDAO");
|
||||
this.nodeService = (NodeService)this.applicationContext.getBean("NodeService");
|
||||
|
||||
SearchService searchService = (SearchService)this.applicationContext.getBean("searchService");
|
||||
TenantAdminService tenantAdminService = (TenantAdminService)this.applicationContext.getBean("tenantAdminService");
|
||||
MessageService messageService = (MessageService)this.applicationContext.getBean("messageService");
|
||||
|
||||
DictionaryRepositoryBootstrap bootstrap = new DictionaryRepositoryBootstrap();
|
||||
bootstrap.setContentService(this.contentService);
|
||||
bootstrap.setSearchService(searchService);
|
||||
bootstrap.setDictionaryDAO(this.dictionaryDAO);
|
||||
bootstrap.setTransactionService(this.transactionService);
|
||||
bootstrap.setTenantAdminService(tenantAdminService);
|
||||
@@ -162,8 +160,8 @@ public class DictionaryModelTypeTest extends BaseAlfrescoSpringTest
|
||||
RepositoryLocation location = new RepositoryLocation();
|
||||
location.setStoreProtocol(this.storeRef.getProtocol());
|
||||
location.setStoreId(this.storeRef.getIdentifier());
|
||||
location.setQueryLanguage(SearchService.LANGUAGE_XPATH);
|
||||
// NOTE: we are not setting the path for now .. in doing so we are searching the whole store
|
||||
location.setQueryLanguage(RepositoryLocation.LANGUAGE_PATH);
|
||||
// NOTE: we are not setting the path for now .. in doing so we are searching the root node only
|
||||
|
||||
List<RepositoryLocation> locations = new ArrayList<RepositoryLocation>();
|
||||
locations.add(location);
|
||||
@@ -178,7 +176,7 @@ public class DictionaryModelTypeTest extends BaseAlfrescoSpringTest
|
||||
* Test the creation of dictionary model nodes
|
||||
*/
|
||||
public void testCreateAndUpdateDictionaryModelNodeContent()
|
||||
{
|
||||
{
|
||||
try
|
||||
{
|
||||
// Check that the model has not yet been loaded into the dictionary
|
||||
@@ -192,17 +190,17 @@ public class DictionaryModelTypeTest extends BaseAlfrescoSpringTest
|
||||
|
||||
// Check that the namespace is not yet in the namespace service
|
||||
String uri = this.namespaceService.getNamespaceURI("test1");
|
||||
assertNull(uri);
|
||||
assertNull(uri);
|
||||
|
||||
// Create a model node
|
||||
PropertyMap properties = new PropertyMap(1);
|
||||
properties.put(ContentModel.PROP_MODEL_ACTIVE, true);
|
||||
final NodeRef modelNode = this.nodeService.createNode(
|
||||
this.rootNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
this.rootNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "dictionaryModels"),
|
||||
ContentModel.TYPE_DICTIONARY_MODEL,
|
||||
properties).getChildRef();
|
||||
properties).getChildRef();
|
||||
assertNotNull(modelNode);
|
||||
|
||||
// Add the model content to the model node
|
||||
@@ -271,7 +269,7 @@ public class DictionaryModelTypeTest extends BaseAlfrescoSpringTest
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
public Object execute() throws Exception
|
||||
{
|
||||
{
|
||||
DictionaryModelTypeTest.this.nodeService.deleteNode(modelNode);
|
||||
return null;
|
||||
}
|
||||
@@ -295,11 +293,11 @@ public class DictionaryModelTypeTest extends BaseAlfrescoSpringTest
|
||||
// Create a model node
|
||||
PropertyMap properties = new PropertyMap(1);
|
||||
final NodeRef modelNode = this.nodeService.createNode(
|
||||
this.rootNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
this.rootNodeRef,
|
||||
ContentModel.ASSOC_CHILDREN,
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "dictionaryModels"),
|
||||
ContentModel.TYPE_DICTIONARY_MODEL,
|
||||
properties).getChildRef();
|
||||
properties).getChildRef();
|
||||
assertNotNull(modelNode);
|
||||
|
||||
// Add the model content to the model node
|
||||
|
@@ -26,25 +26,27 @@ package org.alfresco.repo.dictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.i18n.MessageDeployer;
|
||||
import org.alfresco.repo.i18n.MessageService;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
import org.alfresco.repo.tenant.TenantAdminService;
|
||||
import org.alfresco.repo.tenant.TenantDeployer;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.springframework.extensions.surf.util.AbstractLifecycleBean;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -71,9 +73,6 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
||||
/** Dictionary DAO */
|
||||
private DictionaryDAO dictionaryDAO = null;
|
||||
|
||||
/** Search service */
|
||||
private SearchService searchService;
|
||||
|
||||
/** The content service */
|
||||
private ContentService contentService;
|
||||
|
||||
@@ -102,16 +101,6 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
||||
this.dictionaryDAO = dictionaryDAO;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the search search service
|
||||
*
|
||||
* @param searchService the search service
|
||||
*/
|
||||
public void setSearchService(SearchService searchService)
|
||||
{
|
||||
this.searchService = searchService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the content service
|
||||
*
|
||||
@@ -224,11 +213,11 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
||||
public void onDictionaryInit()
|
||||
{
|
||||
if (this.repositoryModelsLocations != null)
|
||||
{
|
||||
{
|
||||
Map<String, M2Model> modelMap = new HashMap<String, M2Model>();
|
||||
|
||||
|
||||
// Register the models found in the repository
|
||||
|
||||
|
||||
for (RepositoryLocation repositoryLocation : this.repositoryModelsLocations)
|
||||
{
|
||||
StoreRef storeRef = repositoryLocation.getStoreRef();
|
||||
@@ -238,37 +227,36 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
||||
logger.warn("StoreRef '"+ storeRef+"' does not exist");
|
||||
continue; // skip this location
|
||||
}
|
||||
|
||||
if (repositoryLocation.getQueryLanguage().equals(SearchService.LANGUAGE_XPATH))
|
||||
|
||||
List<NodeRef> nodeRefs = null;
|
||||
|
||||
if (repositoryLocation.getQueryLanguage().equals(RepositoryLocation.LANGUAGE_PATH))
|
||||
{
|
||||
NodeRef rootNode = nodeService.getRootNode(storeRef);
|
||||
nodeRefs = getNodes(storeRef, repositoryLocation, ContentModel.TYPE_DICTIONARY_MODEL);
|
||||
|
||||
List<NodeRef> nodeRefs = searchService.selectNodes(rootNode,
|
||||
repositoryLocation.getXPathQueryStatement(ContentModel.TYPE_DICTIONARY_MODEL.getPrefixedQName(namespaceService)),
|
||||
null,
|
||||
namespaceService,
|
||||
false);
|
||||
|
||||
for (NodeRef dictionaryModel : nodeRefs)
|
||||
if (nodeRefs.size() > 0)
|
||||
{
|
||||
// Ignore if the node is a working copy or archived, or if its inactive
|
||||
if (! (nodeService.hasAspect(dictionaryModel, ContentModel.ASPECT_WORKING_COPY) || nodeService.hasAspect(dictionaryModel, ContentModel.ASPECT_ARCHIVED)))
|
||||
for (NodeRef dictionaryModel : nodeRefs)
|
||||
{
|
||||
Boolean isActive = (Boolean)nodeService.getProperty(dictionaryModel, ContentModel.PROP_MODEL_ACTIVE);
|
||||
|
||||
if ((isActive != null) && (isActive.booleanValue() == true))
|
||||
// Ignore if the node is a working copy or archived, or if its inactive
|
||||
if (! (nodeService.hasAspect(dictionaryModel, ContentModel.ASPECT_WORKING_COPY) || nodeService.hasAspect(dictionaryModel, ContentModel.ASPECT_ARCHIVED)))
|
||||
{
|
||||
M2Model model = createM2Model(dictionaryModel);
|
||||
if (model != null)
|
||||
Boolean isActive = (Boolean)nodeService.getProperty(dictionaryModel, ContentModel.PROP_MODEL_ACTIVE);
|
||||
|
||||
if ((isActive != null) && (isActive.booleanValue() == true))
|
||||
{
|
||||
if (logger.isTraceEnabled())
|
||||
M2Model model = createM2Model(dictionaryModel);
|
||||
if (model != null)
|
||||
{
|
||||
logger.trace("onDictionaryInit: "+model.getName()+" ("+dictionaryModel+")");
|
||||
}
|
||||
|
||||
for (M2Namespace namespace : model.getNamespaces())
|
||||
{
|
||||
modelMap.put(namespace.getUri(), model);
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace("onDictionaryInit: "+model.getName()+" ("+dictionaryModel+")");
|
||||
}
|
||||
|
||||
for (M2Namespace namespace : model.getNamespaces())
|
||||
{
|
||||
modelMap.put(namespace.getUri(), model);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -277,10 +265,10 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.error("Unsupported query language for models location: " + repositoryLocation.getQueryLanguage());
|
||||
logger.error("Unsupported query language for models location: " + repositoryLocation.getQueryLanguage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Load the models ensuring that they are loaded in the correct order
|
||||
List<String> loadedModels = new ArrayList<String>();
|
||||
for (Map.Entry<String, M2Model> entry : modelMap.entrySet())
|
||||
@@ -312,7 +300,7 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
||||
{
|
||||
// Register the messages found in the repository
|
||||
for (RepositoryLocation repositoryLocation : this.repositoryMessagesLocations)
|
||||
{
|
||||
{
|
||||
StoreRef storeRef = repositoryLocation.getStoreRef();
|
||||
|
||||
if (! nodeService.exists(storeRef))
|
||||
@@ -321,39 +309,64 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
||||
continue; // skip this location
|
||||
}
|
||||
|
||||
if (repositoryLocation.getQueryLanguage().equals(SearchService.LANGUAGE_XPATH))
|
||||
if (repositoryLocation.getQueryLanguage().equals(RepositoryLocation.LANGUAGE_PATH))
|
||||
{
|
||||
NodeRef rootNode = nodeService.getRootNode(storeRef);
|
||||
List<NodeRef> nodeRefs = getNodes(storeRef, repositoryLocation, ContentModel.TYPE_CONTENT);
|
||||
|
||||
List<NodeRef> nodeRefs = searchService.selectNodes(rootNode,
|
||||
repositoryLocation.getXPathQueryStatement(ContentModel.TYPE_CONTENT.getPrefixedQName(namespaceService)),
|
||||
null,
|
||||
namespaceService,
|
||||
false);
|
||||
|
||||
List<String> resourceBundleBaseNames = new ArrayList<String>();
|
||||
|
||||
for (NodeRef messageResource : nodeRefs)
|
||||
if (nodeRefs.size() > 0)
|
||||
{
|
||||
String resourceName = (String) nodeService.getProperty(
|
||||
messageResource, ContentModel.PROP_NAME);
|
||||
List<String> resourceBundleBaseNames = new ArrayList<String>();
|
||||
|
||||
String bundleBaseName = messageService.getBaseBundleName(resourceName);
|
||||
|
||||
if (!resourceBundleBaseNames.contains(bundleBaseName))
|
||||
for (NodeRef messageResource : nodeRefs)
|
||||
{
|
||||
resourceBundleBaseNames.add(bundleBaseName);
|
||||
String resourceName = (String) nodeService.getProperty(messageResource, ContentModel.PROP_NAME);
|
||||
|
||||
String bundleBaseName = messageService.getBaseBundleName(resourceName);
|
||||
|
||||
if (!resourceBundleBaseNames.contains(bundleBaseName))
|
||||
{
|
||||
resourceBundleBaseNames.add(bundleBaseName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.error("Unsupported query language for messages location: " + repositoryLocation.getQueryLanguage());
|
||||
logger.error("Unsupported query language for messages location: " + repositoryLocation.getQueryLanguage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected List<NodeRef> getNodes(StoreRef storeRef, RepositoryLocation repositoryLocation, QName nodeType)
|
||||
{
|
||||
List<NodeRef> nodeRefs = new ArrayList<NodeRef>();
|
||||
|
||||
NodeRef rootNodeRef = nodeService.getRootNode(storeRef);
|
||||
String[] pathElements = repositoryLocation.getPathElements();
|
||||
|
||||
NodeRef folderNodeRef = rootNodeRef;
|
||||
if (pathElements.length > 0)
|
||||
{
|
||||
folderNodeRef = resolveQNameFolderPath(rootNodeRef, pathElements);
|
||||
}
|
||||
|
||||
Set<QName> types = new HashSet<QName>(1);
|
||||
types.add(nodeType);
|
||||
List<ChildAssociationRef> childAssocRefs = nodeService.getChildAssocs(folderNodeRef, types);
|
||||
|
||||
if (childAssocRefs.size() > 0)
|
||||
{
|
||||
nodeRefs = new ArrayList<NodeRef>(childAssocRefs.size());
|
||||
for (ChildAssociationRef childAssocRef : childAssocRefs)
|
||||
{
|
||||
nodeRefs.add(childAssocRef.getChildRef());
|
||||
}
|
||||
}
|
||||
|
||||
return nodeRefs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a model (and its dependents) if it does not exist in the list of loaded models.
|
||||
*
|
||||
@@ -468,4 +481,25 @@ public class DictionaryRepositoryBootstrap extends AbstractLifecycleBean impleme
|
||||
tenantAdminService.unregister(messageService);
|
||||
}
|
||||
}
|
||||
|
||||
protected NodeRef resolveQNameFolderPath(NodeRef rootNodeRef, String[] pathQNames)
|
||||
{
|
||||
if (pathQNames.length == 0)
|
||||
{
|
||||
throw new IllegalArgumentException("Path array is empty");
|
||||
}
|
||||
// walk the folder tree
|
||||
NodeRef parentNodeRef = rootNodeRef;
|
||||
for (int i = 0; i < pathQNames.length; i++)
|
||||
{
|
||||
String pathQName = pathQNames[i];
|
||||
List<ChildAssociationRef> childAssocRefs = nodeService.getChildAssocs(parentNodeRef, RegexQNamePattern.MATCH_ALL, QName.createQName(pathQName, namespaceService));
|
||||
if (childAssocRefs.size() != 1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
parentNodeRef = childAssocRefs.get(0).getChildRef();
|
||||
}
|
||||
return parentNodeRef;
|
||||
}
|
||||
}
|
||||
|
@@ -1,3 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.dictionary;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
@@ -13,7 +37,6 @@ import org.alfresco.service.cmr.dictionary.DictionaryException;
|
||||
import org.alfresco.service.cmr.dictionary.ModelDefinition;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
@@ -59,13 +82,10 @@ public class DictionaryRepositoryBootstrapTest extends BaseAlfrescoSpringTest
|
||||
|
||||
/** The bootstrap service */
|
||||
private DictionaryRepositoryBootstrap bootstrap;
|
||||
|
||||
/** The search service */
|
||||
private SearchService searchService;
|
||||
|
||||
|
||||
/** The dictionary DAO */
|
||||
private DictionaryDAO dictionaryDAO;
|
||||
|
||||
|
||||
/** The transaction service */
|
||||
private TransactionService transactionService;
|
||||
|
||||
@@ -77,7 +97,7 @@ public class DictionaryRepositoryBootstrapTest extends BaseAlfrescoSpringTest
|
||||
|
||||
/** The message service */
|
||||
private MessageService messageService;
|
||||
|
||||
|
||||
/**
|
||||
* @see org.springframework.test.AbstractTransactionalSpringContextTests#onSetUpInTransaction()
|
||||
*/
|
||||
@@ -90,7 +110,6 @@ public class DictionaryRepositoryBootstrapTest extends BaseAlfrescoSpringTest
|
||||
this.behaviourFilter = (BehaviourFilter)this.applicationContext.getBean("policyBehaviourFilter");
|
||||
this.behaviourFilter.disableBehaviour(ContentModel.TYPE_DICTIONARY_MODEL);
|
||||
|
||||
this.searchService = (SearchService)this.applicationContext.getBean("searchService");
|
||||
this.dictionaryDAO = (DictionaryDAO)this.applicationContext.getBean("dictionaryDAO");
|
||||
this.transactionService = (TransactionService)this.applicationContext.getBean("transactionComponent");
|
||||
this.tenantAdminService = (TenantAdminService)this.applicationContext.getBean("tenantAdminService");
|
||||
@@ -99,19 +118,18 @@ public class DictionaryRepositoryBootstrapTest extends BaseAlfrescoSpringTest
|
||||
|
||||
this.bootstrap = new DictionaryRepositoryBootstrap();
|
||||
this.bootstrap.setContentService(this.contentService);
|
||||
this.bootstrap.setSearchService(this.searchService);
|
||||
this.bootstrap.setDictionaryDAO(this.dictionaryDAO);
|
||||
this.bootstrap.setTransactionService(this.transactionService);
|
||||
this.bootstrap.setTenantAdminService(this.tenantAdminService);
|
||||
this.bootstrap.setNodeService(this.nodeService);
|
||||
this.bootstrap.setNamespaceService(this.namespaceService);
|
||||
this.bootstrap.setMessageService(this.messageService);
|
||||
|
||||
|
||||
RepositoryLocation location = new RepositoryLocation();
|
||||
location.setStoreProtocol(this.storeRef.getProtocol());
|
||||
location.setStoreId(this.storeRef.getIdentifier());
|
||||
location.setQueryLanguage(SearchService.LANGUAGE_XPATH);
|
||||
// NOTE: we are not setting the path for now .. in doing so we are searching the whole dictionary
|
||||
location.setQueryLanguage(RepositoryLocation.LANGUAGE_PATH);
|
||||
// NOTE: we are not setting the path for now .. in doing so we are searching the root node only
|
||||
|
||||
List<RepositoryLocation> locations = new ArrayList<RepositoryLocation>();
|
||||
locations.add(location);
|
||||
@@ -208,7 +226,7 @@ public class DictionaryRepositoryBootstrapTest extends BaseAlfrescoSpringTest
|
||||
ContentModel.TYPE_DICTIONARY_MODEL).getChildRef();
|
||||
ContentWriter contentWriter1 = this.contentService.getWriter(model, ContentModel.PROP_CONTENT, true);
|
||||
contentWriter1.setEncoding("UTF-8");
|
||||
contentWriter1.setMimetype(MimetypeMap.MIMETYPE_XML);
|
||||
contentWriter1.setMimetype(MimetypeMap.MIMETYPE_XML);
|
||||
String modelOne = getModelString(
|
||||
uri,
|
||||
prefix,
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -48,6 +48,8 @@ public class RepositoryLocation
|
||||
/** Search Language */
|
||||
private String queryLanguage = "xpath"; // default
|
||||
|
||||
public static final String LANGUAGE_PATH = "path"; // lookup directly using node (prefix qname) path
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -110,7 +112,7 @@ public class RepositoryLocation
|
||||
*/
|
||||
public void setQueryLanguage(String queryLanguage)
|
||||
{
|
||||
if (queryLanguage.equals(SearchService.LANGUAGE_LUCENE) || queryLanguage.equals(SearchService.LANGUAGE_XPATH))
|
||||
if (queryLanguage.equals(SearchService.LANGUAGE_LUCENE) || queryLanguage.equals(SearchService.LANGUAGE_XPATH) || queryLanguage.equals(LANGUAGE_PATH))
|
||||
{
|
||||
this.queryLanguage = queryLanguage;
|
||||
}
|
||||
@@ -180,7 +182,30 @@ public class RepositoryLocation
|
||||
{
|
||||
result = this.path + result;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public String[] getPathElements()
|
||||
{
|
||||
if ((this.path != null) && (! this.path.equals("")))
|
||||
{
|
||||
String pathToSplit = this.path;
|
||||
|
||||
while (pathToSplit.startsWith("/"))
|
||||
{
|
||||
pathToSplit = pathToSplit.substring(1);
|
||||
}
|
||||
while (pathToSplit.endsWith("/"))
|
||||
{
|
||||
pathToSplit = pathToSplit.substring(0, pathToSplit.length() - 1);
|
||||
}
|
||||
String[] pathElements = pathToSplit.split("/");
|
||||
return pathElements;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
}
|
@@ -33,7 +33,6 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
import org.alfresco.model.ContentModel;
|
||||
@@ -452,7 +451,7 @@ public class MLPropertyInterceptor implements MethodInterceptor
|
||||
*/
|
||||
private boolean isCollectionOfMLText(Serializable outboundValue)
|
||||
{
|
||||
if(outboundValue instanceof Collection)
|
||||
if(outboundValue instanceof Collection<?>)
|
||||
{
|
||||
for(Object o : (Collection<?>)outboundValue)
|
||||
{
|
||||
|
@@ -387,12 +387,13 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
||||
* deleted node. This transactional list is used to detect and prevent that from
|
||||
* happening.
|
||||
*
|
||||
* @param nodeRef the deleted node to track
|
||||
* @param nodeRef the deleted node to track
|
||||
* @return <tt>true</tt> if the node was not already tracked
|
||||
*/
|
||||
private void trackDeletedNodeRef(NodeRef deletedNodeRef)
|
||||
private boolean trackDeletedNodeRef(NodeRef deletedNodeRef)
|
||||
{
|
||||
Set<NodeRef> deletedNodes = TransactionalResourceHelper.getSet(KEY_DELETED_NODES);
|
||||
deletedNodes.add(deletedNodeRef);
|
||||
return deletedNodes.add(deletedNodeRef);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2413,7 +2414,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
||||
NodeRef childNodeRef = oldChildNodePair.getSecond();
|
||||
if (nodeDaoService.getNodeRefStatus(childNodeRef).isDeleted())
|
||||
{
|
||||
//Node has been already deleted.
|
||||
// Node has already been deleted.
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 Alfresco Software Limited.
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -106,14 +106,24 @@ public abstract class AbstractLuceneBase
|
||||
indexInfo = IndexInfo.getIndexInfo(baseDir, config);
|
||||
try
|
||||
{
|
||||
if (deltaId != null)
|
||||
if (this.deltaId != null)
|
||||
{
|
||||
indexInfo.setStatus(deltaId, TransactionStatus.ACTIVE, null, null);
|
||||
if (! getStatus().equals(TransactionStatus.ACTIVE))
|
||||
{
|
||||
setStatus(TransactionStatus.ACTIVE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s_logger.isDebugEnabled())
|
||||
{
|
||||
s_logger.debug("Delta already set as active " + deltaId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new IndexerException("Filed to set delta as active");
|
||||
throw new IndexerException("Failed to set delta as active");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -597,7 +597,11 @@ public class PersonTest extends BaseSpringTest
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(deletePersonWork, false, true);
|
||||
}
|
||||
|
||||
public void testSplitPersonCleanupManyTimes() throws Throwable
|
||||
/**
|
||||
* Disabled due to time constraints. This <i>does</i> highlight a problem, but one that won't manifest
|
||||
* itself critically in the product.
|
||||
*/
|
||||
public void xtestSplitPersonCleanupManyTimes() throws Throwable
|
||||
{
|
||||
for (int i = 0; i < 100; i++) // Bump this number up to 1000 for 'real' testing
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user