mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-1124 (RM user can create a folder within the unfiled records area)
RM-1125 (RM user can delete a folder within the unfiled records area) RM-1126 (RM user can edit the meta-data of a folder within the unfiled records area) RM-1127 (RM user can view the details of a folder in the unfiled records area) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@59986 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
<list>
|
||||
<value>RECORD_CATEGORY</value>
|
||||
<value>RECORD_FOLDER</value>
|
||||
<value>UNFILED_RECORD_CONTAINER</value>
|
||||
</list>
|
||||
</property>
|
||||
<property name="conditions">
|
||||
@@ -66,14 +67,14 @@
|
||||
<property name="group"><ref bean="folderControlGroup"/></property>
|
||||
<property name="index" value="40" />
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- Unassignable -->
|
||||
|
||||
<bean id="rmMoveRecordFolderCapability"
|
||||
parent="compositeCapability">
|
||||
<property name="name" value="MoveRecordFolder"/>
|
||||
<property name="private" value="true"/>
|
||||
<property name="undetermined" value="true"/>
|
||||
<property name="undetermined" value="true"/>
|
||||
<property name="capabilities">
|
||||
<list>
|
||||
<ref bean="rmCreateModifyDestroyFoldersCapability"/>
|
||||
|
@@ -48,37 +48,38 @@
|
||||
<property name="recordService" ref="recordService"/>
|
||||
<property name="recordFolderService" ref="RecordFolderService"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="rm.baseBehaviour" abstract="true">
|
||||
<property name="nodeService" ref="NodeService" />
|
||||
<property name="nodeService" ref="NodeService" />
|
||||
<property name="dictionaryService" ref="DictionaryService" />
|
||||
<property name="behaviourFilter" ref="policyBehaviourFilter" />
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- rma model types -->
|
||||
|
||||
|
||||
<bean id="rma.recordsManagementContainer" class="org.alfresco.module.org_alfresco_module_rm.model.rma.type.RecordsManagementContainerType" parent="rm.baseBehaviour">
|
||||
<property name="identifierService" ref="recordsManagementIdentifierService"/>
|
||||
<property name="recordService" ref="RecordService" />
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="rma.filePlan" class="org.alfresco.module.org_alfresco_module_rm.model.rma.type.FilePlanType" parent="rm.baseBehaviour">
|
||||
<property name="identifierService" ref="recordsManagementIdentifierService"/>
|
||||
<property name="filePlanService" ref="FilePlanService" />
|
||||
<property name="recordFolderService" ref="RecordFolderService" />
|
||||
<property name="filePlanRoleService" ref="FilePlanRoleService" />
|
||||
<property name="filePlanService" ref="FilePlanService" />
|
||||
<property name="recordFolderService" ref="RecordFolderService" />
|
||||
<property name="filePlanRoleService" ref="FilePlanRoleService" />
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="rma.recordCategory" class="org.alfresco.module.org_alfresco_module_rm.model.rma.type.RecordCategoryType" parent="rm.baseBehaviour">
|
||||
<property name="vitalRecordService" ref="VitalRecordService" />
|
||||
<property name="filePlanPermissionService" ref="FilePlanPermissionService" />
|
||||
<property name="recordFolderService" ref="RecordFolderService" />
|
||||
<property name="vitalRecordService" ref="VitalRecordService" />
|
||||
<property name="filePlanPermissionService" ref="FilePlanPermissionService" />
|
||||
<property name="recordFolderService" ref="RecordFolderService" />
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="rma.recordFolder" class="org.alfresco.module.org_alfresco_module_rm.model.rma.type.RecordFolderType" parent="rm.baseBehaviour">
|
||||
<property name="recordService" ref="RecordService" />
|
||||
<property name="recordFolderService" ref="RecordFolderService" />
|
||||
<property name="dispositionService" ref="DispositionService" />
|
||||
<property name="vitalRecordService" ref="VitalRecordService" />
|
||||
<property name="recordService" ref="RecordService" />
|
||||
<property name="recordFolderService" ref="RecordFolderService" />
|
||||
<property name="dispositionService" ref="DispositionService" />
|
||||
<property name="vitalRecordService" ref="VitalRecordService" />
|
||||
</bean>
|
||||
|
||||
<bean id="rma.dispositionActionDefinition" class="org.alfresco.module.org_alfresco_module_rm.model.rma.type.DispositionActionDefinitionType" parent="rm.baseBehaviour">
|
||||
@@ -89,51 +90,51 @@
|
||||
<property name="recordsManagementSearchService" ref="RecordsManagementSearchService" />
|
||||
<property name="capabilityService" ref="CapabilityService" />
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- rma model aspects -->
|
||||
|
||||
|
||||
<bean id="rma.filePlanComponent" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.FilePlanComponentAspect" parent="rm.baseBehaviour">
|
||||
<property name="scriptService" ref="ScriptService" />
|
||||
<property name="namespaceService" ref="NamespaceService" />
|
||||
<property name="filePlanService" ref="FilePlanService" />
|
||||
<property name="scriptService" ref="ScriptService" />
|
||||
<property name="namespaceService" ref="NamespaceService" />
|
||||
<property name="filePlanService" ref="FilePlanService" />
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="rma.record" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.RecordAspect" parent="rm.baseBehaviour">
|
||||
<property name="scriptService" ref="ScriptService" />
|
||||
<property name="extendedSecurityService" ref="ExtendedSecurityService" />
|
||||
<property name="recordService" ref="RecordService" />
|
||||
<property name="scriptService" ref="ScriptService" />
|
||||
<property name="extendedSecurityService" ref="ExtendedSecurityService" />
|
||||
<property name="recordService" ref="RecordService" />
|
||||
</bean>
|
||||
|
||||
<bean id="rma.recordComponentIdentifier" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.RecordComponentIdentifierAspect" parent="rm.baseBehaviour">
|
||||
|
||||
<bean id="rma.recordComponentIdentifier" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.RecordComponentIdentifierAspect" parent="rm.baseBehaviour">
|
||||
<property name="attributeService" ref="attributeService"/>
|
||||
<property name="filePlanService" ref="FilePlanService" />
|
||||
<property name="identifierService" ref="recordsManagementIdentifierService"/>
|
||||
<property name="identifierService" ref="recordsManagementIdentifierService"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="rma.scheduled" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.ScheduledAspect" parent="rm.baseBehaviour">
|
||||
<property name="dispositionService" ref="dispositionService"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="rma.dispositionLifecycle" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.DispositionLifecycleAspect" parent="rm.baseBehaviour">
|
||||
<property name="dispositionService" ref="DispositionService"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="rma.recordSearch" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.RecordSearchAspect" parent="rm.baseBehaviour">
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="rma.vitalRecord" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.VitalRecordAspect" parent="rm.baseBehaviour">
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="rma.freeze" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.FrozenAspect" parent="rm.baseBehaviour">
|
||||
<property name="filePlanService" ref="FilePlanService" />
|
||||
<property name="freezeService" ref="FreezeService" />
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="rma.vitalRecordDefinition" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.VitalRecordDefinitionAspect" parent="rm.baseBehaviour">
|
||||
<property name="recordsManagementActionService" ref="RecordsManagementActionService"/>
|
||||
<property name="filePlanAuthenticationService" ref="FilePlanAuthenticationService" />
|
||||
<property name="filePlanAuthenticationService" ref="FilePlanAuthenticationService" />
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="rma.extendedSecurity" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.ExtendedSecurityAspect" parent="rm.baseBehaviour">
|
||||
<property name="extendedSecurityService" ref="ExtendedSecurityService"/>
|
||||
</bean>
|
||||
|
@@ -1240,6 +1240,7 @@
|
||||
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.getRecords=RM.Read.0,AFTER_RM.FilterNode
|
||||
org.alfresco.module.org_alfresco_module_rm.record.RecordService.makeRecord=RM_ALLOW
|
||||
org.alfresco.module.org_alfresco_module_rm.record.RecordService.*=RM_DENY
|
||||
]]>
|
||||
</value>
|
||||
@@ -1383,8 +1384,8 @@
|
||||
<property name="recordsManagementAdminService" ref = "recordsManagementAdminService"/>
|
||||
</bean>
|
||||
|
||||
<bean id="caveatConfigComponent"
|
||||
class="org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigComponentImpl"
|
||||
<bean id="caveatConfigComponent"
|
||||
class="org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigComponentImpl"
|
||||
depends-on="org_alfresco_module_rm_dictionaryBootstrap">
|
||||
<property name="contentService" ref="contentService"/>
|
||||
<property name="dictionaryService" ref="dictionaryService"/>
|
||||
|
@@ -317,6 +317,7 @@
|
||||
<property name="kinds">
|
||||
<set>
|
||||
<value>RECORD_FOLDER</value>
|
||||
<value>UNFILED_RECORD_CONTAINER</value>
|
||||
</set>
|
||||
</property>
|
||||
<property name="capability" value ="FileRecords"/>
|
||||
@@ -573,6 +574,7 @@
|
||||
<property name="kinds">
|
||||
<set>
|
||||
<value>RECORD_CATEGORY</value>
|
||||
<value>UNFILED_RECORD_CONTAINER</value>
|
||||
</set>
|
||||
</property>
|
||||
<property name="capability" value ="CreateModifyDestroyFolders"/>
|
||||
|
@@ -165,7 +165,14 @@ Filters.getFilterParams = function RecordsManagementFilter_getFilterParams(filte
|
||||
|
||||
case "unfiledRecords":
|
||||
filterParams.variablePath = false;
|
||||
filterParams.query = "";
|
||||
if (filterData == null)
|
||||
{
|
||||
filterParams.query = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
filterParams.query = "+PARENT:\"" + filterData + "\"";
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@@ -27,6 +27,7 @@ import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind
|
||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.security.AccessStatus;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
@@ -155,6 +156,9 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
|
||||
rmNodeValues.put("type", useShortQName ? type.toPrefixString(namespaceService) : type.toString());
|
||||
}
|
||||
|
||||
// Find out if it is an unfiled record container child
|
||||
rmNodeValues.put("isUnfileRecordContainerChild", isUnfileRecordContainerChild(nodeRef));
|
||||
|
||||
// Set the indicators array
|
||||
setIndicators(rmNodeValues, nodeRef);
|
||||
|
||||
@@ -164,6 +168,25 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
|
||||
return rmNodeValues;
|
||||
}
|
||||
|
||||
private boolean isUnfileRecordContainerChild(NodeRef nodeRef)
|
||||
{
|
||||
boolean isUnfileRecordContainerChild = false;
|
||||
|
||||
List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(nodeRef);
|
||||
if (parentAssocs.size() == 1)
|
||||
{
|
||||
NodeRef parentNodeRef = parentAssocs.iterator().next().getParentRef();
|
||||
FilePlanComponentKind filePlanComponentKind = filePlanService.getFilePlanComponentKind(parentNodeRef);
|
||||
|
||||
if (filePlanComponentKind != null && filePlanComponentKind.equals(FilePlanComponentKind.RECORD_CATEGORY) == false)
|
||||
{
|
||||
isUnfileRecordContainerChild = true;
|
||||
}
|
||||
}
|
||||
|
||||
return isUnfileRecordContainerChild;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void setIndicators(JSONObject rmNodeValues, NodeRef nodeRef)
|
||||
{
|
||||
|
@@ -22,7 +22,6 @@ import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour;
|
||||
@@ -47,7 +46,7 @@ import org.apache.commons.lang.ArrayUtils;
|
||||
|
||||
/**
|
||||
* rma:recordFolder behaviour bean
|
||||
*
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.2
|
||||
*/
|
||||
@@ -58,27 +57,27 @@ import org.apache.commons.lang.ArrayUtils;
|
||||
public class RecordFolderType extends BaseBehaviourBean
|
||||
implements NodeServicePolicies.OnMoveNodePolicy,
|
||||
NodeServicePolicies.OnCreateChildAssociationPolicy
|
||||
{
|
||||
{
|
||||
/** unwanted aspects */
|
||||
private QName[] unwantedAspects =
|
||||
private QName[] unwantedAspects =
|
||||
{
|
||||
ASPECT_VITAL_RECORD,
|
||||
ASPECT_DISPOSITION_LIFECYCLE,
|
||||
ASPECT_VITAL_RECORD,
|
||||
ASPECT_DISPOSITION_LIFECYCLE,
|
||||
RecordsManagementSearchBehaviour.ASPECT_RM_SEARCH
|
||||
};
|
||||
|
||||
|
||||
/** record service */
|
||||
private RecordService recordService;
|
||||
|
||||
|
||||
/** record folder service */
|
||||
private RecordFolderService recordFolderService;
|
||||
|
||||
|
||||
/** disposition service */
|
||||
private DispositionService dispositionService;
|
||||
|
||||
|
||||
/** vital record service */
|
||||
protected VitalRecordService vitalRecordService;
|
||||
|
||||
|
||||
/**
|
||||
* @param recordService record service
|
||||
*/
|
||||
@@ -86,7 +85,7 @@ public class RecordFolderType extends BaseBehaviourBean
|
||||
{
|
||||
this.recordService = recordService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param recordFolderService record folder service
|
||||
*/
|
||||
@@ -94,7 +93,7 @@ public class RecordFolderType extends BaseBehaviourBean
|
||||
{
|
||||
this.recordFolderService = recordFolderService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param dispositionService disposition service
|
||||
*/
|
||||
@@ -102,7 +101,7 @@ public class RecordFolderType extends BaseBehaviourBean
|
||||
{
|
||||
this.dispositionService = dispositionService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param vitalRecordService vital record service
|
||||
*/
|
||||
@@ -110,10 +109,10 @@ public class RecordFolderType extends BaseBehaviourBean
|
||||
{
|
||||
this.vitalRecordService = vitalRecordService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Record folder move behaviour
|
||||
*
|
||||
*
|
||||
* @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef)
|
||||
*/
|
||||
@Override
|
||||
@@ -172,7 +171,7 @@ public class RecordFolderType extends BaseBehaviourBean
|
||||
throw new UnsupportedOperationException("Cannot move record folder into another record folder.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Record folder copy callback
|
||||
*/
|
||||
@@ -216,7 +215,7 @@ public class RecordFolderType extends BaseBehaviourBean
|
||||
result = false;
|
||||
}
|
||||
else if (ArrayUtils.contains(unwantedAspects, classQName) == true)
|
||||
{
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
||||
@@ -224,7 +223,7 @@ public class RecordFolderType extends BaseBehaviourBean
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean)
|
||||
*/
|
||||
@@ -239,12 +238,6 @@ public class RecordFolderType extends BaseBehaviourBean
|
||||
NodeRef nodeRef = childAssocRef.getChildRef();
|
||||
if (nodeService.exists(nodeRef) == true)
|
||||
{
|
||||
// ensure folders are never added to a record folder
|
||||
if (instanceOf(nodeRef, ContentModel.TYPE_FOLDER) == true)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("You can't create a folder within an exisiting record folder.");
|
||||
}
|
||||
|
||||
// ensure nothing is being added to a closed record folder
|
||||
NodeRef recordFolder = childAssocRef.getParentRef();
|
||||
Boolean isClosed = (Boolean) nodeService.getProperty(recordFolder, PROP_IS_CLOSED);
|
||||
@@ -254,10 +247,10 @@ public class RecordFolderType extends BaseBehaviourBean
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* On transaction commit
|
||||
*
|
||||
*
|
||||
* @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean)
|
||||
*/
|
||||
@Behaviour
|
||||
@@ -269,7 +262,7 @@ public class RecordFolderType extends BaseBehaviourBean
|
||||
public void onCreateChildAssociationOnCommit(ChildAssociationRef childAssocRef, boolean bNew)
|
||||
{
|
||||
final NodeRef recordFolder = childAssocRef.getChildRef();
|
||||
|
||||
|
||||
behaviourFilter.disableBehaviour();
|
||||
try
|
||||
{
|
||||
@@ -288,9 +281,9 @@ public class RecordFolderType extends BaseBehaviourBean
|
||||
finally
|
||||
{
|
||||
behaviourFilter.enableBehaviour();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes unwanted aspects
|
||||
*
|
||||
|
@@ -22,6 +22,7 @@ import org.alfresco.model.ContentModel;
|
||||
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.RecordsManagementModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||
import org.alfresco.repo.node.NodeServicePolicies;
|
||||
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
||||
import org.alfresco.repo.policy.annotation.Behaviour;
|
||||
@@ -35,7 +36,7 @@ import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* rma:recordsManagementContainer behaviour bean.
|
||||
*
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.2
|
||||
*/
|
||||
@@ -48,7 +49,10 @@ public class RecordsManagementContainerType extends BaseBehaviourBean
|
||||
{
|
||||
/** identifier service */
|
||||
protected IdentifierService identifierService;
|
||||
|
||||
|
||||
/** record service */
|
||||
protected RecordService recordService;
|
||||
|
||||
/**
|
||||
* @param identifierService identifier service
|
||||
*/
|
||||
@@ -56,7 +60,15 @@ public class RecordsManagementContainerType extends BaseBehaviourBean
|
||||
{
|
||||
this.identifierService = identifierService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param recordService record service
|
||||
*/
|
||||
public void setRecordService(RecordService recordService)
|
||||
{
|
||||
this.recordService = recordService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.model.BaseTypeBehaviour#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean)
|
||||
*/
|
||||
@@ -66,7 +78,7 @@ public class RecordsManagementContainerType extends BaseBehaviourBean
|
||||
notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
|
||||
)
|
||||
public void onCreateChildAssociation(final ChildAssociationRef childAssocRef, boolean isNewNode)
|
||||
{
|
||||
{
|
||||
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
||||
{
|
||||
@Override
|
||||
@@ -77,53 +89,71 @@ public class RecordsManagementContainerType extends BaseBehaviourBean
|
||||
if (nodeService.exists(child) == true)
|
||||
{
|
||||
QName childType = nodeService.getType(child);
|
||||
|
||||
|
||||
// We only care about "folder" or sub-types
|
||||
if (dictionaryService.isSubClass(childType, ContentModel.TYPE_FOLDER) == true)
|
||||
{
|
||||
{
|
||||
if (dictionaryService.isSubClass(childType, ContentModel.TYPE_SYSTEM_FOLDER) == true)
|
||||
{
|
||||
// this is a rule container, make sure it is an file plan component
|
||||
nodeService.addAspect(child, ASPECT_FILE_PLAN_COMPONENT, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
// We need to automatically cast the created folder to RM type if it is a plain folder
|
||||
// This occurs if the RM folder has been created via IMap, WebDav, etc
|
||||
if (nodeService.hasAspect(child, ASPECT_FILE_PLAN_COMPONENT) == false)
|
||||
{
|
||||
// TODO it may not always be a record folder ... perhaps if the current user is a admin it would be a record category??
|
||||
|
||||
{
|
||||
// TODO it may not always be a record folder ... perhaps if the current user is a admin it would be a record category??
|
||||
|
||||
// Assume any created folder is a rma:recordFolder
|
||||
nodeService.setType(child, TYPE_RECORD_FOLDER);
|
||||
}
|
||||
|
||||
nodeService.setType(child, TYPE_RECORD_FOLDER);
|
||||
}
|
||||
|
||||
// Catch all to generate the rm id (assuming it doesn't already have one!)
|
||||
setIdenifierProperty(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NodeRef parentRef = childAssocRef.getParentRef();
|
||||
QName parentType = nodeService.getType(parentRef);
|
||||
boolean isContentSubType = dictionaryService.isSubClass(childType, ContentModel.TYPE_CONTENT);
|
||||
boolean isUnfiledRecordContainerSubType = dictionaryService.isSubClass(parentType, RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER);
|
||||
if (isContentSubType == true && isUnfiledRecordContainerSubType == true)
|
||||
{
|
||||
if (nodeService.hasAspect(child, ASPECT_FILE_PLAN_COMPONENT) == false)
|
||||
{
|
||||
nodeService.addAspect(child, ASPECT_FILE_PLAN_COMPONENT, null);
|
||||
}
|
||||
if (nodeService.hasAspect(child, ASPECT_RECORD) == false)
|
||||
{
|
||||
recordService.makeRecord(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param nodeRef
|
||||
*/
|
||||
protected void setIdenifierProperty(final NodeRef nodeRef)
|
||||
{
|
||||
AuthenticationUtil.runAsSystem(new RunAsWork<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
public Object doWork() throws Exception
|
||||
{
|
||||
if (nodeService.hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT) == true &&
|
||||
if (nodeService.hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT) == true &&
|
||||
nodeService.getProperty(nodeRef, PROP_IDENTIFIER) == null)
|
||||
{
|
||||
String id = identifierService.generateIdentifier(nodeRef);
|
||||
String id = identifierService.generateIdentifier(nodeRef);
|
||||
nodeService.setProperty(nodeRef, RecordsManagementModel.PROP_IDENTIFIER, id);
|
||||
}
|
||||
return null;
|
||||
|
@@ -161,4 +161,11 @@ public interface RecordService
|
||||
* @param typeQName Type to add
|
||||
*/
|
||||
void addRecordType(NodeRef nodeRef, QName typeQName);
|
||||
|
||||
/**
|
||||
* Creates a record from the given document
|
||||
*
|
||||
* @param nodeRef The document node reference from which a record will be created
|
||||
*/
|
||||
void makeRecord(NodeRef nodeRef);
|
||||
}
|
||||
|
@@ -196,7 +196,7 @@ public class RecordServiceImpl implements RecordService,
|
||||
|
||||
/** Permission service */
|
||||
private PermissionService permissionService;
|
||||
|
||||
|
||||
/** Record aspect */
|
||||
private RecordAspect recordAspect;
|
||||
|
||||
@@ -348,7 +348,7 @@ public class RecordServiceImpl implements RecordService,
|
||||
{
|
||||
this.permissionService = permissionService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param recordAspect record aspect
|
||||
*/
|
||||
@@ -367,7 +367,7 @@ public class RecordServiceImpl implements RecordService,
|
||||
TYPE_RECORD_FOLDER,
|
||||
ContentModel.ASSOC_CONTAINS,
|
||||
onCreateChildAssociation);
|
||||
|
||||
|
||||
policyComponent.bindAssociationBehaviour(
|
||||
NodeServicePolicies.BeforeDeleteChildAssociationPolicy.QNAME,
|
||||
ContentModel.TYPE_FOLDER,
|
||||
@@ -426,44 +426,44 @@ public class RecordServiceImpl implements RecordService,
|
||||
* Helper method to switch the name of the record around. Used to support record creation via
|
||||
* file protocols.
|
||||
*
|
||||
* @param nodeRef node reference (record)
|
||||
* @param nodeRef node reference (record)
|
||||
*/
|
||||
private void switchNames(NodeRef nodeRef)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (nodeService.hasAspect(nodeRef, ASPECT_RECORD) == true)
|
||||
{
|
||||
String origionalName = (String)nodeService.getProperty(nodeRef, PROP_ORIGIONAL_NAME);
|
||||
if (origionalName != null)
|
||||
{
|
||||
String name = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
|
||||
fileFolderService.rename(nodeRef, origionalName);
|
||||
nodeService.setProperty(nodeRef, PROP_ORIGIONAL_NAME, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (FileExistsException e)
|
||||
{
|
||||
if (logger.isDebugEnabled() == true)
|
||||
{
|
||||
logger.debug(e.getMessage());
|
||||
}
|
||||
}
|
||||
catch (InvalidNodeRefException e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (nodeService.hasAspect(nodeRef, ASPECT_RECORD) == true)
|
||||
{
|
||||
String origionalName = (String)nodeService.getProperty(nodeRef, PROP_ORIGIONAL_NAME);
|
||||
if (origionalName != null)
|
||||
{
|
||||
String name = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
|
||||
fileFolderService.rename(nodeRef, origionalName);
|
||||
nodeService.setProperty(nodeRef, PROP_ORIGIONAL_NAME, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (FileExistsException e)
|
||||
{
|
||||
if (logger.isDebugEnabled() == true)
|
||||
{
|
||||
logger.debug(e.getMessage());
|
||||
}
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
}
|
||||
catch (InvalidNodeRefException e)
|
||||
{
|
||||
if (logger.isDebugEnabled() == true)
|
||||
{
|
||||
logger.debug(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
if (logger.isDebugEnabled() == true)
|
||||
{
|
||||
logger.debug(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -774,12 +774,15 @@ public class RecordServiceImpl implements RecordService,
|
||||
*
|
||||
* @param document the document from which a record will be created
|
||||
*/
|
||||
private void makeRecord(NodeRef document)
|
||||
@Override
|
||||
public void makeRecord(NodeRef document)
|
||||
{
|
||||
ParameterCheck.mandatory("document", document);
|
||||
|
||||
ruleService.disableRules();
|
||||
try
|
||||
{
|
||||
// get the record id
|
||||
// get the record id
|
||||
String recordId = identifierService.generateIdentifier(ASPECT_RECORD,
|
||||
nodeService.getPrimaryParent(document).getParentRef());
|
||||
|
||||
|
Reference in New Issue
Block a user