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:
Roy Wetherall
2013-09-03 00:59:04 +00:00
parent c1c46e1690
commit b7dd2e3fcb
3 changed files with 58 additions and 16 deletions

View File

@@ -68,6 +68,9 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase
List<String> missingProperties = new ArrayList<String>(5); List<String> missingProperties = new ArrayList<String>(5);
// 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)
{
recordService.disablePropertyEditableCheck();
try
{ {
// Add the declared aspect // Add the declared aspect
Map<QName, Serializable> declaredProps = new HashMap<QName, Serializable>(2); Map<QName, Serializable> declaredProps = new HashMap<QName, Serializable>(2);
@@ -86,6 +89,11 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase
} }
}); });
} }
finally
{
recordService.enablePropertyEditableCheck();
}
}
else else
{ {
logger.debug(buildMissingPropertiesErrorString(missingProperties)); logger.debug(buildMissingPropertiesErrorString(missingProperties));

View File

@@ -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
* *

View File

@@ -417,6 +417,24 @@ public class RecordServiceImpl implements RecordService,
} }
} }
/**
* @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());