mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-395: Edit Disposition Date action doesn't work
* edit disposition action now works * associated capability improved to only show action when disposition date available to be updated! * issue became apparent because the available disposition properties don't always make sense for a folder level disposition (eg: file date) Disposition properties are context sensitive: * UI dynamically pulls list of disposition properties based on disposition level and disposition action * WebScript added to retrieve disposition properties based on context * Disposition properties spring context indicates excluded actions and disposition level relevance * Added Created Date as disposition property for folder level disposition * Cutoff Date no longer shows as disposition property option for cutoff action git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.0@38394 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -115,4 +115,10 @@
|
|||||||
<property name="namespaceService" ref="NamespaceService"/>
|
<property name="namespaceService" ref="NamespaceService"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="capabilityCondition.hasDispositionAsOfDate"
|
||||||
|
parent="capabilityCondition.base"
|
||||||
|
class="org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition.HasDispositionDateCapabilityCondition">
|
||||||
|
<property name="dispositionService" ref="DispositionService"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
@@ -105,6 +105,7 @@
|
|||||||
<map>
|
<map>
|
||||||
<entry key="capabilityCondition.filling" value="true"/>
|
<entry key="capabilityCondition.filling" value="true"/>
|
||||||
<entry key="capabilityCondition.frozenOrFrozenChildren" value="false"/>
|
<entry key="capabilityCondition.frozenOrFrozenChildren" value="false"/>
|
||||||
|
<entry key="capabilityCondition.hasDispositionAsOfDate" value="true"/>
|
||||||
</map>
|
</map>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
@@ -17,6 +17,11 @@
|
|||||||
|
|
||||||
<bean id="disposition.properties.cutoffdate" parent="disposition.properties.base">
|
<bean id="disposition.properties.cutoffdate" parent="disposition.properties.base">
|
||||||
<property name="name" value="rma:cutOffDate" />
|
<property name="name" value="rma:cutOffDate" />
|
||||||
|
<property name="excludedDispositionActions">
|
||||||
|
<set>
|
||||||
|
<value>cutoff</value>
|
||||||
|
</set>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="disposition.properties.dispositionasof" parent="disposition.properties.base">
|
<bean id="disposition.properties.dispositionasof" parent="disposition.properties.base">
|
||||||
@@ -25,10 +30,17 @@
|
|||||||
|
|
||||||
<bean id="disposition.properties.datefiled" parent="disposition.properties.base">
|
<bean id="disposition.properties.datefiled" parent="disposition.properties.base">
|
||||||
<property name="name" value="rma:dateFiled" />
|
<property name="name" value="rma:dateFiled" />
|
||||||
|
<property name="appliesToFolderLevel" value="false"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="disposition.properties.publicationdate" parent="disposition.properties.base">
|
<bean id="disposition.properties.publicationdate" parent="disposition.properties.base">
|
||||||
<property name="name" value="rma:publicationDate" />
|
<property name="name" value="rma:publicationDate" />
|
||||||
|
<property name="appliesToFolderLevel" value="false"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="disposition.properties.created" parent="disposition.properties.base">
|
||||||
|
<property name="name" value="cm:created" />
|
||||||
|
<property name="appliesToRecordLevel" value="false"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
@@ -111,6 +111,12 @@
|
|||||||
<property name="namespaceService" ref="NamespaceService"/>
|
<property name="namespaceService" ref="NamespaceService"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<!-- REST impl for GET disposition properties -->
|
||||||
|
<bean id="webscript.org.alfresco.rma.dispositionproperties.get" class="org.alfresco.module.org_alfresco_module_rm.script.DispositionPropertiesGet" parent="webscript">
|
||||||
|
<property name="dispositionService" ref="DispositionService"/>
|
||||||
|
<property name="namespaceService" ref="NamespaceService"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<!-- REST impl for GET Records MetaData aspects -->
|
<!-- REST impl for GET Records MetaData aspects -->
|
||||||
<bean id="webscript.org.alfresco.rma.recordmetadataaspects.get" class="org.alfresco.module.org_alfresco_module_rm.script.RecordMetaDataAspectsGet" parent="webscript">
|
<bean id="webscript.org.alfresco.rma.recordmetadataaspects.get" class="org.alfresco.module.org_alfresco_module_rm.script.RecordMetaDataAspectsGet" parent="webscript">
|
||||||
<property name="recordsManagementService" ref="RecordsManagementService"/>
|
<property name="recordsManagementService" ref="RecordsManagementService"/>
|
||||||
|
@@ -0,0 +1,9 @@
|
|||||||
|
<webscript>
|
||||||
|
<shortname>Disposition Properties</shortname>
|
||||||
|
<description>Returns a list of the disposition properties based on the context provided.</description>
|
||||||
|
<url>/api/rma/dispositionproperties?recordlevel={recordlevel}&dispositionaction={dispositionaction}</url>
|
||||||
|
<format default="json">argument</format>
|
||||||
|
<authentication>user</authentication>
|
||||||
|
<transaction allow="readonly">required</transaction>
|
||||||
|
<lifecycle>internal</lifecycle>
|
||||||
|
</webscript>
|
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"data" :
|
||||||
|
{
|
||||||
|
"properties":
|
||||||
|
[
|
||||||
|
<#list properties as item>
|
||||||
|
{
|
||||||
|
"label": "${item.label}",
|
||||||
|
"value": "${item.value}"
|
||||||
|
}<#if item_has_next>,</#if>
|
||||||
|
</#list>
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition;
|
||||||
|
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether a disposable item currently has a disposition date or not.
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
*/
|
||||||
|
public class HasDispositionDateCapabilityCondition extends AbstractCapabilityCondition
|
||||||
|
{
|
||||||
|
/** Disposition service */
|
||||||
|
private DispositionService dispositionService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dispositionService disposition service
|
||||||
|
*/
|
||||||
|
public void setDispositionService(DispositionService dispositionService)
|
||||||
|
{
|
||||||
|
this.dispositionService = dispositionService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean evaluate(NodeRef nodeRef)
|
||||||
|
{
|
||||||
|
boolean result = false;
|
||||||
|
|
||||||
|
DispositionAction dispositionAction = dispositionService.getNextDispositionAction(nodeRef);
|
||||||
|
if (dispositionAction != null)
|
||||||
|
{
|
||||||
|
if (dispositionAction.getAsOfDate() != null)
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@@ -45,10 +45,11 @@ public interface DispositionService
|
|||||||
void registerDispositionProperty(DispositionProperty dispositionProperty);
|
void registerDispositionProperty(DispositionProperty dispositionProperty);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of disposition period properties
|
* Returns the list of disposition period properties that apply given the context provided.
|
||||||
*
|
*
|
||||||
* @return list of disposition period properties
|
* @return filtered list of disposition period properties
|
||||||
*/
|
*/
|
||||||
|
Collection<DispositionProperty> getDispositionProperties(boolean isRecordLevel, String dispositionAction);
|
||||||
Collection<DispositionProperty> getDispositionProperties();
|
Collection<DispositionProperty> getDispositionProperties();
|
||||||
|
|
||||||
|
|
||||||
|
@@ -166,8 +166,24 @@ public class DispositionServiceImpl implements DispositionService, RecordsManage
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getDispositionProperties()
|
* @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#getDispositionProperties(boolean, java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
|
public Collection<DispositionProperty> getDispositionProperties(boolean isRecordLevel, String dispositionAction)
|
||||||
|
{
|
||||||
|
Collection<DispositionProperty> values = dispositionProperties.values();
|
||||||
|
List<DispositionProperty> result = new ArrayList<DispositionProperty>(values.size());
|
||||||
|
for (DispositionProperty dispositionProperty : values)
|
||||||
|
{
|
||||||
|
boolean test = dispositionProperty.applies(isRecordLevel, dispositionAction);
|
||||||
|
if (test == true)
|
||||||
|
{
|
||||||
|
result.add(dispositionProperty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<DispositionProperty> getDispositionProperties()
|
public Collection<DispositionProperty> getDispositionProperties()
|
||||||
{
|
{
|
||||||
|
@@ -6,6 +6,7 @@ package org.alfresco.module.org_alfresco_module_rm.disposition.property;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction;
|
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction;
|
||||||
@@ -35,6 +36,7 @@ public class DispositionProperty implements NodeServicePolicies.OnUpdateProperti
|
|||||||
/** Property QName */
|
/** Property QName */
|
||||||
private QName propertyName;
|
private QName propertyName;
|
||||||
|
|
||||||
|
/** Behaviour */
|
||||||
private JavaBehaviour behaviour;
|
private JavaBehaviour behaviour;
|
||||||
|
|
||||||
/** Namespace service */
|
/** Namespace service */
|
||||||
@@ -52,6 +54,15 @@ public class DispositionProperty implements NodeServicePolicies.OnUpdateProperti
|
|||||||
/** Node service */
|
/** Node service */
|
||||||
private NodeService nodeService;
|
private NodeService nodeService;
|
||||||
|
|
||||||
|
/** Indicates whether this disposition property applies to a folder level disposition */
|
||||||
|
private boolean appliesToFolderLevel = true;
|
||||||
|
|
||||||
|
/** Indicates whether this disposition property applies to a record level disposition */
|
||||||
|
private boolean appliesToRecordLevel = true;
|
||||||
|
|
||||||
|
/** Set of disposition actions this property does not apply to */
|
||||||
|
private Set<String> excludedDispositionActions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param namespaceService namespace service
|
* @param namespaceService namespace service
|
||||||
*/
|
*/
|
||||||
@@ -116,6 +127,30 @@ public class DispositionProperty implements NodeServicePolicies.OnUpdateProperti
|
|||||||
return dictionaryService.getProperty(propertyName);
|
return dictionaryService.getProperty(propertyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param excludedDispositionActions list of excluded disposition actions
|
||||||
|
*/
|
||||||
|
public void setExcludedDispositionActions(Set<String> excludedDispositionActions)
|
||||||
|
{
|
||||||
|
this.excludedDispositionActions = excludedDispositionActions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param appliesToFolderLevel
|
||||||
|
*/
|
||||||
|
public void setAppliesToFolderLevel(boolean appliesToFolderLevel)
|
||||||
|
{
|
||||||
|
this.appliesToFolderLevel = appliesToFolderLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param appliesToRecordLevel
|
||||||
|
*/
|
||||||
|
public void setAppliesToRecordLevel(boolean appliesToRecordLevel)
|
||||||
|
{
|
||||||
|
this.appliesToRecordLevel = appliesToRecordLevel;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bean initialisation method
|
* Bean initialisation method
|
||||||
*/
|
*/
|
||||||
@@ -132,6 +167,39 @@ public class DispositionProperty implements NodeServicePolicies.OnUpdateProperti
|
|||||||
behaviour);
|
behaviour);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the disposition property applies given the context.
|
||||||
|
*
|
||||||
|
* @param isRecordLevel true if record level disposition schedule, false otherwise
|
||||||
|
* @param dispositionAction disposition action name
|
||||||
|
* @return boolean true if applies, false otherwise
|
||||||
|
*/
|
||||||
|
public boolean applies(boolean isRecordLevel, String dispositionAction)
|
||||||
|
{
|
||||||
|
boolean result = false;
|
||||||
|
|
||||||
|
if ((isRecordLevel == true && appliesToRecordLevel == true) ||
|
||||||
|
(isRecordLevel == false && appliesToFolderLevel == true))
|
||||||
|
{
|
||||||
|
if (excludedDispositionActions != null && excludedDispositionActions.size() != 0)
|
||||||
|
{
|
||||||
|
if (excludedDispositionActions.contains(dispositionAction) == false)
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onUpdateProperties(
|
public void onUpdateProperties(
|
||||||
final NodeRef nodeRef,
|
final NodeRef nodeRef,
|
||||||
@@ -197,6 +265,13 @@ public class DispositionProperty implements NodeServicePolicies.OnUpdateProperti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the property has been updated or not.
|
||||||
|
*
|
||||||
|
* @param before
|
||||||
|
* @param after
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private boolean isPropertyUpdated(Map<QName, Serializable> before, Map<QName, Serializable> after)
|
private boolean isPropertyUpdated(Map<QName, Serializable> before, Map<QName, Serializable> after)
|
||||||
{
|
{
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
|
@@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2011 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.script;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
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.PropertyDefinition;
|
||||||
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
import org.springframework.extensions.webscripts.Cache;
|
||||||
|
import org.springframework.extensions.webscripts.DeclarativeWebScript;
|
||||||
|
import org.springframework.extensions.webscripts.Status;
|
||||||
|
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Roy Wetherall
|
||||||
|
*/
|
||||||
|
public class DispositionPropertiesGet extends DeclarativeWebScript
|
||||||
|
{
|
||||||
|
protected DispositionService dispositionService;
|
||||||
|
protected NamespaceService namespaceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @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)
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
if (propTitle == null || propTitle.length() == 0)
|
||||||
|
{
|
||||||
|
propTitle = StringUtils.capitalize(propName.getLocalName());
|
||||||
|
}
|
||||||
|
item.put("label", propTitle);
|
||||||
|
item.put("value", propName.toPrefixString(this.namespaceService));
|
||||||
|
items.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// create model object with the lists model
|
||||||
|
Map<String, Object> model = new HashMap<String, Object>(1);
|
||||||
|
model.put("properties", items);
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user