mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-614: Can't complete record without "Complete Record" capability
* added enable/disable property check methods to record service .. useful when setting 'system' properties git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@54807 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -69,22 +69,30 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase
|
|||||||
// Aspect not already defined - check mandatory properties then add
|
// Aspect not already defined - check mandatory properties then add
|
||||||
if (mandatoryPropertiesSet(actionedUponNodeRef, missingProperties) == true)
|
if (mandatoryPropertiesSet(actionedUponNodeRef, missingProperties) == true)
|
||||||
{
|
{
|
||||||
// Add the declared aspect
|
recordService.disablePropertyEditableCheck();
|
||||||
Map<QName, Serializable> declaredProps = new HashMap<QName, Serializable>(2);
|
try
|
||||||
declaredProps.put(PROP_DECLARED_AT, new Date());
|
{
|
||||||
declaredProps.put(PROP_DECLARED_BY, AuthenticationUtil.getRunAsUser());
|
// Add the declared aspect
|
||||||
this.nodeService.addAspect(actionedUponNodeRef, ASPECT_DECLARED_RECORD, declaredProps);
|
Map<QName, Serializable> declaredProps = new HashMap<QName, Serializable>(2);
|
||||||
|
declaredProps.put(PROP_DECLARED_AT, new Date());
|
||||||
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
declaredProps.put(PROP_DECLARED_BY, AuthenticationUtil.getRunAsUser());
|
||||||
{
|
this.nodeService.addAspect(actionedUponNodeRef, ASPECT_DECLARED_RECORD, declaredProps);
|
||||||
@Override
|
|
||||||
public Void doWork() throws Exception
|
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
||||||
{
|
{
|
||||||
// remove all owner related rights
|
@Override
|
||||||
ownableService.setOwner(actionedUponNodeRef, OwnableService.NO_OWNER);
|
public Void doWork() throws Exception
|
||||||
return null;
|
{
|
||||||
}
|
// remove all owner related rights
|
||||||
});
|
ownableService.setOwner(actionedUponNodeRef, OwnableService.NO_OWNER);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
recordService.enablePropertyEditableCheck();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -35,6 +35,16 @@ import org.alfresco.service.namespace.QName;
|
|||||||
*/
|
*/
|
||||||
public interface RecordService
|
public interface RecordService
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Disables the property editable check.
|
||||||
|
*/
|
||||||
|
void disablePropertyEditableCheck();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the property editable check. By default this is always enabled.
|
||||||
|
*/
|
||||||
|
void enablePropertyEditableCheck();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of all the record meta-data aspects
|
* Gets a list of all the record meta-data aspects
|
||||||
*
|
*
|
||||||
|
@@ -416,6 +416,24 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
onUpdateProperties.enable();
|
onUpdateProperties.enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#disablePropertyEditableCheck()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void disablePropertyEditableCheck()
|
||||||
|
{
|
||||||
|
onUpdateProperties.disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#enablePropertyEditableCheck()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void enablePropertyEditableCheck()
|
||||||
|
{
|
||||||
|
onUpdateProperties.enable();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#getRecordMetaDataAspects()
|
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#getRecordMetaDataAspects()
|
||||||
@@ -1031,6 +1049,12 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method that indicates whether a property is considered record metadata or not.
|
||||||
|
*
|
||||||
|
* @param property property
|
||||||
|
* @return boolea true if record metadata, false otherwise
|
||||||
|
*/
|
||||||
private boolean isRecordMetadata(QName property)
|
private boolean isRecordMetadata(QName property)
|
||||||
{
|
{
|
||||||
boolean result = ArrayUtils.contains(RECORD_MODEL_URIS, property.getNamespaceURI());
|
boolean result = ArrayUtils.contains(RECORD_MODEL_URIS, property.getNamespaceURI());
|
||||||
|
Reference in New Issue
Block a user