Fixed major bugs (Visibility modifier) reported in Sonar

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@74412 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2014-06-22 15:53:31 +00:00
parent f2eca8cbc3
commit 15a00fa939
27 changed files with 235 additions and 124 deletions

View File

@@ -41,19 +41,35 @@ public abstract class RecordsManagementActionConditionEvaluatorAbstractBase exte
BeanNameAware BeanNameAware
{ {
/** records management action service */ /** records management action service */
protected RecordsManagementActionService recordsManagementActionService; private RecordsManagementActionService recordsManagementActionService;
/** File Plan Service */ /** File Plan Service */
protected FilePlanService filePlanService; private FilePlanService filePlanService;
/** bean name */ /** bean name */
private String name; private String name;
/** public condition */ /** public condition */
protected boolean publicCondition = true; private boolean publicCondition = true;
private RetryingTransactionHelper retryingTransactionHelper; private RetryingTransactionHelper retryingTransactionHelper;
/**
* @return Records management action service
*/
protected RecordsManagementActionService getRecordsManagementActionService()
{
return this.recordsManagementActionService;
}
/**
* @return File plan service
*/
protected FilePlanService getFilePlanService()
{
return this.filePlanService;
}
/** /**
* @param recordsManagementActionService records management action service * @param recordsManagementActionService records management action service
*/ */
@@ -95,7 +111,7 @@ public abstract class RecordsManagementActionConditionEvaluatorAbstractBase exte
{ {
public Void execute() public Void execute()
{ {
recordsManagementActionService.register(RecordsManagementActionConditionEvaluatorAbstractBase.this); getRecordsManagementActionService().register(RecordsManagementActionConditionEvaluatorAbstractBase.this);
return null; return null;
} }

View File

@@ -60,15 +60,31 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
private Map<String, RecordsManagementAction> dispositionActions = new HashMap<String, RecordsManagementAction>(5); private Map<String, RecordsManagementAction> dispositionActions = new HashMap<String, RecordsManagementAction>(5);
/** Policy component */ /** Policy component */
PolicyComponent policyComponent; private PolicyComponent policyComponent;
/** Node service */ /** Node service */
NodeService nodeService; private NodeService nodeService;
/** Policy delegates */ /** Policy delegates */
private ClassPolicyDelegate<BeforeRMActionExecution> beforeRMActionExecutionDelegate; private ClassPolicyDelegate<BeforeRMActionExecution> beforeRMActionExecutionDelegate;
private ClassPolicyDelegate<OnRMActionExecution> onRMActionExecutionDelegate; private ClassPolicyDelegate<OnRMActionExecution> onRMActionExecutionDelegate;
/**
* @return Policy component
*/
protected PolicyComponent getPolicyComponent()
{
return this.policyComponent;
}
/**
* @return Node Service
*/
protected NodeService getNodeService()
{
return this.nodeService;
}
/** /**
* Set the policy component * Set the policy component
* *
@@ -95,8 +111,8 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
public void init() public void init()
{ {
// Register the various policies // Register the various policies
beforeRMActionExecutionDelegate = policyComponent.registerClassPolicy(BeforeRMActionExecution.class); beforeRMActionExecutionDelegate = getPolicyComponent().registerClassPolicy(BeforeRMActionExecution.class);
onRMActionExecutionDelegate = policyComponent.registerClassPolicy(OnRMActionExecution.class); onRMActionExecutionDelegate = getPolicyComponent().registerClassPolicy(OnRMActionExecution.class);
} }
/** /**
@@ -133,7 +149,7 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
protected void invokeBeforeRMActionExecution(NodeRef nodeRef, String name, Map<String, Serializable> parameters) protected void invokeBeforeRMActionExecution(NodeRef nodeRef, String name, Map<String, Serializable> parameters)
{ {
// get qnames to invoke against // get qnames to invoke against
Set<QName> qnames = PoliciesUtil.getTypeAndAspectQNames(nodeService, nodeRef); Set<QName> qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), nodeRef);
// execute policy for node type and aspects // execute policy for node type and aspects
BeforeRMActionExecution policy = beforeRMActionExecutionDelegate.get(qnames); BeforeRMActionExecution policy = beforeRMActionExecutionDelegate.get(qnames);
policy.beforeRMActionExecution(nodeRef, name, parameters); policy.beforeRMActionExecution(nodeRef, name, parameters);
@@ -149,7 +165,7 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
protected void invokeOnRMActionExecution(NodeRef nodeRef, String name, Map<String, Serializable> parameters) protected void invokeOnRMActionExecution(NodeRef nodeRef, String name, Map<String, Serializable> parameters)
{ {
// get qnames to invoke against // get qnames to invoke against
Set<QName> qnames = PoliciesUtil.getTypeAndAspectQNames(nodeService, nodeRef); Set<QName> qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), nodeRef);
// execute policy for node type and aspects // execute policy for node type and aspects
OnRMActionExecution policy = onRMActionExecutionDelegate.get(qnames); OnRMActionExecution policy = onRMActionExecutionDelegate.get(qnames);
policy.onRMActionExecution(nodeRef, name, parameters); policy.onRMActionExecution(nodeRef, name, parameters);
@@ -260,7 +276,7 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
// Execute action // Execute action
invokeBeforeRMActionExecution(nodeRef, name, parameters); invokeBeforeRMActionExecution(nodeRef, name, parameters);
RecordsManagementActionResult result = rmAction.execute(nodeRef, parameters); RecordsManagementActionResult result = rmAction.execute(nodeRef, parameters);
if (nodeService.exists(nodeRef)) if (getNodeService().exists(nodeRef))
{ {
invokeOnRMActionExecution(nodeRef, name, parameters); invokeOnRMActionExecution(nodeRef, name, parameters);
} }

View File

@@ -34,7 +34,7 @@ import org.alfresco.service.namespace.QName;
/** /**
* Records management IsKind evaluator that evaluates according to the file plan * Records management IsKind evaluator that evaluates according to the file plan
* component kind passed in. * component kind passed in.
* *
* @author Craig Tan * @author Craig Tan
* @since 2.1 * @since 2.1
*/ */
@@ -55,7 +55,7 @@ public class IsKindEvaluator extends RecordsManagementActionConditionEvaluatorAb
boolean result = false; boolean result = false;
String kind = ((QName) actionCondition.getParameterValue(PARAM_KIND)).getLocalName(); String kind = ((QName) actionCondition.getParameterValue(PARAM_KIND)).getLocalName();
FilePlanComponentKind filePlanComponentKind = filePlanService.getFilePlanComponentKind(actionedUponNodeRef); FilePlanComponentKind filePlanComponentKind = getFilePlanService().getFilePlanComponentKind(actionedUponNodeRef);
if (filePlanComponentKind != null && if (filePlanComponentKind != null &&
filePlanComponentKind.toString().equals(kind)) filePlanComponentKind.toString().equals(kind))

View File

@@ -51,7 +51,27 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr
{ {
COPY, MOVE, LINK COPY, MOVE, LINK
}; };
protected CopyMoveLinkFileToActionMode mode;
/** Action Mode */
private CopyMoveLinkFileToActionMode mode;
/**
* @return Action Mode
*/
protected CopyMoveLinkFileToActionMode getMode()
{
return this.mode;
}
/**
* Sets the action mode
*
* @param mode Action mode
*/
protected void setMode(CopyMoveLinkFileToActionMode mode)
{
this.mode = mode;
}
/** /**
* @param fileFolderService file folder service * @param fileFolderService file folder service
@@ -120,15 +140,15 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr
{ {
try try
{ {
if(mode == CopyMoveLinkFileToActionMode.MOVE) if(getMode() == CopyMoveLinkFileToActionMode.MOVE)
{ {
fileFolderService.move(actionedUponNodeRef, finalRecordFolder, null); fileFolderService.move(actionedUponNodeRef, finalRecordFolder, null);
} }
else if(mode == CopyMoveLinkFileToActionMode.COPY) else if(getMode() == CopyMoveLinkFileToActionMode.COPY)
{ {
fileFolderService.copy(actionedUponNodeRef, finalRecordFolder, null); fileFolderService.copy(actionedUponNodeRef, finalRecordFolder, null);
} }
else if(mode == CopyMoveLinkFileToActionMode.LINK) else if(getMode() == CopyMoveLinkFileToActionMode.LINK)
{ {
recordService.link(actionedUponNodeRef, finalRecordFolder); recordService.link(actionedUponNodeRef, finalRecordFolder);
} }

View File

@@ -1,6 +1,5 @@
package org.alfresco.module.org_alfresco_module_rm.action.impl; package org.alfresco.module.org_alfresco_module_rm.action.impl;
/** /**
* File To action implementation. * File To action implementation.
* *
@@ -16,6 +15,6 @@ public class CopyToAction extends CopyMoveLinkFileToBaseAction
public void init() public void init()
{ {
super.init(); super.init();
this.mode = CopyMoveLinkFileToActionMode.COPY; setMode(CopyMoveLinkFileToActionMode.COPY);
} }
} }

View File

@@ -1,6 +1,5 @@
package org.alfresco.module.org_alfresco_module_rm.action.impl; package org.alfresco.module.org_alfresco_module_rm.action.impl;
/** /**
* File To action implementation. * File To action implementation.
* *
@@ -16,6 +15,6 @@ public class FileToAction extends CopyMoveLinkFileToBaseAction
public void init() public void init()
{ {
super.init(); super.init();
this.mode = CopyMoveLinkFileToActionMode.MOVE; setMode(CopyMoveLinkFileToActionMode.MOVE);
} }
} }

View File

@@ -1,6 +1,5 @@
package org.alfresco.module.org_alfresco_module_rm.action.impl; package org.alfresco.module.org_alfresco_module_rm.action.impl;
/** /**
* Link To action implementation. * Link To action implementation.
* *
@@ -16,6 +15,6 @@ public class LinkToAction extends CopyMoveLinkFileToBaseAction
public void init() public void init()
{ {
super.init(); super.init();
this.mode = CopyMoveLinkFileToActionMode.LINK; setMode(CopyMoveLinkFileToActionMode.LINK);
} }
} }

View File

@@ -1,6 +1,5 @@
package org.alfresco.module.org_alfresco_module_rm.action.impl; package org.alfresco.module.org_alfresco_module_rm.action.impl;
/** /**
* File To action implementation. * File To action implementation.
* *
@@ -16,6 +15,6 @@ public class MoveToAction extends CopyMoveLinkFileToBaseAction
public void init() public void init()
{ {
super.init(); super.init();
this.mode = CopyMoveLinkFileToActionMode.MOVE; setMode(CopyMoveLinkFileToActionMode.MOVE);
} }
} }

View File

@@ -21,9 +21,9 @@ package org.alfresco.module.org_alfresco_module_rm.audit.event;
import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.util.ParameterCheck; import org.alfresco.util.ParameterCheck;
import org.apache.commons.lang.StringUtils;
import org.springframework.extensions.surf.util.I18NUtil; import org.springframework.extensions.surf.util.I18NUtil;
/** /**
* Class to represent an audit event * Class to represent an audit event
* *
@@ -34,14 +34,14 @@ import org.springframework.extensions.surf.util.I18NUtil;
public class AuditEvent implements RecordsManagementModel, Comparable<AuditEvent> public class AuditEvent implements RecordsManagementModel, Comparable<AuditEvent>
{ {
/** Name */ /** Name */
protected String name; private String name;
/** Label */ /** Label */
protected String label; private String label;
/** Records management audit service */ /** Records management audit service */
protected RecordsManagementAuditService recordsManagementAuditService; protected RecordsManagementAuditService recordsManagementAuditService;
/** /**
* @param recordsManagementAuditService records management audit service * @param recordsManagementAuditService records management audit service
*/ */
@@ -49,18 +49,18 @@ public class AuditEvent implements RecordsManagementModel, Comparable<AuditEvent
{ {
this.recordsManagementAuditService = recordsManagementAuditService; this.recordsManagementAuditService = recordsManagementAuditService;
} }
/** /**
* Init method * Init method
*/ */
public void init() public void init()
{ {
ParameterCheck.mandatory("name", name); ParameterCheck.mandatory("name", name);
ParameterCheck.mandatory("label", label); ParameterCheck.mandatory("label", label);
recordsManagementAuditService.registerAuditEvent(this); recordsManagementAuditService.registerAuditEvent(this);
} }
/** /**
* Default constructor. * Default constructor.
*/ */
@@ -68,10 +68,10 @@ public class AuditEvent implements RecordsManagementModel, Comparable<AuditEvent
{ {
// do nothing // do nothing
} }
/** /**
* Default constructor. * Default constructor.
* *
* @param name audit event name * @param name audit event name
* @param label audit event label (can be actual label or I18N lookup key) * @param label audit event label (can be actual label or I18N lookup key)
*/ */
@@ -79,11 +79,11 @@ public class AuditEvent implements RecordsManagementModel, Comparable<AuditEvent
{ {
ParameterCheck.mandatory("name", name); ParameterCheck.mandatory("name", name);
ParameterCheck.mandatory("label", label); ParameterCheck.mandatory("label", label);
this.name = name; setName(name);
this.label = label; setLabel(label);
} }
/** /**
* @return audit event name * @return audit event name
*/ */
@@ -91,11 +91,11 @@ public class AuditEvent implements RecordsManagementModel, Comparable<AuditEvent
{ {
return this.name; return this.name;
} }
/** /**
* @param name audit event name * @param name audit event name
*/ */
public void setName(String name) public void setName(String name)
{ {
this.name = name; this.name = name;
} }
@@ -106,26 +106,26 @@ public class AuditEvent implements RecordsManagementModel, Comparable<AuditEvent
public String getLabel() public String getLabel()
{ {
String lookup = I18NUtil.getMessage(label); String lookup = I18NUtil.getMessage(label);
if (lookup == null) if (StringUtils.isBlank(lookup))
{ {
lookup = label; lookup = label;
} }
return lookup; return lookup;
} }
/** /**
* @param label audit event label * @param label audit event label
*/ */
public void setLabel(String label) public void setLabel(String label)
{ {
this.label = label; this.label = label;
} }
/** /**
* Compare by label. * Compare by label.
* *
* @param compare compare to audit event * @param compare compare to audit event
* @return int * @return int
*/ */
@Override @Override
public int compareTo(AuditEvent compare) public int compareTo(AuditEvent compare)

View File

@@ -26,7 +26,7 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
/** /**
* Audits the creation of file plan component objects * Audits the creation of file plan component objects
* *
* @author Roy Wetherall * @author Roy Wetherall
* @since 2.1 * @since 2.1
*/ */
@@ -44,6 +44,6 @@ public class CreateObjectAuditEvent extends AuditEvent implements OnCreateNodePo
) )
public void onCreateNode(ChildAssociationRef childAssocRef) public void onCreateNode(ChildAssociationRef childAssocRef)
{ {
recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), name); recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName());
} }
} }

