mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.1 to HEAD
13265: Fix incorrect wiring of guest user name 13266: Merged V2.1A to V3.1 13252: Fix ADB-159: Generation of content model xml throws exception 13267: Remove accidental addition of folders 13280: IndexTransactionTracker logging changes 13281: Added bean to push properties from repository properties into the VM properties 13283: Added forgotten Hibernate diff file after JAWS-223 fix 13291: Fix ETHREEOH-1340: Alfresco Repository Draft CMIS Implementation" link refers to localhost 13297: Fix ETHREEOH-885: workflow mapAuthorityToName tests don't handle sub-classed objects correctly. 13308: First part of JAWS-215 - permission migration from V2.1-A to V3.1 13313: Build fix for 2.1-A to 3.1 ACL patch ___________________________________________________________________ Modified: svn:mergeinfo Merged /alfresco/BRANCHES/V2.1-A:r13252 Merged /alfresco/BRANCHES/V3.1:r13265-13267,13277-13283,13286,13289,13291,13295,13297,13308-13313 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13615 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,6 +24,10 @@
|
||||
*/
|
||||
package org.alfresco.repo.dictionary;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -33,6 +37,7 @@ import net.sf.ehcache.Cache;
|
||||
import net.sf.ehcache.CacheManager;
|
||||
|
||||
import org.alfresco.i18n.I18NUtil;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.cache.EhCacheAdapter;
|
||||
import org.alfresco.repo.dictionary.constraint.RegexConstraint;
|
||||
import org.alfresco.repo.dictionary.constraint.StringLengthConstraint;
|
||||
@@ -44,10 +49,12 @@ import org.alfresco.service.cmr.dictionary.ClassDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.Constraint;
|
||||
import org.alfresco.service.cmr.dictionary.ConstraintDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryException;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.ModelDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
|
||||
@@ -372,4 +379,82 @@ public class DictionaryDAOTest extends TestCase
|
||||
childAssocDef = (ChildAssociationDefinition) assocDef;
|
||||
assertTrue("Expected 'true' for timestamp propagation", childAssocDef.getPropagateTimestamps());
|
||||
}
|
||||
|
||||
public void testADB159() throws UnsupportedEncodingException
|
||||
{
|
||||
// source dictionary
|
||||
TenantService tenantService = new SingleTServiceImpl();
|
||||
NamespaceDAOImpl namespaceDAO = new NamespaceDAOImpl();
|
||||
namespaceDAO.setTenantService(tenantService);
|
||||
initNamespaceCaches(namespaceDAO);
|
||||
DictionaryDAOImpl dictionaryDAO = new DictionaryDAOImpl(namespaceDAO);
|
||||
dictionaryDAO.setTenantService(tenantService);
|
||||
initDictionaryCaches(dictionaryDAO);
|
||||
|
||||
// destination dictionary
|
||||
NamespaceDAOImpl namespaceDAO2 = new NamespaceDAOImpl();
|
||||
namespaceDAO2.setTenantService(tenantService);
|
||||
initNamespaceCaches(namespaceDAO2);
|
||||
DictionaryDAOImpl dictionaryDAO2 = new DictionaryDAOImpl(namespaceDAO2);
|
||||
dictionaryDAO2.setTenantService(tenantService);
|
||||
initDictionaryCaches(dictionaryDAO2);
|
||||
|
||||
List<String> models = new ArrayList<String>();
|
||||
models.add("alfresco/model/dictionaryModel.xml");
|
||||
models.add("alfresco/model/systemModel.xml");
|
||||
models.add("alfresco/model/contentModel.xml");
|
||||
models.add("alfresco/model/wcmModel.xml");
|
||||
models.add("alfresco/model/applicationModel.xml");
|
||||
models.add("org/alfresco/repo/security/authentication/userModel.xml");
|
||||
models.add("org/alfresco/repo/action/actionModel.xml");
|
||||
models.add("org/alfresco/repo/rule/ruleModel.xml");
|
||||
models.add("org/alfresco/repo/version/version_model.xml");
|
||||
|
||||
// round-trip default models
|
||||
for (String bootstrapModel : models)
|
||||
{
|
||||
InputStream modelStream = getClass().getClassLoader().getResourceAsStream(bootstrapModel);
|
||||
if (modelStream == null)
|
||||
{
|
||||
throw new DictionaryException("Could not find bootstrap model " + bootstrapModel);
|
||||
}
|
||||
try
|
||||
{
|
||||
// parse model from xml
|
||||
M2Model model = M2Model.createModel(modelStream);
|
||||
dictionaryDAO.putModel(model);
|
||||
|
||||
// regenerate xml from model
|
||||
ByteArrayOutputStream xml1 = new ByteArrayOutputStream();
|
||||
model.toXML(xml1);
|
||||
|
||||
// register regenerated xml with other dictionary
|
||||
M2Model model2 = M2Model.createModel(new ByteArrayInputStream(xml1.toByteArray()));
|
||||
dictionaryDAO2.putModel(model2);
|
||||
}
|
||||
catch(DictionaryException e)
|
||||
{
|
||||
throw new DictionaryException("Could not import bootstrap model " + bootstrapModel, e);
|
||||
}
|
||||
}
|
||||
|
||||
// specific test case
|
||||
M2Model model = M2Model.createModel("test:adb25");
|
||||
model.createNamespace(TEST_URL, "test");
|
||||
model.createImport(NamespaceService.DICTIONARY_MODEL_1_0_URI, NamespaceService.DICTIONARY_MODEL_PREFIX);
|
||||
model.createImport(NamespaceService.SYSTEM_MODEL_1_0_URI, NamespaceService.SYSTEM_MODEL_PREFIX);
|
||||
model.createImport(NamespaceService.CONTENT_MODEL_1_0_URI, NamespaceService.CONTENT_MODEL_PREFIX);
|
||||
|
||||
M2Type testType = model.createType("test:adb25" );
|
||||
testType.setParentName("cm:" + ContentModel.TYPE_CONTENT.getLocalName());
|
||||
|
||||
M2Property prop1 = testType.createProperty("test:prop1");
|
||||
prop1.setMandatory(false);
|
||||
prop1.setType("d:" + DataTypeDefinition.TEXT.getLocalName());
|
||||
prop1.setMultiValued(false);
|
||||
|
||||
ByteArrayOutputStream xml1 = new ByteArrayOutputStream();
|
||||
model.toXML(xml1);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -171,6 +171,10 @@ public abstract class M2ClassAssociation
|
||||
this.targetRoleName = name;
|
||||
}
|
||||
|
||||
public Boolean getTargetMandatory()
|
||||
{
|
||||
return isTargetMandatory();
|
||||
}
|
||||
|
||||
public boolean isTargetMandatory()
|
||||
{
|
||||
@@ -183,6 +187,10 @@ public abstract class M2ClassAssociation
|
||||
this.isTargetMandatory = isTargetMandatory;
|
||||
}
|
||||
|
||||
public Boolean getTargetMandatoryEnforced()
|
||||
{
|
||||
return isTargetMandatoryEnforced();
|
||||
}
|
||||
|
||||
public boolean isTargetMandatoryEnforced()
|
||||
{
|
||||
|
@@ -34,8 +34,8 @@ import java.util.List;
|
||||
public class M2NamedValue
|
||||
{
|
||||
private String name;
|
||||
private String simpleValue;
|
||||
private List<String> listValue;
|
||||
private String simpleValue = null;
|
||||
private List<String> listValue = null;
|
||||
|
||||
/*package*/ M2NamedValue()
|
||||
{
|
||||
|
@@ -61,7 +61,6 @@
|
||||
<value name="description" field="description" usage="optional"/>
|
||||
<value name="parent" field="parentName" usage="optional"/>
|
||||
<value name="archive" field="archive" usage="optional"/>
|
||||
|
||||
<structure name="properties" usage="optional">
|
||||
<collection field="properties" item-type="org.alfresco.repo.dictionary.M2Property" factory="org.alfresco.repo.dictionary.M2Model.createList"/>
|
||||
</structure>
|
||||
@@ -74,18 +73,18 @@
|
||||
<value style="attribute" name="name" field="name"/>
|
||||
<structure name="mandatory" usage="optional">
|
||||
<value style="attribute" name="enforced" field="isMandatoryEnforced" usage="optional" />
|
||||
<value style="text" field="isMandatory" />
|
||||
<value style="text" field="isMandatory" usage="optional"/>
|
||||
</structure>
|
||||
<value name="default" field="defaultValue" usage="optional"/>
|
||||
<structure name="constraints" usage="optional">
|
||||
<collection field="constraints" item-type="org.alfresco.repo.dictionary.M2Constraint" factory="org.alfresco.repo.dictionary.M2Model.createList"/>
|
||||
<collection field="constraints" item-type="org.alfresco.repo.dictionary.M2Constraint" usage="optional" factory="org.alfresco.repo.dictionary.M2Model.createList"/>
|
||||
</structure>
|
||||
</structure>
|
||||
</collection>
|
||||
</structure>
|
||||
<structure name="mandatory-aspects" usage="optional">
|
||||
<collection field="mandatoryAspects" factory="org.alfresco.repo.dictionary.M2Model.createList">
|
||||
<value name="aspect"/>
|
||||
<value name="aspect" type="java.lang.String"/>
|
||||
</collection>
|
||||
</structure>
|
||||
</mapping>
|
||||
@@ -94,7 +93,7 @@
|
||||
<structure map-as="org.alfresco.repo.dictionary.M2Class"/>
|
||||
</mapping>
|
||||
|
||||
<mapping name="aspect" class="org.alfresco.repo.dictionary.M2Aspect" extends="org.alfresco.repo.dictionary.M2Class">
|
||||
<mapping name="aspect" class="org.alfresco.repo.dictionary.M2Aspect" extends="org.alfresco.repo.dictionary.M2Class">
|
||||
<structure map-as="org.alfresco.repo.dictionary.M2Class"/>
|
||||
</mapping>
|
||||
|
||||
@@ -117,20 +116,16 @@
|
||||
<value name="tokenised" field="indexTokenisationMode" usage="optional" serializer="org.alfresco.repo.dictionary.IndexTokenisationMode.serializer" deserializer="org.alfresco.repo.dictionary.IndexTokenisationMode.deserializer"/>
|
||||
</structure>
|
||||
<structure name="constraints" usage="optional">
|
||||
<collection field="constraints" item-type="org.alfresco.repo.dictionary.M2Constraint" factory="org.alfresco.repo.dictionary.M2Model.createList"/>
|
||||
<collection field="constraints" item-type="org.alfresco.repo.dictionary.M2Constraint" factory="org.alfresco.repo.dictionary.M2Model.createList" usage="optional"/>
|
||||
</structure>
|
||||
</mapping>
|
||||
|
||||
<mapping abstract="true" class="org.alfresco.repo.dictionary.M2NamedValue">
|
||||
<value style="attribute" name="name" field="name" />
|
||||
<structure name="value" usage="optional">
|
||||
<value style="text" field="simpleValue" />
|
||||
</structure>
|
||||
<value name="value" field="simpleValue" usage="optional" />
|
||||
<structure name="list" usage="optional">
|
||||
<collection field="listValue" factory="org.alfresco.repo.dictionary.M2Model.createList" usage="optional" >
|
||||
<structure name="value" usage="optional" >
|
||||
<value style="text" />
|
||||
</structure>
|
||||
<collection field="listValue" factory="org.alfresco.repo.dictionary.M2Model.createList" usage="optional">
|
||||
<value name="value" style="element" usage="optional" type="java.lang.String"/>
|
||||
</collection>
|
||||
</structure>
|
||||
</mapping>
|
||||
@@ -158,8 +153,8 @@
|
||||
<value name="class" field="targetClassName"/>
|
||||
<value name="role" field="targetRoleName" usage="optional"/>
|
||||
<structure name="mandatory" usage="optional">
|
||||
<value style="attribute" name="enforced" field="isTargetMandatoryEnforced" usage="optional"/>
|
||||
<value style="text" field="isTargetMandatory" />
|
||||
<value style="attribute" name="enforced" field="isTargetMandatoryEnforced" get-method="getTargetMandatoryEnforced" usage="optional"/>
|
||||
<value style="text" field="isTargetMandatory" get-method="getTargetMandatory"/>
|
||||
</structure>
|
||||
<value name="many" field="isTargetMany" usage="optional"/>
|
||||
</structure>
|
||||
|
@@ -1,26 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 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
|
||||
* 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"
|
||||
* 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.node.index;
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.repo.domain.Transaction;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.util.ISO8601DateFormat;
|
||||
import org.alfresco.util.ISO8601DateFormat;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
@@ -65,10 +65,10 @@ public class IndexTransactionTracker extends AbstractReindexComponent
|
||||
private Map<Long, TxnRecord> voids;
|
||||
private boolean forceReindex;
|
||||
|
||||
private long fromTxnId;
|
||||
private String statusMsg;
|
||||
private static final String NO_REINDEX = "No reindex in progress";
|
||||
|
||||
private long fromTxnId;
|
||||
private String statusMsg;
|
||||
private static final String NO_REINDEX = "No reindex in progress";
|
||||
|
||||
/**
|
||||
* Set the defaults.
|
||||
* <ul>
|
||||
@@ -86,16 +86,16 @@ public class IndexTransactionTracker extends AbstractReindexComponent
|
||||
maxRecordSetSize = 1000;
|
||||
maxTransactionsPerLuceneCommit = 100;
|
||||
disableInTransactionIndexing = false;
|
||||
|
||||
started = false;
|
||||
|
||||
started = false;
|
||||
previousTxnIds = Collections.<Long>emptyList();
|
||||
lastMaxTxnId = Long.MAX_VALUE;
|
||||
fromTimeInclusive = -1L;
|
||||
voids = new TreeMap<Long, TxnRecord>();
|
||||
forceReindex = false;
|
||||
|
||||
fromTxnId = 0L;
|
||||
statusMsg = NO_REINDEX;
|
||||
|
||||
fromTxnId = 0L;
|
||||
statusMsg = NO_REINDEX;
|
||||
}
|
||||
|
||||
public synchronized void setListener(IndexTransactionTrackerListener listener)
|
||||
@@ -195,26 +195,29 @@ public class IndexTransactionTracker extends AbstractReindexComponent
|
||||
return reindexInTransaction();
|
||||
}
|
||||
};
|
||||
|
||||
public void resetFromTxn(long txnId)
|
||||
{
|
||||
logger.info("resetFromTxn: "+txnId);
|
||||
|
||||
this.fromTxnId = txnId;
|
||||
this.started = false; // this will cause index tracker to break out (so that it can be re-started)
|
||||
}
|
||||
|
||||
public void resetFromTxn(long txnId)
|
||||
{
|
||||
if (logger.isInfoEnabled())
|
||||
{
|
||||
logger.info("resetFromTxn: " + txnId);
|
||||
}
|
||||
|
||||
this.fromTxnId = txnId;
|
||||
this.started = false; // this will cause index tracker to break out (so that it can be re-started)
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void reindexImpl()
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("reindexImpl started: " + this);
|
||||
}
|
||||
|
||||
if (logger.isInfoEnabled())
|
||||
{
|
||||
logger.info("reindexImpl started: " + this);
|
||||
}
|
||||
|
||||
RetryingTransactionHelper retryingTransactionHelper = transactionService.getRetryingTransactionHelper();
|
||||
|
||||
if (!started)
|
||||
|
||||
if (!started)
|
||||
{
|
||||
// Disable in-transaction indexing
|
||||
if (disableInTransactionIndexing && nodeIndexer != null)
|
||||
@@ -226,29 +229,37 @@ public class IndexTransactionTracker extends AbstractReindexComponent
|
||||
voids.clear();
|
||||
previousTxnIds = new ArrayList<Long>(maxRecordSetSize);
|
||||
lastMaxTxnId = null; // So that it is ignored at first
|
||||
|
||||
if (this.fromTxnId != 0L)
|
||||
{
|
||||
logger.info("reindexImpl: start fromTxnId: "+fromTxnId+" "+this);
|
||||
|
||||
Long fromTxnCommitTime = getTxnCommitTime(this.fromTxnId);
|
||||
|
||||
if (fromTxnCommitTime == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
fromTimeInclusive = fromTxnCommitTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
fromTimeInclusive = retryingTransactionHelper.doInTransaction(getStartingCommitTimeWork, true, true);
|
||||
}
|
||||
|
||||
fromTxnId = 0L;
|
||||
|
||||
if (this.fromTxnId != 0L)
|
||||
{
|
||||
if (logger.isInfoEnabled())
|
||||
{
|
||||
logger.info("reindexImpl: start fromTxnId: " + fromTxnId);
|
||||
}
|
||||
|
||||
Long fromTxnCommitTime = getTxnCommitTime(this.fromTxnId);
|
||||
|
||||
if (fromTxnCommitTime == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
fromTimeInclusive = fromTxnCommitTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
fromTimeInclusive = retryingTransactionHelper.doInTransaction(getStartingCommitTimeWork, true, true);
|
||||
}
|
||||
|
||||
fromTxnId = 0L;
|
||||
started = true;
|
||||
|
||||
logger.info("reindexImpl: start fromTimeInclusive: "+ISO8601DateFormat.format(new Date(fromTimeInclusive))+" "+this);
|
||||
|
||||
if (logger.isInfoEnabled())
|
||||
{
|
||||
logger.info(
|
||||
"reindexImpl: start fromTimeInclusive: " +
|
||||
ISO8601DateFormat.format(new Date(fromTimeInclusive)));
|
||||
}
|
||||
}
|
||||
|
||||
while (true)
|
||||
@@ -262,36 +273,36 @@ public class IndexTransactionTracker extends AbstractReindexComponent
|
||||
}
|
||||
// Wait for the asynchronous reindexing to complete
|
||||
waitForAsynchronousReindexing();
|
||||
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace("reindexImpl: completed: "+this);
|
||||
}
|
||||
|
||||
statusMsg = NO_REINDEX;
|
||||
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace("reindexImpl: completed: "+this);
|
||||
}
|
||||
|
||||
statusMsg = NO_REINDEX;
|
||||
}
|
||||
|
||||
private Long getTxnCommitTime(final long txnId)
|
||||
{
|
||||
RetryingTransactionHelper retryingTransactionHelper = transactionService.getRetryingTransactionHelper();
|
||||
|
||||
RetryingTransactionCallback<Long> getTxnCommitTimeWork = new RetryingTransactionCallback<Long>()
|
||||
{
|
||||
public Long execute() throws Exception
|
||||
{
|
||||
Transaction txn = nodeDaoService.getTxnById(txnId);
|
||||
if (txn != null)
|
||||
{
|
||||
return txn.getCommitTimeMs();
|
||||
}
|
||||
|
||||
logger.warn("Txn not found: "+txnId);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
return retryingTransactionHelper.doInTransaction(getTxnCommitTimeWork, true, true);
|
||||
}
|
||||
|
||||
private Long getTxnCommitTime(final long txnId)
|
||||
{
|
||||
RetryingTransactionHelper retryingTransactionHelper = transactionService.getRetryingTransactionHelper();
|
||||
|
||||
RetryingTransactionCallback<Long> getTxnCommitTimeWork = new RetryingTransactionCallback<Long>()
|
||||
{
|
||||
public Long execute() throws Exception
|
||||
{
|
||||
Transaction txn = nodeDaoService.getTxnById(txnId);
|
||||
if (txn != null)
|
||||
{
|
||||
return txn.getCommitTimeMs();
|
||||
}
|
||||
|
||||
logger.warn("Txn not found: "+txnId);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
return retryingTransactionHelper.doInTransaction(getTxnCommitTimeWork, true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns <tt>true</tt> if the reindex process can exit otherwise <tt>false</tt> if
|
||||
@@ -299,8 +310,8 @@ public class IndexTransactionTracker extends AbstractReindexComponent
|
||||
*/
|
||||
private boolean reindexInTransaction()
|
||||
{
|
||||
List<Transaction> txns = null;
|
||||
|
||||
List<Transaction> txns = null;
|
||||
|
||||
long toTimeExclusive = System.currentTimeMillis() - reindexLagMs;
|
||||
|
||||
// Check that the voids haven't been filled
|
||||
@@ -316,7 +327,7 @@ public class IndexTransactionTracker extends AbstractReindexComponent
|
||||
}
|
||||
|
||||
// get next transactions to index
|
||||
txns = getNextTransactions(fromTimeInclusive, toTimeExclusive, previousTxnIds);
|
||||
txns = getNextTransactions(fromTimeInclusive, toTimeExclusive, previousTxnIds);
|
||||
|
||||
// If there are no transactions, then all the work is done
|
||||
if (txns.size() == 0)
|
||||
@@ -327,15 +338,15 @@ public class IndexTransactionTracker extends AbstractReindexComponent
|
||||
return false;
|
||||
}
|
||||
|
||||
statusMsg = String.format(
|
||||
"Reindexing batch of %d transactions from %s (txnId=%s)",
|
||||
txns.size(),
|
||||
(new Date(fromTimeInclusive)).toString(),
|
||||
txns.isEmpty() ? "---" : txns.get(0).getId().toString());
|
||||
|
||||
statusMsg = String.format(
|
||||
"Reindexing batch of %d transactions from %s (txnId=%s)",
|
||||
txns.size(),
|
||||
(new Date(fromTimeInclusive)).toString(),
|
||||
txns.isEmpty() ? "---" : txns.get(0).getId().toString());
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(statusMsg);
|
||||
logger.debug(statusMsg);
|
||||
}
|
||||
|
||||
// Reindex the transactions. Voids between the last set of transactions and this
|
||||
@@ -372,9 +383,9 @@ public class IndexTransactionTracker extends AbstractReindexComponent
|
||||
previousTxnIds.add(txn.getId());
|
||||
}
|
||||
|
||||
if (isShuttingDown() || (! started))
|
||||
if (isShuttingDown() || (! started))
|
||||
{
|
||||
// break out if the VM is shutting down or tracker has been reset (ie. !started)
|
||||
// break out if the VM is shutting down or tracker has been reset (ie. !started)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -384,11 +395,11 @@ public class IndexTransactionTracker extends AbstractReindexComponent
|
||||
}
|
||||
}
|
||||
|
||||
public String getReindexStatus()
|
||||
{
|
||||
return statusMsg;
|
||||
}
|
||||
|
||||
public String getReindexStatus()
|
||||
{
|
||||
return statusMsg;
|
||||
}
|
||||
|
||||
private static final long ONE_HOUR_MS = 3600*1000;
|
||||
/**
|
||||
* Find a transaction time to start indexing from (inclusive). The last recorded transaction by ID
|
||||
@@ -633,9 +644,9 @@ found:
|
||||
}
|
||||
}
|
||||
|
||||
if (isShuttingDown() || (! started))
|
||||
if (isShuttingDown() || (! started))
|
||||
{
|
||||
// break out if the VM is shutting down or tracker has been reset (ie. !started)
|
||||
// break out if the VM is shutting down or tracker has been reset (ie. !started)
|
||||
break;
|
||||
}
|
||||
// Flush the reindex buffer, if it is full or if we are on the last transaction and there are no more
|
||||
|
@@ -32,6 +32,7 @@ import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.jscript.ScriptNode;
|
||||
import org.alfresco.repo.security.authority.AuthorityDAO;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.workflow.WorkflowException;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.dom4j.Element;
|
||||
@@ -50,6 +51,7 @@ public class AlfrescoAssignment extends JBPMSpringAssignmentHandler
|
||||
{
|
||||
private static final long serialVersionUID = 1025667849552265719L;
|
||||
private ServiceRegistry services;
|
||||
private DictionaryService dictionaryService;
|
||||
private AuthorityDAO authorityDAO;
|
||||
|
||||
private Element actor;
|
||||
@@ -63,6 +65,7 @@ public class AlfrescoAssignment extends JBPMSpringAssignmentHandler
|
||||
protected void initialiseHandler(BeanFactory factory)
|
||||
{
|
||||
services = (ServiceRegistry)factory.getBean(ServiceRegistry.SERVICE_REGISTRY);
|
||||
dictionaryService = services.getDictionaryService();
|
||||
authorityDAO = (AuthorityDAO)factory.getBean("authorityDAO");
|
||||
}
|
||||
|
||||
@@ -162,6 +165,10 @@ public class AlfrescoAssignment extends JBPMSpringAssignmentHandler
|
||||
if (node instanceof ScriptNode)
|
||||
{
|
||||
String actor = mapAuthorityToName((ScriptNode)node, true);
|
||||
if (actor == null)
|
||||
{
|
||||
throw new WorkflowException("pooledactors expression does not evaluate to a collection of authorities");
|
||||
}
|
||||
actors.add(actor);
|
||||
}
|
||||
}
|
||||
@@ -218,15 +225,16 @@ public class AlfrescoAssignment extends JBPMSpringAssignmentHandler
|
||||
{
|
||||
String name = null;
|
||||
QName type = authority.getQNameType();
|
||||
if (type.equals(ContentModel.TYPE_PERSON))
|
||||
|
||||
if (dictionaryService.isSubClass(type, ContentModel.TYPE_PERSON))
|
||||
{
|
||||
name = (String)authority.getProperties().get(ContentModel.PROP_USERNAME);
|
||||
}
|
||||
else if (type.equals(ContentModel.TYPE_AUTHORITY))
|
||||
else if (allowGroup && dictionaryService.isSubClass(type, ContentModel.TYPE_AUTHORITY_CONTAINER))
|
||||
{
|
||||
name = authorityDAO.getAuthorityName(authority.getNodeRef());
|
||||
}
|
||||
else if (allowGroup && type.equals(ContentModel.TYPE_AUTHORITY_CONTAINER))
|
||||
else if (type.equals(ContentModel.TYPE_AUTHORITY))
|
||||
{
|
||||
name = authorityDAO.getAuthorityName(authority.getNodeRef());
|
||||
}
|
||||
|
@@ -2576,7 +2576,8 @@ public class JBPMEngine extends BPMEngine
|
||||
{
|
||||
String name = null;
|
||||
QName type = nodeService.getType(authority);
|
||||
if (type.equals(ContentModel.TYPE_PERSON))
|
||||
|
||||
if (dictionaryService.isSubClass(type, ContentModel.TYPE_PERSON))
|
||||
{
|
||||
name = (String)nodeService.getProperty(authority, ContentModel.PROP_USERNAME);
|
||||
}
|
||||
|
Reference in New Issue
Block a user