mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-695: Consolidation of RM actions appearing in RM rule UI
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@50977 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -182,6 +182,7 @@
|
||||
|
||||
<bean id="ruleService" class="org.alfresco.repo.rule.ExtendedRuleServiceImpl" init-method="init">
|
||||
<property name="nodeService" ref="NodeService"/>
|
||||
<property name="nodeService2" ref="NodeService"/>
|
||||
<property name="runtimeNodeService" ref="nodeService"/>
|
||||
<property name="copyService" ref="copyService"/>
|
||||
<property name="actionService" ref="ActionService"/>
|
||||
|
@@ -20,6 +20,26 @@ create-record.hide-record.display-label=Hide Record
|
||||
# Declare record
|
||||
declareRecord.title=Declare record
|
||||
declareRecord.description=Declares a record.
|
||||
# Undeclare record
|
||||
undeclareRecord.title=Undeclare record
|
||||
undeclareRecord.description=Undeclares a record.
|
||||
# Open record folder
|
||||
openRecordFolder.title=Open record folder
|
||||
openRecordFolder.description=Opens a record folder.
|
||||
# Close record folder
|
||||
closeRecordFolder.title=Close record folder
|
||||
closeRecordFolder.description=Closes a record folder.
|
||||
# Complete event
|
||||
completeEvent.title=Complete event
|
||||
completeEvent.description=Completes an event.
|
||||
completeEvent.eventName.display-label=Event
|
||||
# Freeze
|
||||
freeze.title=Freeze
|
||||
freeze.description=Freezes a record.
|
||||
freeze.reason.display-label=Reason
|
||||
# Unfreeze
|
||||
unfreeze.title=Unfreeze
|
||||
unfreeze.description=Unfreezes a record.
|
||||
# File to
|
||||
fileTo.title=File to
|
||||
fileTo.description=Files a record to the specified record folder.
|
||||
@@ -32,3 +52,7 @@ reject.reason.display-label=Reject reason
|
||||
# Request Information
|
||||
requestInfo.title=Request Information
|
||||
requestInfo.description=Starts a workflow for requesting more information for a record
|
||||
# Execute script
|
||||
executeScript.title=Execute script
|
||||
executeScript.description=Execute a script.
|
||||
executeScript.script-ref.display-label=Script
|
@@ -12,6 +12,27 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- Action parameter constraints -->
|
||||
|
||||
<bean id="rm-ac-manual-event" class="org.alfresco.module.org_alfresco_module_rm.action.constraint.ManualEventParameterConstraint" parent="action-constraint">
|
||||
<property name="recordsManagementEventService" ref="recordsManagementEventService"/>
|
||||
</bean>
|
||||
|
||||
<bean id="rm-ac-scripts" class="org.alfresco.repo.action.constraint.FolderContentsParameterConstraint" parent="action-constraint">
|
||||
<property name="dictionaryService" ref="dictionaryService"/>
|
||||
<property name="searchService" ref="searchService"/>
|
||||
<property name="nodeService" ref="nodeService"/>
|
||||
<property name="namespaceService" ref="namespaceService" />
|
||||
<property name="repository" ref="repositoryHelper" />
|
||||
<property name="searchPath" value="/app:company_home/app:dictionary/cm:records_management/cm:records_management_scripts"/>
|
||||
<property name="cacheAllowableValues" value="false" />
|
||||
<property name="nodeInclusionFilter">
|
||||
<list>
|
||||
<value>js</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- Conditions -->
|
||||
|
||||
<bean id="rmCapabilityConditionEvaluator"
|
||||
@@ -212,7 +233,9 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="openRecordFolder" class="org.alfresco.module.org_alfresco_module_rm.action.impl.OpenRecordFolderAction" parent="rmAction" />
|
||||
<bean id="openRecordFolder" class="org.alfresco.module.org_alfresco_module_rm.action.impl.OpenRecordFolderAction" parent="rmAction">
|
||||
<property name="publicAction" value="true"/>
|
||||
</bean>
|
||||
|
||||
<!-- close record folder -->
|
||||
|
||||
@@ -237,7 +260,9 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="closeRecordFolder" class="org.alfresco.module.org_alfresco_module_rm.action.impl.CloseRecordFolderAction" parent="rmAction" />
|
||||
<bean id="closeRecordFolder" class="org.alfresco.module.org_alfresco_module_rm.action.impl.CloseRecordFolderAction" parent="rmAction">
|
||||
<property name="publicAction" value="true"/>
|
||||
</bean>
|
||||
|
||||
<!-- reviewed -->
|
||||
|
||||
@@ -315,6 +340,7 @@
|
||||
</bean>
|
||||
|
||||
<bean id="undeclareRecord" class="org.alfresco.module.org_alfresco_module_rm.action.impl.UndeclareRecordAction" parent="rmAction">
|
||||
<property name="publicAction" value="true"/>
|
||||
</bean>
|
||||
|
||||
<!-- Freeze record -->
|
||||
@@ -340,7 +366,9 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="freeze" class="org.alfresco.module.org_alfresco_module_rm.action.impl.FreezeAction" parent="rmAction" depends-on="rmExtendRetentionPeriodOrFreezeCapability" />
|
||||
<bean id="freeze" class="org.alfresco.module.org_alfresco_module_rm.action.impl.FreezeAction" parent="rmAction" depends-on="rmExtendRetentionPeriodOrFreezeCapability">
|
||||
<property name="publicAction" value="true"/>
|
||||
</bean>
|
||||
|
||||
<!-- Unfreeze record -->
|
||||
|
||||
@@ -365,7 +393,9 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="unfreeze" class="org.alfresco.module.org_alfresco_module_rm.action.impl.UnfreezeAction" parent="rmAction" />
|
||||
<bean id="unfreeze" class="org.alfresco.module.org_alfresco_module_rm.action.impl.UnfreezeAction" parent="rmAction">
|
||||
<property name="publicAction" value="true"/>
|
||||
</bean>
|
||||
|
||||
<!-- Relinquish Hold Action-->
|
||||
|
||||
@@ -542,6 +572,7 @@
|
||||
</bean>
|
||||
|
||||
<bean id="completeEvent" class="org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction" parent="rmAction">
|
||||
<property name="publicAction" value="true"/>
|
||||
</bean>
|
||||
|
||||
<!-- undo event -->
|
||||
@@ -725,6 +756,8 @@
|
||||
<property name="allowParameterSubstitutions" value="true"/>
|
||||
</bean>
|
||||
|
||||
<!-- RequestInfo action -->
|
||||
|
||||
<bean id="requestInfo_proxy" parent="rmProxyAction">
|
||||
<property name="target" ref="requestInfo"/>
|
||||
<property name="interceptorNames">
|
||||
@@ -739,4 +772,40 @@
|
||||
<property name="workflowService" ref="WorkflowService"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- ExecuteScript action -->
|
||||
|
||||
<bean id="executeScript_proxy" class="org.alfresco.module.org_alfresco_module_rm.capability.RMActionProxyFactoryBean" parent="rmProxyAction" init-method="registerAction">
|
||||
<property name="target">
|
||||
<ref bean="executeScript"/>
|
||||
</property>
|
||||
<property name="interceptorNames">
|
||||
<list>
|
||||
<idref bean="allow_security"/>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
<bean id="executeScript" class="org.alfresco.module.org_alfresco_module_rm.action.impl.DelegateAction">
|
||||
<property name="publicAction" value="true"/>
|
||||
<property name="delegateAction" ref="rmscript" />
|
||||
</bean>
|
||||
<bean id="rmscript" class="org.alfresco.module.org_alfresco_module_rm.action.dm.ExecuteScriptAction" parent="script">
|
||||
<!-- The service registry is needed as ScriptAction needs it -->
|
||||
<property name="serviceRegistry">
|
||||
<ref bean="ServiceRegistry" />
|
||||
</property>
|
||||
<property name="personService">
|
||||
<ref bean="personService" />
|
||||
</property>
|
||||
<property name="storeUrl">
|
||||
<value>${spaces.store}</value>
|
||||
</property>
|
||||
<property name="companyHomePath">
|
||||
<value>/${spaces.company_home.childname}</value>
|
||||
</property>
|
||||
<property name="sysAdminParams">
|
||||
<ref bean="sysAdminParams" />
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (C) 2009-2010 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.constraint;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent;
|
||||
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType;
|
||||
import org.alfresco.repo.action.constraint.BaseParameterConstraint;
|
||||
|
||||
/**
|
||||
* Manual event parameter constraint
|
||||
*
|
||||
* @author Craig Tan
|
||||
*/
|
||||
public class ManualEventParameterConstraint extends BaseParameterConstraint
|
||||
{
|
||||
/** Name constant */
|
||||
public static final String NAME = "rm-ac-manual-events";
|
||||
|
||||
private RecordsManagementEventService recordsManagementEventService;
|
||||
|
||||
public void setRecordsManagementEventService(RecordsManagementEventService recordsManagementEventService)
|
||||
{
|
||||
this.recordsManagementEventService = recordsManagementEventService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.service.cmr.action.ParameterConstraint#getAllowableValues()
|
||||
*/
|
||||
protected Map<String, String> getAllowableValuesImpl()
|
||||
{
|
||||
List<RecordsManagementEvent> events = recordsManagementEventService.getEvents();
|
||||
Map<String, String> result = new HashMap<String, String>(events.size());
|
||||
for (RecordsManagementEvent event : events)
|
||||
{
|
||||
RecordsManagementEventType eventType = recordsManagementEventService.getEventType(event.getType());
|
||||
if (eventType != null && !eventType.isAutomaticEvent())
|
||||
{
|
||||
result.put(event.getName(), event.getDisplayLabel());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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.action.dm;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.repo.action.ParameterDefinitionImpl;
|
||||
import org.alfresco.repo.action.executer.ScriptActionExecuter;
|
||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
|
||||
/**
|
||||
* Executes a JavaScript
|
||||
*
|
||||
* Note: This is a 'normal' dm action, rather than a records management action.
|
||||
*
|
||||
* @author Craig Tan
|
||||
*/
|
||||
public class ExecuteScriptAction extends ScriptActionExecuter
|
||||
{
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
protected void addParameterDefinitions(List<ParameterDefinition> paramList)
|
||||
{
|
||||
paramList.add(new ParameterDefinitionImpl(PARAM_SCRIPTREF, DataTypeDefinition.NODE_REF, true,
|
||||
getParamDisplayLabel(PARAM_SCRIPTREF), false, "rm-ac-scripts"));
|
||||
}
|
||||
|
||||
}
|
@@ -18,10 +18,12 @@
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.action.impl;
|
||||
|
||||
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.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
|
||||
/**
|
||||
@@ -31,17 +33,33 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
||||
*/
|
||||
public class CloseRecordFolderAction extends RMActionExecuterAbstractBase
|
||||
{
|
||||
/** Logger */
|
||||
private static Log logger = LogFactory.getLog(CloseRecordFolderAction.class);
|
||||
|
||||
/** I18N */
|
||||
private static final String MSG_CLOSE_RECORD_FOLDER_NOT_FOLDER = "rm.action.close-record-folder-not-folder";
|
||||
|
||||
/** Parameter names */
|
||||
public static final String PARAM_CLOSE_PARENT = "closeParent";
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
|
||||
* @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)
|
||||
{
|
||||
// TODO check that the user in question has the correct permissions to close a records folder
|
||||
|
||||
if (recordService.isRecord(actionedUponNodeRef))
|
||||
{
|
||||
ChildAssociationRef assocRef = nodeService.getPrimaryParent(actionedUponNodeRef);
|
||||
if (assocRef != null)
|
||||
{
|
||||
actionedUponNodeRef = assocRef.getParentRef();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.recordsManagementService.isRecordFolder(actionedUponNodeRef) == true)
|
||||
{
|
||||
Boolean isClosed = (Boolean)this.nodeService.getProperty(actionedUponNodeRef, PROP_IS_CLOSED);
|
||||
@@ -52,7 +70,8 @@ public class CloseRecordFolderAction extends RMActionExecuterAbstractBase
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CLOSE_RECORD_FOLDER_NOT_FOLDER, actionedUponNodeRef.toString()));
|
||||
if (logger.isWarnEnabled())
|
||||
logger.warn(I18NUtil.getMessage(MSG_CLOSE_RECORD_FOLDER_NOT_FOLDER, actionedUponNodeRef.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -23,14 +23,16 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase;
|
||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction;
|
||||
import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails;
|
||||
import org.alfresco.repo.action.ParameterDefinitionImpl;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
|
||||
/**
|
||||
* Complete event action
|
||||
@@ -47,7 +49,18 @@ public class CompleteEventAction extends RMActionExecuterAbstractBase
|
||||
public static final String PARAM_EVENT_COMPLETED_AT = "eventCompletedAt";
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
protected void addParameterDefinitions(List<ParameterDefinition> paramList)
|
||||
{
|
||||
paramList.add(new ParameterDefinitionImpl(PARAM_EVENT_NAME, DataTypeDefinition.TEXT, true,
|
||||
getParamDisplayLabel(PARAM_EVENT_NAME), false, "rm-ac-manual-event"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @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)
|
||||
@@ -66,6 +79,16 @@ public class CompleteEventAction extends RMActionExecuterAbstractBase
|
||||
EventCompletionDetails event = getEvent(da, eventName);
|
||||
if (event != null)
|
||||
{
|
||||
if (eventCompletedAt == null)
|
||||
{
|
||||
eventCompletedAt = new Date();
|
||||
}
|
||||
|
||||
if (eventCompletedBy == null)
|
||||
{
|
||||
eventCompletedBy = AuthenticationUtil.getRunAsUser();
|
||||
}
|
||||
|
||||
// Update the event so that it is complete
|
||||
NodeRef eventNodeRef = event.getNodeRef();
|
||||
Map<QName, Serializable> props = this.nodeService.getProperties(eventNodeRef);
|
||||
@@ -80,7 +103,8 @@ public class CompleteEventAction extends RMActionExecuterAbstractBase
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_EVENT_NO_DISP_LC, eventName));
|
||||
// RM-695: Commenting error handling out. If the current disposition stage does not define the event being completed nothing should happen.
|
||||
// throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_EVENT_NO_DISP_LC, eventName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -26,7 +26,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase;
|
||||
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
@@ -96,7 +95,10 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNDECLARED_ONLY_RECORDS, actionedUponNodeRef.toString()));
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn(I18NUtil.getMessage(MSG_UNDECLARED_ONLY_RECORDS, actionedUponNodeRef.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,8 +18,13 @@
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.action.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase;
|
||||
import org.alfresco.repo.action.ParameterDefinitionImpl;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
/**
|
||||
@@ -32,6 +37,15 @@ public class FreezeAction extends RMActionExecuterAbstractBase
|
||||
/** Parameter names */
|
||||
public static final String PARAM_REASON = "reason";
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#addParameterDefinitions(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
protected void addParameterDefinitions(List<ParameterDefinition> paramList)
|
||||
{
|
||||
paramList.add(new ParameterDefinitionImpl(PARAM_REASON, DataTypeDefinition.TEXT, true, getParamDisplayLabel(PARAM_REASON)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
|
@@ -18,10 +18,12 @@
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.action.impl;
|
||||
|
||||
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.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
|
||||
/**
|
||||
@@ -31,8 +33,14 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
||||
*/
|
||||
public class OpenRecordFolderAction extends RMActionExecuterAbstractBase
|
||||
{
|
||||
/** Logger */
|
||||
private static Log logger = LogFactory.getLog(OpenRecordFolderAction.class);
|
||||
|
||||
private static final String MSG_NO_OPEN_RECORD_FOLDER = "rm.action.no-open-record-folder";
|
||||
|
||||
/** Parameter names */
|
||||
public static final String PARAM_OPEN_PARENT = "openParent";
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action,
|
||||
* org.alfresco.service.cmr.repository.NodeRef)
|
||||
@@ -43,6 +51,15 @@ public class OpenRecordFolderAction extends RMActionExecuterAbstractBase
|
||||
// TODO move re-open logic into a service method
|
||||
// TODO check that the user in question has the correct permission to re-open a records folder
|
||||
|
||||
if (recordService.isRecord(actionedUponNodeRef))
|
||||
{
|
||||
ChildAssociationRef assocRef = nodeService.getPrimaryParent(actionedUponNodeRef);
|
||||
if (assocRef != null)
|
||||
{
|
||||
actionedUponNodeRef = assocRef.getParentRef();
|
||||
}
|
||||
}
|
||||
|
||||
if (this.recordsManagementService.isRecordFolder(actionedUponNodeRef) == true)
|
||||
{
|
||||
Boolean isClosed = (Boolean) this.nodeService.getProperty(actionedUponNodeRef, PROP_IS_CLOSED);
|
||||
@@ -53,7 +70,8 @@ public class OpenRecordFolderAction extends RMActionExecuterAbstractBase
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_OPEN_RECORD_FOLDER, actionedUponNodeRef.toString()));
|
||||
if (logger.isWarnEnabled())
|
||||
logger.warn(I18NUtil.getMessage(MSG_NO_OPEN_RECORD_FOLDER, actionedUponNodeRef.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -18,10 +18,11 @@
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.action.impl;
|
||||
|
||||
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.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
|
||||
/**
|
||||
@@ -31,6 +32,9 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
||||
*/
|
||||
public class UndeclareRecordAction extends RMActionExecuterAbstractBase
|
||||
{
|
||||
/** Logger */
|
||||
private static Log logger = LogFactory.getLog(UndeclareRecordAction.class);
|
||||
|
||||
/** I18N */
|
||||
private static final String MSG_RECORDS_ONLY_UNDECLARED = "rm.action.records_only_undeclared";
|
||||
|
||||
@@ -50,7 +54,10 @@ public class UndeclareRecordAction extends RMActionExecuterAbstractBase
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_RECORDS_ONLY_UNDECLARED));
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn(I18NUtil.getMessage(MSG_RECORDS_ONLY_UNDECLARED));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -21,11 +21,14 @@ package org.alfresco.repo.rule;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.RecordsManagementService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.rule.Rule;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* Extended rule service implementation.
|
||||
@@ -39,6 +42,8 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
|
||||
|
||||
private FilePlanAuthenticationService filePlanAuthenticationService;
|
||||
|
||||
protected NodeService nodeService;
|
||||
|
||||
private RecordsManagementService recordsManagementService;
|
||||
|
||||
public void setRunAsRmAdmin(boolean runAsRmAdmin)
|
||||
@@ -56,6 +61,11 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
|
||||
this.recordsManagementService = recordsManagementService;
|
||||
}
|
||||
|
||||
public void setNodeService2(NodeService nodeService)
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveRule(final NodeRef nodeRef, final Rule rule)
|
||||
{
|
||||
@@ -81,24 +91,31 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
|
||||
@Override
|
||||
public void executeRule(final Rule rule, final NodeRef nodeRef, final Set<ExecutedRuleData> executedRules)
|
||||
{
|
||||
if (isFilePlanComponentRule(rule) == true && runAsRmAdmin == true)
|
||||
QName typeQName = nodeService.getType(nodeRef);
|
||||
|
||||
// The dispositionSchedule node will not be executed by rules
|
||||
if (recordsManagementService.isFilePlanComponent(nodeRef) == true
|
||||
&& typeQName.equals(RecordsManagementModel.TYPE_DISPOSITION_SCHEDULE) == false)
|
||||
{
|
||||
String user = AuthenticationUtil.getFullyAuthenticatedUser();
|
||||
try
|
||||
if (isFilePlanComponentRule(rule) == true && runAsRmAdmin == true)
|
||||
{
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(filePlanAuthenticationService.getRmAdminUserName());
|
||||
ExtendedRuleServiceImpl.super.executeRule(rule, nodeRef, executedRules);
|
||||
String user = AuthenticationUtil.getFullyAuthenticatedUser();
|
||||
try
|
||||
{
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(filePlanAuthenticationService.getRmAdminUserName());
|
||||
ExtendedRuleServiceImpl.super.executeRule(rule, nodeRef, executedRules);
|
||||
}
|
||||
finally
|
||||
{
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(user);
|
||||
}
|
||||
}
|
||||
finally
|
||||
else
|
||||
{
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(user);
|
||||
// just execute the rule as the current user
|
||||
super.executeRule(rule, nodeRef, executedRules);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// just execute the rule as the current user
|
||||
super.executeRule(rule, nodeRef, executedRules);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isFilePlanComponentRule(Rule rule)
|
||||
|
Reference in New Issue
Block a user