View File

@@ -26,7 +26,7 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
/** /**
* Audits person creation. * Audits person creation.
* *
* @author Roy Wetherall * @author Roy Wetherall
* @since 2.1 * @since 2.1
*/ */
@@ -44,6 +44,6 @@ public class CreatePersonAuditEvent extends AuditEvent implements OnCreateNodePo
) )
public void onCreateNode(ChildAssociationRef childAssocRef) public void onCreateNode(ChildAssociationRef childAssocRef)
{ {
recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), name); recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName());
} }
} }

View File

@@ -26,13 +26,13 @@ import org.alfresco.service.cmr.repository.NodeRef;
/** /**
* Audits file plan component delete * Audits file plan component delete
* *
* @author Roy Wetherall * @author Roy Wetherall
* @since 2.1 * @since 2.1
*/ */
@BehaviourBean @BehaviourBean
public class DeleteObjectAuditEvent extends AuditEvent implements BeforeDeleteNodePolicy public class DeleteObjectAuditEvent extends AuditEvent implements BeforeDeleteNodePolicy
{ {
/** /**
* @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef)
*/ */
@@ -41,9 +41,9 @@ public class DeleteObjectAuditEvent extends AuditEvent implements BeforeDeleteNo
( (
kind = BehaviourKind.CLASS, kind = BehaviourKind.CLASS,
type = "rma:filePlanComponent" type = "rma:filePlanComponent"
) )
public void beforeDeleteNode(NodeRef nodeRef) public void beforeDeleteNode(NodeRef nodeRef)
{ {
recordsManagementAuditService.auditEvent(nodeRef, name, null, null, true, false); recordsManagementAuditService.auditEvent(nodeRef, getName(), null, null, true, false);
} }
} }

