mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merged BRANCHES/V2.2 to BRANCHES/V2.3:
111776: Merged BRANCHES/V2.1 to BRANCHES/V2.2: 111636: Merged BRANCHES/V2.1.0.x to BRANCHES/V2.1: 68559: Change base Alfresco version from 4.2.0-RC4 to 4.2.0 68568: Merge from HEAD to BRANCHES/V2.1.0.x 68569: Update module version to 2.1.0.1 76475: Merge HEAD to BRANCHES/V2.1.0.x: 76597: Merge HEAD to BRANCHES/V2.1.0.x: 74932: RM-1461: CLONE - RM slower then standard repo/sites when rendering document details when folder contains 15k documents 76598: Merged HEAD to BRANCHES/V2.1.0.x: 75102: RM Performance testing 76599: Update module version to 2.1.0.2 76601: Merged HEAD to BRANCHES/V2.1.0.x: 75186: RM Performance Improvements 76673: Root container cache to improve unfiled record browse performance * relates to RM-1594 and RM-1595 76850: RM performance enhancements * serach improvements * in-place record browse improvements * saved search via file plan browse improvements 76851: Additional unit test to check extended security with cache is working as expected. 76852: Rollback checked in config 77709: RM-1630: Error on manage references page * regression caused by performance improvements 84337: Update version to 2.1.0.3 84421: Transaction level cahcing of declarative capability evaluation 84676: Fix build 84677: Prevent unnessary repeated creation of QName 84678: Improvements to extended dynamic authorities * requiredFor set * direct access to extended permission information, not via service 84679: Correct requiredFor value 88087: RM-1661 (Performance on setting permissions at a high category level) 88092: RM-1661 (Performance on setting permissions at a high category level) * Fixed failing unit tests 88144: RM-1661 (Performance on setting permissions at a high category level) 88182: RM-1724 (Inheritance is not off for root categories, unfiled records, holds and transfers) 88192: RM-1661 (Performance on setting permissions at a high category level) * Added unit tests 88193: RM-1661 (Performance on setting permissions at a high category level) * Fixed failing unit tests 88358: RM-1661 (Performance on setting permissions at a high category level) * Added unit tests 88685: RM-1742 (Locally Set Permissions for moved Record duplicate parent folder Locally Set Permissions) 88686: RM-1741 (Moved root category doesn't inherit permissions) 88687: RM-1741 (Moved root category doesn't inherit permissions) * Unit test added 88688: RM-1742 (Locally Set Permissions for moved Record duplicate parent folder Locally Set Permissions) * Unit test added 88691: RM-1745 (RM Admin role can only be added with read permission on the manage permission page) 88772: RM-1741 (Moved root category doesn't inherit permissions) 88860: RM-1661 (Performance on setting permissions at a high category level) 88864: RM-1661 (Performance on setting permissions at a high category level) * Fixed failing unit tests 88959: RM-1746 (Moved record/category always have the inheritance on) 88960: RM-1661 (Performance on setting permissions at a high category level) * Fixed failing unit tests 88961: RM-1661 (Performance on setting permissions at a high category level) * Fixed failing unit tests 88962: RM-1661 (Performance on setting permissions at a high category level) * Fixed failing unit tests 91745: RM-1785 (RM: HF 2.1.0.3-33 causes permissions to not be displayed in Share everywhere else in the repo) 91838: Update version to 2.1.0.4 111641: Update Alfresco to 4.2.2.24. 111786: Fixing unresolved merge conflicts. 111793: Merged BRANCHES/V2.2.1.x to V2.2: 103185: RM-2162: Records Management patch RMv22DODModelSeparationModulePatch taking too long with large amount of records git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.3@111947 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -46,6 +46,8 @@ public interface DOD5015Model
|
||||
QName PROP_MEDIA_TYPE = QName.createQName(DOD_URI, "mediaType");
|
||||
QName PROP_FORMAT = QName.createQName(DOD_URI, "format");
|
||||
QName PROP_DATE_RECEIVED = QName.createQName(DOD_URI, "dateReceived");
|
||||
QName PROP_ADDRESS = QName.createQName(DOD_URI, "address");
|
||||
QName PROP_OTHER_ADDRESS = QName.createQName(DOD_URI, "otherAddress");
|
||||
|
||||
// Scanned Record
|
||||
QName ASPECT_SCANNED_RECORD = QName.createQName(DOD_URI, "scannedRecord");
|
||||
|
@@ -72,11 +72,11 @@ public class CustomEmailMappingServiceImpl extends AbstractLifecycleBean impleme
|
||||
/** Default custom mappings (TODO move to spring config) */
|
||||
private static final CustomMapping[] DEFAULT_MAPPINGS =
|
||||
{
|
||||
new CustomMapping("Date", "rma:dateReceived"),
|
||||
new CustomMapping("messageTo", "rma:address"),
|
||||
new CustomMapping("messageFrom", "rma:originator"),
|
||||
new CustomMapping("messageSent", "rma:publicationDate"),
|
||||
new CustomMapping("messageCc", "rma:otherAddress")
|
||||
new CustomMapping("Date", "dod:dateReceived"),
|
||||
new CustomMapping("messageTo", "dod:address"),
|
||||
new CustomMapping("messageFrom", "dod:originator"),
|
||||
new CustomMapping("messageSent", "dod:publicationDate"),
|
||||
new CustomMapping("messageCc", "dod:otherAddress")
|
||||
};
|
||||
|
||||
/** Extractor */
|
||||
|
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.patch;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -73,12 +75,12 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
|
||||
modulePatchExecuter.register(this);
|
||||
}
|
||||
|
||||
protected void setTxnReadOnly(boolean txnReadOnly)
|
||||
public void setTxnReadOnly(boolean txnReadOnly)
|
||||
{
|
||||
this.txnReadOnly = txnReadOnly;
|
||||
}
|
||||
|
||||
protected void setTxnRequiresNew(boolean txnRequiresNew)
|
||||
public void setTxnRequiresNew(boolean txnRequiresNew)
|
||||
{
|
||||
this.txnRequiresNew = txnRequiresNew;
|
||||
}
|
||||
@@ -229,15 +231,19 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
|
||||
",target=" + targetSchema);
|
||||
}
|
||||
|
||||
long startTime = System.nanoTime();
|
||||
|
||||
// do patch in transaction
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||
new ApplyCallback(),
|
||||
txnReadOnly,
|
||||
txnRequiresNew);
|
||||
|
||||
long elapsedTime = System.nanoTime() - startTime;
|
||||
|
||||
if (LOGGER.isInfoEnabled())
|
||||
{
|
||||
LOGGER.info(" ... module patch applied");
|
||||
LOGGER.info(" ... module patch applied in " + TimeUnit.NANOSECONDS.toMillis(elapsedTime) + "ms");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -36,6 +36,9 @@ public class RMv22DODCompliantSitePatch extends AbstractModulePatch
|
||||
{
|
||||
/** QName DAO */
|
||||
private QNameDAO qnameDAO;
|
||||
|
||||
/** indicates whether we convert to a standard file plan or not */
|
||||
private boolean convertToStandardFilePlan = false;
|
||||
|
||||
/**
|
||||
* @param qnameDAO QName DAO
|
||||
@@ -45,24 +48,35 @@ public class RMv22DODCompliantSitePatch extends AbstractModulePatch
|
||||
this.qnameDAO = qnameDAO;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param convertToStandardFilePlan convert to standard file if true, false otherwise
|
||||
*/
|
||||
public void setConvertToStandardFilePlan(boolean convertToStandardFilePlan)
|
||||
{
|
||||
this.convertToStandardFilePlan = convertToStandardFilePlan;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal()
|
||||
*/
|
||||
@Override
|
||||
public void applyInternal()
|
||||
{
|
||||
// ensure all existing sites are of the correct type
|
||||
if (qnameDAO.getQName(RecordsManagementModel.TYPE_RM_SITE) != null &&
|
||||
qnameDAO.getQName(DOD5015Model.TYPE_DOD_5015_SITE) == null)
|
||||
{
|
||||
qnameDAO.updateQName(RecordsManagementModel.TYPE_RM_SITE, DOD5015Model.TYPE_DOD_5015_SITE);
|
||||
}
|
||||
|
||||
// ensure all the existing file plans are of the correct type
|
||||
if (qnameDAO.getQName(RecordsManagementModel.TYPE_FILE_PLAN) != null &&
|
||||
qnameDAO.getQName(DOD5015Model.TYPE_DOD_5015_FILE_PLAN) == null)
|
||||
{
|
||||
qnameDAO.updateQName(RecordsManagementModel.TYPE_FILE_PLAN, DOD5015Model.TYPE_DOD_5015_FILE_PLAN);
|
||||
}
|
||||
if (!convertToStandardFilePlan)
|
||||
{
|
||||
// ensure all existing sites are of the correct type
|
||||
if (qnameDAO.getQName(RecordsManagementModel.TYPE_RM_SITE) != null &&
|
||||
qnameDAO.getQName(DOD5015Model.TYPE_DOD_5015_SITE) == null)
|
||||
{
|
||||
qnameDAO.updateQName(RecordsManagementModel.TYPE_RM_SITE, DOD5015Model.TYPE_DOD_5015_SITE);
|
||||
}
|
||||
|
||||
// ensure all the existing file plans are of the correct type
|
||||
if (qnameDAO.getQName(RecordsManagementModel.TYPE_FILE_PLAN) != null &&
|
||||
qnameDAO.getQName(DOD5015Model.TYPE_DOD_5015_FILE_PLAN) == null)
|
||||
{
|
||||
qnameDAO.updateQName(RecordsManagementModel.TYPE_FILE_PLAN, DOD5015Model.TYPE_DOD_5015_FILE_PLAN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -20,7 +20,6 @@ package org.alfresco.module.org_alfresco_module_rm.patch.v22;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
|
||||
@@ -28,7 +27,8 @@ import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch;
|
||||
import org.alfresco.repo.domain.node.NodeDAO;
|
||||
import org.alfresco.repo.domain.patch.PatchDAO;
|
||||
import org.alfresco.repo.domain.qname.QNameDAO;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.Pair;
|
||||
|
||||
@@ -43,9 +43,9 @@ public class RMv22DODModelSeparationModulePatch extends AbstractModulePatch
|
||||
{
|
||||
/** query batch size */
|
||||
private static final long BATCH_SIZE = 100000L;
|
||||
|
||||
/** QName DAO */
|
||||
private QNameDAO qnameDAO;
|
||||
|
||||
/** indicates whether we convert to a standard file plan or not */
|
||||
private boolean convertToStandardFilePlan = false;
|
||||
|
||||
/** Patch DAO */
|
||||
private PatchDAO patchDAO;
|
||||
@@ -61,16 +61,18 @@ public class RMv22DODModelSeparationModulePatch extends AbstractModulePatch
|
||||
DOD5015Model.PROP_PUBLICATION_DATE,
|
||||
DOD5015Model.PROP_MEDIA_TYPE,
|
||||
DOD5015Model.PROP_FORMAT,
|
||||
DOD5015Model.PROP_DATE_RECEIVED
|
||||
DOD5015Model.PROP_DATE_RECEIVED,
|
||||
DOD5015Model.PROP_ADDRESS,
|
||||
DOD5015Model.PROP_OTHER_ADDRESS
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param qnameDAO QName DAO
|
||||
* @param convertToStandardFilePlan convert to standard file if true, false otherwise
|
||||
*/
|
||||
public void setQnameDAO(QNameDAO qnameDAO)
|
||||
public void setConvertToStandardFilePlan(boolean convertToStandardFilePlan)
|
||||
{
|
||||
this.qnameDAO = qnameDAO;
|
||||
}
|
||||
this.convertToStandardFilePlan = convertToStandardFilePlan;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param patchDAO patch DAO
|
||||
@@ -94,50 +96,73 @@ public class RMv22DODModelSeparationModulePatch extends AbstractModulePatch
|
||||
@Override
|
||||
public void applyInternal()
|
||||
{
|
||||
Long maxNodeId = patchDAO.getMaxAdmNodeID();
|
||||
long recordCount = patchDAO.getCountNodesWithAspects(Collections.singleton(ASPECT_RECORD));
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug(" ... updating " + recordCount + " records");
|
||||
}
|
||||
if (!convertToStandardFilePlan)
|
||||
{
|
||||
Long maxNodeId = patchDAO.getMaxAdmNodeID();
|
||||
long recordCount = patchDAO.getCountNodesWithAspects(Collections.singleton(ASPECT_RECORD));
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug(" ... updating " + recordCount + " records in batches of " + BATCH_SIZE);
|
||||
}
|
||||
|
||||
// apply the DOD record aspect to all exiting records
|
||||
int completed = 0;
|
||||
for (Long i = 0L; i < maxNodeId; i+=BATCH_SIZE)
|
||||
{
|
||||
final Long finali = i;
|
||||
Integer batchCount = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Integer>()
|
||||
{
|
||||
int batchCount = 0;
|
||||
|
||||
public Integer execute() throws Throwable
|
||||
{
|
||||
nodeDAO.getNodesWithAspects(Collections.singleton(ASPECT_RECORD), finali, finali + BATCH_SIZE, new NodeDAO.NodeRefQueryCallback()
|
||||
{
|
||||
public boolean handle(Pair<Long, NodeRef> nodePair)
|
||||
{
|
||||
// get the records properties
|
||||
Map<QName, Serializable> properties = nodeDAO.getNodeProperties(nodePair.getFirst());
|
||||
boolean changed = false;
|
||||
|
||||
// apply the DOD record aspect to all exiting records
|
||||
int completed = 0;
|
||||
Pair<Long, QName> recordAspect = qnameDAO.getQName(ASPECT_RECORD);
|
||||
if (recordAspect != null)
|
||||
{
|
||||
for (Long i = 0L; i < maxNodeId; i+=BATCH_SIZE)
|
||||
{
|
||||
List<Long> nodeIds = patchDAO.getNodesByAspectQNameId(recordAspect.getFirst(), i, i + BATCH_SIZE);
|
||||
for (Long nodeId : nodeIds)
|
||||
{
|
||||
// get the records properties
|
||||
Map<QName, Serializable> properties = nodeDAO.getNodeProperties(nodeId);
|
||||
|
||||
for (QName qname : qnames)
|
||||
{
|
||||
// if the record has any of the moved properties
|
||||
QName origional = QName.createQName(RecordsManagementModel.RM_URI, qname.getLocalName());
|
||||
if (properties.containsKey(origional))
|
||||
{
|
||||
// move the property value
|
||||
Serializable value = properties.get(origional);
|
||||
properties.put(qname, value);
|
||||
properties.remove(origional);
|
||||
}
|
||||
}
|
||||
|
||||
// set properties and add aspect
|
||||
nodeDAO.setNodeProperties(nodeId, properties);
|
||||
nodeDAO.addNodeAspects(nodeId, Collections.singleton(DOD5015Model.ASPECT_DOD_5015_RECORD));
|
||||
}
|
||||
for (QName qname : qnames)
|
||||
{
|
||||
// if the record has any of the moved properties
|
||||
QName origional = QName.createQName(RecordsManagementModel.RM_URI, qname.getLocalName());
|
||||
if (properties.containsKey(origional))
|
||||
{
|
||||
// move the property value
|
||||
Serializable value = properties.get(origional);
|
||||
properties.put(qname, value);
|
||||
properties.remove(origional);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
completed += completed + nodeIds.size();
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug(" ... completed " + completed + " of " + recordCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
// set properties and add aspect
|
||||
if (changed)
|
||||
{
|
||||
nodeDAO.setNodeProperties(nodePair.getFirst(), properties);
|
||||
}
|
||||
nodeDAO.addNodeAspects(nodePair.getFirst(), Collections.singleton(DOD5015Model.ASPECT_DOD_5015_RECORD));
|
||||
batchCount ++;
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
return batchCount;
|
||||
}
|
||||
} , false, true);
|
||||
|
||||
if (batchCount != 0)
|
||||
{
|
||||
completed = completed + batchCount;
|
||||
if (LOGGER.isDebugEnabled())
|
||||
{
|
||||
LOGGER.debug(" ... completed " + completed + " of " + recordCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user