mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
RM-5012 - generate identifier on record declare
This commit is contained in:
@@ -144,6 +144,7 @@
|
|||||||
<property name="filePlanService" ref="FilePlanService"/>
|
<property name="filePlanService" ref="FilePlanService"/>
|
||||||
<property name="recordService" ref="RecordService"/>
|
<property name="recordService" ref="RecordService"/>
|
||||||
<property name="authenticationUtil" ref="rm.authenticationUtil"/>
|
<property name="authenticationUtil" ref="rm.authenticationUtil"/>
|
||||||
|
<property name="transactionService" ref="transactionService" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean class="org.alfresco.rm.rest.api.transfercontainers.TransferContainerEntityResource">
|
<bean class="org.alfresco.rm.rest.api.transfercontainers.TransferContainerEntityResource">
|
||||||
|
@@ -853,7 +853,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
|
|
||||||
// make the document a record
|
// make the document a record
|
||||||
makeRecord(nodeRef);
|
makeRecord(nodeRef);
|
||||||
appendIdentifierToName(nodeService, nodeRef);
|
generateRecordIdentifier(nodeService, identifierService, nodeRef);
|
||||||
|
|
||||||
if (latestVersionRecord != null)
|
if (latestVersionRecord != null)
|
||||||
{
|
{
|
||||||
@@ -1063,7 +1063,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
|
|
||||||
// make record
|
// make record
|
||||||
makeRecord(record);
|
makeRecord(record);
|
||||||
appendIdentifierToName(nodeService, record);
|
generateRecordIdentifier(nodeService, identifierService, record);
|
||||||
|
|
||||||
// remove added copy assocs
|
// remove added copy assocs
|
||||||
List<AssociationRef> recordAssocs = nodeService.getTargetAssocs(record, ContentModel.ASSOC_ORIGINAL);
|
List<AssociationRef> recordAssocs = nodeService.getTargetAssocs(record, ContentModel.ASSOC_ORIGINAL);
|
||||||
@@ -1198,7 +1198,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
{
|
{
|
||||||
// make record
|
// make record
|
||||||
makeRecord(record);
|
makeRecord(record);
|
||||||
appendIdentifierToName(nodeService, record);
|
generateRecordIdentifier(nodeService, identifierService, record);
|
||||||
}
|
}
|
||||||
|
|
||||||
return record;
|
return record;
|
||||||
@@ -1811,7 +1811,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
{
|
{
|
||||||
if (nodeService.exists(nodeRef) && !nodeService.hasAspect(nodeRef, ContentModel.ASPECT_HIDDEN) && !nodeService.hasAspect(nodeRef, ContentModel.ASPECT_LOCKABLE))
|
if (nodeService.exists(nodeRef) && !nodeService.hasAspect(nodeRef, ContentModel.ASPECT_HIDDEN) && !nodeService.hasAspect(nodeRef, ContentModel.ASPECT_LOCKABLE))
|
||||||
{
|
{
|
||||||
appendIdentifierToName(nodeService, nodeRef);
|
generateRecordIdentifier(nodeService, identifierService, record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,6 +31,7 @@ import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.rest.framework.Operation;
|
import org.alfresco.rest.framework.Operation;
|
||||||
import org.alfresco.rest.framework.WebApiDescription;
|
import org.alfresco.rest.framework.WebApiDescription;
|
||||||
import org.alfresco.rest.framework.resource.EntityResource;
|
import org.alfresco.rest.framework.resource.EntityResource;
|
||||||
@@ -42,6 +43,7 @@ import org.alfresco.service.cmr.model.FileFolderService;
|
|||||||
import org.alfresco.service.cmr.model.FileInfo;
|
import org.alfresco.service.cmr.model.FileInfo;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
import org.alfresco.util.ParameterCheck;
|
import org.alfresco.util.ParameterCheck;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
|
||||||
@@ -59,6 +61,7 @@ public class FilesEntityResource implements InitializingBean
|
|||||||
private FilePlanService filePlanService;
|
private FilePlanService filePlanService;
|
||||||
private FileFolderService fileFolderService;
|
private FileFolderService fileFolderService;
|
||||||
private RecordService recordService;
|
private RecordService recordService;
|
||||||
|
private TransactionService transactionService;
|
||||||
|
|
||||||
public void setAuthenticationUtil(AuthenticationUtil authenticationUtil)
|
public void setAuthenticationUtil(AuthenticationUtil authenticationUtil)
|
||||||
{
|
{
|
||||||
@@ -85,6 +88,11 @@ public class FilesEntityResource implements InitializingBean
|
|||||||
this.nodesModelFactory = nodesModelFactory;
|
this.nodesModelFactory = nodesModelFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTransactionService(TransactionService transactionService)
|
||||||
|
{
|
||||||
|
this.transactionService = transactionService;
|
||||||
|
}
|
||||||
|
|
||||||
@Operation("declare")
|
@Operation("declare")
|
||||||
@WebApiDescription(title = "Declare as record", description="Declare a file as record.")
|
@WebApiDescription(title = "Declare as record", description="Declare a file as record.")
|
||||||
public Record declareAsRecord(String fileId, Void body, Parameters parameters, WithResponse withResponse)
|
public Record declareAsRecord(String fileId, Void body, Parameters parameters, WithResponse withResponse)
|
||||||
@@ -104,7 +112,15 @@ public class FilesEntityResource implements InitializingBean
|
|||||||
|
|
||||||
// Create the record
|
// Create the record
|
||||||
NodeRef file = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, fileId);
|
NodeRef file = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, fileId);
|
||||||
|
RetryingTransactionCallback<Void> callback = new RetryingTransactionCallback<Void>()
|
||||||
|
{
|
||||||
|
public Void execute()
|
||||||
|
{
|
||||||
recordService.createRecord(filePlan, file, !hideRecord);
|
recordService.createRecord(filePlan, file, !hideRecord);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true);
|
||||||
|
|
||||||
// Return record state
|
// Return record state
|
||||||
FileInfo info = fileFolderService.getFileInfo(file);
|
FileInfo info = fileFolderService.getFileInfo(file);
|
||||||
|
Reference in New Issue
Block a user