View File

@@ -30,7 +30,7 @@ import org.alfresco.service.namespace.QName;
/** /**
* Audits file plan component property updates * Audits file plan component property updates
* *
* @author Roy Wetherall * @author Roy Wetherall
* @since 2.1 * @since 2.1
*/ */
@@ -48,7 +48,7 @@ public class UpdateObjectAuditEvent extends AuditEvent implements OnUpdateProper
) )
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after) public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
{ {
recordsManagementAuditService.auditEvent(nodeRef, name, before, after, false, true); recordsManagementAuditService.auditEvent(nodeRef, getName(), before, after, false, true);
} }
} }

View File

@@ -28,8 +28,6 @@ import org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoterException;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.aopalliance.intercept.MethodInvocation; import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** /**
* Abstract base policy implementation * Abstract base policy implementation
@@ -40,17 +38,14 @@ import org.apache.commons.logging.LogFactory;
public abstract class AbstractBasePolicy extends RMSecurityCommon public abstract class AbstractBasePolicy extends RMSecurityCommon
implements Policy implements Policy
{ {
/** Logger */
protected static Log logger = LogFactory.getLog(AbstractBasePolicy.class);
/** Capability service */ /** Capability service */
protected CapabilityService capabilityService; private CapabilityService capabilityService;
/** Policy register */ /** Policy register */
protected PolicyRegister policyRegister; private PolicyRegister policyRegister;
/** Policy name */ /** Policy name */
protected String name; private String name;
/** /**
* @param name policy name * @param name policy name
@@ -69,6 +64,22 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
return name; return name;
} }
/**
* @return Capability service
*/
protected CapabilityService getCapabilityService()
{
return this.capabilityService;
}
/**
* @return Policy register
*/
protected PolicyRegister getPolicyRegister()
{
return this.policyRegister;
}
/** /**
* @param capabilityService capability service * @param capabilityService capability service
*/ */
@@ -90,7 +101,7 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
*/ */
public void init() public void init()
{ {
policyRegister.registerPolicy(this); getPolicyRegister().registerPolicy(this);
} }
/** /**

View File

@@ -26,13 +26,13 @@ public class AssocPolicy extends AbstractBasePolicy
{ {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public int evaluate( public int evaluate(
MethodInvocation invocation, MethodInvocation invocation,
Class[] params, Class[] params,
ConfigAttributeDefinition cad) ConfigAttributeDefinition cad)
{ {
NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
return capabilityService.getCapability(RMPermissionModel.VIEW_RECORDS).evaluate(testNodeRef); return getCapabilityService().getCapability(RMPermissionModel.VIEW_RECORDS).evaluate(testNodeRef);
} }
} }

View File

@@ -23,7 +23,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.aopalliance.intercept.MethodInvocation; import org.aopalliance.intercept.MethodInvocation;
/** /**
* *
* @author Roy Wetherall * @author Roy Wetherall
* @since 2.1 * @since 2.1
*/ */
@@ -35,12 +35,12 @@ public class CapabilityPolicy extends AbstractBasePolicy
@Override @Override
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public int evaluate( public int evaluate(
MethodInvocation invocation, MethodInvocation invocation,
Class[] params, Class[] params,
ConfigAttributeDefinition cad) ConfigAttributeDefinition cad)
{ {
NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
return capabilityService.getCapability(RMPermissionModel.MANAGE_ACCESS_CONTROLS).evaluate(testNodeRef); return getCapabilityService().getCapability(RMPermissionModel.MANAGE_ACCESS_CONTROLS).evaluate(testNodeRef);
} }
} }

