mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-1623 (Move In-Place Record)
* Created a new service for the inplace record actions git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@80914 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -28,14 +28,14 @@
|
|||||||
<!-- Hide record action -->
|
<!-- Hide record action -->
|
||||||
<bean id="hide-record" parent="action-executer" class="org.alfresco.module.org_alfresco_module_rm.action.dm.HideRecordAction">
|
<bean id="hide-record" parent="action-executer" class="org.alfresco.module.org_alfresco_module_rm.action.dm.HideRecordAction">
|
||||||
<property name="nodeService" ref="NodeService" />
|
<property name="nodeService" ref="NodeService" />
|
||||||
<property name="recordService" ref="RecordService" />
|
<property name="inplaceRecordService" ref="InplaceRecordService" />
|
||||||
<property name="publicAction" value="false"/>
|
<property name="publicAction" value="false"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- Move DM record action -->
|
<!-- Move DM record action -->
|
||||||
<bean id="move-dm-record" parent="action-executer" class="org.alfresco.module.org_alfresco_module_rm.action.dm.MoveDmRecordAction">
|
<bean id="move-dm-record" parent="action-executer" class="org.alfresco.module.org_alfresco_module_rm.action.dm.MoveDmRecordAction">
|
||||||
<property name="nodeService" ref="NodeService"/>
|
<property name="nodeService" ref="NodeService"/>
|
||||||
<property name="recordService" ref="RecordService"/>
|
<property name="inplaceRecordService" ref="InplaceRecordService"/>
|
||||||
<property name="publicAction" value="false"/>
|
<property name="publicAction" value="false"/>
|
||||||
<property name="adhocPropertiesAllowed" value="true" />
|
<property name="adhocPropertiesAllowed" value="true" />
|
||||||
</bean>
|
</bean>
|
||||||
|
@@ -1040,7 +1040,6 @@
|
|||||||
<property name="recordFolderService" ref="RecordFolderService" />
|
<property name="recordFolderService" ref="RecordFolderService" />
|
||||||
<property name="filePlanRoleService" ref="FilePlanRoleService" />
|
<property name="filePlanRoleService" ref="FilePlanRoleService" />
|
||||||
<property name="permissionService" ref="permissionService" />
|
<property name="permissionService" ref="permissionService" />
|
||||||
<property name="siteService" ref="SiteService" />
|
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="recordMetadataAspectBootstrap" class="org.alfresco.module.org_alfresco_module_rm.record.RecordMetadataBootstrap" init-method="init" abstract="true">
|
<bean id="recordMetadataAspectBootstrap" class="org.alfresco.module.org_alfresco_module_rm.record.RecordMetadataBootstrap" init-method="init" abstract="true">
|
||||||
@@ -1094,7 +1093,6 @@
|
|||||||
org.alfresco.module.org_alfresco_module_rm.record.RecordService.createRecord=RM_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.record.RecordService.createRecord=RM_ALLOW
|
||||||
org.alfresco.module.org_alfresco_module_rm.record.RecordService.createRecordFromContent=RM.Create.0
|
org.alfresco.module.org_alfresco_module_rm.record.RecordService.createRecordFromContent=RM.Create.0
|
||||||
org.alfresco.module.org_alfresco_module_rm.record.RecordService.file=RM_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.record.RecordService.file=RM_ALLOW
|
||||||
org.alfresco.module.org_alfresco_module_rm.record.RecordService.hideRecord=RM_ALLOW
|
|
||||||
org.alfresco.module.org_alfresco_module_rm.record.RecordService.isPropertyEditable=RM.Read.0
|
org.alfresco.module.org_alfresco_module_rm.record.RecordService.isPropertyEditable=RM.Read.0
|
||||||
org.alfresco.module.org_alfresco_module_rm.record.RecordService.isMetadataStub=RM.Read.0
|
org.alfresco.module.org_alfresco_module_rm.record.RecordService.isMetadataStub=RM.Read.0
|
||||||
org.alfresco.module.org_alfresco_module_rm.record.RecordService.rejectRecord=RM_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.record.RecordService.rejectRecord=RM_ALLOW
|
||||||
@@ -1102,13 +1100,64 @@
|
|||||||
org.alfresco.module.org_alfresco_module_rm.record.RecordService.addRecordType=RM_ALLOW
|
org.alfresco.module.org_alfresco_module_rm.record.RecordService.addRecordType=RM_ALLOW
|
||||||
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.moveRecord=RM.Write.0
|
|
||||||
org.alfresco.module.org_alfresco_module_rm.record.RecordService.*=RM_DENY
|
org.alfresco.module.org_alfresco_module_rm.record.RecordService.*=RM_DENY
|
||||||
]]>
|
]]>
|
||||||
</value>
|
</value>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<!-- Inplace Record Service -->
|
||||||
|
|
||||||
|
<bean id="inplaceRecordService" class="org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordServiceImpl">
|
||||||
|
<property name="siteService" ref="SiteService" />
|
||||||
|
<property name="nodeService" ref="NodeService" />
|
||||||
|
<property name="extendedSecurityService" ref="ExtendedSecurityService" />
|
||||||
|
<property name="fileFolderService" ref="FileFolderService" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="InplaceRecordService" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||||
|
<property name="proxyInterfaces">
|
||||||
|
<value>org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService</value>
|
||||||
|
</property>
|
||||||
|
<property name="targetSource">
|
||||||
|
<bean class="org.alfresco.config.NonBlockingLazyInitTargetSource">
|
||||||
|
<property name="targetBeanName">
|
||||||
|
<idref bean="inplaceRecordService"/>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
<property name="interceptorNames">
|
||||||
|
<list>
|
||||||
|
<idref local="InplaceRecordService_transaction"/>
|
||||||
|
<idref bean="exceptionTranslator"/>
|
||||||
|
<idref local="InplaceRecordService_security"/>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="InplaceRecordService_transaction" class="org.springframework.transaction.interceptor.TransactionInterceptor">
|
||||||
|
<property name="transactionManager">
|
||||||
|
<ref bean="transactionManager"/>
|
||||||
|
</property>
|
||||||
|
<property name="transactionAttributes">
|
||||||
|
<props>
|
||||||
|
<prop key="*">${server.transaction.mode.default}</prop>
|
||||||
|
</props>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="InplaceRecordService_security" parent="baseSecurity">
|
||||||
|
<property name="objectDefinitionSource">
|
||||||
|
<value>
|
||||||
|
<![CDATA[
|
||||||
|
org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService.hideRecord=RM_ALLOW
|
||||||
|
org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService.moveRecord=RM.Write.0
|
||||||
|
org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService.*=RM_DENY
|
||||||
|
]]>
|
||||||
|
</value>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<!-- File Plan Authentication Service -->
|
<!-- File Plan Authentication Service -->
|
||||||
<bean id="filePlanAuthenticationService"
|
<bean id="filePlanAuthenticationService"
|
||||||
class="org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationServiceImpl" />
|
class="org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationServiceImpl" />
|
||||||
|
@@ -22,7 +22,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase;
|
import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
import org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService;
|
||||||
import org.alfresco.service.cmr.action.Action;
|
import org.alfresco.service.cmr.action.Action;
|
||||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -51,8 +51,8 @@ public class HideRecordAction extends AuditableActionExecuterAbstractBase
|
|||||||
/** Node service */
|
/** Node service */
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
|
|
||||||
/** Record service */
|
/** Inplace record service */
|
||||||
private RecordService recordService;
|
private InplaceRecordService inplaceRecordService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param nodeService node service
|
* @param nodeService node service
|
||||||
@@ -63,11 +63,11 @@ public class HideRecordAction extends AuditableActionExecuterAbstractBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param recordService record service
|
* @param inplaceRecordService inplace record service
|
||||||
*/
|
*/
|
||||||
public void setRecordService(RecordService recordService)
|
public void setInplaceRecordService(InplaceRecordService inplaceRecordService)
|
||||||
{
|
{
|
||||||
this.recordService = recordService;
|
this.inplaceRecordService = inplaceRecordService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -87,7 +87,7 @@ public class HideRecordAction extends AuditableActionExecuterAbstractBase
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// hide the record from the collaboration site
|
// hide the record from the collaboration site
|
||||||
recordService.hideRecord(actionedUponNodeRef);
|
inplaceRecordService.hideRecord(actionedUponNodeRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -23,7 +23,7 @@ import java.util.List;
|
|||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase;
|
import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
import org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService;
|
||||||
import org.alfresco.service.cmr.action.Action;
|
import org.alfresco.service.cmr.action.Action;
|
||||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -53,8 +53,8 @@ public class MoveDmRecordAction extends AuditableActionExecuterAbstractBase impl
|
|||||||
/** Node service */
|
/** Node service */
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
|
|
||||||
/** Record service */
|
/** Inplace record service */
|
||||||
private RecordService recordService;
|
private InplaceRecordService inplaceRecordService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the node service
|
* Gets the node service
|
||||||
@@ -77,23 +77,23 @@ public class MoveDmRecordAction extends AuditableActionExecuterAbstractBase impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the record service
|
* Gets the inplace record service
|
||||||
*
|
*
|
||||||
* @return Record service
|
* @return Inplace record service
|
||||||
*/
|
*/
|
||||||
protected RecordService getRecordService()
|
protected InplaceRecordService getInplaceRecordService()
|
||||||
{
|
{
|
||||||
return this.recordService;
|
return this.inplaceRecordService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the record service
|
* Sets the inplace record service
|
||||||
*
|
*
|
||||||
* @param recordService Record service
|
* @param InplaceRecordService Inplace record service
|
||||||
*/
|
*/
|
||||||
public void setRecordService(RecordService recordService)
|
public void setInplaceRecordService(InplaceRecordService inplaceRecordService)
|
||||||
{
|
{
|
||||||
this.recordService = recordService;
|
this.inplaceRecordService = inplaceRecordService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -110,7 +110,7 @@ public class MoveDmRecordAction extends AuditableActionExecuterAbstractBase impl
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Move the record within the collaboration site
|
// Move the record within the collaboration site
|
||||||
getRecordService().moveRecord(actionedUponNodeRef, getTargetNodeRef(action));
|
getInplaceRecordService().moveRecord(actionedUponNodeRef, getTargetNodeRef(action));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.record;
|
||||||
|
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inplace Record Service Interface.
|
||||||
|
*
|
||||||
|
* @author Tuna Aksoy
|
||||||
|
* @since 2.3
|
||||||
|
*/
|
||||||
|
public interface InplaceRecordService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Hides a record within a collaboration site
|
||||||
|
*
|
||||||
|
* @param nodeRef The record which should be hidden
|
||||||
|
*/
|
||||||
|
void hideRecord(NodeRef nodeRef);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves a record within a collaboration site
|
||||||
|
*
|
||||||
|
* @param nodeRef The record which should be moved
|
||||||
|
* @param targetNodeRef The target node reference where it should be moved to
|
||||||
|
*/
|
||||||
|
void moveRecord(NodeRef nodeRef, NodeRef targetNodeRef);
|
||||||
|
}
|
@@ -0,0 +1,190 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.record;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
|
import org.alfresco.service.cmr.model.FileExistsException;
|
||||||
|
import org.alfresco.service.cmr.model.FileFolderService;
|
||||||
|
import org.alfresco.service.cmr.model.FileNotFoundException;
|
||||||
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
|
import org.alfresco.service.cmr.site.SiteInfo;
|
||||||
|
import org.alfresco.service.cmr.site.SiteService;
|
||||||
|
import org.alfresco.util.ParameterCheck;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inplace record service implementation.
|
||||||
|
*
|
||||||
|
* @author Tuna Aksoy
|
||||||
|
* @since 2.3
|
||||||
|
*/
|
||||||
|
public class InplaceRecordServiceImpl implements InplaceRecordService, RecordsManagementModel
|
||||||
|
{
|
||||||
|
/** Site service */
|
||||||
|
private SiteService siteService;
|
||||||
|
|
||||||
|
/** Node service */
|
||||||
|
private NodeService nodeService;
|
||||||
|
|
||||||
|
/** Extended security service */
|
||||||
|
private ExtendedSecurityService extendedSecurityService;
|
||||||
|
|
||||||
|
/** File folder service */
|
||||||
|
private FileFolderService fileFolderService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param siteService site service
|
||||||
|
*/
|
||||||
|
public void setSiteService(SiteService siteService)
|
||||||
|
{
|
||||||
|
this.siteService = siteService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param nodeService node service
|
||||||
|
*/
|
||||||
|
public void setNodeService(NodeService nodeService)
|
||||||
|
{
|
||||||
|
this.nodeService = nodeService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param extendedSecurityService extended security service
|
||||||
|
*/
|
||||||
|
public void setExtendedSecurityService(
|
||||||
|
ExtendedSecurityService extendedSecurityService)
|
||||||
|
{
|
||||||
|
this.extendedSecurityService = extendedSecurityService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param fileFolderService file folder service
|
||||||
|
*/
|
||||||
|
public void setFileFolderService(FileFolderService fileFolderService)
|
||||||
|
{
|
||||||
|
this.fileFolderService = fileFolderService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService#hideRecord(org.alfresco.service.cmr.repository.NodeRef)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void hideRecord(final NodeRef nodeRef)
|
||||||
|
{
|
||||||
|
ParameterCheck.mandatory("NodeRef", nodeRef);
|
||||||
|
|
||||||
|
// do the work of hiding the record as the system user
|
||||||
|
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Void doWork()
|
||||||
|
{
|
||||||
|
// remove the child association
|
||||||
|
NodeRef originatingLocation = (NodeRef) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION);
|
||||||
|
List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(nodeRef);
|
||||||
|
for (ChildAssociationRef childAssociationRef : parentAssocs)
|
||||||
|
{
|
||||||
|
if (!childAssociationRef.isPrimary() && childAssociationRef.getParentRef().equals(originatingLocation))
|
||||||
|
{
|
||||||
|
nodeService.removeChildAssociation(childAssociationRef);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove the extended security from the node
|
||||||
|
// this prevents the users from continuing to see the record in searchs and other linked locations
|
||||||
|
extendedSecurityService.removeAllExtendedSecurity(nodeRef);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService#moveRecord(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void moveRecord(final NodeRef nodeRef, final NodeRef targetNodeRef)
|
||||||
|
{
|
||||||
|
ParameterCheck.mandatory("nodeRef", nodeRef);
|
||||||
|
ParameterCheck.mandatory("targetNodeRef", targetNodeRef);
|
||||||
|
|
||||||
|
NodeRef sourceParentNodeRef = null;
|
||||||
|
|
||||||
|
NodeRef originatingLocation = (NodeRef) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION);
|
||||||
|
for (ChildAssociationRef parentAssoc : nodeService.getParentAssocs(nodeRef))
|
||||||
|
{
|
||||||
|
if (!parentAssoc.isPrimary() && parentAssoc.getParentRef().equals(originatingLocation))
|
||||||
|
{
|
||||||
|
sourceParentNodeRef = parentAssoc.getParentRef();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sourceParentNodeRef == null)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Could not find source parent node reference.");
|
||||||
|
}
|
||||||
|
|
||||||
|
SiteInfo sourceSite = siteService.getSite(sourceParentNodeRef);
|
||||||
|
SiteInfo targetSite = siteService.getSite(targetNodeRef);
|
||||||
|
|
||||||
|
if (!sourceSite.equals(targetSite))
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("The record can only be moved within the same collaboration site.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sourceSite.getSitePreset().equals("site-dashboard"))
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Only records within a collaboration site can be moved.");
|
||||||
|
}
|
||||||
|
|
||||||
|
final NodeRef source = sourceParentNodeRef;
|
||||||
|
|
||||||
|
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Void doWork()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Move the record
|
||||||
|
fileFolderService.moveFrom(nodeRef, source, targetNodeRef, null);
|
||||||
|
|
||||||
|
// Update the originating location property
|
||||||
|
nodeService.setProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION, targetNodeRef);
|
||||||
|
}
|
||||||
|
catch (FileExistsException | FileNotFoundException ex)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Can't move node: " + ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -169,13 +169,6 @@ public interface RecordService
|
|||||||
*/
|
*/
|
||||||
void file(NodeRef record);
|
void file(NodeRef record);
|
||||||
|
|
||||||
/**
|
|
||||||
* Hides a record within a collaboration site
|
|
||||||
*
|
|
||||||
* @param nodeRef The record which should be hidden
|
|
||||||
*/
|
|
||||||
void hideRecord(NodeRef nodeRef);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rejects a record with the provided reason
|
* Rejects a record with the provided reason
|
||||||
*
|
*
|
||||||
@@ -231,12 +224,4 @@ public interface RecordService
|
|||||||
* @param folder The folder in which the link will be created
|
* @param folder The folder in which the link will be created
|
||||||
*/
|
*/
|
||||||
void link(NodeRef nodeRef, NodeRef folder);
|
void link(NodeRef nodeRef, NodeRef folder);
|
||||||
|
|
||||||
/**
|
|
||||||
* Moves a record within a collaboration site
|
|
||||||
*
|
|
||||||
* @param nodeRef The record which should be moved
|
|
||||||
* @param targetNodeRef The target node reference where it should be moved to
|
|
||||||
*/
|
|
||||||
void moveRecord(NodeRef nodeRef, NodeRef targetNodeRef);
|
|
||||||
}
|
}
|
||||||
|
@@ -80,8 +80,6 @@ import org.alfresco.service.cmr.security.AccessPermission;
|
|||||||
import org.alfresco.service.cmr.security.AccessStatus;
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
import org.alfresco.service.cmr.security.OwnableService;
|
import org.alfresco.service.cmr.security.OwnableService;
|
||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.service.cmr.site.SiteInfo;
|
|
||||||
import org.alfresco.service.cmr.site.SiteService;
|
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||||
@@ -196,9 +194,6 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
/** Permission service */
|
/** Permission service */
|
||||||
private PermissionService permissionService;
|
private PermissionService permissionService;
|
||||||
|
|
||||||
/** Site service */
|
|
||||||
private SiteService siteService;
|
|
||||||
|
|
||||||
/** 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;
|
||||||
|
|
||||||
@@ -320,14 +315,6 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
this.permissionService = permissionService;
|
this.permissionService = permissionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param siteService site service
|
|
||||||
*/
|
|
||||||
public void setSiteService(SiteService siteService)
|
|
||||||
{
|
|
||||||
this.siteService = siteService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init method
|
* Init method
|
||||||
*/
|
*/
|
||||||
@@ -1049,41 +1036,6 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#hideRecord(org.alfresco.service.cmr.repository.NodeRef)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void hideRecord(final NodeRef nodeRef)
|
|
||||||
{
|
|
||||||
ParameterCheck.mandatory("NodeRef", nodeRef);
|
|
||||||
|
|
||||||
// do the work of hiding the record as the system user
|
|
||||||
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public Void doWork()
|
|
||||||
{
|
|
||||||
// remove the child association
|
|
||||||
NodeRef originatingLocation = (NodeRef) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION);
|
|
||||||
List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(nodeRef);
|
|
||||||
for (ChildAssociationRef childAssociationRef : parentAssocs)
|
|
||||||
{
|
|
||||||
if (!childAssociationRef.isPrimary() && childAssociationRef.getParentRef().equals(originatingLocation))
|
|
||||||
{
|
|
||||||
nodeService.removeChildAssociation(childAssociationRef);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove the extended security from the node
|
|
||||||
// this prevents the users from continuing to see the record in searchs and other linked locations
|
|
||||||
extendedSecurityService.removeAllExtendedSecurity(nodeRef);
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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)
|
||||||
*/
|
*/
|
||||||
@@ -1488,68 +1440,4 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
nodeService.addChild(folder, nodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nodeService.getProperty(nodeRef, ContentModel.PROP_NAME).toString()));
|
nodeService.addChild(folder, nodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nodeService.getProperty(nodeRef, ContentModel.PROP_NAME).toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#moveRecord(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void moveRecord(final NodeRef nodeRef, final NodeRef targetNodeRef)
|
|
||||||
{
|
|
||||||
ParameterCheck.mandatory("nodeRef", nodeRef);
|
|
||||||
ParameterCheck.mandatory("targetNodeRef", targetNodeRef);
|
|
||||||
|
|
||||||
NodeRef sourceParentNodeRef = null;
|
|
||||||
|
|
||||||
NodeRef originatingLocation = (NodeRef) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION);
|
|
||||||
for (ChildAssociationRef parentAssoc : nodeService.getParentAssocs(nodeRef))
|
|
||||||
{
|
|
||||||
if (!parentAssoc.isPrimary() && parentAssoc.getParentRef().equals(originatingLocation))
|
|
||||||
{
|
|
||||||
sourceParentNodeRef = parentAssoc.getParentRef();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sourceParentNodeRef == null)
|
|
||||||
{
|
|
||||||
throw new AlfrescoRuntimeException("Could not find source parent node reference.");
|
|
||||||
}
|
|
||||||
|
|
||||||
SiteInfo sourceSite = siteService.getSite(sourceParentNodeRef);
|
|
||||||
SiteInfo targetSite = siteService.getSite(targetNodeRef);
|
|
||||||
|
|
||||||
if (!sourceSite.equals(targetSite))
|
|
||||||
{
|
|
||||||
throw new AlfrescoRuntimeException("The record can only be moved within the same collaboration site.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sourceSite.getSitePreset().equals("site-dashboard"))
|
|
||||||
{
|
|
||||||
throw new AlfrescoRuntimeException("Only records within a collaboration site can be moved.");
|
|
||||||
}
|
|
||||||
|
|
||||||
final NodeRef source = sourceParentNodeRef;
|
|
||||||
|
|
||||||
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public Void doWork()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Move the record
|
|
||||||
fileFolderService.moveFrom(nodeRef, source, targetNodeRef, null);
|
|
||||||
|
|
||||||
// Update the originating location property
|
|
||||||
nodeService.setProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION, targetNodeRef);
|
|
||||||
}
|
|
||||||
catch (FileExistsException | FileNotFoundException ex)
|
|
||||||
{
|
|
||||||
throw new AlfrescoRuntimeException("Can't move node: " + ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user