RM-5175_Complete_record_with_missing_metadata

This commit is contained in:
Sara Aspery
2017-06-06 16:21:49 +01:00
parent 74c40cd445
commit a7fddef34b
3 changed files with 585 additions and 145 deletions

View File

@@ -29,6 +29,7 @@ package org.alfresco.module.org_alfresco_module_rm.action.impl;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -193,6 +194,27 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase
}
}
// check for missing mandatory metadata from custom aspect definitions
if (result)
{
Collection<QName> aspects = this.getDictionaryService().getAspects(RM_CUSTOM_MODEL);
for (QName aspect : aspects)
{
// TODO should not apply record custom metadata for non-electronic and vice versa
AspectDefinition aspectDef = this.getDictionaryService().getAspect(aspect);
for (PropertyDefinition propDef : aspectDef.getProperties().values())
{
if (propDef.isMandatory() && nodeRefProps.get(propDef.getName()) == null)
{
logMissingProperty(propDef, missingProperties);
result = false;
break;
}
}
}
}
return result;
}