View File

@@ -27,13 +27,13 @@ public class CreatePolicy extends AbstractBasePolicy
{ {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public int evaluate( public int evaluate(
MethodInvocation invocation, MethodInvocation invocation,
Class[] params, Class[] params,
ConfigAttributeDefinition cad) ConfigAttributeDefinition cad)
{ {
NodeRef linkee = null; NodeRef linkee = null;
QName assocType = null; QName assocType = null;
// get the destination node // get the destination node
NodeRef destination = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); NodeRef destination = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
@@ -41,7 +41,7 @@ public class CreatePolicy extends AbstractBasePolicy
{ {
// get the linkee when present // get the linkee when present
linkee = getTestNode(invocation, params, cad.getParameters().get(1), cad.isParent()); linkee = getTestNode(invocation, params, cad.getParameters().get(1), cad.isParent());
// get the assoc type // get the assoc type
if(cad.getParameters().size() > 2) if(cad.getParameters().size() > 2)
{ {
@@ -49,7 +49,7 @@ public class CreatePolicy extends AbstractBasePolicy
} }
} }
return ((CreateCapability)capabilityService.getCapability("Create")).evaluate(destination, linkee, assocType); return ((CreateCapability) getCapabilityService().getCapability("Create")).evaluate(destination, linkee, assocType);
} }
} }

