mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Issues found during demo prep.
* a couple of checks for type wheren't doing sub-type of cm:content checks * could not view a held record in-place git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@69667 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
<property name="recordService" ref="RecordService"/>
|
<property name="recordService" ref="RecordService"/>
|
||||||
<property name="filePlanService" ref="FilePlanService"/>
|
<property name="filePlanService" ref="FilePlanService"/>
|
||||||
<property name="capabilityService" ref="CapabilityService"/>
|
<property name="capabilityService" ref="CapabilityService"/>
|
||||||
|
<property name="dictionaryService" ref="DictionaryService" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- extends core bean with RM extensions -->
|
<!-- extends core bean with RM extensions -->
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package org.alfresco.module.org_alfresco_module_rm.action.constraint;
|
package org.alfresco.module.org_alfresco_module_rm.action.constraint;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -27,6 +28,8 @@ 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.repo.action.constraint.BaseParameterConstraint;
|
import org.alfresco.repo.action.constraint.BaseParameterConstraint;
|
||||||
import org.alfresco.repo.i18n.StaticMessageLookup;
|
import org.alfresco.repo.i18n.StaticMessageLookup;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||||
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -81,24 +84,35 @@ public class RecordTypeParameterConstraint extends BaseParameterConstraint
|
|||||||
*/
|
*/
|
||||||
protected Map<String, String> getAllowableValuesImpl()
|
protected Map<String, String> getAllowableValuesImpl()
|
||||||
{
|
{
|
||||||
// get the file plan
|
return AuthenticationUtil.runAsSystem(new RunAsWork<Map<String, String>>()
|
||||||
// TODO we will likely have to re-implement as a custom control so that context of the file
|
|
||||||
// plan can be correctly determined when setting the rule up
|
|
||||||
NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
|
|
||||||
|
|
||||||
Set<QName> recordTypes = recordService.getRecordMetadataAspects(filePlan);
|
|
||||||
|
|
||||||
Map<String, String> result = new HashMap<String, String>(recordTypes.size());
|
|
||||||
for (QName recordType : recordTypes)
|
|
||||||
{
|
{
|
||||||
AspectDefinition aspectDefinition = dictionaryService.getAspect(recordType);
|
@SuppressWarnings("unchecked")
|
||||||
if (aspectDefinition != null)
|
public Map<String, String> doWork() throws Exception
|
||||||
{
|
{
|
||||||
result.put(aspectDefinition.getName().getLocalName(), aspectDefinition.getTitle(new StaticMessageLookup()));
|
Map<String, String> result = Collections.EMPTY_MAP;
|
||||||
|
|
||||||
|
// get the file plan
|
||||||
|
// TODO we will likely have to re-implement as a custom control so that context of the file
|
||||||
|
// plan can be correctly determined when setting the rule up
|
||||||
|
NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
|
||||||
|
|
||||||
|
if (filePlan != null)
|
||||||
|
{
|
||||||
|
Set<QName> recordTypes = recordService.getRecordMetadataAspects(filePlan);
|
||||||
|
|
||||||
|
result = new HashMap<String, String>(recordTypes.size());
|
||||||
|
for (QName recordType : recordTypes)
|
||||||
|
{
|
||||||
|
AspectDefinition aspectDefinition = dictionaryService.getAspect(recordType);
|
||||||
|
if (aspectDefinition != null)
|
||||||
|
{
|
||||||
|
result.put(aspectDefinition.getName().getLocalName(), aspectDefinition.getTitle(new StaticMessageLookup()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -279,7 +279,7 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr
|
|||||||
if(create)
|
if(create)
|
||||||
{
|
{
|
||||||
creating = true;
|
creating = true;
|
||||||
boolean lastAsFolder = lastPathElement && (ContentModel.TYPE_CONTENT.equals(nodeService.getType(actionedUponNodeRef)) || RecordsManagementModel.TYPE_NON_ELECTRONIC_DOCUMENT.equals(nodeService.getType(actionedUponNodeRef)));
|
boolean lastAsFolder = lastPathElement && (dictionaryService.isSubClass(nodeService.getType(actionedUponNodeRef), ContentModel.TYPE_CONTENT) || RecordsManagementModel.TYPE_NON_ELECTRONIC_DOCUMENT.equals(nodeService.getType(actionedUponNodeRef)));
|
||||||
nodeRef = createChild(action, parent, childName, targetisUnfiledRecords, lastAsFolder);
|
nodeRef = createChild(action, parent, childName, targetisUnfiledRecords, lastAsFolder);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -26,7 +26,9 @@ import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
|
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.fileplan.FilePlanService;
|
||||||
|
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.RecordService;
|
||||||
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
import org.alfresco.service.cmr.model.FileInfo;
|
import org.alfresco.service.cmr.model.FileInfo;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -53,6 +55,9 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
|
|||||||
/** Capability service */
|
/** Capability service */
|
||||||
private CapabilityService capabilityService;
|
private CapabilityService capabilityService;
|
||||||
|
|
||||||
|
/** dictionary service */
|
||||||
|
private DictionaryService dictionaryService;
|
||||||
|
|
||||||
/** Indicators */
|
/** Indicators */
|
||||||
private List<BaseEvaluator> indicators = new ArrayList<BaseEvaluator>();
|
private List<BaseEvaluator> indicators = new ArrayList<BaseEvaluator>();
|
||||||
|
|
||||||
@@ -83,6 +88,14 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
|
|||||||
this.capabilityService = capabilityService;
|
this.capabilityService = capabilityService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dictionaryService dictionary service
|
||||||
|
*/
|
||||||
|
public void setDictionaryService(DictionaryService dictionaryService)
|
||||||
|
{
|
||||||
|
this.dictionaryService = dictionaryService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param indicator registered indicator
|
* @param indicator registered indicator
|
||||||
*/
|
*/
|
||||||
@@ -107,35 +120,44 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
|
|||||||
@Override
|
@Override
|
||||||
protected void setRootValues(FileInfo nodeInfo, JSONObject rootJSONObject, boolean useShortQNames)
|
protected void setRootValues(FileInfo nodeInfo, JSONObject rootJSONObject, boolean useShortQNames)
|
||||||
{
|
{
|
||||||
// Set the base root values
|
if (nodeInfo != null)
|
||||||
super.setRootValues(nodeInfo, rootJSONObject, useShortQNames);
|
|
||||||
|
|
||||||
// Get the node reference for convenience
|
|
||||||
NodeRef nodeRef = nodeInfo.getNodeRef();
|
|
||||||
|
|
||||||
if (AccessStatus.ALLOWED.equals(capabilityService.getCapabilityAccessState(nodeRef,
|
|
||||||
RMPermissionModel.VIEW_RECORDS)))
|
|
||||||
{
|
{
|
||||||
// Indicate whether the node is a RM object or not
|
// Set the base root values
|
||||||
boolean isFilePlanComponent = filePlanService.isFilePlanComponent(nodeInfo.getNodeRef());
|
super.setRootValues(nodeInfo, rootJSONObject, useShortQNames);
|
||||||
rootJSONObject.put("isRmNode", isFilePlanComponent);
|
|
||||||
|
|
||||||
if (isFilePlanComponent)
|
// Get the node reference for convenience
|
||||||
|
NodeRef nodeRef = nodeInfo.getNodeRef();
|
||||||
|
|
||||||
|
if (AccessStatus.ALLOWED.equals(capabilityService.getCapabilityAccessState(nodeRef,
|
||||||
|
RMPermissionModel.VIEW_RECORDS)))
|
||||||
{
|
{
|
||||||
rootJSONObject.put("rmNode", setRmNodeValues(nodeRef, useShortQNames));
|
// Indicate whether the node is a RM object or not
|
||||||
|
boolean isFilePlanComponent = filePlanService.isFilePlanComponent(nodeInfo.getNodeRef());
|
||||||
|
rootJSONObject.put("isRmNode", isFilePlanComponent);
|
||||||
|
|
||||||
// FIXME: Is this the right place to add the information?
|
if (isFilePlanComponent)
|
||||||
addInfo(nodeInfo, rootJSONObject);
|
{
|
||||||
|
rootJSONObject.put("rmNode", setRmNodeValues(nodeRef, useShortQNames));
|
||||||
|
|
||||||
|
// FIXME: Is this the right place to add the information?
|
||||||
|
addInfo(nodeInfo, rootJSONObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to add information about node
|
||||||
|
*
|
||||||
|
* @param nodeInfo node information
|
||||||
|
* @param rootJSONObject root JSON object
|
||||||
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private void addInfo(FileInfo nodeInfo, JSONObject rootJSONObject)
|
private void addInfo(FileInfo nodeInfo, JSONObject rootJSONObject)
|
||||||
{
|
{
|
||||||
String itemType = (String) rootJSONObject.get("type");
|
String itemType = (String) rootJSONObject.get("type");
|
||||||
String typeContent = ContentModel.TYPE_CONTENT.toPrefixString(namespaceService);
|
QName itemTypeQName = QName.createQName(itemType, namespaceService);
|
||||||
if (itemType.equals(typeContent))
|
if (dictionaryService.isSubClass(itemTypeQName, ContentModel.TYPE_CONTENT))
|
||||||
{
|
{
|
||||||
NodeRef nodeRef = nodeInfo.getNodeRef();
|
NodeRef nodeRef = nodeInfo.getNodeRef();
|
||||||
List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(nodeRef);
|
List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(nodeRef);
|
||||||
@@ -147,7 +169,15 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
|
|||||||
if (!parent.isPrimary())
|
if (!parent.isPrimary())
|
||||||
{
|
{
|
||||||
originatingLocation = parent.getParentRef();
|
originatingLocation = parent.getParentRef();
|
||||||
break;
|
|
||||||
|
// only consider the non-RM parent otherwise we can
|
||||||
|
// run into issues with frozen or transferring records
|
||||||
|
if (!nodeService.hasAspect(originatingLocation, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT))
|
||||||
|
{
|
||||||
|
// assume we have found the correct in-place location
|
||||||
|
// FIXME when we support multiple in-place locations
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user