mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Revert "Merge branch 'feature/RM-4572_CreateRecordResponseContainsWrongName' into 'master'
This reverts commita0710a379a
, reversing changes made to7c4ead5bdf
.
This commit is contained in:
@@ -127,7 +127,6 @@ public interface RecordsManagementModel extends RecordsManagementCustomModel
|
||||
QName ASPECT_RECORD_COMPONENT_ID = QName.createQName(RM_URI, "recordComponentIdentifier");
|
||||
QName PROP_IDENTIFIER = QName.createQName(RM_URI, "identifier");
|
||||
QName PROP_DB_UNIQUENESS_ID = QName.createQName(RM_URI, "dbUniquenessId");
|
||||
QName PROP_ID_IS_TEMPORARILY_EDITABLE = QName.createQName(RM_URI, "idIsTemporarilyEditable");
|
||||
|
||||
// Vital record definition aspect
|
||||
QName ASPECT_VITAL_RECORD_DEFINITION = QName.createQName(RM_URI, "vitalRecordDefinition");
|
||||
|
@@ -47,7 +47,6 @@ import org.alfresco.repo.policy.annotation.BehaviourKind;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
import org.alfresco.service.cmr.attributes.AttributeService;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
@@ -65,7 +64,6 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
||||
public class RecordComponentIdentifierAspect extends BaseBehaviourBean
|
||||
implements NodeServicePolicies.OnUpdatePropertiesPolicy,
|
||||
NodeServicePolicies.BeforeDeleteNodePolicy,
|
||||
NodeServicePolicies.OnAddAspectPolicy,
|
||||
CopyServicePolicies.OnCopyCompletePolicy
|
||||
{
|
||||
/** I18N */
|
||||
@@ -129,7 +127,7 @@ public class RecordComponentIdentifierAspect extends BaseBehaviourBean
|
||||
if (newIdValue != null)
|
||||
{
|
||||
String oldIdValue = (String)before.get(PROP_IDENTIFIER);
|
||||
if (oldIdValue != null && !oldIdValue.equals(newIdValue) && !isRecordIdentifierEditable(nodeRef))
|
||||
if (oldIdValue != null && !oldIdValue.equals(newIdValue))
|
||||
{
|
||||
throw new IntegrityException(I18NUtil.getMessage(MSG_SET_ID, nodeRef.toString()), null);
|
||||
}
|
||||
@@ -142,17 +140,6 @@ public class RecordComponentIdentifierAspect extends BaseBehaviourBean
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method that checks if a record's identifier is temporarily editable
|
||||
* @param record the record to check
|
||||
* @return true if it is editable false otherwise
|
||||
*/
|
||||
private boolean isRecordIdentifierEditable(NodeRef record)
|
||||
{
|
||||
Boolean isEditableProperty = (Boolean)nodeService.getProperty(record, RecordsManagementModel.PROP_ID_IS_TEMPORARILY_EDITABLE);
|
||||
return isEditableProperty == null ? false : isEditableProperty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up the {@link RecordsManagementModel#PROP_IDENTIFIER rma:identifier} property unique triplet.
|
||||
*
|
||||
@@ -252,28 +239,4 @@ public class RecordComponentIdentifierAspect extends BaseBehaviourBean
|
||||
}
|
||||
}
|
||||
|
||||
@Behaviour
|
||||
(
|
||||
kind = BehaviourKind.CLASS,
|
||||
notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
|
||||
)
|
||||
@Override
|
||||
public void onAddAspect(final NodeRef nodeRef, final QName aspectTypeQName)
|
||||
{
|
||||
AuthenticationUtil.runAsSystem(new RunAsWork<Object>()
|
||||
{
|
||||
public Object doWork()
|
||||
{
|
||||
/*
|
||||
* When creating a new record the identifier is writable to allow the upload in multiple steps.
|
||||
* On transaction commit make the identifier read only (remove the editable aspect).
|
||||
*/
|
||||
if(nodeService.exists(nodeRef) && nodeService.hasAspect(nodeRef, aspectTypeQName))
|
||||
{
|
||||
nodeService.setProperty(nodeRef, RecordsManagementModel.PROP_ID_IS_TEMPORARILY_EDITABLE, false);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -124,8 +124,7 @@ public class RecordsManagementContainerType extends BaseBehaviourBean
|
||||
@Behaviour
|
||||
(
|
||||
kind = BehaviourKind.ASSOCIATION,
|
||||
// Execute on first event to make all type conversions and set all the properties before transaction ends and response is returned
|
||||
notificationFrequency = NotificationFrequency.EVERY_EVENT,
|
||||
notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT,
|
||||
name = BEHAVIOUR_NAME
|
||||
)
|
||||
public void onCreateChildAssociation(final ChildAssociationRef childAssocRef, boolean isNewNode)
|
||||
@@ -199,10 +198,8 @@ public class RecordsManagementContainerType extends BaseBehaviourBean
|
||||
if (nodeService.hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT) &&
|
||||
nodeService.getProperty(nodeRef, PROP_IDENTIFIER) == null)
|
||||
{
|
||||
// Generate identifier and leave it editable until the transaction ends
|
||||
String id = identifierService.generateIdentifier(nodeRef);
|
||||
nodeService.setProperty(nodeRef, RecordsManagementModel.PROP_IDENTIFIER, id);
|
||||
nodeService.setProperty(nodeRef, RecordsManagementModel.PROP_ID_IS_TEMPORARILY_EDITABLE, true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user