View File

@@ -25,13 +25,13 @@ public class DeclarePolicy extends AbstractBasePolicy
{ {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public int evaluate( public int evaluate(
MethodInvocation invocation, MethodInvocation invocation,
Class[] params, Class[] params,
ConfigAttributeDefinition cad) ConfigAttributeDefinition cad)
{ {
NodeRef declaree = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); NodeRef declaree = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
return capabilityService.getCapability("Declare").evaluate(declaree); return getCapabilityService().getCapability("Declare").evaluate(declaree);
} }
} }

View File

@@ -27,9 +27,9 @@ public class DeletePolicy extends AbstractBasePolicy
{ {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public int evaluate( public int evaluate(
MethodInvocation invocation, MethodInvocation invocation,
Class[] params, Class[] params,
ConfigAttributeDefinition cad) ConfigAttributeDefinition cad)
{ {
NodeRef deletee = null; NodeRef deletee = null;
@@ -40,7 +40,7 @@ public class DeletePolicy extends AbstractBasePolicy
if (deletee != null) if (deletee != null)
{ {
return capabilityService.getCapability("Delete").evaluate(deletee); return getCapabilityService().getCapability("Delete").evaluate(deletee);
} }
else else

View File

@@ -28,8 +28,8 @@ public class MovePolicy extends AbstractBasePolicy
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public int evaluate( public int evaluate(
MethodInvocation invocation, MethodInvocation invocation,
Class[] params, Class[] params,
ConfigAttributeDefinition cad) ConfigAttributeDefinition cad)
{ {
@@ -47,7 +47,7 @@ public class MovePolicy extends AbstractBasePolicy
if ((movee != null) && (destination != null)) if ((movee != null) && (destination != null))
{ {
return capabilityService.getCapability("Move").evaluate(movee, destination); return getCapabilityService().getCapability("Move").evaluate(movee, destination);
} }
else else
{ {

View File

@@ -24,7 +24,7 @@ import org.aopalliance.intercept.MethodInvocation;
/** /**
* Read method security policy. * Read method security policy.
* *
* @author Roy Wetherall * @author Roy Wetherall
* @since 2.1 * @since 2.1
*/ */
@@ -33,11 +33,11 @@ public class ReadPolicy extends AbstractBasePolicy
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public int evaluate( public int evaluate(
MethodInvocation invocation, MethodInvocation invocation,
Class[] params, Class[] params,
ConfigAttributeDefinition cad) ConfigAttributeDefinition cad)
{ {
NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
return capabilityService.getCapability(RMPermissionModel.VIEW_RECORDS).evaluate(testNodeRef); return getCapabilityService().getCapability(RMPermissionModel.VIEW_RECORDS).evaluate(testNodeRef);
} }
} }

View File

@@ -30,16 +30,16 @@ public class ReadPropertyPolicy extends AbstractBasePolicy
{ {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public int evaluate( public int evaluate(
MethodInvocation invocation, MethodInvocation invocation,
Class[] params, Class[] params,
ConfigAttributeDefinition cad) ConfigAttributeDefinition cad)
{ {
NodeRef nodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); NodeRef nodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
QName propertyQName = getQName(invocation, params, cad.getParameters().get(1)); QName propertyQName = getQName(invocation, params, cad.getParameters().get(1));
if(propertyQName.equals(RecordsManagementModel.PROP_HOLD_REASON)) if(propertyQName.equals(RecordsManagementModel.PROP_HOLD_REASON))
{ {
return capabilityService.getCapability(RMPermissionModel.VIEW_UPDATE_REASONS_FOR_FREEZE).evaluate(nodeRef); return getCapabilityService().getCapability(RMPermissionModel.VIEW_UPDATE_REASONS_FOR_FREEZE).evaluate(nodeRef);
} }
else else
{ {

View File

@@ -47,7 +47,7 @@ public class UpdatePolicy extends AbstractBasePolicy
properties = getProperties(invocation, params, cad.getParameters().get(2)); properties = getProperties(invocation, params, cad.getParameters().get(2));
} }
UpdateCapability updateCapability = (UpdateCapability)capabilityService.getCapability("Update"); UpdateCapability updateCapability = (UpdateCapability) getCapabilityService().getCapability("Update");
return updateCapability.evaluate(updatee, aspectQName, properties); return updateCapability.evaluate(updatee, aspectQName, properties);
} }

View File

@@ -24,13 +24,13 @@ import org.aopalliance.intercept.MethodInvocation;
public class UpdatePropertiesPolicy extends AbstractBasePolicy public class UpdatePropertiesPolicy extends AbstractBasePolicy
{ {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public int evaluate( public int evaluate(
MethodInvocation invocation, MethodInvocation invocation,
Class[] params, Class[] params,
ConfigAttributeDefinition cad) ConfigAttributeDefinition cad)
{ {
NodeRef nodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); NodeRef nodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
return capabilityService.getCapability("UpdateProperties").evaluate(nodeRef); return getCapabilityService().getCapability("UpdateProperties").evaluate(nodeRef);
} }
} }

View File

@@ -26,12 +26,12 @@ public class WriteContentPolicy extends AbstractBasePolicy
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public int evaluate( public int evaluate(
MethodInvocation invocation, MethodInvocation invocation,
Class[] params, Class[] params,
ConfigAttributeDefinition cad) ConfigAttributeDefinition cad)
{ {
NodeRef updatee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); NodeRef updatee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
return capabilityService.getCapability("WriteContent").evaluate(updatee); return getCapabilityService().getCapability("WriteContent").evaluate(updatee);
} }
} }

View File

@@ -69,10 +69,30 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
protected static final String TRANSIENT_DISPOSITION_INSTRUCTIONS = "rmDispositionInstructions"; protected static final String TRANSIENT_DISPOSITION_INSTRUCTIONS = "rmDispositionInstructions";
/** Disposition service */ /** Disposition service */
protected DispositionService dispositionService; private DispositionService dispositionService;
/** File Plan Service */ /** File Plan Service */
protected FilePlanService filePlanService; private FilePlanService filePlanService;
/**
* Returns the disposition service
*
* @return Disposition service
*/
protected DispositionService getDispositionService()
{
return this.dispositionService;
}
/**
* Returns the file plan service
*
* @return File plan service
*/
protected FilePlanService getFilePlanService()
{
return this.filePlanService;
}
/** /**
* Sets the disposition service * Sets the disposition service
@@ -103,12 +123,12 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
Form form, Form form,
Map<String, Object> context) Map<String, Object> context)
{ {
if (filePlanService.isFilePlanComponent(nodeRef)) if (getFilePlanService().isFilePlanComponent(nodeRef))
{ {
// add all the custom properties // add all the custom properties
addCustomPropertyFieldsToGroup(form, nodeRef); addCustomPropertyFieldsToGroup(form, nodeRef);
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); FilePlanComponentKind kind = getFilePlanService().getFilePlanComponentKind(nodeRef);
if (FilePlanComponentKind.RECORD.equals(kind)) if (FilePlanComponentKind.RECORD.equals(kind))
{ {
// add all the record meta-data aspect properties // add all the record meta-data aspect properties
@@ -143,7 +163,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
// 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. // level or folder level.
DispositionSchedule schedule = new DispositionScheduleImpl(this.rmServiceRegistry, this.nodeService, nodeRef); DispositionSchedule schedule = new DispositionScheduleImpl(this.rmServiceRegistry, this.nodeService, nodeRef);
if (dispositionService.hasDisposableItems(schedule)) if (getDispositionService().hasDisposableItems(schedule))
{ {
protectRecordLevelDispositionPropertyField(form); protectRecordLevelDispositionPropertyField(form);
} }
@@ -245,7 +265,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
addTransientPropertyField(form, TRANSIENT_DECLARED, DataTypeDefinition.BOOLEAN, recordService.isDeclared(nodeRef)); addTransientPropertyField(form, TRANSIENT_DECLARED, DataTypeDefinition.BOOLEAN, recordService.isDeclared(nodeRef));
} }
DispositionSchedule ds = dispositionService.getDispositionSchedule(nodeRef); DispositionSchedule ds = getDispositionService().getDispositionSchedule(nodeRef);
if (ds != null) if (ds != null)
{ {
String instructions = ds.getDispositionInstructions(); String instructions = ds.getDispositionInstructions();
@@ -254,7 +274,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
addTransientPropertyField(form, TRANSIENT_DISPOSITION_INSTRUCTIONS, DataTypeDefinition.TEXT, instructions); addTransientPropertyField(form, TRANSIENT_DISPOSITION_INSTRUCTIONS, DataTypeDefinition.TEXT, instructions);
} }
NodeRef recordCategory = dispositionService.getAssociatedRecordsManagementContainer(ds); NodeRef recordCategory = getDispositionService().getAssociatedRecordsManagementContainer(ds);
if (recordCategory != null) if (recordCategory != null)
{ {
String categoryId = (String)nodeService.getProperty(recordCategory, PROP_IDENTIFIER); String categoryId = (String)nodeService.getProperty(recordCategory, PROP_IDENTIFIER);

View File

@@ -52,16 +52,48 @@ public class FilePlanType extends BaseBehaviourBean
NodeServicePolicies.OnDeleteNodePolicy NodeServicePolicies.OnDeleteNodePolicy
{ {
/** file plan service */ /** file plan service */
protected FilePlanService filePlanService; private FilePlanService filePlanService;
/** record folder service */ /** record folder service */
protected RecordFolderService recordFolderService; private RecordFolderService recordFolderService;
/** identifier service */ /** identifier service */
protected IdentifierService identifierService; private IdentifierService identifierService;
/** file plan role service */ /** file plan role service */
protected FilePlanRoleService filePlanRoleService; private FilePlanRoleService filePlanRoleService;
/**
* @return File plan service
*/
protected FilePlanService getFilePlanService()
{
return this.filePlanService;
}
/**
* @return Record folder service
*/
protected RecordFolderService getRecordFolderService()
{
return this.recordFolderService;
}
/**
* @return Identifier service
*/
protected IdentifierService getIdentifierService()
{
return this.identifierService;
}
/**
* @return File plan role service
*/
protected FilePlanRoleService getFilePlanRoleService()
{
return this.filePlanRoleService;
}
/** /**
* @param filePlanService file plan service * @param filePlanService file plan service
@@ -114,7 +146,7 @@ public class FilePlanType extends BaseBehaviourBean
// ensure we are not trying to put a record folder in the root of the file plan // ensure we are not trying to put a record folder in the root of the file plan
NodeRef parent = childAssocRef.getParentRef(); NodeRef parent = childAssocRef.getParentRef();
if (filePlanService.isFilePlan(parent) && recordFolderService.isRecordFolder(nodeRef)) if (getFilePlanService().isFilePlan(parent) && getRecordFolderService().isRecordFolder(nodeRef))
{ {
throw new AlfrescoRuntimeException("Operation failed, because you can not place a record folder in the root of the file plan."); throw new AlfrescoRuntimeException("Operation failed, because you can not place a record folder in the root of the file plan.");
} }
@@ -141,7 +173,7 @@ public class FilePlanType extends BaseBehaviourBean
if (nodeService.hasAspect(filePlan, ASPECT_FILE_PLAN_COMPONENT) && if (nodeService.hasAspect(filePlan, ASPECT_FILE_PLAN_COMPONENT) &&
nodeService.getProperty(filePlan, PROP_IDENTIFIER) == null) nodeService.getProperty(filePlan, PROP_IDENTIFIER) == null)
{ {
String id = identifierService.generateIdentifier(filePlan); String id = getIdentifierService().generateIdentifier(filePlan);
nodeService.setProperty(filePlan, RecordsManagementModel.PROP_IDENTIFIER, id); nodeService.setProperty(filePlan, RecordsManagementModel.PROP_IDENTIFIER, id);
} }
@@ -150,7 +182,7 @@ public class FilePlanType extends BaseBehaviourBean
}); });
// setup the file plan roles // setup the file plan roles
filePlanRoleService.setupFilePlanRoles(filePlan); getFilePlanRoleService().setupFilePlanRoles(filePlan);
} }
/** /**
@@ -165,6 +197,6 @@ public class FilePlanType extends BaseBehaviourBean
public void onDeleteNode(ChildAssociationRef childAssocRef, boolean archived) public void onDeleteNode(ChildAssociationRef childAssocRef, boolean archived)
{ {
// tear down the file plan roles // tear down the file plan roles
filePlanRoleService.tearDownFilePlanRoles(childAssocRef.getChildRef()); getFilePlanRoleService().tearDownFilePlanRoles(childAssocRef.getChildRef());
} }
} }