mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-752 (RM Dependency upgrade to 4.2)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@51839 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -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<QName, AssociationDefinition> map = recordsManagementAdminService.getCustomReferenceDefinitions();
|
||||
for (Map.Entry<QName, AssociationDefinition> 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<AssociationRef> 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<QName, Serializable> 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<QName, Serializable> docProps = new HashMap<QName, Serializable>(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<Void>()
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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)
|
||||
|
@@ -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<QName, Serializable> 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;
|
||||
}
|
||||
}
|
||||
|
@@ -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<ItemType> extends AbstractFilter<ItemType, NodeRef>
|
||||
@@ -60,10 +61,11 @@ public abstract class RecordsManagementFormFilter<ItemType> 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<ItemType> extends AbstractFilt
|
||||
|
||||
/**
|
||||
* Sets the node service
|
||||
*
|
||||
*
|
||||
* @param nodeService The NodeService instance
|
||||
*/
|
||||
public void setNodeService(NodeService nodeService)
|
||||
@@ -83,17 +85,17 @@ public abstract class RecordsManagementFormFilter<ItemType> 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<ItemType> 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<ItemType> 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<ItemType> extends AbstractFilt
|
||||
for (Map.Entry<QName, PropertyDefinition> 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);
|
||||
|
@@ -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.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @author Gavin Cornwell
|
||||
*/
|
||||
public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter<NodeRef> 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<String> fields,
|
||||
List<String> forcedFields,
|
||||
NodeRef nodeRef,
|
||||
List<String> fields,
|
||||
List<String> forcedFields,
|
||||
Form form,
|
||||
Map<String, Object> 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<QName> 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<QName> 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");
|
||||
}
|
||||
|
@@ -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.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @author Gavin Cornwell
|
||||
*/
|
||||
public class RecordsManagementTypeFormFilter extends RecordsManagementFormFilter<TypeDefinition> 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<String> fields, List<String> forcedFields, Form form,
|
||||
Map<String, Object> 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<QName> 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<QName, PropertyDefinition> 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<PropertyDefinition> properties = customProps.values();
|
||||
FieldGroup group = new FieldGroup(CUSTOM_RM_FIELD_GROUP_ID, null, false, false, null);
|
||||
List<Field> fields = FieldUtils.makePropertyFields(properties, group, namespaceService);
|
||||
List<Field> 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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -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());
|
||||
}
|
||||
|
@@ -245,7 +245,7 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
|
||||
notificationContext.setAsyncNotification(false);
|
||||
notificationContext.setIgnoreNotificationFailure(true);
|
||||
|
||||
notificationContext.setBodyTemplate(getDueForReviewTemplate());
|
||||
notificationContext.setBodyTemplate(getDueForReviewTemplate().toString());
|
||||
Map<String, Serializable> args = new HashMap<String, Serializable>(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<String, Serializable> args = new HashMap<String, Serializable>(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);
|
||||
|
@@ -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<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
|
||||
{
|
||||
Map<String, Object> model = new HashMap<String, Object>();
|
||||
|
||||
|
||||
Map<String, String> 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<Map<String, String>> listOfReferenceData = new ArrayList<Map<String, String>>();
|
||||
|
||||
|
||||
for (Entry<QName, AssociationDefinition> entry : currentCustomRefs.entrySet())
|
||||
{
|
||||
Map<String, String> data = new HashMap<String, String>();
|
||||
|
||||
AssociationDefinition nextValue = entry.getValue();
|
||||
|
||||
|
||||
CustomReferenceType referenceType = nextValue instanceof ChildAssociationDefinition ?
|
||||
CustomReferenceType.PARENT_CHILD : CustomReferenceType.BIDIRECTIONAL;
|
||||
|
||||
|
||||
data.put(REFERENCE_TYPE, referenceType.toString());
|
||||
|
||||
// It is the title which stores either the label, or the source and target.
|
||||
String nextTitle = nextValue.getTitle();
|
||||
String nextTitle = nextValue.getTitle(dictionaryService);
|
||||
if (CustomReferenceType.PARENT_CHILD.equals(referenceType))
|
||||
{
|
||||
if (nextTitle != null)
|
||||
@@ -136,10 +143,10 @@ public class CustomReferenceDefinitionsGet extends DeclarativeWebScript
|
||||
{
|
||||
throw new WebScriptException("Unsupported custom reference type: " + referenceType);
|
||||
}
|
||||
|
||||
|
||||
listOfReferenceData.add(data);
|
||||
}
|
||||
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Retrieved custom reference definitions: " + listOfReferenceData.size());
|
||||
|
@@ -26,6 +26,7 @@ import java.util.Map;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService;
|
||||
import org.alfresco.service.cmr.dictionary.AssociationDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -38,7 +39,7 @@ import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* This class provides the implementation for the customrefs.get webscript.
|
||||
*
|
||||
*
|
||||
* @author Neil McErlean
|
||||
*/
|
||||
public class CustomRefsGet extends AbstractRmWebScript
|
||||
@@ -56,22 +57,28 @@ public class CustomRefsGet extends AbstractRmWebScript
|
||||
private static final String CUSTOM_REFS_TO = "customRefsTo";
|
||||
private static final String NODE_NAME = "nodeName";
|
||||
private static final String NODE_TITLE = "nodeTitle";
|
||||
|
||||
|
||||
private static Log logger = LogFactory.getLog(CustomRefsGet.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<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
|
||||
{
|
||||
Map<String, Object> ftlModel = new HashMap<String, Object>();
|
||||
|
||||
|
||||
NodeRef node = parseRequestForNodeRef(req);
|
||||
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Getting custom reference instances for " + node);
|
||||
@@ -79,27 +86,27 @@ public class CustomRefsGet extends AbstractRmWebScript
|
||||
|
||||
// All the references that come 'out' from this node.
|
||||
List<Map<String, String>> listOfOutwardReferenceData = new ArrayList<Map<String, String>>();
|
||||
|
||||
|
||||
List<AssociationRef> assocsFromThisNode = this.rmAdminService.getCustomReferencesFrom(node);
|
||||
addBidirectionalReferenceData(listOfOutwardReferenceData, assocsFromThisNode);
|
||||
|
||||
|
||||
List<ChildAssociationRef> childAssocs = this.rmAdminService.getCustomChildReferences(node);
|
||||
addParentChildReferenceData(listOfOutwardReferenceData, childAssocs);
|
||||
|
||||
|
||||
// All the references that come 'in' to this node.
|
||||
List<Map<String, String>> listOfInwardReferenceData = new ArrayList<Map<String, String>>();
|
||||
|
||||
|
||||
List<AssociationRef> toAssocs = this.rmAdminService.getCustomReferencesTo(node);
|
||||
addBidirectionalReferenceData(listOfInwardReferenceData, toAssocs);
|
||||
|
||||
|
||||
List<ChildAssociationRef> parentAssocs = this.rmAdminService.getCustomParentReferences(node);
|
||||
addParentChildReferenceData(listOfInwardReferenceData, parentAssocs);
|
||||
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Retrieved custom reference instances: " + assocsFromThisNode);
|
||||
}
|
||||
|
||||
|
||||
ftlModel.put(NODE_NAME, nodeService.getProperty(node, ContentModel.PROP_NAME));
|
||||
ftlModel.put(NODE_TITLE, nodeService.getProperty(node, ContentModel.PROP_TITLE));
|
||||
ftlModel.put(CUSTOM_REFS_FROM, listOfOutwardReferenceData);
|
||||
@@ -112,7 +119,7 @@ public class CustomRefsGet extends AbstractRmWebScript
|
||||
* This method goes through the associationRefs specified and constructs a Map<String, String>
|
||||
* for each assRef. FTL-relevant data are added to that map. The associationRefs must all be
|
||||
* parent/child references.
|
||||
*
|
||||
*
|
||||
* @param listOfReferenceData
|
||||
* @param assocs
|
||||
*/
|
||||
@@ -124,23 +131,23 @@ public class CustomRefsGet extends AbstractRmWebScript
|
||||
Map<String, String> data = new HashMap<String, String>();
|
||||
|
||||
QName typeQName = childAssRef.getTypeQName();
|
||||
|
||||
|
||||
data.put(CHILD_REF, childAssRef.getChildRef().toString());
|
||||
data.put(PARENT_REF, childAssRef.getParentRef().toString());
|
||||
|
||||
AssociationDefinition assDef = rmAdminService.getCustomReferenceDefinitions().get(typeQName);
|
||||
|
||||
|
||||
if (assDef != null)
|
||||
{
|
||||
String compoundTitle = assDef.getTitle();
|
||||
|
||||
String compoundTitle = assDef.getTitle(dictionaryService);
|
||||
|
||||
data.put(REF_ID, typeQName.getLocalName());
|
||||
|
||||
|
||||
String[] sourceAndTarget = rmAdminService.splitSourceTargetId(compoundTitle);
|
||||
data.put(SOURCE, sourceAndTarget[0]);
|
||||
data.put(TARGET, sourceAndTarget[1]);
|
||||
data.put(REFERENCE_TYPE, CustomReferenceType.PARENT_CHILD.toString());
|
||||
|
||||
|
||||
listOfReferenceData.add(data);
|
||||
}
|
||||
}
|
||||
@@ -150,7 +157,7 @@ public class CustomRefsGet extends AbstractRmWebScript
|
||||
* This method goes through the associationRefs specified and constructs a Map<String, String>
|
||||
* for each assRef. FTL-relevant data are added to that map. The associationRefs must all be
|
||||
* bidirectional references.
|
||||
*
|
||||
*
|
||||
* @param listOfReferenceData
|
||||
* @param assocs
|
||||
*/
|
||||
@@ -163,15 +170,15 @@ public class CustomRefsGet extends AbstractRmWebScript
|
||||
|
||||
QName typeQName = assRef.getTypeQName();
|
||||
AssociationDefinition assDef = rmAdminService.getCustomReferenceDefinitions().get(typeQName);
|
||||
|
||||
|
||||
if (assDef != null)
|
||||
{
|
||||
data.put(LABEL, assDef.getTitle());
|
||||
data.put(LABEL, assDef.getTitle(dictionaryService));
|
||||
data.put(REF_ID, typeQName.getLocalName());
|
||||
data.put(REFERENCE_TYPE, CustomReferenceType.BIDIRECTIONAL.toString());
|
||||
data.put(SOURCE_REF, assRef.getSourceRef().toString());
|
||||
data.put(TARGET_REF, assRef.getTargetRef().toString());
|
||||
|
||||
|
||||
listOfReferenceData.add(data);
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import java.util.Map;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.disposition.property.DispositionProperty;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
@@ -42,33 +43,44 @@ public class DispositionPropertiesGet extends DeclarativeWebScript
|
||||
{
|
||||
protected DispositionService dispositionService;
|
||||
protected NamespaceService namespaceService;
|
||||
|
||||
protected DictionaryService dictionaryService;
|
||||
|
||||
/**
|
||||
* Sets the disposition service
|
||||
*
|
||||
*
|
||||
* @param dispositionService the disposition service
|
||||
*/
|
||||
public void setDispositionService(DispositionService dispositionService)
|
||||
{
|
||||
this.dispositionService = dispositionService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the NamespaceService instance
|
||||
*
|
||||
*
|
||||
* @param namespaceService The NamespaceService instance
|
||||
*/
|
||||
public void setNamespaceService(NamespaceService namespaceService)
|
||||
{
|
||||
this.namespaceService = namespaceService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the DictionaryService instance
|
||||
*
|
||||
* @param dictionaryService The DictionaryService instance
|
||||
*/
|
||||
public void setDictionaryService(DictionaryService dictionaryService)
|
||||
{
|
||||
this.dictionaryService = dictionaryService;
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache)
|
||||
*/
|
||||
@Override
|
||||
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
|
||||
{
|
||||
{
|
||||
boolean recordLevel = false;
|
||||
String recordLevelValue = req.getParameter("recordlevel");
|
||||
if (recordLevelValue != null)
|
||||
@@ -76,18 +88,18 @@ public class DispositionPropertiesGet extends DeclarativeWebScript
|
||||
recordLevel = Boolean.valueOf(recordLevelValue);
|
||||
}
|
||||
String dispositionAction = req.getParameter("dispositionaction");
|
||||
|
||||
|
||||
Collection<DispositionProperty> dispositionProperties = dispositionService.getDispositionProperties(recordLevel, dispositionAction);
|
||||
List<Map<String, String>> items = new ArrayList<Map<String, String>>(dispositionProperties.size());
|
||||
for (DispositionProperty dispositionProperty : dispositionProperties)
|
||||
{
|
||||
PropertyDefinition propDef = dispositionProperty.getPropertyDefinition();
|
||||
QName propName = dispositionProperty.getQName();
|
||||
|
||||
|
||||
if (propDef != null)
|
||||
{
|
||||
Map<String, String> item = new HashMap<String, String>(2);
|
||||
String propTitle = propDef.getTitle();
|
||||
String propTitle = propDef.getTitle(dictionaryService);
|
||||
if (propTitle == null || propTitle.length() == 0)
|
||||
{
|
||||
propTitle = StringUtils.capitalize(propName.getLocalName());
|
||||
@@ -97,7 +109,7 @@ public class DispositionPropertiesGet extends DeclarativeWebScript
|
||||
items.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// create model object with the lists model
|
||||
Map<String, Object> model = new HashMap<String, Object>(1);
|
||||
model.put("properties", items);
|
||||
|
@@ -49,7 +49,7 @@ import org.springframework.util.StringUtils;
|
||||
/**
|
||||
* Implementation for Java backed webscript to return lists
|
||||
* of values for various records management services.
|
||||
*
|
||||
*
|
||||
* @author Gavin Cornwell
|
||||
*/
|
||||
public class ListOfValuesGet extends DeclarativeWebScript
|
||||
@@ -61,50 +61,50 @@ public class ListOfValuesGet extends DeclarativeWebScript
|
||||
protected DispositionService dispositionService;
|
||||
protected DictionaryService ddService;
|
||||
protected NamespaceService namespaceService;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the RecordsManagementService instance
|
||||
*
|
||||
*
|
||||
* @param rmService The RecordsManagementService instance
|
||||
*/
|
||||
public void setRecordsManagementService(RecordsManagementService rmService)
|
||||
{
|
||||
this.rmService = rmService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the RecordsManagementActionService instance
|
||||
*
|
||||
*
|
||||
* @param rmActionService The RecordsManagementActionService instance
|
||||
*/
|
||||
public void setRecordsManagementActionService(RecordsManagementActionService rmActionService)
|
||||
{
|
||||
this.rmActionService = rmActionService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the RecordsManagementAuditService instance
|
||||
*
|
||||
*
|
||||
* @param rmAuditService The RecordsManagementAuditService instance
|
||||
*/
|
||||
public void setRecordsManagementAuditService(RecordsManagementAuditService rmAuditService)
|
||||
{
|
||||
this.rmAuditService = rmAuditService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the RecordsManagementEventService instance
|
||||
*
|
||||
*
|
||||
* @param rmEventService The RecordsManagementEventService instance
|
||||
*/
|
||||
public void setRecordsManagementEventService(RecordsManagementEventService rmEventService)
|
||||
{
|
||||
this.rmEventService = rmEventService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the disposition service
|
||||
*
|
||||
*
|
||||
* @param dispositionService the disposition service
|
||||
*/
|
||||
public void setDispositionService(DispositionService dispositionService)
|
||||
@@ -114,24 +114,24 @@ public class ListOfValuesGet extends DeclarativeWebScript
|
||||
|
||||
/**
|
||||
* Sets the DictionaryService instance
|
||||
*
|
||||
*
|
||||
* @param ddService The DictionaryService instance
|
||||
*/
|
||||
public void setDictionaryService(DictionaryService ddService)
|
||||
{
|
||||
this.ddService = ddService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the NamespaceService instance
|
||||
*
|
||||
*
|
||||
* @param namespaceService The NamespaceService instance
|
||||
*/
|
||||
public void setNamespaceService(NamespaceService namespaceService)
|
||||
{
|
||||
this.namespaceService = namespaceService;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache)
|
||||
*/
|
||||
@@ -146,16 +146,16 @@ public class ListOfValuesGet extends DeclarativeWebScript
|
||||
listsModel.put("periodTypes", createPeriodTypesModel(requestUrl));
|
||||
listsModel.put("periodProperties", createPeriodPropertiesModel(requestUrl));
|
||||
listsModel.put("auditEvents", createAuditEventsModel(requestUrl));
|
||||
|
||||
|
||||
// create model object with the lists model
|
||||
Map<String, Object> model = new HashMap<String, Object>(1);
|
||||
model.put("lists", listsModel);
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates the model for the list of disposition actions.
|
||||
*
|
||||
*
|
||||
* @param baseUrl The base URL of the service
|
||||
* @return model of disposition actions list
|
||||
*/
|
||||
@@ -171,18 +171,18 @@ public class ListOfValuesGet extends DeclarativeWebScript
|
||||
item.put("value", dispositionAction.getName());
|
||||
items.add(item);
|
||||
}
|
||||
|
||||
|
||||
// create the model
|
||||
Map<String, Object> model = new HashMap<String, Object>(2);
|
||||
model.put("url", baseUrl + "/dispositionactions");
|
||||
model.put("items", items);
|
||||
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates the model for the list of events.
|
||||
*
|
||||
*
|
||||
* @param baseUrl The base URL of the service
|
||||
* @return model of events list
|
||||
*/
|
||||
@@ -196,22 +196,22 @@ public class ListOfValuesGet extends DeclarativeWebScript
|
||||
Map<String, Object> item = new HashMap<String, Object>(3);
|
||||
item.put("label", event.getDisplayLabel());
|
||||
item.put("value", event.getName());
|
||||
item.put("automatic",
|
||||
item.put("automatic",
|
||||
this.rmEventService.getEventType(event.getType()).isAutomaticEvent());
|
||||
items.add(item);
|
||||
}
|
||||
|
||||
|
||||
// create the model
|
||||
Map<String, Object> model = new HashMap<String, Object>(2);
|
||||
model.put("url", baseUrl + "/events");
|
||||
model.put("items", items);
|
||||
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates the model for the list of period types.
|
||||
*
|
||||
*
|
||||
* @param baseUrl The base URL of the service
|
||||
* @return model of period types list
|
||||
*/
|
||||
@@ -231,18 +231,18 @@ public class ListOfValuesGet extends DeclarativeWebScript
|
||||
items.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// create the model
|
||||
Map<String, Object> model = new HashMap<String, Object>(2);
|
||||
model.put("url", baseUrl + "/periodtypes");
|
||||
model.put("items", items);
|
||||
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates the model for the list of period properties.
|
||||
*
|
||||
*
|
||||
* @param baseUrl The base URL of the service
|
||||
* @return model of period properties list
|
||||
*/
|
||||
@@ -255,11 +255,11 @@ public class ListOfValuesGet extends DeclarativeWebScript
|
||||
{
|
||||
PropertyDefinition propDef = dispositionProperty.getPropertyDefinition();
|
||||
QName propName = dispositionProperty.getQName();
|
||||
|
||||
|
||||
if (propDef != null)
|
||||
{
|
||||
Map<String, String> item = new HashMap<String, String>(2);
|
||||
String propTitle = propDef.getTitle();
|
||||
String propTitle = propDef.getTitle(ddService);
|
||||
if (propTitle == null || propTitle.length() == 0)
|
||||
{
|
||||
propTitle = StringUtils.capitalize(propName.getLocalName());
|
||||
@@ -269,18 +269,18 @@ public class ListOfValuesGet extends DeclarativeWebScript
|
||||
items.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// create the model
|
||||
Map<String, Object> model = new HashMap<String, Object>(2);
|
||||
model.put("url", baseUrl + "/periodproperties");
|
||||
model.put("items", items);
|
||||
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates the model for the list of audit events.
|
||||
*
|
||||
*
|
||||
* @param baseUrl The base URL of the service
|
||||
* @return model of audit events list
|
||||
*/
|
||||
@@ -296,12 +296,12 @@ public class ListOfValuesGet extends DeclarativeWebScript
|
||||
item.put("value", event.getName());
|
||||
items.add(item);
|
||||
}
|
||||
|
||||
|
||||
// create the model
|
||||
Map<String, Object> model = new HashMap<String, Object>(2);
|
||||
model.put("url", baseUrl + "/auditevents");
|
||||
model.put("items", items);
|
||||
|
||||
|
||||
return model;
|
||||
}
|
||||
}
|
@@ -38,17 +38,17 @@ import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
|
||||
/**
|
||||
* RM serach properties GET web script
|
||||
*
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
*/
|
||||
public class RMSearchPropertiesGet extends DeclarativeWebScript
|
||||
{
|
||||
/** Services */
|
||||
private RecordsManagementAdminService adminService;
|
||||
private RecordService recordService;
|
||||
private DictionaryService dictionaryService;
|
||||
private RecordsManagementAdminService adminService;
|
||||
private RecordService recordService;
|
||||
private DictionaryService dictionaryService;
|
||||
private NamespaceService namespaceService;
|
||||
|
||||
|
||||
/**
|
||||
* @param adminService records management admin service
|
||||
*/
|
||||
@@ -56,7 +56,7 @@ public class RMSearchPropertiesGet extends DeclarativeWebScript
|
||||
{
|
||||
this.adminService = adminService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param recordService record service
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ public class RMSearchPropertiesGet extends DeclarativeWebScript
|
||||
{
|
||||
this.recordService = recordService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param dictionaryService dictionary service
|
||||
*/
|
||||
@@ -72,7 +72,7 @@ public class RMSearchPropertiesGet extends DeclarativeWebScript
|
||||
{
|
||||
this.dictionaryService = dictionaryService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param namespaceService namespace service
|
||||
*/
|
||||
@@ -80,7 +80,7 @@ public class RMSearchPropertiesGet extends DeclarativeWebScript
|
||||
{
|
||||
this.namespaceService = namespaceService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache)
|
||||
*/
|
||||
@@ -88,9 +88,9 @@ public class RMSearchPropertiesGet extends DeclarativeWebScript
|
||||
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
|
||||
{
|
||||
Map<String, Object> model = new HashMap<String, Object>(13);
|
||||
|
||||
|
||||
List<Group> groups = new ArrayList<Group>(5);
|
||||
|
||||
|
||||
Set<QName> aspects = recordService.getRecordMetaDataAspects();
|
||||
for (QName aspect : aspects)
|
||||
{
|
||||
@@ -103,9 +103,9 @@ public class RMSearchPropertiesGet extends DeclarativeWebScript
|
||||
propObjs[index] = propObj;
|
||||
index ++;
|
||||
}
|
||||
|
||||
|
||||
AspectDefinition aspectDefinition = dictionaryService.getAspect(aspect);
|
||||
Group group = new Group(aspect.getLocalName(), aspectDefinition.getTitle(), propObjs);
|
||||
Group group = new Group(aspect.getLocalName(), aspectDefinition.getTitle(), propObjs);
|
||||
groups.add(group);
|
||||
}
|
||||
|
||||
@@ -118,74 +118,74 @@ public class RMSearchPropertiesGet extends DeclarativeWebScript
|
||||
propObjs[index] = propObj;
|
||||
index ++;
|
||||
}
|
||||
|
||||
Group group = new Group("rmcustom", "Custom", propObjs);
|
||||
|
||||
Group group = new Group("rmcustom", "Custom", propObjs);
|
||||
groups.add(group);
|
||||
|
||||
|
||||
model.put("groups", groups);
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
public class Group
|
||||
{
|
||||
{
|
||||
private String id;
|
||||
private String label;
|
||||
private Property[] properties;
|
||||
|
||||
|
||||
public Group(String id, String label, Property[] properties)
|
||||
{
|
||||
this.id = id;
|
||||
this.label = label;
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public String getLabel()
|
||||
{
|
||||
return label;
|
||||
}
|
||||
|
||||
|
||||
public Property[] getProperties()
|
||||
{
|
||||
return properties;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class Property
|
||||
{
|
||||
private String prefix;
|
||||
private String shortName;
|
||||
private String label;
|
||||
private String type;
|
||||
|
||||
|
||||
public Property(PropertyDefinition propertyDefinition)
|
||||
{
|
||||
QName qName = propertyDefinition.getName().getPrefixedQName(namespaceService);
|
||||
this.prefix = QName.splitPrefixedQName(qName.toPrefixString())[0];
|
||||
this.shortName = qName.getLocalName();
|
||||
this.label = propertyDefinition.getTitle();
|
||||
this.label = propertyDefinition.getTitle(dictionaryService);
|
||||
this.type = propertyDefinition.getDataType().getName().getLocalName();
|
||||
}
|
||||
|
||||
|
||||
public String getPrefix()
|
||||
{
|
||||
return prefix;
|
||||
}
|
||||
|
||||
|
||||
public String getShortName()
|
||||
{
|
||||
return shortName;
|
||||
}
|
||||
|
||||
|
||||
public String getLabel()
|
||||
{
|
||||
return label;
|
||||
}
|
||||
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -196,7 +196,7 @@ public class RmClassesGet extends DictionaryWebServiceBase implements RecordsMan
|
||||
}
|
||||
|
||||
List<ClassDefinition> classDefinitions = new ArrayList<ClassDefinition>(classdef.values());
|
||||
Collections.sort(classDefinitions, new DictionaryComparators.ClassDefinitionComparator());
|
||||
Collections.sort(classDefinitions, new DictionaryComparators.ClassDefinitionComparator(dictionaryservice));
|
||||
model.put(MODEL_PROP_KEY_CLASS_DEFS, classDefinitions);
|
||||
model.put(MODEL_PROP_KEY_PROPERTY_DETAILS, propdef.values());
|
||||
model.put(MODEL_PROP_KEY_ASSOCIATION_DETAILS, assocdef.values());
|
||||
|
@@ -147,7 +147,7 @@ public class RmPropertiesGet extends DictionaryWebServiceBase implements Records
|
||||
}
|
||||
|
||||
// Order property definitions by title
|
||||
Collections.sort(props, new DictionaryComparators.PropertyDefinitionComparator());
|
||||
Collections.sort(props, new DictionaryComparators.PropertyDefinitionComparator(dictionaryservice));
|
||||
|
||||
// Pass list of property definitions to template
|
||||
Map<String, Object> model = new HashMap<String, Object>();
|
||||
|
Reference in New Issue
Block a user