From 54b89a0973696510f061eb442fbc6eb85983e9b9 Mon Sep 17 00:00:00 2001
From: Tuna Aksoy
Date: Mon, 15 Apr 2013 20:49:23 +0000
Subject: [PATCH] RM dependency upgrade (4.2.d)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@49264 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
---
.../org_alfresco_module_rm/module-context.xml | 1 +
.../org_alfresco_module_rm/module.properties | 2 +-
.../rm-service-context.xml | 7 +-
.../rm-webscript-context.xml | 7 +-
.../RecordsManagementAdminServiceImpl.java | 510 +++++++++---------
.../action/impl/SplitEmailAction.java | 72 +--
.../RecordsManagementAuditServiceImpl.java | 4 +-
.../email/RFC822MetadataExtracter.java | 22 +-
.../forms/RecordsManagementFormFilter.java | 40 +-
.../RecordsManagementNodeFormFilter.java | 104 ++--
.../RecordsManagementTypeFormFilter.java | 26 +-
.../jscript/app/JSONConversionComponent.java | 4 +-
.../RecordsManagementNotificationHelper.java | 8 +-
.../script/CustomReferenceDefinitionsGet.java | 31 +-
.../script/CustomRefsGet.java | 53 +-
.../script/CustomisableGet.java | 44 +-
.../script/DispositionPropertiesGet.java | 32 +-
.../script/ListOfValuesGet.java | 78 +--
.../script/RecordMetaDataAspectsGet.java | 28 +-
.../slingshot/RMSearchPropertiesGet.java | 60 +--
.../web/scripts/dictionary/RmClassesGet.java | 2 +-
.../scripts/dictionary/RmPropertiesGet.java | 2 +-
...RecordsManagementAdminServiceImplTest.java | 488 ++++++++---------
23 files changed, 833 insertions(+), 792 deletions(-)
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/module-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/module-context.xml
index 97cf25064a..f63f430006 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/module-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/module-context.xml
@@ -199,6 +199,7 @@
+
-
+
@@ -1158,9 +1158,9 @@
-
+
-
+
@@ -1399,6 +1399,7 @@
+
diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml
index 2d7ae00b0a..463660be58 100644
--- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml
+++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml
@@ -68,6 +68,7 @@
class="org.alfresco.module.org_alfresco_module_rm.script.CustomReferenceDefinitionsGet"
parent="webscript">
+
@@ -89,6 +90,7 @@
class="org.alfresco.module.org_alfresco_module_rm.script.CustomRefsGet"
parent="rmBaseWebscript">
+
@@ -155,6 +157,7 @@
parent="webscript">
+
@@ -514,7 +517,7 @@
-
+
@@ -522,7 +525,7 @@
class="org.alfresco.repo.web.scripts.rule.RmActionConditionDefinitionsGet"
parent="webscript">
-
+
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementAdminServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementAdminServiceImpl.java
index e7c116d913..d673513bd5 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementAdminServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/RecordsManagementAdminServiceImpl.java
@@ -87,10 +87,10 @@ import org.springframework.extensions.surf.util.URLDecoder;
/**
* Records Management AdminService Implementation.
- *
+ *
* @author Neil McErlean, janv
*/
-public class RecordsManagementAdminServiceImpl implements RecordsManagementAdminService,
+public class RecordsManagementAdminServiceImpl implements RecordsManagementAdminService,
RecordsManagementCustomModel,
NodeServicePolicies.OnAddAspectPolicy,
NodeServicePolicies.OnRemoveAspectPolicy,
@@ -98,7 +98,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
{
/** Logger */
private static Log logger = LogFactory.getLog(RecordsManagementAdminServiceImpl.class);
-
+
/** I18N messages*/
private static final String MSG_SERVICE_NOT_INIT = "rm.admin.service-not-init";
private static final String MSG_PROP_EXIST = "rm.admin.prop-exist";
@@ -117,26 +117,26 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
private static final String MSG_ERROR_WRITE_CUSTOM_MODEL = "rm.admin.error-write-custom-model";
private static final String MSG_ERROR_CLIENT_ID = "rm.admin.error-client-id";
private static final String MSG_ERROR_SPLIT_ID = "rm.admin.error-split-id";
-
+
/** Constants */
- public static final String RMC_CUSTOM_ASSOCS = RecordsManagementCustomModel.RM_CUSTOM_PREFIX + ":customAssocs";
- private static final String CUSTOM_CONSTRAINT_TYPE = org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.class.getName();
- private static final NodeRef RM_CUSTOM_MODEL_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "records_management_custom_model");
+ public static final String RMC_CUSTOM_ASSOCS = RecordsManagementCustomModel.RM_CUSTOM_PREFIX + ":customAssocs";
+ private static final String CUSTOM_CONSTRAINT_TYPE = org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.class.getName();
+ private static final NodeRef RM_CUSTOM_MODEL_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "records_management_custom_model");
private static final String PARAM_ALLOWED_VALUES = "allowedValues";
private static final String PARAM_CASE_SENSITIVE = "caseSensitive";
- private static final String PARAM_MATCH_LOGIC = "matchLogic";
- public static final String RMA_RECORD = "rma:record";
+ private static final String PARAM_MATCH_LOGIC = "matchLogic";
+ public static final String RMA_RECORD = "rma:record";
private static final String SOURCE_TARGET_ID_SEPARATOR = "__";
-
+
/** Dictionary service */
private DictionaryService dictionaryService;
-
- /** Namespace service */
+
+ /** Namespace service */
private NamespaceService namespaceService;
-
+
/** Node service */
private NodeService nodeService;
-
+
/** Content service */
private ContentService contentService;
@@ -145,17 +145,17 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
/** Policy component */
private PolicyComponent policyComponent;
-
+
/** Policy delegates */
private ClassPolicyDelegate beforeCreateReferenceDelegate;
- private ClassPolicyDelegate onCreateReferenceDelegate;
+ private ClassPolicyDelegate onCreateReferenceDelegate;
private ClassPolicyDelegate beforeRemoveReferenceDelegate;
private ClassPolicyDelegate onRemoveReferenceDelegate;
-
+
/** List of types that can be customisable */
private List pendingCustomisableTypes;
private Map customisableTypes;
-
+
/**
* @param dictionaryService the dictionary service
*/
@@ -179,7 +179,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
{
this.nodeService = nodeService;
}
-
+
/**
* @param contentService the content service
*/
@@ -187,7 +187,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
{
this.contentService = contentService;
}
-
+
/**
* @param policyComponent the policy component
*/
@@ -195,17 +195,17 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
{
this.policyComponent = policyComponent;
}
-
+
/**
* Bootstrap for standard (non-RMC) dynamic models
- *
+ *
* @param dictonaryRepositoryBootstrap dictionary repository bootstrap
*/
public void setDictionaryRepositoryBootstrap(DictionaryRepositoryBootstrap dictonaryRepositoryBootstrap)
{
this.dictonaryRepositoryBootstrap = dictonaryRepositoryBootstrap;
- }
-
+ }
+
/**
* Initialisation method
*/
@@ -217,7 +217,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
beforeRemoveReferenceDelegate = policyComponent.registerClassPolicy(BeforeRemoveReference.class);
onRemoveReferenceDelegate = policyComponent.registerClassPolicy(OnRemoveReference.class);
}
-
+
protected void invokeBeforeCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference)
{
// get qnames to invoke against
@@ -226,7 +226,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
BeforeCreateReference policy = beforeCreateReferenceDelegate.get(qnames);
policy.beforeCreateReference(fromNodeRef, toNodeRef, reference);
}
-
+
protected void invokeOnCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference)
{
// get qnames to invoke against
@@ -235,7 +235,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
OnCreateReference policy = onCreateReferenceDelegate.get(qnames);
policy.onCreateReference(fromNodeRef, toNodeRef, reference);
}
-
+
protected void invokeBeforeRemoveReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference)
{
// get qnames to invoke against
@@ -244,7 +244,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
BeforeRemoveReference policy = beforeRemoveReferenceDelegate.get(qnames);
policy.beforeRemoveReference(fromNodeRef, toNodeRef, reference);
}
-
+
protected void invokeOnRemoveReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference)
{
// get qnames to invoke against
@@ -272,7 +272,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
isCustomisable(aspectTypeQName) == true)
{
QName customPropertyAspect = getCustomAspect(aspectTypeQName);
- nodeService.removeAspect(nodeRef, customPropertyAspect);
+ nodeService.removeAspect(nodeRef, customPropertyAspect);
}
}
@@ -286,9 +286,9 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
if (isCustomisable(type) == true)
{
QName customPropertyAspect = getCustomAspect(type);
- nodeService.addAspect(nodeRef, customPropertyAspect, null);
+ nodeService.addAspect(nodeRef, customPropertyAspect, null);
}
-
+
TypeDefinition def = dictionaryService.getType(type);
if (def != null)
{
@@ -298,52 +298,52 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
{
type = null;
}
- }
+ }
}
-
+
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#initialiseCustomModel()
*/
public void initialiseCustomModel()
- {
+ {
// Bind class behaviours
policyComponent.bindClassBehaviour(
- NodeServicePolicies.OnAddAspectPolicy.QNAME,
- this,
+ NodeServicePolicies.OnAddAspectPolicy.QNAME,
+ this,
new JavaBehaviour(this, "onAddAspect", NotificationFrequency.FIRST_EVENT));
policyComponent.bindClassBehaviour(
- NodeServicePolicies.OnRemoveAspectPolicy.QNAME,
- this,
+ NodeServicePolicies.OnRemoveAspectPolicy.QNAME,
+ this,
new JavaBehaviour(this, "onRemoveAspect", NotificationFrequency.FIRST_EVENT));
policyComponent.bindClassBehaviour(
- NodeServicePolicies.OnCreateNodePolicy.QNAME,
- this,
+ NodeServicePolicies.OnCreateNodePolicy.QNAME,
+ this,
new JavaBehaviour(this, "onCreateNode", NotificationFrequency.FIRST_EVENT));
-
+
// Initialise the map
getCustomisableMap();
}
-
+
/**
* @param customisableTypes list of string representations of the type qnames that are customisable
*/
public void setCustomisableTypes(List customisableTypes)
{
pendingCustomisableTypes = new ArrayList();
- for (String customisableType : customisableTypes)
+ for (String customisableType : customisableTypes)
{
pendingCustomisableTypes.add(QName.createQName(customisableType, namespaceService));
}
}
-
+
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomisable()
*/
public Set getCustomisable()
{
- return getCustomisableMap().keySet();
+ return getCustomisableMap().keySet();
}
-
+
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#getCustomisable(org.alfresco.service.cmr.repository.NodeRef)
*/
@@ -351,7 +351,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
public Set getCustomisable(NodeRef nodeRef)
{
Set result = new HashSet(5);
-
+
// Check the nodes hierarchy for customisable types
QName type = nodeService.getType(nodeRef);
while (type != null && ContentModel.TYPE_CMOBJECT.equals(type) == false)
@@ -359,9 +359,9 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
// Add to the list if the type is customisable
if (isCustomisable(type) == true)
{
- result.add(type);
+ result.add(type);
}
-
+
// Type and get the types parent
TypeDefinition def = dictionaryService.getType(type);
if (def != null)
@@ -373,7 +373,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
type = null;
}
}
-
+
// Get all the nodes aspects
Set aspects = nodeService.getAspects(nodeRef);
for (QName aspect : aspects)
@@ -386,7 +386,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
{
result.add(tempAspect);
}
-
+
// Try and get the parent aspect
AspectDefinition aspectDef = dictionaryService.getAspect(tempAspect);
if (aspectDef != null)
@@ -399,13 +399,13 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
}
}
}
-
+
return result;
}
-
+
/**
* Gets a map containing all the customisable types
- *
+ *
* @return map from the customisable type to its custom aspect
*/
private Map getCustomisableMap()
@@ -414,14 +414,14 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
{
customisableTypes = new HashMap(7);
Collection aspects = dictionaryService.getAspects(RM_CUSTOM_MODEL);
- for (QName aspect : aspects)
+ for (QName aspect : aspects)
{
AspectDefinition aspectDef = dictionaryService.getAspect(aspect);
String name = aspectDef.getName().getLocalName();
if (name.endsWith("Properties") == true)
{
QName type = null;
- String prefixString = aspectDef.getDescription();
+ String prefixString = aspectDef.getDescription(dictionaryService);
if (prefixString == null)
{
// Backward compatibility from previous RM V1.0 custom models
@@ -432,14 +432,14 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
else if (CompatibilityModel.NAME_CUSTOM_RECORD_FOLDER_PROPERTIES.equals(name) == true)
{
type = RecordsManagementModel.TYPE_RECORD_FOLDER;
- }
+ }
else if (CompatibilityModel.NAME_CUSTOM_RECORD_CATEGORY_PROPERTIES.equals(name) == true)
{
type = RecordsManagementModel.TYPE_RECORD_CATEGORY;
}
else if (CompatibilityModel.NAME_CUSTOM_RECORD_SERIES_PROPERTIES.equals(name) == true)
{
- // Only add the deprecated record series type as customisable if
+ // Only add the deprecated record series type as customisable if
// a v1.0 installation has added custom properties
if (aspectDef.getProperties().size() != 0)
{
@@ -451,12 +451,12 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
{
type = QName.createQName(prefixString, namespaceService);
}
-
+
// Add the customisable type to the map
if (type != null)
{
customisableTypes.put(type, aspect);
-
+
// Remove customisable type from the pending list
if (pendingCustomisableTypes != null && pendingCustomisableTypes.contains(type) == true)
{
@@ -465,25 +465,25 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
}
}
}
-
+
// Deal with any pending types left over
if (pendingCustomisableTypes != null && pendingCustomisableTypes.size() != 0)
{
NodeRef modelRef = getCustomModelRef(RecordsManagementModel.RM_CUSTOM_URI);
M2Model model = readCustomContentModel(modelRef);
try
- {
- for (QName customisableType : pendingCustomisableTypes)
+ {
+ for (QName customisableType : pendingCustomisableTypes)
{
QName customAspect = getCustomAspectImpl(customisableType);
-
+
// Create the new aspect to hold the custom properties
M2Aspect aspect = model.createAspect(customAspect.toPrefixString(namespaceService));
aspect.setDescription(customisableType.toPrefixString(namespaceService));
-
- // Make a record of the customisable type
+
+ // Make a record of the customisable type
customisableTypes.put(customisableType, customAspect);
- }
+ }
}
finally
{
@@ -491,13 +491,13 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
}
}
}
- return customisableTypes;
- }
+ return customisableTypes;
+ }
/**
* Gets the QName of the custom aspect given the customisable type QName
- *
- * @param customisableType
+ *
+ * @param customisableType
* @return
*/
private QName getCustomAspect(QName customisableType)
@@ -510,10 +510,10 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
}
return result;
}
-
+
/**
* Builds a custom aspect QName from a customisable type/aspect QName
- *
+ *
* @param customisableType
* @return
*/
@@ -523,32 +523,32 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
localName = MessageFormat.format("{0}CustomProperties", localName);
return QName.createQName(RM_CUSTOM_URI, localName);
}
-
+
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#isCustomisable(org.alfresco.service.namespace.QName)
*/
@Override
- public boolean isCustomisable(QName type)
+ public boolean isCustomisable(QName type)
{
- ParameterCheck.mandatory("type", type);
+ ParameterCheck.mandatory("type", type);
return getCustomisable().contains(type);
}
-
+
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#makeCustomisable(org.alfresco.service.namespace.QName)
*/
@Override
- public void makeCustomisable(QName type)
+ public void makeCustomisable(QName type)
{
ParameterCheck.mandatory("type", type);
-
+
if (customisableTypes == null)
{
// Add the type to the pending list
pendingCustomisableTypes.add(type);
}
else
- {
+ {
QName customAspect = getCustomAspect(type);
if (dictionaryService.getAspect(customAspect) == null)
{
@@ -568,25 +568,25 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
}
}
}
-
+
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#unmakeCustomisable(org.alfresco.service.namespace.QName)
*/
@Override
- public void unmakeCustomisable(QName type)
+ public void unmakeCustomisable(QName type)
{
ParameterCheck.mandatory("type", type);
-
+
if (customisableTypes == null)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_SERVICE_NOT_INIT));
}
-
+
QName customAspect = getCustomAspect(type);
if (dictionaryService.getAspect(customAspect) != null)
{
// TODO need to confirm that the custom properties are not being used!
-
+
NodeRef modelRef = getCustomModelRef(customAspect.getNamespaceURI());
M2Model model = readCustomContentModel(modelRef);
try
@@ -606,10 +606,10 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#existsCustomProperty(org.alfresco.service.namespace.QName)
*/
@Override
- public boolean existsCustomProperty(QName propertyName)
+ public boolean existsCustomProperty(QName propertyName)
{
ParameterCheck.mandatory("propertyName", propertyName);
-
+
boolean result = false;
if (RM_CUSTOM_URI.equals(propertyName.getNamespaceURI()) == true &&
dictionaryService.getProperty(propertyName) != null)
@@ -625,7 +625,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
public Map getCustomPropertyDefinitions()
{
Map result = new HashMap();
- for (QName customisableType : getCustomisable())
+ for (QName customisableType : getCustomisable())
{
Map props = getCustomPropertyDefinitions(customisableType);
if (props != null)
@@ -651,102 +651,102 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
return propDefns;
}
-
+
/**
- * @throws CustomMetadataException
+ * @throws CustomMetadataException
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#addCustomPropertyDefinition(org.alfresco.service.namespace.QName, org.alfresco.service.namespace.QName, java.lang.String, org.alfresco.service.namespace.QName, java.lang.String, java.lang.String)
*/
public QName addCustomPropertyDefinition(QName propId, QName aspectName, String label, QName dataType, String title, String description) throws CustomMetadataException
{
return addCustomPropertyDefinition(propId, aspectName, label, dataType, title, description, null, false, false, false, null);
}
-
+
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#addCustomPropertyDefinition(org.alfresco.service.namespace.QName, org.alfresco.service.namespace.QName, java.lang.String, org.alfresco.service.namespace.QName, java.lang.String, java.lang.String, java.lang.String, boolean, boolean, boolean, org.alfresco.service.namespace.QName)
*/
public QName addCustomPropertyDefinition(QName propId,
- QName aspectName,
- String label,
- QName dataType,
- String title,
- String description,
- String defaultValue,
- boolean multiValued,
- boolean mandatory,
- boolean isProtected,
+ QName aspectName,
+ String label,
+ QName dataType,
+ String title,
+ String description,
+ String defaultValue,
+ boolean multiValued,
+ boolean mandatory,
+ boolean isProtected,
QName lovConstraint) throws CustomMetadataException
{
if (isCustomisable(aspectName) == false)
{
throw new NotCustomisableMetadataException(aspectName.toPrefixString(namespaceService));
}
-
+
// title parameter is currently ignored. Intentionally.
if (propId == null)
{
// Generate a propId
propId = this.generateQNameFor(label);
}
-
+
ParameterCheck.mandatory("aspectName", aspectName);
ParameterCheck.mandatory("label", label);
ParameterCheck.mandatory("dataType", dataType);
-
+
NodeRef modelRef = getCustomModelRef(propId.getNamespaceURI());
M2Model deserializedModel = readCustomContentModel(modelRef);
-
+
QName customAspect = getCustomAspect(aspectName);
M2Aspect customPropsAspect = deserializedModel.getAspect(customAspect.toPrefixString(namespaceService));
-
+
if (customPropsAspect == null)
{
throw new InvalidCustomAspectMetadataException(customAspect, aspectName.toPrefixString(namespaceService));
}
-
+
String propIdAsString = propId.toPrefixString(namespaceService);
M2Property customProp = customPropsAspect.getProperty(propIdAsString);
if (customProp != null)
{
throw new PropertyAlreadyExistsMetadataException(propIdAsString);
}
-
+
M2Property newProp = customPropsAspect.createProperty(propIdAsString);
newProp.setName(propIdAsString);
newProp.setType(dataType.toPrefixString(namespaceService));
-
+
// Note that the title is used to store the RM 'label'.
newProp.setTitle(label);
newProp.setDescription(description);
newProp.setDefaultValue(defaultValue);
-
+
newProp.setMandatory(mandatory);
newProp.setProtected(isProtected);
newProp.setMultiValued(multiValued);
-
+
newProp.setIndexed(true);
newProp.setIndexedAtomically(true);
newProp.setStoredInIndex(false);
newProp.setIndexTokenisationMode(IndexTokenisationMode.FALSE);
-
+
if (lovConstraint != null)
{
if (! dataType.equals(DataTypeDefinition.TEXT))
{
throw new CannotApplyConstraintMetadataException(lovConstraint, propIdAsString, dataType);
}
-
+
String lovConstraintQNameAsString = lovConstraint.toPrefixString(namespaceService);
newProp.addConstraintRef(lovConstraintQNameAsString);
}
-
+
writeCustomContentModel(modelRef, deserializedModel);
-
+
if (logger.isInfoEnabled())
{
logger.info("addCustomPropertyDefinition: "+label+
"=" + propIdAsString + " to aspect: "+aspectName);
}
-
+
return propId;
}
@@ -756,15 +756,15 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
public QName updateCustomPropertyDefinitionName(QName propQName, String newName) throws CustomMetadataException
{
ParameterCheck.mandatory("propQName", propQName);
-
+
PropertyDefinition propDefn = dictionaryService.getProperty(propQName);
if (propDefn == null)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName));
}
-
+
if (newName == null) return propQName;
-
+
QName newPropQName = getQNameForClientId(newName);
if (newPropQName != null)
{
@@ -776,72 +776,72 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
throw new PropertyAlreadyExistsMetadataException(propIdAsString);
}
}
-
+
NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI());
M2Model deserializedModel = readCustomContentModel(modelRef);
-
+
M2Property targetProperty = findProperty(propQName, deserializedModel);
targetProperty.setName(new StringBuilder().append(RecordsManagementCustomModel.RM_CUSTOM_PREFIX).append(QName.NAMESPACE_PREFIX).append(newName).toString());
targetProperty.setTitle(URLDecoder.decode(newName));
writeCustomContentModel(modelRef, deserializedModel);
-
+
if (logger.isInfoEnabled())
{
logger.info("setCustomPropertyDefinitionLabel: "+propQName+
"=" + newName);
}
-
+
return propQName;
}
-
+
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#setCustomPropertyDefinitionLabel(org.alfresco.service.namespace.QName, java.lang.String)
*/
public QName setCustomPropertyDefinitionLabel(QName propQName, String newLabel)
{
ParameterCheck.mandatory("propQName", propQName);
-
+
PropertyDefinition propDefn = dictionaryService.getProperty(propQName);
if (propDefn == null)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName));
}
-
+
if (newLabel == null) return propQName;
NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI());
M2Model deserializedModel = readCustomContentModel(modelRef);
-
+
M2Property targetProperty = findProperty(propQName, deserializedModel);
targetProperty.setTitle(newLabel);
writeCustomContentModel(modelRef, deserializedModel);
-
+
if (logger.isInfoEnabled())
{
logger.info("setCustomPropertyDefinitionLabel: "+propQName+
"=" + newLabel);
}
-
+
return propQName;
}
-
+
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#setCustomPropertyDefinitionConstraint(org.alfresco.service.namespace.QName, org.alfresco.service.namespace.QName)
*/
public QName setCustomPropertyDefinitionConstraint(QName propQName, QName newLovConstraint)
{
ParameterCheck.mandatory("propQName", propQName);
-
+
PropertyDefinition propDefn = dictionaryService.getProperty(propQName);
if (propDefn == null)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName));
}
-
+
NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI());
M2Model deserializedModel = readCustomContentModel(modelRef);
-
+
M2Property targetProp = findProperty(propQName, deserializedModel);
String dataType = targetProp.getType();
@@ -851,10 +851,10 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
throw new AlfrescoRuntimeException(I18NUtil.getMessage(CannotApplyConstraintMetadataException.MSG_CANNOT_APPLY_CONSTRAINT, newLovConstraint, targetProp.getName(), dataType));
}
String lovConstraintQNameAsString = newLovConstraint.toPrefixString(namespaceService);
-
+
// Add the constraint - if it isn't already there.
String refOfExistingConstraint = null;
-
+
for (M2Constraint c : targetProp.getConstraints())
{
// There should only be one constraint.
@@ -866,14 +866,14 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
targetProp.removeConstraintRef(refOfExistingConstraint);
}
targetProp.addConstraintRef(lovConstraintQNameAsString);
-
+
writeCustomContentModel(modelRef, deserializedModel);
-
+
if (logger.isInfoEnabled())
{
logger.info("addCustomPropertyDefinitionConstraint: "+lovConstraintQNameAsString);
}
-
+
return propQName;
}
@@ -883,36 +883,36 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
public QName removeCustomPropertyDefinitionConstraints(QName propQName)
{
ParameterCheck.mandatory("propQName", propQName);
-
+
PropertyDefinition propDefn = dictionaryService.getProperty(propQName);
if (propDefn == null)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName));
}
-
+
NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI());
M2Model deserializedModel = readCustomContentModel(modelRef);
-
+
M2Property targetProperty = findProperty(propQName, deserializedModel);
-
+
// Need to count backwards to remove constraints
for (int i = targetProperty.getConstraints().size() - 1; i >= 0; i--) {
String ref = targetProperty.getConstraints().get(i).getRef();
targetProperty.removeConstraintRef(ref);
}
-
+
writeCustomContentModel(modelRef, deserializedModel);
-
+
if (logger.isInfoEnabled())
{
logger.info("removeCustomPropertyDefinitionConstraints: "+propQName);
}
-
+
return propQName;
}
/**
- *
+ *
* @param propQName
* @param deserializedModel
* @return
@@ -940,28 +940,28 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
public void removeCustomPropertyDefinition(QName propQName)
{
ParameterCheck.mandatory("propQName", propQName);
-
+
NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI());
M2Model deserializedModel = readCustomContentModel(modelRef);
-
+
String propQNameAsString = propQName.toPrefixString(namespaceService);
-
+
String aspectName = null;
-
+
boolean found = false;
-
+
// Need to select the correct aspect in the customModel from which we'll
// attempt to delete the property definition.
for (QName customisableType : getCustomisable())
{
aspectName = getCustomAspect(customisableType).toPrefixString(namespaceService);
M2Aspect customPropsAspect = deserializedModel.getAspect(aspectName);
-
+
if (customPropsAspect == null)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNKNOWN_ASPECT, aspectName));
}
-
+
M2Property prop = customPropsAspect.getProperty(propQNameAsString);
if (prop != null)
{
@@ -972,20 +972,20 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
msg.append(propQNameAsString);
logger.debug(msg.toString());
}
-
+
found = true;
customPropsAspect.removeProperty(propQNameAsString);
break;
}
}
-
+
if (found == false)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQNameAsString));
}
-
+
writeCustomContentModel(modelRef, deserializedModel);
-
+
if (logger.isInfoEnabled())
{
logger.info("deleteCustomPropertyDefinition: "+propQNameAsString+" from aspect: "+aspectName);
@@ -999,10 +999,10 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
{
AspectDefinition aspectDefn = dictionaryService.getAspect(ASPECT_CUSTOM_ASSOCIATIONS);
Map assocDefns = aspectDefn.getAssociations();
-
+
return assocDefns;
}
-
+
/**
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#addCustomReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
*/
@@ -1051,7 +1051,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
// Invoke before create reference policy
invokeBeforeCreateReference(fromNode, toNode, refId);
-
+
if (assocDef.isChild())
{
this.nodeService.addChild(fromNode, toNode, refId, refId);
@@ -1060,12 +1060,12 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
{
this.nodeService.createAssociation(fromNode, toNode, refId);
}
-
+
// Invoke on create reference policy
invokeOnCreateReference(fromNode, toNode, refId);
}
- public void removeCustomReference(NodeRef fromNode, NodeRef toNode, QName assocId)
+ public void removeCustomReference(NodeRef fromNode, NodeRef toNode, QName assocId)
{
Map availableAssocs = this.getCustomReferenceDefinitions();
@@ -1074,7 +1074,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
{
throw new IllegalArgumentException(I18NUtil.getMessage(MSG_REF_EXIST, assocId));
}
-
+
invokeBeforeRemoveReference(fromNode, toNode, assocId);
if (assocDef.isChild())
@@ -1095,7 +1095,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
{
nodeService.removeAssociation(fromNode, toNode, assocId);
}
-
+
invokeOnRemoveReference(fromNode, toNode, assocId);
}
@@ -1110,7 +1110,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
List childAssocs = nodeService.getChildAssocs(node);
return childAssocs;
}
-
+
public List getCustomReferencesTo(NodeRef node)
{
List retrievedAssocs = nodeService.getSourceAssocs(node, RegexQNamePattern.MATCH_ALL);
@@ -1122,7 +1122,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
List result = nodeService.getParentAssocs(node);
return result;
}
-
+
// note: currently RMC custom assocs only
public QName addCustomAssocDefinition(String label)
{
@@ -1133,14 +1133,14 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
{
throw new IllegalArgumentException(I18NUtil.getMessage(MSG_REF_LABEL_IN_USE, label));
}
-
+
NodeRef modelRef = getCustomModelRef(""); // defaults to RM_CUSTOM_URI
M2Model deserializedModel = readCustomContentModel(modelRef);
-
+
String aspectName = RecordsManagementAdminServiceImpl.RMC_CUSTOM_ASSOCS;
-
+
M2Aspect customAssocsAspect = deserializedModel.getAspect(aspectName);
-
+
if (customAssocsAspect == null)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNKNOWN_ASPECT, aspectName));
@@ -1148,13 +1148,13 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
QName generatedQName = this.generateQNameFor(label);
String generatedShortQName = generatedQName.toPrefixString(namespaceService);
-
+
M2ClassAssociation customAssoc = customAssocsAspect.getAssociation(generatedShortQName);
if (customAssoc != null)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_ASSOC_EXISTS, generatedShortQName));
}
-
+
M2Association newAssoc = customAssocsAspect.createAssociation(generatedShortQName);
newAssoc.setSourceMandatory(false);
newAssoc.setTargetMandatory(false);
@@ -1165,17 +1165,17 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
// The label is stored in the title.
newAssoc.setTitle(label);
-
+
// TODO Could be the customAssocs aspect
newAssoc.setTargetClassName(RecordsManagementAdminServiceImpl.RMA_RECORD);
-
+
writeCustomContentModel(modelRef, deserializedModel);
-
+
if (logger.isInfoEnabled())
{
logger.info("addCustomAssocDefinition: ("+label+")");
}
-
+
return generatedQName;
}
@@ -1183,20 +1183,20 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
{
for (AssociationDefinition associationDefinition : getCustomReferenceDefinitions().values())
{
- if (associationDefinition.getTitle().equalsIgnoreCase(label))
+ if (associationDefinition.getTitle(dictionaryService).equalsIgnoreCase(label))
{
return true;
}
}
return false;
}
-
+
// note: currently RMC custom assocs only
public QName addCustomChildAssocDefinition(String source, String target)
{
ParameterCheck.mandatoryString("source", source);
ParameterCheck.mandatoryString("target", target);
-
+
String compoundID = this.getCompoundIdFor(source, target);
if (existsLabel(compoundID))
{
@@ -1205,11 +1205,11 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
NodeRef modelRef = getCustomModelRef(""); // defaults to RM_CUSTOM_URI
M2Model deserializedModel = readCustomContentModel(modelRef);
-
+
String aspectName = RecordsManagementAdminServiceImpl.RMC_CUSTOM_ASSOCS;
-
+
M2Aspect customAssocsAspect = deserializedModel.getAspect(aspectName);
-
+
if (customAssocsAspect == null)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNKNOWN_ASPECT, aspectName));
@@ -1221,31 +1221,31 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CHILD_ASSOC_EXISTS, compoundID));
}
QName generatedQName = this.generateQNameFor(compoundID);
-
+
M2ChildAssociation newAssoc = customAssocsAspect.createChildAssociation(generatedQName.toPrefixString(namespaceService));
newAssoc.setSourceMandatory(false);
newAssoc.setTargetMandatory(false);
-
+
// MOB-1573
newAssoc.setSourceMany(true);
newAssoc.setTargetMany(true);
// source and target are stored in title.
newAssoc.setTitle(compoundID);
-
+
// TODO Could be the custom assocs aspect
newAssoc.setTargetClassName(RecordsManagementAdminServiceImpl.RMA_RECORD);
-
+
writeCustomContentModel(modelRef, deserializedModel);
-
+
if (logger.isInfoEnabled())
{
logger.info("addCustomChildAssocDefinition: ("+source+","+target+")");
}
-
+
return generatedQName;
}
-
+
// note: currently RMC custom assocs only
public QName updateCustomChildAssocDefinition(QName refQName, String newSource, String newTarget)
{
@@ -1257,7 +1257,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
}
return persistUpdatedAssocTitle(refQName, compoundId);
}
-
+
// note: currently RMC custom assocs only
public QName updateCustomAssocDefinition(QName refQName, String newLabel)
{
@@ -1277,18 +1277,18 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
private QName persistUpdatedAssocTitle(QName refQName, String newTitle)
{
ParameterCheck.mandatory("refQName", refQName);
-
+
AssociationDefinition assocDefn = dictionaryService.getAssociation(refQName);
if (assocDefn == null)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONNOT_FIND_ASSOC_DEF, refQName));
}
-
+
NodeRef modelRef = getCustomModelRef(""); // defaults to RM_CUSTOM_URI
M2Model deserializedModel = readCustomContentModel(modelRef);
-
+
M2Aspect customAssocsAspect = deserializedModel.getAspect(RMC_CUSTOM_ASSOCS);
-
+
for (M2ClassAssociation assoc : customAssocsAspect.getAssociations())
{
if (refQName.toPrefixString(namespaceService).equals(assoc.getName()))
@@ -1300,125 +1300,125 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
}
}
writeCustomContentModel(modelRef, deserializedModel);
-
+
if (logger.isInfoEnabled())
{
logger.info("persistUpdatedAssocTitle: "+refQName+
"=" + newTitle + " to aspect: " + RMC_CUSTOM_ASSOCS);
}
-
+
return refQName;
}
-
- public void addCustomConstraintDefinition(QName constraintName, String title, boolean caseSensitive, List allowedValues, MatchLogic matchLogic)
+
+ public void addCustomConstraintDefinition(QName constraintName, String title, boolean caseSensitive, List allowedValues, MatchLogic matchLogic)
{
ParameterCheck.mandatory("constraintName", constraintName);
ParameterCheck.mandatoryString("title", title);
ParameterCheck.mandatory("allowedValues", allowedValues);
-
+
NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI());
M2Model deserializedModel = readCustomContentModel(modelRef);
-
+
String constraintNameAsPrefixString = constraintName.toPrefixString(namespaceService);
-
+
M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString);
if (customConstraint != null)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONSTRAINT_EXISTS, constraintNameAsPrefixString));
}
-
+
M2Constraint newCon = deserializedModel.createConstraint(constraintNameAsPrefixString, CUSTOM_CONSTRAINT_TYPE);
-
+
newCon.setTitle(title);
newCon.createParameter(PARAM_ALLOWED_VALUES, allowedValues);
newCon.createParameter(PARAM_CASE_SENSITIVE, caseSensitive ? "true" : "false");
newCon.createParameter(PARAM_MATCH_LOGIC, matchLogic.toString());
-
+
writeCustomContentModel(modelRef, deserializedModel);
-
+
if (logger.isInfoEnabled())
{
logger.info("addCustomConstraintDefinition: "+constraintNameAsPrefixString+" (valueCnt: "+allowedValues.size()+")");
}
}
-
+
/*
- public void addCustomConstraintDefinition(QName constraintName, String description, Map parameters)
+ public void addCustomConstraintDefinition(QName constraintName, String description, Map parameters)
{
// TODO Auto-generated method stub
}
*/
-
+
public void changeCustomConstraintValues(QName constraintName, List newAllowedValues)
{
ParameterCheck.mandatory("constraintName", constraintName);
ParameterCheck.mandatory("newAllowedValues", newAllowedValues);
-
+
NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI());
M2Model deserializedModel = readCustomContentModel(modelRef);
-
+
String constraintNameAsPrefixString = constraintName.toPrefixString(namespaceService);
-
+
M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString);
if (customConstraint == null)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_FIND_CONSTRAINT, constraintNameAsPrefixString));
}
-
+
String type = customConstraint.getType();
if ((type == null) || (! type.equals(CUSTOM_CONSTRAINT_TYPE)))
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNEXPECTED_TYPE_CONSTRAINT, type, constraintNameAsPrefixString, CUSTOM_CONSTRAINT_TYPE));
}
-
+
customConstraint.removeParameter(PARAM_ALLOWED_VALUES);
customConstraint.createParameter(PARAM_ALLOWED_VALUES, newAllowedValues);
-
+
writeCustomContentModel(modelRef, deserializedModel);
-
+
if (logger.isInfoEnabled())
{
logger.info("changeCustomConstraintValues: "+constraintNameAsPrefixString+" (valueCnt: "+newAllowedValues.size()+")");
}
}
-
+
public void changeCustomConstraintTitle(QName constraintName, String title)
{
ParameterCheck.mandatory("constraintName", constraintName);
ParameterCheck.mandatoryString("title", title);
-
+
NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI());
M2Model deserializedModel = readCustomContentModel(modelRef);
-
+
String constraintNameAsPrefixString = constraintName.toPrefixString(namespaceService);
-
+
M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString);
if (customConstraint == null)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_FIND_CONSTRAINT, constraintNameAsPrefixString));
}
-
+
String type = customConstraint.getType();
if ((type == null) || (! type.equals(CUSTOM_CONSTRAINT_TYPE)))
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNEXPECTED_TYPE_CONSTRAINT, type, constraintNameAsPrefixString, CUSTOM_CONSTRAINT_TYPE));
}
-
+
customConstraint.setTitle(title);
-
+
writeCustomContentModel(modelRef, deserializedModel);
-
+
if (logger.isInfoEnabled())
{
logger.info("changeCustomConstraintTitle: "+constraintNameAsPrefixString+" (title: "+title+")");
}
}
-
- public List getCustomConstraintDefinitions(QName modelQName)
+
+ public List getCustomConstraintDefinitions(QName modelQName)
{
Collection conDefs = dictionaryService.getConstraints(modelQName, true);
-
+
for (ConstraintDefinition conDef : conDefs)
{
Constraint con = conDef.getConstraint();
@@ -1427,36 +1427,36 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
conDefs.remove(conDef);
}
}
-
+
return new ArrayList(conDefs);
}
-
- public void removeCustomConstraintDefinition(QName constraintName)
+
+ public void removeCustomConstraintDefinition(QName constraintName)
{
ParameterCheck.mandatory("constraintName", constraintName);
-
+
NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI());
M2Model deserializedModel = readCustomContentModel(modelRef);
-
+
String constraintNameAsPrefixString = constraintName.toPrefixString(namespaceService);
-
+
M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString);
if (customConstraint == null)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_FIND_CONSTRAINT, constraintNameAsPrefixString));
}
-
+
deserializedModel.removeConstraint(constraintNameAsPrefixString);
-
+
writeCustomContentModel(modelRef, deserializedModel);
-
+
if (logger.isInfoEnabled())
{
logger.info("deleteCustomConstraintDefinition: "+constraintNameAsPrefixString);
}
}
-
+
private NodeRef getCustomModelRef(String uri)
{
if ((uri.equals("")) || (uri.equals(RecordsManagementModel.RM_CUSTOM_URI)))
@@ -1468,13 +1468,13 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
{
// ALF-5875
List modelRefs = dictonaryRepositoryBootstrap.getModelRefs();
-
+
for (NodeRef modelRef : modelRefs)
{
try
{
M2Model model = readCustomContentModel(modelRef);
-
+
for (M2Namespace namespace : model.getNamespaces())
{
if (namespace.getUri().equals(uri))
@@ -1482,24 +1482,24 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
return modelRef;
}
}
- }
+ }
catch (DictionaryException de)
{
logger.warn("readCustomContentModel: skip model ("+modelRef+") whilst searching for uri ("+uri+"): "+de);
}
}
-
+
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_MODEL_NOT_FOUND, uri));
}
}
-
+
private M2Model readCustomContentModel(NodeRef modelNodeRef)
{
ContentReader reader = this.contentService.getReader(modelNodeRef,
ContentModel.TYPE_CONTENT);
-
+
if (reader.exists() == false) {throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_MODEL_NO_CONTENT, modelNodeRef.toString()));}
-
+
InputStream contentIn = null;
M2Model deserializedModel = null;
try
@@ -1520,16 +1520,16 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
}
return deserializedModel;
}
-
+
private void writeCustomContentModel(NodeRef modelRef, M2Model deserializedModel)
{
ContentWriter writer = this.contentService.getWriter(modelRef, ContentModel.TYPE_CONTENT, true);
writer.setMimetype(MimetypeMap.MIMETYPE_XML);
writer.setEncoding("UTF-8");
-
+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
deserializedModel.toXML(baos);
-
+
String updatedModelXml;
try
{
@@ -1543,7 +1543,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
}
}
-
+
public QName getQNameForClientId(String localName)
{
//TODO 1. After certification. This implementation currently does not support reference,
@@ -1551,7 +1551,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
//TODO 2. Note the implicit assumption here that all custom references will have
// unique titles. This is, in fact, not guaranteed.
-
+
QName propertyResult = null;
for (QName qn : getCustomPropertyDefinitions().keySet())
{
@@ -1560,12 +1560,12 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
propertyResult = qn;
}
}
-
+
if (propertyResult != null)
{
return propertyResult;
}
-
+
QName referenceResult = null;
for (QName refQn : getCustomReferenceDefinitions().keySet())
{
@@ -1574,7 +1574,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
referenceResult = refQn;
}
}
-
+
// TODO Handle the case where both are not null
return referenceResult;
}
@@ -1586,13 +1586,13 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
// TODO log it's already taken. What to do?
throw new IllegalArgumentException(I18NUtil.getMessage(MSG_ERROR_CLIENT_ID, clientId));
}
-
+
String newGUID = GUID.generate();
QName newQName = QName.createQName(RM_CUSTOM_PREFIX, newGUID, namespaceService);
-
+
return newQName;
}
-
+
public String[] splitSourceTargetId(String sourceTargetId)
{
if (!sourceTargetId.contains(SOURCE_TARGET_ID_SEPARATOR))
@@ -1601,12 +1601,12 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
}
return sourceTargetId.split(SOURCE_TARGET_ID_SEPARATOR);
}
-
+
public String getCompoundIdFor(String sourceId, String targetId)
{
ParameterCheck.mandatoryString("sourceId", sourceId);
ParameterCheck.mandatoryString("targetId", targetId);
-
+
if (sourceId.contains(SOURCE_TARGET_ID_SEPARATOR))
{
throw new IllegalArgumentException("sourceId cannot contain '" + SOURCE_TARGET_ID_SEPARATOR
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/SplitEmailAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/SplitEmailAction.java
index aa49a588ff..770d25527b 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/SplitEmailAction.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/SplitEmailAction.java
@@ -56,9 +56,9 @@ import org.springframework.util.FileCopyUtils;
/**
* Split Email Action
- *
+ *
* Splits the attachments for an email message out to independent records.
- *
+ *
* @author Mark Rogers
*/
public class SplitEmailAction extends RMActionExecuterAbstractBase
@@ -67,30 +67,30 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase
private static final String MSG_NO_READ_MIME_MESSAGE = "rm.action.no-read-mime-message";
private static final String MSG_EMAIL_DECLARED = "rm.action.email-declared";
private static final String MSG_EMAIL_NOT_RECORD = "rm.action.email-not-record";
-
+
/** Relationship Labels */
private static final String REL_FROM = "Message";
private static final String REL_TO = "Attachment";
-
+
/** Logger */
private static Log logger = LogFactory.getLog(SplitEmailAction.class);
private QName relationshipQName;
-
+
public void bootstrap()
{
- String compoundId = recordsManagementAdminService.getCompoundIdFor(REL_FROM, REL_TO);
-
+ String compoundId = recordsManagementAdminService.getCompoundIdFor(REL_FROM, REL_TO);
+
Map map = recordsManagementAdminService.getCustomReferenceDefinitions();
for (Map.Entry entry : map.entrySet())
{
- if (compoundId.equals(entry.getValue().getTitle()) == true)
+ if (compoundId.equals(entry.getValue().getTitle(dictionaryService)) == true)
{
relationshipQName = entry.getKey();
break;
}
}
-
+
if (relationshipQName == null)
{
relationshipQName = recordsManagementAdminService.addCustomChildAssocDefinition(REL_FROM, REL_TO);
@@ -106,7 +106,7 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase
{
// get node type
nodeService.getType(actionedUponNodeRef);
-
+
if (logger.isDebugEnabled() == true)
{
logger.debug("split email:" + actionedUponNodeRef);
@@ -117,8 +117,8 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase
if (recordService.isDeclared(actionedUponNodeRef) == false)
{
ChildAssociationRef parent = nodeService.getPrimaryParent(actionedUponNodeRef);
-
- /**
+
+ /**
* Check whether the email message has already been split - do nothing if it has already been split
*/
List refs = nodeService.getTargetAssocs(actionedUponNodeRef, ImapModel.ASSOC_IMAP_ATTACHMENT);
@@ -130,7 +130,7 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase
}
return;
}
-
+
/**
* Get the content and if its a mime message then create atachments for each part
*/
@@ -152,12 +152,12 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase
createAttachment(actionedUponNodeRef, parent.getParentRef(), part);
}
}
- }
- }
+ }
+ }
catch (Exception e)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_READ_MIME_MESSAGE, e.toString()), e);
- }
+ }
}
else
{
@@ -169,7 +169,7 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_EMAIL_NOT_RECORD, actionedUponNodeRef.toString()));
}
}
-
+
/**
* Create attachment from Mime Message Part
* @param messageNodeRef - the node ref of the mime message
@@ -192,7 +192,7 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase
logger.warn("Cannot decode file name '" + fileName + "'", e);
}
}
-
+
Map messageProperties = nodeService.getProperties(messageNodeRef);
String messageTitle = (String)messageProperties.get(ContentModel.PROP_NAME);
if(messageTitle == null)
@@ -201,24 +201,24 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase
}
else
{
- messageTitle = messageTitle + " - " + fileName;
+ messageTitle = messageTitle + " - " + fileName;
}
ContentType contentType = new ContentType(part.getContentType());
-
+
Map docProps = new HashMap(1);
docProps.put(ContentModel.PROP_NAME, messageTitle + " - " + fileName);
docProps.put(ContentModel.PROP_TITLE, fileName);
-
+
/**
* Create an attachment node in the same folder as the message
*/
- ChildAssociationRef attachmentRef = nodeService.createNode(parentNodeRef,
- ContentModel.ASSOC_CONTAINS,
- QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, fileName),
+ ChildAssociationRef attachmentRef = nodeService.createNode(parentNodeRef,
+ ContentModel.ASSOC_CONTAINS,
+ QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, fileName),
ContentModel.TYPE_CONTENT,
docProps);
-
+
/**
* Write the content into the new attachment node
*/
@@ -226,18 +226,18 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase
writer.setMimetype(contentType.getBaseType());
OutputStream os = writer.getContentOutputStream();
FileCopyUtils.copy(part.getInputStream(), os);
-
+
/**
* Create a link from the message to the attachment
- */
+ */
createRMReference(messageNodeRef, attachmentRef.getChildRef());
-
-
+
+
}
-
+
/**
* Create a link from the message to the attachment
- */
+ */
private void createRMReference(final NodeRef parentRef, final NodeRef childRef)
{
AuthenticationUtil.runAsSystem(new RunAsWork()
@@ -246,16 +246,16 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase
public Void doWork() throws Exception
{
// add the relationship
- recordsManagementAdminService.addCustomReference(parentRef, childRef, relationshipQName);
-
+ recordsManagementAdminService.addCustomReference(parentRef, childRef, relationshipQName);
+
// add the IMAP attachment aspect
nodeService.createAssociation(
parentRef,
childRef,
ImapModel.ASSOC_IMAP_ATTACHMENT);
-
+
return null;
- }
+ }
});
- }
+ }
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java
index 0cc4e8cdac..1d4b8a4619 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java
@@ -818,7 +818,7 @@ public class RecordsManagementAuditServiceImpl
if (nodeTypeQname != null)
{
TypeDefinition typeDef = dictionaryService.getType(nodeTypeQname);
- nodeType = (typeDef != null) ? typeDef.getTitle() : null;
+ nodeType = (typeDef != null) ? typeDef.getTitle(dictionaryService) : null;
}
}
else if (values.containsKey(RecordsManagementAuditService.RM_AUDIT_DATA_LOGIN_USERNAME))
@@ -1291,7 +1291,7 @@ public class RecordsManagementAuditServiceImpl
PropertyDefinition propDef = this.dictionaryService.getProperty(property);
if (propDef != null)
{
- label = propDef.getTitle();
+ label = propDef.getTitle(dictionaryService);
}
if (label == null)
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/RFC822MetadataExtracter.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/RFC822MetadataExtracter.java
index 65f28e6919..a8f846f3dc 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/RFC822MetadataExtracter.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/RFC822MetadataExtracter.java
@@ -33,17 +33,17 @@ import org.alfresco.service.namespace.QName;
/**
* Extended RFC822 Metadata Extractor that is sensitive to whether we are in a RM
* site or not.
- *
+ *
* @author Roy Wetherall
*/
public class RFC822MetadataExtracter extends org.alfresco.repo.content.metadata.RFC822MetadataExtracter
{
/** Reference to default properties */
- private static final String PROPERTIES_URL = "org/alfresco/repo/content/metadata/RFC822MetadataExtracter.properties";
-
+ private static final String PROPERTIES_URL = "alfresco/metadata/RFC822MetadataExtracter.properties";
+
/** Node service */
private NodeService nodeService;
-
+
/**
* Sets the node service
* @param nodeService node service
@@ -52,7 +52,7 @@ public class RFC822MetadataExtracter extends org.alfresco.repo.content.metadata.
{
this.nodeService = nodeService;
}
-
+
/**
* @see org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter#filterSystemProperties(java.util.Map, java.util.Map)
*/
@@ -73,7 +73,7 @@ public class RFC822MetadataExtracter extends org.alfresco.repo.content.metadata.
}
}
}
-
+
/**
* @see org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter#getDefaultMapping()
*/
@@ -82,7 +82,7 @@ public class RFC822MetadataExtracter extends org.alfresco.repo.content.metadata.
// Attempt to load the properties
return readMappingProperties(PROPERTIES_URL);
}
-
+
/**
* Given a set of properties, try and retrieve the node reference
* @param properties node properties
@@ -91,21 +91,21 @@ public class RFC822MetadataExtracter extends org.alfresco.repo.content.metadata.
private NodeRef getNodeRef(Map properties)
{
NodeRef result = null;
-
+
// Get the elements of the node reference
String storeProto = (String)properties.get(ContentModel.PROP_STORE_PROTOCOL);
String storeId = (String)properties.get(ContentModel.PROP_STORE_IDENTIFIER);
String nodeId = (String)properties.get(ContentModel.PROP_NODE_UUID);
-
+
if (storeProto != null && storeProto.length() != 0 &&
storeId != null && storeId.length() != 0 &&
nodeId != null && nodeId.length() != 0)
-
+
{
// Create the node reference
result = new NodeRef(new StoreRef(storeProto, storeId), nodeId);
}
-
+
return result;
}
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementFormFilter.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementFormFilter.java
index 5768888b3c..62d73c695f 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementFormFilter.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementFormFilter.java
@@ -32,6 +32,7 @@ import org.alfresco.repo.forms.Form;
import org.alfresco.repo.forms.FormData;
import org.alfresco.repo.forms.processor.AbstractFilter;
import org.alfresco.repo.forms.processor.node.FieldUtils;
+import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
@@ -43,7 +44,7 @@ import org.apache.commons.logging.LogFactory;
/**
* Abstract base class for records management related form filter
* implementations.
- *
+ *
* @author Gavin Cornwell
*/
public abstract class RecordsManagementFormFilter extends AbstractFilter
@@ -60,10 +61,11 @@ public abstract class RecordsManagementFormFilter extends AbstractFilt
protected RecordsManagementService rmService;
protected RecordsManagementAdminService rmAdminService;
protected RecordService recordService;
+ protected DictionaryService dictionaryService;
/**
* Sets the NamespaceService instance
- *
+ *
* @param namespaceService The NamespaceService instance
*/
public void setNamespaceService(NamespaceService namespaceService)
@@ -73,7 +75,7 @@ public abstract class RecordsManagementFormFilter extends AbstractFilt
/**
* Sets the node service
- *
+ *
* @param nodeService The NodeService instance
*/
public void setNodeService(NodeService nodeService)
@@ -83,17 +85,17 @@ public abstract class RecordsManagementFormFilter extends AbstractFilt
/**
* Sets the RecordsManagementServiceRegistry instance
- *
+ *
* @param rmServiceRegistry The RecordsManagementServiceRegistry instance
*/
public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry rmServiceRegistry)
{
this.rmServiceRegistry = rmServiceRegistry;
}
-
+
/**
* Sets the RecordsManagementService instance
- *
+ *
* @param rmService The RecordsManagementService instance
*/
public void setRecordsManagementService(RecordsManagementService rmService)
@@ -103,14 +105,14 @@ public abstract class RecordsManagementFormFilter extends AbstractFilt
/**
* Sets the RecordsManagementAdminService instance
- *
+ *
* @param rmAdminService The RecordsManagementAdminService instance
*/
public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService)
{
this.rmAdminService = rmAdminService;
}
-
+
/**
* @param recordService record service
*/
@@ -118,10 +120,18 @@ public abstract class RecordsManagementFormFilter extends AbstractFilt
{
this.recordService = recordService;
}
-
+
+ /**
+ * @param dictionaryService dictionary service
+ */
+ public void setDictionaryService(DictionaryService dictionaryService)
+ {
+ this.dictionaryService = dictionaryService;
+ }
+
/**
* Add property fields to group
- *
+ *
* @param form
* @param props
* @param setId
@@ -133,17 +143,17 @@ public abstract class RecordsManagementFormFilter extends AbstractFilt
for (Map.Entry entry : props.entrySet())
{
PropertyDefinition prop = entry.getValue();
-
+
String id = form.getItem().getId();
id = id.replaceFirst("/", "://");
NodeRef nodeRef = new NodeRef(id);
Serializable value = nodeService.getProperty(nodeRef, entry.getKey());
-
+
FieldGroup group = new FieldGroup(setId, null, false, false, null);
- Field field = FieldUtils.makePropertyField(prop, value, group, namespaceService);
-
+ Field field = FieldUtils.makePropertyField(prop, value, group, namespaceService, dictionaryService);
+
form.addField(field);
-
+
if (logger.isDebugEnabled() == true)
{
logger.debug("Adding custom property .. " + prop.getName().toString() + " .. with value " + value + ".. to group .. " + setId);
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java
index 7379f3138d..4caccbd84a 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java
@@ -54,7 +54,7 @@ import org.apache.commons.logging.LogFactory;
* management type are provided as part of the Form and also assigned to the
* same field group.
*
- *
+ *
* @author Gavin Cornwell
*/
public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter implements RecordsManagementModel, DOD5015Model
@@ -68,23 +68,23 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
/** Dictionary service */
protected DictionaryService dictionaryService;
-
+
/** Disposition service */
- protected DispositionService dispositionService;
+ protected DispositionService dispositionService;
/**
* Sets the data dictionary service
- *
+ *
* @param dictionaryService The DictionaryService instance
*/
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
-
+
/**
* Sets the disposition service
- *
+ *
* @param dispositionService disposition service
*/
public void setDispositionService(DispositionService dispositionService)
@@ -97,32 +97,32 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
*/
@Override
public void afterGenerate(
- NodeRef nodeRef,
- List fields,
- List forcedFields,
+ NodeRef nodeRef,
+ List fields,
+ List forcedFields,
Form form,
Map context)
{
if (rmService.isFilePlanComponent(nodeRef) == true)
- {
+ {
// add all the custom properties
addCustomPropertyFieldsToGroup(form, nodeRef);
-
+
FilePlanComponentKind kind = rmService.getFilePlanComponentKind(nodeRef);
if (FilePlanComponentKind.RECORD.equals(kind) == true)
{
// add all the record meta-data aspect properties
addRecordMetadataPropertyFieldsToGroup(form, nodeRef);
-
+
// add required transient properties
addTransientProperties(form, nodeRef);
-
+
// add the supplemental marking list property
forceSupplementalMarkingListProperty(form, nodeRef);
-
+
// protect uneditable properties
protectRecordProperties(form, nodeRef);
-
+
// if the record is the result of an email we need to 'protect' some fields
if (this.nodeService.hasAspect(nodeRef, ImapModel.ASPECT_IMAP_CONTENT))
{
@@ -133,14 +133,14 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
{
// add the supplemental marking list property
forceSupplementalMarkingListProperty(form, nodeRef);
-
+
// add required transient properties
addTransientProperties(form, nodeRef);
}
else if (FilePlanComponentKind.DISPOSITION_SCHEDULE.equals(kind) == true)
{
// use the same mechanism used to determine whether steps can be removed from the
- // schedule to determine whether the disposition level can be changed i.e. record
+ // schedule to determine whether the disposition level can be changed i.e. record
// level or folder level.
DispositionSchedule schedule = new DispositionScheduleImpl(this.rmServiceRegistry, this.nodeService, nodeRef);
if (dispositionService.hasDisposableItems(schedule) == true)
@@ -148,19 +148,19 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
protectRecordLevelDispositionPropertyField(form);
}
}
-
+
}
}
-
+
/**
- *
+ *
* @param form
* @param nodeRef
*/
protected void addCustomPropertyFieldsToGroup(Form form, NodeRef nodeRef)
{
Set customisables = rmAdminService.getCustomisable(nodeRef);
-
+
// Compatibility support: don't show category properties if node of type series
QName type = nodeService.getType(nodeRef);
if (CompatibilityModel.TYPE_RECORD_SERIES.equals(type) == true)
@@ -168,22 +168,22 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
// remove record category from the list of customisable types to apply to the form
customisables.remove(TYPE_RECORD_CATEGORY);
}
-
+
for (QName customisable : customisables)
{
addPropertyFieldsToGroup(form, rmAdminService.getCustomPropertyDefinitions(customisable), CUSTOM_RM_FIELD_GROUP_ID);
}
}
-
+
/**
- *
+ *
* @param form
* @param nodeRef
*/
protected void addRecordMetadataPropertyFieldsToGroup(Form form, NodeRef nodeRef)
{
Set aspects = recordService.getRecordMetaDataAspects();
-
+
for (QName aspect : aspects)
{
if (nodeService.hasAspect(nodeRef, aspect) == true)
@@ -199,26 +199,26 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
* Forces the "rmc:supplementalMarkingList" property to be present, if it is
* already on the given node this method does nothing, otherwise a property
* field definition is generated for the property.
- *
+ *
* @param form The Form instance to add the property to
* @param nodeRef The node the form is being generated for
*/
protected void forceSupplementalMarkingListProperty(Form form, NodeRef nodeRef)
{
- if (!this.nodeService.hasAspect(nodeRef,
+ if (!this.nodeService.hasAspect(nodeRef,
RecordsManagementCustomModel.ASPECT_SUPPLEMENTAL_MARKING_LIST))
{
PropertyDefinition propDef = this.dictionaryService.getProperty(
RecordsManagementCustomModel.PROP_SUPPLEMENTAL_MARKING_LIST);
-
+
if (propDef != null)
{
- Field field = FieldUtils.makePropertyField(propDef, null, null, namespaceService);
+ Field field = FieldUtils.makePropertyField(propDef, null, null, namespaceService, dictionaryService);
form.addField(field);
}
else if (logger.isWarnEnabled())
{
- logger.warn("Could not add " +
+ logger.warn("Could not add " +
RecordsManagementCustomModel.PROP_SUPPLEMENTAL_MARKING_LIST.getLocalName() +
" property as it's definition could not be found");
}
@@ -226,7 +226,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
}
/**
- *
+ *
* @param form
* @param nodeRef
*/
@@ -236,7 +236,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
{
addTransientPropertyField(form, TRANSIENT_DECLARED, DataTypeDefinition.BOOLEAN, recordService.isDeclared(nodeRef));
}
-
+
DispositionSchedule ds = dispositionService.getDispositionSchedule(nodeRef);
if (ds != null)
{
@@ -245,7 +245,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
{
addTransientPropertyField(form, TRANSIENT_DISPOSITION_INSTRUCTIONS, DataTypeDefinition.TEXT, instructions);
}
-
+
NodeRef recordCategory = dispositionService.getAssociatedRecordsManagementContainer(ds);
if (recordCategory != null)
{
@@ -255,11 +255,11 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
addTransientPropertyField(form, TRANSIENT_CATEGORY_ID, DataTypeDefinition.TEXT, categoryId);
}
}
- }
+ }
}
-
+
/**
- *
+ *
* @param form
* @param name
* @param type
@@ -276,9 +276,9 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
form.addFieldDefinition(declaredField);
form.addData(dataKeyName, value);
}
-
+
/**
- *
+ *
* @param form
* @param nodeRef
*/
@@ -296,15 +296,15 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
prefixName = "cm:content";
}
else
- {
+ {
prefixName = fieldDef.getName();
}
-
+
if (logger.isDebugEnabled() == true)
{
logger.debug("Checking property " + prefixName + " is editable by user " + AuthenticationUtil.getFullyAuthenticatedUser());
}
-
+
QName qname = QName.createQName(prefixName, namespaceService);
if (recordService.isPropertyEditable(nodeRef, qname) == false)
{
@@ -315,13 +315,13 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
fieldDef.setProtectedField(true);
}
}
- }
+ }
}
-
+
/**
* Marks all the fields that contain data extracted from an email
* as protected fields.
- *
+ *
* @param form The Form instance to add the property to
* @param nodeRef The node the form is being generated for
*/
@@ -332,14 +332,14 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
for (FieldDefinition fieldDef : fieldDefs)
{
String prefixName = fieldDef.getName();
-
- // check the value of the property, if empty then do not mark property
+
+ // check the value of the property, if empty then do not mark property
// as read only
QName qname = QName.createQName(prefixName, namespaceService);
Serializable value = nodeService.getProperty(nodeRef, qname);
if (value != null)
- {
- if (prefixName.equals("cm:title") ||
+ {
+ if (prefixName.equals("cm:title") ||
prefixName.equals("cm:author") ||
prefixName.equals("rma:originator") ||
prefixName.equals("rma:publicationDate") ||
@@ -351,16 +351,16 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
}
}
}
-
+
if (logger.isDebugEnabled() == true)
{
logger.debug("Set email related fields to be protected");
}
}
-
+
/**
* Marks the recordLevelDisposition property as protected to disable editing
- *
+ *
* @param form The Form instance
*/
protected void protectRecordLevelDispositionPropertyField(Form form)
@@ -375,7 +375,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
break;
}
}
-
+
if (logger.isDebugEnabled())
logger.debug("Set 'rma:recordLevelDisposition' field to be protected as record folders or records are present");
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilter.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilter.java
index e2a56cbb83..b61b26355e 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilter.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilter.java
@@ -49,7 +49,7 @@ import org.springframework.extensions.surf.util.ParameterCheck;
* The filter also ensures that any custom properties defined for the records
* management type are provided as part of the Form.
*
- *
+ *
* @author Gavin Cornwell
*/
public class RecordsManagementTypeFormFilter extends RecordsManagementFormFilter implements RecordsManagementModel
@@ -66,10 +66,10 @@ public class RecordsManagementTypeFormFilter extends RecordsManagementFormFilter
protected static final FieldGroup TITLE_FIELD_GROUP = new FieldGroup(TITLE_FIELD_GROUP_ID, null, false, false, null);
protected static final FieldGroup DESC_FIELD_GROUP = new FieldGroup(DESC_FIELD_GROUP_ID, null, false, false, null);
protected static final FieldGroup OTHER_FIELD_GROUP = new FieldGroup(OTHER_FIELD_GROUP_ID, null, false, false, null);
-
+
/** Identifier service */
protected IdentifierService identifierService;
-
+
/**
* @param identifierService identifier service
*/
@@ -77,7 +77,7 @@ public class RecordsManagementTypeFormFilter extends RecordsManagementFormFilter
{
this.identifierService = identifierService;
}
-
+
/*
* @see
* org.alfresco.repo.forms.processor.Filter#afterGenerate(java.lang.Object,
@@ -87,12 +87,12 @@ public class RecordsManagementTypeFormFilter extends RecordsManagementFormFilter
public void afterGenerate(TypeDefinition type, List fields, List forcedFields, Form form,
Map context)
{
- QName typeName = type.getName();
+ QName typeName = type.getName();
if (rmAdminService.isCustomisable(typeName) == true)
{
- addCustomRMProperties(typeName, form);
+ addCustomRMProperties(typeName, form);
}
-
+
// What about any mandatory aspects?
Set aspects = type.getDefaultAspectNames();
for (QName aspect : aspects)
@@ -107,7 +107,7 @@ public class RecordsManagementTypeFormFilter extends RecordsManagementFormFilter
/**
* Adds a property definition for each of the custom properties for the
* given RM type to the given form.
- *
+ *
* @param rmTypeCustomAspect Enum representing the RM type to add custom
* properties for
* @param form The form to add the properties to
@@ -116,20 +116,20 @@ public class RecordsManagementTypeFormFilter extends RecordsManagementFormFilter
{
ParameterCheck.mandatory("customisableType", customisableType);
ParameterCheck.mandatory("form", form);
-
+
Map customProps = rmAdminService.getCustomPropertyDefinitions(customisableType);
-
+
if (customProps != null)
{
if (logger.isDebugEnabled() == true)
{
logger.debug("Found " + customProps.size() + " custom properties for customisable type " + customisableType);
}
-
+
// setup field definition for each custom property
Collection properties = customProps.values();
FieldGroup group = new FieldGroup(CUSTOM_RM_FIELD_GROUP_ID, null, false, false, null);
- List fields = FieldUtils.makePropertyFields(properties, group, namespaceService);
+ List fields = FieldUtils.makePropertyFields(properties, group, namespaceService, dictionaryService);
form.addFields(fields);
}
}
@@ -140,5 +140,5 @@ public class RecordsManagementTypeFormFilter extends RecordsManagementFormFilter
public void afterPersist(TypeDefinition item, FormData data, final NodeRef nodeRef)
{
}
-
+
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java
index 43f46f27d5..91083cb218 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java
@@ -36,7 +36,7 @@ import org.json.simple.JSONObject;
/**
* Extend JSON conversion component to include RM specifics.
- *
+ *
* @author Roy Wetherall
*/
public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONConversionComponent
@@ -162,7 +162,7 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
if (unfiledRecordContainer != null)
{
rmNodeValues.put("unfiledRecordContainer", unfiledRecordContainer.toString());
- rmNodeValues.put("properties", propertiesToJSON(unfiledRecordContainer, useShortQName));
+ rmNodeValues.put("properties", propertiesToJSON(unfiledRecordContainer, nodeService.getProperties(unfiledRecordContainer), useShortQName));
QName type = fileFolderService.getFileInfo(unfiledRecordContainer).getType();
rmNodeValues.put("type", useShortQName ? type.toPrefixString(namespaceService) : type.toString());
}
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/notification/RecordsManagementNotificationHelper.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/notification/RecordsManagementNotificationHelper.java
index ed0437504d..392d0844be 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/notification/RecordsManagementNotificationHelper.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/notification/RecordsManagementNotificationHelper.java
@@ -245,7 +245,7 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
notificationContext.setAsyncNotification(false);
notificationContext.setIgnoreNotificationFailure(true);
- notificationContext.setBodyTemplate(getDueForReviewTemplate());
+ notificationContext.setBodyTemplate(getDueForReviewTemplate().toString());
Map args = new HashMap(1, 1.0f);
args.put("records", (Serializable)records);
args.put("site", getSiteName(root));
@@ -286,7 +286,7 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
notificationContext.setAsyncNotification(false);
notificationContext.setIgnoreNotificationFailure(true);
- notificationContext.setBodyTemplate(supersededTemplate);
+ notificationContext.setBodyTemplate(supersededTemplate.toString());
Map args = new HashMap(1, 1.0f);
args.put("record", record);
args.put("site", getSiteName(root));
@@ -331,13 +331,13 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
args.put("rejectDate", rejectDate);
args.put("recordId", recordId);
args.put("recordName", recordName);
-
+
NotificationContext notificationContext = new NotificationContext();
notificationContext.setAsyncNotification(true);
notificationContext.setIgnoreNotificationFailure(true);
notificationContext.addTo(recordCreator);
notificationContext.setSubject(I18NUtil.getMessage(MSG_SUBJECT_RECORD_REJECTED));
- notificationContext.setBodyTemplate(getRejectedTemplate());
+ notificationContext.setBodyTemplate(getRejectedTemplate().toString());
notificationContext.setTemplateArgs(args);
notificationService.sendNotification(EMailNotificationProvider.NAME, notificationContext);
diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionsGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionsGet.java
index 026962c944..f81040b477 100644
--- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionsGet.java
+++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionsGet.java
@@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletResponse;
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService;
import org.alfresco.service.cmr.dictionary.AssociationDefinition;
import org.alfresco.service.cmr.dictionary.ChildAssociationDefinition;
+import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.namespace.QName;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -40,7 +41,7 @@ import org.springframework.extensions.webscripts.WebScriptRequest;
/**
* This class provides the implementation for the customrefdefinitions.get webscript.
- *
+ *
* @author Neil McErlean
*/
public class CustomReferenceDefinitionsGet extends DeclarativeWebScript
@@ -52,23 +53,29 @@ public class CustomReferenceDefinitionsGet extends DeclarativeWebScript
private static final String TARGET = "target";
private static final String CUSTOM_REFS = "customRefs";
private static Log logger = LogFactory.getLog(CustomReferenceDefinitionsGet.class);
-
+
private RecordsManagementAdminService rmAdminService;
+ private DictionaryService dictionaryService;
public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService)
{
this.rmAdminService = rmAdminService;
}
+ public void setDictionaryService(DictionaryService dictionaryService)
+ {
+ this.dictionaryService = dictionaryService;
+ }
+
@Override
public Map executeImpl(WebScriptRequest req, Status status, Cache cache)
{
Map model = new HashMap();
-
+
Map templateVars = req.getServiceMatch().getTemplateVars();
String refId = templateVars.get(REF_ID);
-
-
+
+
if (logger.isDebugEnabled())
{
logger.debug("Getting custom reference definitions with refId: " + String.valueOf(refId));
@@ -81,7 +88,7 @@ public class CustomReferenceDefinitionsGet extends DeclarativeWebScript
if (refId != null)
{
QName qn = rmAdminService.getQNameForClientId(refId);
-
+
AssociationDefinition assDef = currentCustomRefs.get(qn);
if (assDef == null)
{
@@ -100,20 +107,20 @@ public class CustomReferenceDefinitionsGet extends DeclarativeWebScript
}
List