mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-1583: Not possible to edit the record that was edited before upgrade
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@75569 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,8 +18,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.module.org_alfresco_module_rm.patch.v22;
|
package org.alfresco.module.org_alfresco_module_rm.patch.v22;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
|
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
@@ -93,17 +95,6 @@ public class RMv22DODModelSeparationModulePatch extends AbstractModulePatch
|
|||||||
public void applyInternal()
|
public void applyInternal()
|
||||||
{
|
{
|
||||||
Long maxNodeId = patchDAO.getMaxAdmNodeID();
|
Long maxNodeId = patchDAO.getMaxAdmNodeID();
|
||||||
|
|
||||||
// switch each qname from the rma namespace to the dod namespace
|
|
||||||
for (QName qname : qnames)
|
|
||||||
{
|
|
||||||
QName origional = QName.createQName(RecordsManagementModel.RM_URI, qname.getLocalName());
|
|
||||||
if (qnameDAO.getQName(origional) != null)
|
|
||||||
{
|
|
||||||
qnameDAO.updateQName(origional, qname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
long recordCount = patchDAO.getCountNodesWithAspects(Collections.singleton(ASPECT_RECORD));
|
long recordCount = patchDAO.getCountNodesWithAspects(Collections.singleton(ASPECT_RECORD));
|
||||||
if (LOGGER.isDebugEnabled())
|
if (LOGGER.isDebugEnabled())
|
||||||
{
|
{
|
||||||
@@ -120,6 +111,24 @@ public class RMv22DODModelSeparationModulePatch extends AbstractModulePatch
|
|||||||
List<Long> nodeIds = patchDAO.getNodesByAspectQNameId(recordAspect.getFirst(), i, i + BATCH_SIZE);
|
List<Long> nodeIds = patchDAO.getNodesByAspectQNameId(recordAspect.getFirst(), i, i + BATCH_SIZE);
|
||||||
for (Long nodeId : nodeIds)
|
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));
|
nodeDAO.addNodeAspects(nodeId, Collections.singleton(DOD5015Model.ASPECT_DOD_5015_RECORD));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user