mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-579 (The records managment team can reject an unfiled record using an UI action)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@45995 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -238,4 +238,20 @@
|
|||||||
<property name="index" value="60" />
|
<property name="index" value="60" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="rmRejectRecordsCapability"
|
||||||
|
parent="declarativeCapability">
|
||||||
|
<property name="name" value="RejectRecords"/>
|
||||||
|
<property name="private" value="true" />
|
||||||
|
<property name="conditions">
|
||||||
|
<map>
|
||||||
|
<entry key="capabilityCondition.filling" value="true"/>
|
||||||
|
<entry key="capabilityCondition.frozen" value="false"/>
|
||||||
|
<entry key="capabilityCondition.cutoff" value="false"/>
|
||||||
|
<entry key="capabilityCondition.closed" value="false"/>
|
||||||
|
<entry key="capabilityCondition.declared" value="false"/>
|
||||||
|
</map>
|
||||||
|
</property>
|
||||||
|
<property name="targetCapability" ref="rmFileRecordsCapability" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
@@ -35,6 +35,8 @@ rm.action.node-not-transfer=Node is not a transfer object.
|
|||||||
rm.action.undo-not-last=Can not undo cut off, because last disposition action was not cut off.
|
rm.action.undo-not-last=Can not undo cut off, because last disposition action was not cut off.
|
||||||
rm.action.records_only_undeclared=Only records can be undeclared.
|
rm.action.records_only_undeclared=Only records can be undeclared.
|
||||||
rm.action.event-not-undone=The event {0} can not be undone, because it is not defined on the disposition lifecycle.
|
rm.action.event-not-undone=The event {0} can not be undone, because it is not defined on the disposition lifecycle.
|
||||||
|
rm.action.reject-no-reason=Can not reject a record without a reason.
|
||||||
|
rm.action.reject-only-unfiled-records=Can only reject unfiled records.
|
||||||
#
|
#
|
||||||
# i18n for Rule Actions
|
# i18n for Rule Actions
|
||||||
#
|
#
|
||||||
|
@@ -1149,6 +1149,16 @@
|
|||||||
</properties>
|
</properties>
|
||||||
</aspect>
|
</aspect>
|
||||||
|
|
||||||
|
<!-- Aspect to hold the information about reject reason of a record -->
|
||||||
|
<aspect name="rma:rejectReasonRecord">
|
||||||
|
<title>The reject reason of a record</title>
|
||||||
|
<properties>
|
||||||
|
<property name="rma:rejectReason">
|
||||||
|
<type>d:text</type>
|
||||||
|
</property>
|
||||||
|
</properties>
|
||||||
|
</aspect>
|
||||||
|
|
||||||
</aspects>
|
</aspects>
|
||||||
|
|
||||||
</model>
|
</model>
|
@@ -675,5 +675,28 @@
|
|||||||
class="org.alfresco.module.org_alfresco_module_rm.action.impl.CreateDispositionScheduleAction"
|
class="org.alfresco.module.org_alfresco_module_rm.action.impl.CreateDispositionScheduleAction"
|
||||||
parent="rmAction" />
|
parent="rmAction" />
|
||||||
|
|
||||||
|
<!-- Reject record -->
|
||||||
|
|
||||||
|
<bean id="reject_proxy" class="org.alfresco.module.org_alfresco_module_rm.capability.RMActionProxyFactoryBean" parent="rmProxyAction" init-method="registerAction">
|
||||||
|
<property name="target">
|
||||||
|
<ref bean="reject"/>
|
||||||
|
</property>
|
||||||
|
<property name="interceptorNames">
|
||||||
|
<list>
|
||||||
|
<idref bean="reject_security"/>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="reject_security" class="org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityInterceptor" parent="actionSecurity">
|
||||||
|
<property name="objectDefinitionSource">
|
||||||
|
<value>
|
||||||
|
org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_ALLOW
|
||||||
|
org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW
|
||||||
|
org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW
|
||||||
|
</value>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="reject" class="org.alfresco.module.org_alfresco_module_rm.action.impl.RejectAction" parent="rmAction" />
|
||||||
</beans>
|
</beans>
|
@@ -675,4 +675,15 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="jsonConversionComponent.reject"
|
||||||
|
parent="jsonConversionComponent.baseAction">
|
||||||
|
<property name="name" value="reject"/>
|
||||||
|
<property name="kinds">
|
||||||
|
<set>
|
||||||
|
<value>RECORD</value>
|
||||||
|
</set>
|
||||||
|
</property>
|
||||||
|
<property name="capability" value="RejectRecords" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
@@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2012 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.action.impl;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase;
|
||||||
|
import org.alfresco.service.cmr.action.Action;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reject action for an unfiled record
|
||||||
|
*
|
||||||
|
* @author Tuna Aksoy
|
||||||
|
* @since 2.1
|
||||||
|
*/
|
||||||
|
public class RejectAction extends RMActionExecuterAbstractBase
|
||||||
|
{
|
||||||
|
/** Message properties */
|
||||||
|
private static final String MSG_REJECT_NO_REASON = "rm.action.reject-no-reason";
|
||||||
|
private static final String MSG_REJECT_ONLY_UNFILED_RECORDS = "rm.action.reject-only-unfiled-records";
|
||||||
|
|
||||||
|
/** Parameter names */
|
||||||
|
public static final String PARAM_REASON = "reason";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
|
||||||
|
{
|
||||||
|
recordService.rejectRecord(actionedUponNodeRef, (String) action.getParameterValue(PARAM_REASON));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#isExecutableImpl(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, boolean)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected boolean isExecutableImpl(NodeRef filePlanComponent,
|
||||||
|
Map<String, Serializable> parameters, boolean throwException)
|
||||||
|
{
|
||||||
|
if (recordService.isRecord(filePlanComponent) == true && recordService.isFiled(filePlanComponent) == false)
|
||||||
|
{
|
||||||
|
if (parameters != null && StringUtils.isNotBlank((String) parameters.get(PARAM_REASON)))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (throwException)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_REJECT_NO_REASON));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (throwException)
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_REJECT_ONLY_UNFILED_RECORDS));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -234,4 +234,8 @@ public interface RecordsManagementModel extends RecordsManagementCustomModel
|
|||||||
// Original location of a record
|
// Original location of a record
|
||||||
public static final QName ASPECT_ORIGINAL_LOCATION = QName.createQName(RM_URI, "originalLocation");
|
public static final QName ASPECT_ORIGINAL_LOCATION = QName.createQName(RM_URI, "originalLocation");
|
||||||
public static final QName PROP_ORIGINAL_LOCATION = QName.createQName(RM_URI, "orgLocation");
|
public static final QName PROP_ORIGINAL_LOCATION = QName.createQName(RM_URI, "orgLocation");
|
||||||
|
|
||||||
|
// Reject reason of a record
|
||||||
|
public static final QName ASPECT_REJECT_REASON_RECORD = QName.createQName(RM_URI, "rejectReasonRecord");
|
||||||
|
public static final QName PROP_REJECT_REASON = QName.createQName(RM_URI, "rejectReason");
|
||||||
}
|
}
|
||||||
|
@@ -81,4 +81,12 @@ public interface RecordService
|
|||||||
* @return boolean true if filed, false otherwise
|
* @return boolean true if filed, false otherwise
|
||||||
*/
|
*/
|
||||||
boolean isFiled(NodeRef record);
|
boolean isFiled(NodeRef record);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rejects a node with the provided reason
|
||||||
|
*
|
||||||
|
* @param nodeRef node reference
|
||||||
|
* @param reason reject reason
|
||||||
|
*/
|
||||||
|
void rejectRecord(NodeRef nodeRef, String reason);
|
||||||
}
|
}
|
||||||
|
@@ -23,6 +23,7 @@ import java.util.Calendar;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -425,4 +426,54 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rejectRecord(final NodeRef nodeRef, String reason)
|
||||||
|
{
|
||||||
|
ParameterCheck.mandatory("NodeRef", nodeRef);
|
||||||
|
ParameterCheck.mandatoryString("Reason", reason);
|
||||||
|
|
||||||
|
// do the work of rejecting the record as the system user
|
||||||
|
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Void doWork() throws Exception
|
||||||
|
{
|
||||||
|
// first remove the secondary link association
|
||||||
|
NodeRef originalLocation = (NodeRef) nodeService.getProperty(nodeRef, PROP_ORIGINAL_LOCATION);
|
||||||
|
List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(nodeRef);
|
||||||
|
for (ChildAssociationRef childAssociationRef : parentAssocs)
|
||||||
|
{
|
||||||
|
if (childAssociationRef.isPrimary() == false && childAssociationRef.getParentRef().equals(originalLocation))
|
||||||
|
{
|
||||||
|
nodeService.removeChildAssociation(childAssociationRef);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove the "record" and "file plan component" aspects
|
||||||
|
nodeService.removeAspect(nodeRef, RecordsManagementModel.ASPECT_RECORD);
|
||||||
|
nodeService.removeAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT);
|
||||||
|
|
||||||
|
// remove "identifier" property
|
||||||
|
nodeService.removeProperty(nodeRef, PROP_IDENTIFIER);
|
||||||
|
|
||||||
|
// get the records primary parent association
|
||||||
|
ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef);
|
||||||
|
|
||||||
|
// save the reject reason
|
||||||
|
Map<QName, Serializable> aspectProperties = new HashMap<QName, Serializable>(1);
|
||||||
|
aspectProperties.put(PROP_REJECT_REASON, (Serializable) parentAssoc.getParentRef());
|
||||||
|
nodeService.addAspect(nodeRef, ASPECT_REJECT_REASON_RECORD, aspectProperties);
|
||||||
|
|
||||||
|
// move the record into the collaboration site
|
||||||
|
nodeService.moveNode(nodeRef, originalLocation, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName());
|
||||||
|
|
||||||
|
// remove all extended readers
|
||||||
|
extendedSecurityService.removeAllExtendedReaders(nodeRef);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user