mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merge branch 'feature/refactor_declare_record_action' into RM-4431_CompleteRecordActionRestAPI
This commit is contained in:
@@ -388,8 +388,7 @@
|
|||||||
|
|
||||||
<bean id="declareRecord" class="org.alfresco.module.org_alfresco_module_rm.action.impl.DeclareRecordAction" parent="rmAction">
|
<bean id="declareRecord" class="org.alfresco.module.org_alfresco_module_rm.action.impl.DeclareRecordAction" parent="rmAction">
|
||||||
<property name="publicAction" value="true"/>
|
<property name="publicAction" value="true"/>
|
||||||
<property name="checkMandatoryPropertiesEnabled" value="${rm.completerecord.mandatorypropertiescheck.enabled}"/>
|
<property name="recordService" ref="RecordService" />
|
||||||
<property name="transactionalResourceHelper" ref="rm.transactionalResourceHelper" />
|
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- undeclare record -->
|
<!-- undeclare record -->
|
||||||
|
@@ -1076,6 +1076,9 @@
|
|||||||
<property name="recordableVersionService" ref="RecordableVersionService"/>
|
<property name="recordableVersionService" ref="RecordableVersionService"/>
|
||||||
<property name="alwaysEditURIs" ref="recordService_alwaysEditURIs" />
|
<property name="alwaysEditURIs" ref="recordService_alwaysEditURIs" />
|
||||||
<property name="incompleteNodeTagger" ref="incompleteNodeTagger" />
|
<property name="incompleteNodeTagger" ref="incompleteNodeTagger" />
|
||||||
|
<property name="freezeService" ref="FreezeService" />
|
||||||
|
<property name="namespaceService" ref="NamespaceService"/>
|
||||||
|
<property name="checkMandatoryPropertiesEnabled" value="${rm.completerecord.mandatorypropertiescheck.enabled}"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- Defines a list of namespace URIs for properties, which should be always editable -->
|
<!-- Defines a list of namespace URIs for properties, which should be always editable -->
|
||||||
@@ -1152,6 +1155,7 @@
|
|||||||
org.alfresco.module.org_alfresco_module_rm.record.RecordService.makeRecord=RM_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.record.RecordService.makeRecord=RM_ALLOW
|
||||||
org.alfresco.module.org_alfresco_module_rm.record.RecordService.link=RM_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.record.RecordService.link=RM_ALLOW
|
||||||
org.alfresco.module.org_alfresco_module_rm.record.RecordService.unlink=RM_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.record.RecordService.unlink=RM_ALLOW
|
||||||
|
org.alfresco.module.org_alfresco_module_rm.record.RecordService.complete=RM_ALLOW
|
||||||
org.alfresco.module.org_alfresco_module_rm.record.RecordService.*=RM_DENY
|
org.alfresco.module.org_alfresco_module_rm.record.RecordService.*=RM_DENY
|
||||||
]]>
|
]]>
|
||||||
</value>
|
</value>
|
||||||
|
@@ -27,33 +27,13 @@
|
|||||||
|
|
||||||
package org.alfresco.module.org_alfresco_module_rm.action.impl;
|
package org.alfresco.module.org_alfresco_module_rm.action.impl;
|
||||||
|
|
||||||
import static org.alfresco.module.org_alfresco_module_rm.record.RecordUtils.generateRecordIdentifier;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.text.MessageFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase;
|
import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordServiceImpl;
|
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper;
|
|
||||||
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
|
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
|
||||||
import org.alfresco.service.cmr.action.Action;
|
import org.alfresco.service.cmr.action.Action;
|
||||||
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
|
||||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
|
||||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.security.OwnableService;
|
import org.alfresco.util.ParameterCheck;
|
||||||
import org.alfresco.service.namespace.QName;
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.springframework.extensions.surf.util.I18NUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Declare record action
|
* Declare record action
|
||||||
@@ -65,33 +45,17 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase
|
|||||||
/** action name */
|
/** action name */
|
||||||
public static final String NAME = "declareRecord";
|
public static final String NAME = "declareRecord";
|
||||||
|
|
||||||
/** I18N */
|
/** Record service */
|
||||||
private static final String MSG_UNDECLARED_ONLY_RECORDS = "rm.action.undeclared-only-records";
|
private RecordService recordService;
|
||||||
private static final String MSG_NO_DECLARE_MAND_PROP = "rm.action.no-declare-mand-prop";
|
|
||||||
|
|
||||||
/** Logger */
|
|
||||||
private static Log logger = LogFactory.getLog(DeclareRecordAction.class);
|
|
||||||
|
|
||||||
/** check mandatory properties */
|
|
||||||
private boolean checkMandatoryPropertiesEnabled = true;
|
|
||||||
|
|
||||||
/** transactional resource helper */
|
|
||||||
private TransactionalResourceHelper transactionalResourceHelper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param checkMandatoryPropertiesEnabled true if check mandatory properties is enabled, false otherwise
|
* Sets the record service
|
||||||
|
*
|
||||||
|
* @param recordService record service
|
||||||
*/
|
*/
|
||||||
public void setCheckMandatoryPropertiesEnabled(boolean checkMandatoryPropertiesEnabled)
|
public void setRecordService(RecordService recordService)
|
||||||
{
|
{
|
||||||
this.checkMandatoryPropertiesEnabled = checkMandatoryPropertiesEnabled;
|
this.recordService = recordService;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param transactionalResourceHelper
|
|
||||||
*/
|
|
||||||
public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper)
|
|
||||||
{
|
|
||||||
this.transactionalResourceHelper = transactionalResourceHelper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,167 +64,14 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase
|
|||||||
@Override
|
@Override
|
||||||
protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef)
|
protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef)
|
||||||
{
|
{
|
||||||
if (getNodeService().exists(actionedUponNodeRef) &&
|
ParameterCheck.mandatory("actionedUponNodeRef", actionedUponNodeRef);
|
||||||
getRecordService().isRecord(actionedUponNodeRef) &&
|
try
|
||||||
!getFreezeService().isFrozen(actionedUponNodeRef))
|
|
||||||
{
|
{
|
||||||
if (!getRecordService().isDeclared(actionedUponNodeRef))
|
recordService.complete(actionedUponNodeRef);
|
||||||
{
|
|
||||||
// if the record is newly created make sure the record identifier is set before completing the record
|
|
||||||
Set<NodeRef> newRecords = transactionalResourceHelper.getSet(RecordServiceImpl.KEY_NEW_RECORDS);
|
|
||||||
if(newRecords.contains(actionedUponNodeRef))
|
|
||||||
{
|
|
||||||
generateRecordIdentifier(getNodeService(), getIdentifierService(), actionedUponNodeRef);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> missingProperties = new ArrayList<>(5);
|
|
||||||
// Aspect not already defined - check mandatory properties then add
|
|
||||||
if (!checkMandatoryPropertiesEnabled ||
|
|
||||||
mandatoryPropertiesSet(actionedUponNodeRef, missingProperties))
|
|
||||||
{
|
|
||||||
getRecordService().disablePropertyEditableCheck();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Add the declared aspect
|
|
||||||
Map<QName, Serializable> declaredProps = new HashMap<>(2);
|
|
||||||
declaredProps.put(PROP_DECLARED_AT, new Date());
|
|
||||||
declaredProps.put(PROP_DECLARED_BY, AuthenticationUtil.getRunAsUser());
|
|
||||||
this.getNodeService().addAspect(actionedUponNodeRef, ASPECT_DECLARED_RECORD, declaredProps);
|
|
||||||
|
|
||||||
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public Void doWork()
|
|
||||||
{
|
|
||||||
// remove all owner related rights
|
|
||||||
getOwnableService().setOwner(actionedUponNodeRef, OwnableService.NO_OWNER);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
getRecordService().enablePropertyEditableCheck();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
logger.debug(buildMissingPropertiesErrorString(missingProperties));
|
|
||||||
action.setParameterValue(ActionExecuterAbstractBase.PARAM_RESULT, "missingProperties");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
catch (IntegrityException e) {
|
||||||
{
|
action.setParameterValue(ActionExecuterAbstractBase.PARAM_RESULT, e.getMessage());
|
||||||
if (logger.isWarnEnabled())
|
|
||||||
{
|
|
||||||
logger.warn(I18NUtil.getMessage(MSG_UNDECLARED_ONLY_RECORDS, actionedUponNodeRef.toString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String buildMissingPropertiesErrorString(List<String> missingProperties)
|
|
||||||
{
|
|
||||||
StringBuilder builder = new StringBuilder(255);
|
|
||||||
builder.append(I18NUtil.getMessage(MSG_NO_DECLARE_MAND_PROP));
|
|
||||||
builder.append(" ");
|
|
||||||
for (String missingProperty : missingProperties)
|
|
||||||
{
|
|
||||||
builder.append(missingProperty).append(", ");
|
|
||||||
}
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper method to check whether all the mandatory properties of the node have been set
|
|
||||||
*
|
|
||||||
* @param nodeRef node reference
|
|
||||||
* @return boolean true if all mandatory properties are set, false otherwise
|
|
||||||
*/
|
|
||||||
private boolean mandatoryPropertiesSet(NodeRef nodeRef, List<String> missingProperties)
|
|
||||||
{
|
|
||||||
boolean result = true;
|
|
||||||
|
|
||||||
Map<QName, Serializable> nodeRefProps = this.getNodeService().getProperties(nodeRef);
|
|
||||||
|
|
||||||
QName nodeRefType = this.getNodeService().getType(nodeRef);
|
|
||||||
|
|
||||||
TypeDefinition typeDef = this.getDictionaryService().getType(nodeRefType);
|
|
||||||
for (PropertyDefinition propDef : typeDef.getProperties().values())
|
|
||||||
{
|
|
||||||
if (propDef.isMandatory() && nodeRefProps.get(propDef.getName()) == null)
|
|
||||||
{
|
|
||||||
logMissingProperty(propDef, missingProperties);
|
|
||||||
|
|
||||||
result = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
Set<QName> aspects = this.getNodeService().getAspects(nodeRef);
|
|
||||||
for (QName aspect : aspects)
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for missing mandatory metadata from custom aspect definitions
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
QName aspect = ASPECT_RECORD;
|
|
||||||
if (nodeRefType.equals(TYPE_NON_ELECTRONIC_DOCUMENT))
|
|
||||||
{
|
|
||||||
aspect = TYPE_NON_ELECTRONIC_DOCUMENT;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get customAspectImpl
|
|
||||||
String localName = aspect.toPrefixString(getNamespaceService()).replace(":", "");
|
|
||||||
localName = MessageFormat.format("{0}CustomProperties", localName);
|
|
||||||
QName customAspect = QName.createQName(RM_CUSTOM_URI, localName);
|
|
||||||
|
|
||||||
AspectDefinition aspectDef = this.getDictionaryService().getAspect(customAspect);
|
|
||||||
|
|
||||||
for (PropertyDefinition propDef : aspectDef.getProperties().values())
|
|
||||||
{
|
|
||||||
if (propDef.isMandatory() && nodeRefProps.get(propDef.getName()) == null)
|
|
||||||
{
|
|
||||||
logMissingProperty(propDef, missingProperties);
|
|
||||||
|
|
||||||
result = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Log information about missing properties.
|
|
||||||
*
|
|
||||||
* @param propDef property definition
|
|
||||||
* @param missingProperties missing properties
|
|
||||||
*/
|
|
||||||
private void logMissingProperty(PropertyDefinition propDef, List<String> missingProperties)
|
|
||||||
{
|
|
||||||
if (logger.isWarnEnabled())
|
|
||||||
{
|
|
||||||
StringBuilder msg = new StringBuilder();
|
|
||||||
msg.append("Mandatory property missing: ").append(propDef.getName());
|
|
||||||
logger.warn(msg.toString());
|
|
||||||
}
|
|
||||||
missingProperties.add(propDef.getName().toString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -293,4 +293,11 @@ public interface RecordService
|
|||||||
* @since 2.3
|
* @since 2.3
|
||||||
*/
|
*/
|
||||||
void unlink(NodeRef record, NodeRef recordFolder);
|
void unlink(NodeRef record, NodeRef recordFolder);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Completes a record
|
||||||
|
*
|
||||||
|
* @param nodeRef Record node reference
|
||||||
|
*/
|
||||||
|
void complete(NodeRef nodeRef);
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,7 @@ import static org.alfresco.repo.policy.Behaviour.NotificationFrequency.TRANSACTI
|
|||||||
import static org.alfresco.repo.policy.annotation.BehaviourKind.ASSOCIATION;
|
import static org.alfresco.repo.policy.annotation.BehaviourKind.ASSOCIATION;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
@@ -62,6 +63,7 @@ import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedul
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
|
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
|
||||||
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.fileplan.FilePlanService;
|
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService;
|
import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel;
|
||||||
@@ -82,9 +84,9 @@ import org.alfresco.repo.content.ContentServicePolicies;
|
|||||||
import org.alfresco.repo.node.NodeServicePolicies;
|
import org.alfresco.repo.node.NodeServicePolicies;
|
||||||
import org.alfresco.repo.node.integrity.IncompleteNodeTagger;
|
import org.alfresco.repo.node.integrity.IncompleteNodeTagger;
|
||||||
import org.alfresco.repo.node.integrity.IntegrityException;
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
|
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
||||||
import org.alfresco.repo.policy.ClassPolicyDelegate;
|
import org.alfresco.repo.policy.ClassPolicyDelegate;
|
||||||
import org.alfresco.repo.policy.PolicyComponent;
|
import org.alfresco.repo.policy.PolicyComponent;
|
||||||
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
|
||||||
import org.alfresco.repo.policy.annotation.Behaviour;
|
import org.alfresco.repo.policy.annotation.Behaviour;
|
||||||
import org.alfresco.repo.policy.annotation.BehaviourBean;
|
import org.alfresco.repo.policy.annotation.BehaviourBean;
|
||||||
import org.alfresco.repo.policy.annotation.BehaviourKind;
|
import org.alfresco.repo.policy.annotation.BehaviourKind;
|
||||||
@@ -160,6 +162,8 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
private static final String MSG_NODE_HAS_ASPECT = "rm.service.node-has-aspect";
|
private static final String MSG_NODE_HAS_ASPECT = "rm.service.node-has-aspect";
|
||||||
private static final String FINAL_VERSION = "rm.service.final-version";
|
private static final String FINAL_VERSION = "rm.service.final-version";
|
||||||
private static final String FINAL_DESCRIPTION = "rm.service.final-version-description";
|
private static final String FINAL_DESCRIPTION = "rm.service.final-version-description";
|
||||||
|
private static final String MSG_UNDECLARED_ONLY_RECORDS = "rm.action.undeclared-only-records";
|
||||||
|
private static final String MSG_NO_DECLARE_MAND_PROP = "rm.action.no-declare-mand-prop";
|
||||||
|
|
||||||
/** Always edit property array */
|
/** Always edit property array */
|
||||||
private static final QName[] ALWAYS_EDIT_PROPERTIES = new QName[]
|
private static final QName[] ALWAYS_EDIT_PROPERTIES = new QName[]
|
||||||
@@ -170,6 +174,11 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
/** always edit model URI's */
|
/** always edit model URI's */
|
||||||
private List<String> alwaysEditURIs;
|
private List<String> alwaysEditURIs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check mandatory properties
|
||||||
|
*/
|
||||||
|
private boolean checkMandatoryPropertiesEnabled = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param alwaysEditURIs the alwaysEditURIs to set
|
* @param alwaysEditURIs the alwaysEditURIs to set
|
||||||
*/
|
*/
|
||||||
@@ -265,6 +274,12 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
/** list of available record meta-data aspects and the file plan types the are applicable to */
|
/** list of available record meta-data aspects and the file plan types the are applicable to */
|
||||||
private Map<QName, Set<QName>> recordMetaDataAspects;
|
private Map<QName, Set<QName>> recordMetaDataAspects;
|
||||||
|
|
||||||
|
/** Freeze service */
|
||||||
|
private FreezeService freezeService;
|
||||||
|
|
||||||
|
/** Namespace service */
|
||||||
|
private NamespaceService namespaceService;
|
||||||
|
|
||||||
/** policies */
|
/** policies */
|
||||||
private ClassPolicyDelegate<BeforeFileRecord> beforeFileRecord;
|
private ClassPolicyDelegate<BeforeFileRecord> beforeFileRecord;
|
||||||
private ClassPolicyDelegate<OnFileRecord> onFileRecord;
|
private ClassPolicyDelegate<OnFileRecord> onFileRecord;
|
||||||
@@ -424,6 +439,30 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
this.incompleteNodeTagger = incompleteNodeTagger;
|
this.incompleteNodeTagger = incompleteNodeTagger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param freezeService freeze service
|
||||||
|
*/
|
||||||
|
public void setFreezeService(FreezeService freezeService)
|
||||||
|
{
|
||||||
|
this.freezeService = freezeService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param namespaceService namespace service
|
||||||
|
*/
|
||||||
|
public void setNamespaceService(NamespaceService namespaceService)
|
||||||
|
{
|
||||||
|
this.namespaceService = namespaceService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param checkMandatoryPropertiesEnabled true if check mandatory properties is enabled, false otherwise
|
||||||
|
*/
|
||||||
|
public void setCheckMandatoryPropertiesEnabled(boolean checkMandatoryPropertiesEnabled)
|
||||||
|
{
|
||||||
|
this.checkMandatoryPropertiesEnabled = checkMandatoryPropertiesEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init method
|
* Init method
|
||||||
*/
|
*/
|
||||||
@@ -1347,94 +1386,6 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper method to 'complete' a record.
|
|
||||||
*
|
|
||||||
* @param record node reference to record
|
|
||||||
*/
|
|
||||||
public void complete(NodeRef record)
|
|
||||||
{
|
|
||||||
ParameterCheck.mandatory("item", record);
|
|
||||||
|
|
||||||
// TODO get this from config
|
|
||||||
boolean checkMandatoryPropertiesEnabled = true;
|
|
||||||
|
|
||||||
if (!checkMandatoryPropertiesEnabled || (isMandatoryPropertiesPopulated(record)))
|
|
||||||
{
|
|
||||||
disablePropertyEditableCheck();
|
|
||||||
// Add the declared aspect
|
|
||||||
Map<QName, Serializable> declaredProps = new HashMap<>(2);
|
|
||||||
declaredProps.put(RecordsManagementModel.PROP_DECLARED_AT, new Date());
|
|
||||||
declaredProps.put(RecordsManagementModel.PROP_DECLARED_BY, AuthenticationUtil.getRunAsUser());
|
|
||||||
nodeService.addAspect(record, RecordsManagementModel.ASPECT_DECLARED_RECORD, declaredProps);
|
|
||||||
enablePropertyEditableCheck();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper method to determine whether a record's mandatory properties are set.
|
|
||||||
*
|
|
||||||
* @param nodeRef node reference to record
|
|
||||||
* @return boolean true if all mandatory metadata properties are set, false otherwise
|
|
||||||
*/
|
|
||||||
public boolean isMandatoryPropertiesPopulated(NodeRef nodeRef)
|
|
||||||
{
|
|
||||||
boolean result = true;
|
|
||||||
|
|
||||||
// check for missing mandatory metadata from type definitions
|
|
||||||
Map<QName, Serializable> nodeRefProps = nodeService.getProperties(nodeRef);
|
|
||||||
QName nodeRefType = nodeService.getType(nodeRef);
|
|
||||||
|
|
||||||
TypeDefinition typeDef = dictionaryService.getType(nodeRefType);
|
|
||||||
for (PropertyDefinition propDef : typeDef.getProperties().values())
|
|
||||||
{
|
|
||||||
if (propDef.isMandatory() && nodeRefProps.get(propDef.getName()) == null)
|
|
||||||
{
|
|
||||||
result = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for missing mandatory metadata from aspect definitions
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
// TODO change to aspects = getAspects(nodeRef) ?
|
|
||||||
Set<QName> aspects = nodeService.getAspects(nodeRef);
|
|
||||||
for (QName aspect : aspects)
|
|
||||||
{
|
|
||||||
AspectDefinition aspectDef = dictionaryService.getAspect(aspect);
|
|
||||||
for (PropertyDefinition propDef : aspectDef.getProperties().values())
|
|
||||||
{
|
|
||||||
if (propDef.isMandatory() && nodeRefProps.get(propDef.getName()) == null)
|
|
||||||
{
|
|
||||||
result = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for missing mandatory metadata from custom aspect definitions
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
Collection<QName> aspects = dictionaryService.getAspects(RM_CUSTOM_MODEL);
|
|
||||||
for (QName aspect : aspects)
|
|
||||||
{
|
|
||||||
AspectDefinition aspectDef = dictionaryService.getAspect(aspect);
|
|
||||||
for (PropertyDefinition propDef : aspectDef.getProperties().values())
|
|
||||||
{
|
|
||||||
if (propDef.isMandatory() && nodeRefProps.get(propDef.getName()) == null)
|
|
||||||
{
|
|
||||||
result = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#rejectRecord(org.alfresco.service.cmr.repository.NodeRef, java.lang.String)
|
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#rejectRecord(org.alfresco.service.cmr.repository.NodeRef, java.lang.String)
|
||||||
*/
|
*/
|
||||||
@@ -2012,4 +1963,173 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
incompleteNodeTagger.beforeCommit(false);
|
incompleteNodeTagger.beforeCommit(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Completes a record
|
||||||
|
*
|
||||||
|
* @param nodeRef Record node reference
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void complete(NodeRef nodeRef)
|
||||||
|
{
|
||||||
|
if (nodeService.exists(nodeRef) && isRecord(nodeRef) && !freezeService.isFrozen(nodeRef))
|
||||||
|
{
|
||||||
|
if (!isDeclared(nodeRef))
|
||||||
|
{
|
||||||
|
// if the record is newly created make sure the record identifier is set before completing the record
|
||||||
|
Set<NodeRef> newRecords = transactionalResourceHelper.getSet(RecordServiceImpl.KEY_NEW_RECORDS);
|
||||||
|
if (newRecords.contains(nodeRef))
|
||||||
|
{
|
||||||
|
generateRecordIdentifier(nodeService, identifierService, nodeRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> missingProperties = new ArrayList<>(5);
|
||||||
|
// Aspect not already defined - check mandatory properties then add
|
||||||
|
if (!checkMandatoryPropertiesEnabled || mandatoryPropertiesSet(nodeRef, missingProperties))
|
||||||
|
{
|
||||||
|
disablePropertyEditableCheck();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Add the declared aspect
|
||||||
|
Map<QName, Serializable> declaredProps = new HashMap<>(2);
|
||||||
|
declaredProps.put(PROP_DECLARED_AT, new Date());
|
||||||
|
declaredProps.put(PROP_DECLARED_BY, AuthenticationUtil.getRunAsUser());
|
||||||
|
nodeService.addAspect(nodeRef, ASPECT_DECLARED_RECORD, declaredProps);
|
||||||
|
|
||||||
|
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Void doWork()
|
||||||
|
{
|
||||||
|
// remove all owner related rights
|
||||||
|
ownableService.setOwner(nodeRef, OwnableService.NO_OWNER);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
enablePropertyEditableCheck();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGGER.debug(buildMissingPropertiesErrorString(missingProperties));
|
||||||
|
throw new IntegrityException("The record has missing mandatory properties.", null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new IntegrityException("The record is already completed.", null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (LOGGER.isWarnEnabled())
|
||||||
|
{
|
||||||
|
LOGGER.warn(I18NUtil.getMessage(MSG_UNDECLARED_ONLY_RECORDS, nodeRef.toString()));
|
||||||
|
}
|
||||||
|
throw new IntegrityException("The record does not exist or is frozen.", null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String buildMissingPropertiesErrorString(List<String> missingProperties)
|
||||||
|
{
|
||||||
|
StringBuilder builder = new StringBuilder(255);
|
||||||
|
builder.append(I18NUtil.getMessage(MSG_NO_DECLARE_MAND_PROP));
|
||||||
|
builder.append(" ");
|
||||||
|
for (String missingProperty : missingProperties)
|
||||||
|
{
|
||||||
|
builder.append(missingProperty).append(", ");
|
||||||
|
}
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to check whether all the mandatory properties of the node have been set
|
||||||
|
*
|
||||||
|
* @param nodeRef node reference
|
||||||
|
* @return boolean true if all mandatory properties are set, false otherwise
|
||||||
|
*/
|
||||||
|
private boolean mandatoryPropertiesSet(final NodeRef nodeRef, final List<String> missingProperties)
|
||||||
|
{
|
||||||
|
Map<QName, Serializable> nodeRefProps = nodeService.getProperties(nodeRef);
|
||||||
|
QName nodeRefType = nodeService.getType(nodeRef);
|
||||||
|
|
||||||
|
// check for missing mandatory metadata from type definitions
|
||||||
|
TypeDefinition typeDef = dictionaryService.getType(nodeRefType);
|
||||||
|
checkDefinitionMandatoryPropsSet(typeDef, nodeRefProps, missingProperties);
|
||||||
|
|
||||||
|
// check for missing mandatory metadata from aspect definitions
|
||||||
|
Set<QName> aspects = nodeService.getAspects(nodeRef);
|
||||||
|
for (QName aspect : aspects)
|
||||||
|
{
|
||||||
|
AspectDefinition aspectDef = dictionaryService.getAspect(aspect);
|
||||||
|
checkDefinitionMandatoryPropsSet(aspectDef, nodeRefProps, missingProperties);
|
||||||
|
}
|
||||||
|
|
||||||
|
// check for missing mandatory metadata from custom aspect definitions
|
||||||
|
QName customAspect = getCustomAspectImpl(nodeRefType);
|
||||||
|
AspectDefinition aspectDef = dictionaryService.getAspect(customAspect);
|
||||||
|
checkDefinitionMandatoryPropsSet(aspectDef, nodeRefProps, missingProperties);
|
||||||
|
|
||||||
|
return missingProperties.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to check whether all the definition mandatory properties of the node have been set
|
||||||
|
*
|
||||||
|
* @param classDef the ClassDefinition defining the properties to be checked
|
||||||
|
* @param nodeRefProps the properties of the node to be checked
|
||||||
|
* @param missingProperties the list of mandatory properties found to be missing (currently only the first one)
|
||||||
|
* @return boolean true if all mandatory properties are set, false otherwise
|
||||||
|
*/
|
||||||
|
private void checkDefinitionMandatoryPropsSet(final ClassDefinition classDef, final Map<QName, Serializable> nodeRefProps,
|
||||||
|
final List<String> missingProperties)
|
||||||
|
{
|
||||||
|
for (PropertyDefinition propDef : classDef.getProperties().values())
|
||||||
|
{
|
||||||
|
if (propDef.isMandatory() && nodeRefProps.get(propDef.getName()) == null)
|
||||||
|
{
|
||||||
|
logMissingProperty(propDef, missingProperties);;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log information about missing properties.
|
||||||
|
*
|
||||||
|
* @param propDef property definition
|
||||||
|
* @param missingProperties missing properties
|
||||||
|
*/
|
||||||
|
private void logMissingProperty(PropertyDefinition propDef, List<String> missingProperties)
|
||||||
|
{
|
||||||
|
if (LOGGER.isWarnEnabled())
|
||||||
|
{
|
||||||
|
StringBuilder msg = new StringBuilder();
|
||||||
|
msg.append("Mandatory property missing: ").append(propDef.getName());
|
||||||
|
LOGGER.warn(msg.toString());
|
||||||
|
}
|
||||||
|
missingProperties.add(propDef.getName().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to get the custom aspect for a given nodeRef type
|
||||||
|
*
|
||||||
|
* @param nodeRefType the node type for which to return custom aspect QName
|
||||||
|
* @return QName custom aspect
|
||||||
|
*/
|
||||||
|
private QName getCustomAspectImpl(QName nodeRefType)
|
||||||
|
{
|
||||||
|
QName aspect = ASPECT_RECORD;
|
||||||
|
if (nodeRefType.equals(TYPE_NON_ELECTRONIC_DOCUMENT))
|
||||||
|
{
|
||||||
|
aspect = TYPE_NON_ELECTRONIC_DOCUMENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get customAspectImpl
|
||||||
|
String localName = aspect.toPrefixString(namespaceService).replace(":", "");
|
||||||
|
localName = MessageFormat.format("{0}CustomProperties", localName);
|
||||||
|
return QName.createQName(RM_CUSTOM_URI, localName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -32,8 +32,8 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionResult;
|
import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionResult;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.action.impl.DeclareRecordAction;
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.record.RecordServiceImpl;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -55,9 +55,9 @@ public class CompleteRecordTest extends BaseRMTestCase
|
|||||||
private static final boolean OPTIONAL_METADATA = false;
|
private static final boolean OPTIONAL_METADATA = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* complete record action
|
* Record service impl
|
||||||
*/
|
*/
|
||||||
private DeclareRecordAction action;
|
private RecordServiceImpl recordServiceImpl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices()
|
* @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices()
|
||||||
@@ -67,8 +67,8 @@ public class CompleteRecordTest extends BaseRMTestCase
|
|||||||
{
|
{
|
||||||
super.initServices();
|
super.initServices();
|
||||||
|
|
||||||
// get the action
|
// get the record service
|
||||||
action = (DeclareRecordAction) applicationContext.getBean("declareRecord");
|
recordServiceImpl = (RecordServiceImpl) applicationContext.getBean("recordService");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,7 +80,7 @@ public class CompleteRecordTest extends BaseRMTestCase
|
|||||||
super.tearDownImpl();
|
super.tearDownImpl();
|
||||||
|
|
||||||
// ensure action is returned to original state
|
// ensure action is returned to original state
|
||||||
action.setCheckMandatoryPropertiesEnabled(true);
|
recordServiceImpl.setCheckMandatoryPropertiesEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -100,7 +100,7 @@ public class CompleteRecordTest extends BaseRMTestCase
|
|||||||
public void given()
|
public void given()
|
||||||
{
|
{
|
||||||
// enable mandatory parameter check
|
// enable mandatory parameter check
|
||||||
action.setCheckMandatoryPropertiesEnabled(true);
|
recordServiceImpl.setCheckMandatoryPropertiesEnabled(true);
|
||||||
|
|
||||||
// create a record
|
// create a record
|
||||||
record = utils.createRecord(rmFolder, "record.txt", "title");
|
record = utils.createRecord(rmFolder, "record.txt", "title");
|
||||||
@@ -140,7 +140,7 @@ public class CompleteRecordTest extends BaseRMTestCase
|
|||||||
public void given()
|
public void given()
|
||||||
{
|
{
|
||||||
// enable mandatory parameter check
|
// enable mandatory parameter check
|
||||||
action.setCheckMandatoryPropertiesEnabled(true);
|
recordServiceImpl.setCheckMandatoryPropertiesEnabled(true);
|
||||||
|
|
||||||
// create a record
|
// create a record
|
||||||
record = utils.createRecord(rmFolder, "record.txt", "title");
|
record = utils.createRecord(rmFolder, "record.txt", "title");
|
||||||
@@ -183,7 +183,7 @@ public class CompleteRecordTest extends BaseRMTestCase
|
|||||||
public void given() throws Exception
|
public void given() throws Exception
|
||||||
{
|
{
|
||||||
// enable mandatory parameter check
|
// enable mandatory parameter check
|
||||||
action.setCheckMandatoryPropertiesEnabled(true);
|
recordServiceImpl.setCheckMandatoryPropertiesEnabled(true);
|
||||||
|
|
||||||
// create the custom metadata definition (that has a mandatory property) for electronic records
|
// create the custom metadata definition (that has a mandatory property) for electronic records
|
||||||
defineCustomMetadata(CUSTOM_ELECTRONIC_TEST, ASPECT_RECORD, MANDATORY_METADATA);
|
defineCustomMetadata(CUSTOM_ELECTRONIC_TEST, ASPECT_RECORD, MANDATORY_METADATA);
|
||||||
@@ -229,7 +229,7 @@ public class CompleteRecordTest extends BaseRMTestCase
|
|||||||
public void given() throws Exception
|
public void given() throws Exception
|
||||||
{
|
{
|
||||||
// enable mandatory parameter check
|
// enable mandatory parameter check
|
||||||
action.setCheckMandatoryPropertiesEnabled(true);
|
recordServiceImpl.setCheckMandatoryPropertiesEnabled(true);
|
||||||
|
|
||||||
// define the custom metadata definition (that has a mandatory property)
|
// define the custom metadata definition (that has a mandatory property)
|
||||||
defineCustomMetadata(CUSTOM_ELECTRONIC_TEST, ASPECT_RECORD, MANDATORY_METADATA);
|
defineCustomMetadata(CUSTOM_ELECTRONIC_TEST, ASPECT_RECORD, MANDATORY_METADATA);
|
||||||
@@ -279,7 +279,7 @@ public class CompleteRecordTest extends BaseRMTestCase
|
|||||||
public void given() throws Exception
|
public void given() throws Exception
|
||||||
{
|
{
|
||||||
// enable mandatory parameter check
|
// enable mandatory parameter check
|
||||||
action.setCheckMandatoryPropertiesEnabled(true);
|
recordServiceImpl.setCheckMandatoryPropertiesEnabled(true);
|
||||||
|
|
||||||
// create the custom metadata definition (that has a mandatory property) for non-electronic records
|
// create the custom metadata definition (that has a mandatory property) for non-electronic records
|
||||||
defineCustomMetadata(CUSTOM_NON_ELECTRONIC_TEST, TYPE_NON_ELECTRONIC_DOCUMENT, MANDATORY_METADATA);
|
defineCustomMetadata(CUSTOM_NON_ELECTRONIC_TEST, TYPE_NON_ELECTRONIC_DOCUMENT, MANDATORY_METADATA);
|
||||||
@@ -326,7 +326,7 @@ public class CompleteRecordTest extends BaseRMTestCase
|
|||||||
public void given() throws Exception
|
public void given() throws Exception
|
||||||
{
|
{
|
||||||
// enable mandatory parameter check
|
// enable mandatory parameter check
|
||||||
action.setCheckMandatoryPropertiesEnabled(true);
|
recordServiceImpl.setCheckMandatoryPropertiesEnabled(true);
|
||||||
|
|
||||||
// create the custom metadata definition (that has a mandatory property)
|
// create the custom metadata definition (that has a mandatory property)
|
||||||
defineCustomMetadata(CUSTOM_NON_ELECTRONIC_TEST, TYPE_NON_ELECTRONIC_DOCUMENT, MANDATORY_METADATA);
|
defineCustomMetadata(CUSTOM_NON_ELECTRONIC_TEST, TYPE_NON_ELECTRONIC_DOCUMENT, MANDATORY_METADATA);
|
||||||
@@ -375,7 +375,7 @@ public class CompleteRecordTest extends BaseRMTestCase
|
|||||||
public void given() throws Exception
|
public void given() throws Exception
|
||||||
{
|
{
|
||||||
// enable mandatory parameter check
|
// enable mandatory parameter check
|
||||||
action.setCheckMandatoryPropertiesEnabled(true);
|
recordServiceImpl.setCheckMandatoryPropertiesEnabled(true);
|
||||||
|
|
||||||
// create the custom metadata definition (that does not have a mandatory property)
|
// create the custom metadata definition (that does not have a mandatory property)
|
||||||
defineCustomMetadata(CUSTOM_ELECTRONIC_TEST, ASPECT_RECORD, OPTIONAL_METADATA);
|
defineCustomMetadata(CUSTOM_ELECTRONIC_TEST, ASPECT_RECORD, OPTIONAL_METADATA);
|
||||||
@@ -422,7 +422,7 @@ public class CompleteRecordTest extends BaseRMTestCase
|
|||||||
public void given() throws Exception
|
public void given() throws Exception
|
||||||
{
|
{
|
||||||
// enable mandatory parameter check
|
// enable mandatory parameter check
|
||||||
action.setCheckMandatoryPropertiesEnabled(true);
|
recordServiceImpl.setCheckMandatoryPropertiesEnabled(true);
|
||||||
|
|
||||||
// create the record custom metadata definition (that has a mandatory property)
|
// create the record custom metadata definition (that has a mandatory property)
|
||||||
defineCustomMetadata(CUSTOM_ELECTRONIC_TEST, ASPECT_RECORD, MANDATORY_METADATA);
|
defineCustomMetadata(CUSTOM_ELECTRONIC_TEST, ASPECT_RECORD, MANDATORY_METADATA);
|
||||||
@@ -469,7 +469,7 @@ public class CompleteRecordTest extends BaseRMTestCase
|
|||||||
public void given() throws Exception
|
public void given() throws Exception
|
||||||
{
|
{
|
||||||
// enable mandatory parameter check
|
// enable mandatory parameter check
|
||||||
action.setCheckMandatoryPropertiesEnabled(true);
|
recordServiceImpl.setCheckMandatoryPropertiesEnabled(true);
|
||||||
|
|
||||||
// create the non-electronic record custom metadata definition (that has a mandatory property)
|
// create the non-electronic record custom metadata definition (that has a mandatory property)
|
||||||
defineCustomMetadata(CUSTOM_NON_ELECTRONIC_TEST, TYPE_NON_ELECTRONIC_DOCUMENT, MANDATORY_METADATA);
|
defineCustomMetadata(CUSTOM_NON_ELECTRONIC_TEST, TYPE_NON_ELECTRONIC_DOCUMENT, MANDATORY_METADATA);
|
||||||
@@ -515,7 +515,7 @@ public class CompleteRecordTest extends BaseRMTestCase
|
|||||||
public void given()
|
public void given()
|
||||||
{
|
{
|
||||||
// disable mandatory parameter check
|
// disable mandatory parameter check
|
||||||
action.setCheckMandatoryPropertiesEnabled(false);
|
recordServiceImpl.setCheckMandatoryPropertiesEnabled(false);
|
||||||
|
|
||||||
// create a record
|
// create a record
|
||||||
record = utils.createRecord(rmFolder, "record.txt", "title");
|
record = utils.createRecord(rmFolder, "record.txt", "title");
|
||||||
@@ -555,7 +555,7 @@ public class CompleteRecordTest extends BaseRMTestCase
|
|||||||
public void given()
|
public void given()
|
||||||
{
|
{
|
||||||
// enable mandatory parameter check
|
// enable mandatory parameter check
|
||||||
action.setCheckMandatoryPropertiesEnabled(false);
|
recordServiceImpl.setCheckMandatoryPropertiesEnabled(false);
|
||||||
|
|
||||||
// create a record
|
// create a record
|
||||||
record = utils.createRecord(rmFolder, "record.txt", "title");
|
record = utils.createRecord(rmFolder, "record.txt", "title");
|
||||||
|
Reference in New Issue
Block a user