mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-1420: Impossible to close/reopen folder with frozen record
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@67243 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
<map>
|
<map>
|
||||||
<entry key="capabilityCondition.filling" value="true"/>
|
<entry key="capabilityCondition.filling" value="true"/>
|
||||||
<entry key="capabilityCondition.cutoff" value="false"/>
|
<entry key="capabilityCondition.cutoff" value="false"/>
|
||||||
<entry key="capabilityCondition.frozenOrFrozenChildren" value="false"/>
|
<entry key="capabilityCondition.frozen" value="false"/>
|
||||||
<entry key="capabilityCondition.closed" value="false"/>
|
<entry key="capabilityCondition.closed" value="false"/>
|
||||||
</map>
|
</map>
|
||||||
</property>
|
</property>
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
<map>
|
<map>
|
||||||
<entry key="capabilityCondition.filling" value="true"/>
|
<entry key="capabilityCondition.filling" value="true"/>
|
||||||
<entry key="capabilityCondition.cutoff" value="false"/>
|
<entry key="capabilityCondition.cutoff" value="false"/>
|
||||||
<entry key="capabilityCondition.frozenOrFrozenChildren" value="false"/>
|
<entry key="capabilityCondition.frozen" value="false"/>
|
||||||
<entry key="capabilityCondition.closed" value="true"/>
|
<entry key="capabilityCondition.closed" value="true"/>
|
||||||
</map>
|
</map>
|
||||||
</property>
|
</property>
|
||||||
|
@@ -432,7 +432,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
* @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#addToHolds(java.util.List, org.alfresco.service.cmr.repository.NodeRef)
|
* @see org.alfresco.module.org_alfresco_module_rm.hold.HoldService#addToHolds(java.util.List, org.alfresco.service.cmr.repository.NodeRef)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addToHolds(List<NodeRef> holds, NodeRef nodeRef)
|
public void addToHolds(final List<NodeRef> holds, final NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
ParameterCheck.mandatoryCollection("holds", holds);
|
ParameterCheck.mandatoryCollection("holds", holds);
|
||||||
ParameterCheck.mandatory("nodeRef", nodeRef);
|
ParameterCheck.mandatory("nodeRef", nodeRef);
|
||||||
@@ -442,7 +442,7 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
throw new AlfrescoRuntimeException("Can only add records or record folders to a hold.");
|
throw new AlfrescoRuntimeException("Can only add records or record folders to a hold.");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (NodeRef hold : holds)
|
for (final NodeRef hold : holds)
|
||||||
{
|
{
|
||||||
if (!isHold(hold))
|
if (!isHold(hold))
|
||||||
{
|
{
|
||||||
@@ -452,47 +452,57 @@ public class HoldServiceImpl extends ServiceBaseImpl
|
|||||||
// check that the node isn't already in the hold
|
// check that the node isn't already in the hold
|
||||||
if (!getHeld(hold).contains(nodeRef))
|
if (!getHeld(hold).contains(nodeRef))
|
||||||
{
|
{
|
||||||
// Link the record to the hold
|
// run as system to ensure we have all the appropriate premissions to perform the manipulations we require
|
||||||
nodeService.addChild(hold, nodeRef, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS);
|
runAsSystem(new RunAsWork<Void>()
|
||||||
|
|
||||||
// gather freeze properties
|
|
||||||
Map<QName, Serializable> props = new HashMap<QName, Serializable>(2);
|
|
||||||
props.put(PROP_FROZEN_AT, new Date());
|
|
||||||
props.put(PROP_FROZEN_BY, AuthenticationUtil.getFullyAuthenticatedUser());
|
|
||||||
|
|
||||||
if (!nodeService.hasAspect(nodeRef, ASPECT_FROZEN))
|
|
||||||
{
|
{
|
||||||
// add freeze aspect
|
@Override
|
||||||
nodeService.addAspect(nodeRef, ASPECT_FROZEN, props);
|
public Void doWork() throws Exception
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
|
||||||
{
|
{
|
||||||
StringBuilder msg = new StringBuilder();
|
// Link the record to the hold
|
||||||
msg.append("Frozen aspect applied to '").append(nodeRef).append("'.");
|
nodeService.addChild(hold, nodeRef, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS);
|
||||||
logger.debug(msg.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mark all the folders contents as frozen
|
// gather freeze properties
|
||||||
if (isRecordFolder(nodeRef))
|
Map<QName, Serializable> props = new HashMap<QName, Serializable>(2);
|
||||||
{
|
props.put(PROP_FROZEN_AT, new Date());
|
||||||
List<NodeRef> records = recordService.getRecords(nodeRef);
|
props.put(PROP_FROZEN_BY, AuthenticationUtil.getFullyAuthenticatedUser());
|
||||||
for (NodeRef record : records)
|
|
||||||
{
|
if (!nodeService.hasAspect(nodeRef, ASPECT_FROZEN))
|
||||||
// no need to freeze if already frozen!
|
|
||||||
if (!nodeService.hasAspect(record, ASPECT_FROZEN))
|
|
||||||
{
|
{
|
||||||
nodeService.addAspect(record, ASPECT_FROZEN, props);
|
// add freeze aspect
|
||||||
|
nodeService.addAspect(nodeRef, ASPECT_FROZEN, props);
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
StringBuilder msg = new StringBuilder();
|
StringBuilder msg = new StringBuilder();
|
||||||
msg.append("Frozen aspect applied to '").append(record).append("'.");
|
msg.append("Frozen aspect applied to '").append(nodeRef).append("'.");
|
||||||
logger.debug(msg.toString());
|
logger.debug(msg.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mark all the folders contents as frozen
|
||||||
|
if (isRecordFolder(nodeRef))
|
||||||
|
{
|
||||||
|
List<NodeRef> records = recordService.getRecords(nodeRef);
|
||||||
|
for (NodeRef record : records)
|
||||||
|
{
|
||||||
|
// no need to freeze if already frozen!
|
||||||
|
if (!nodeService.hasAspect(record, ASPECT_FROZEN))
|
||||||
|
{
|
||||||
|
nodeService.addAspect(record, ASPECT_FROZEN, props);
|
||||||
|
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
StringBuilder msg = new StringBuilder();
|
||||||
|
msg.append("Frozen aspect applied to '").append(record).append("'.");
|
||||||
|
logger.debug(msg.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user