mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
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:
@@ -41,19 +41,35 @@ public abstract class RecordsManagementActionConditionEvaluatorAbstractBase exte
|
||||
BeanNameAware
|
||||
{
|
||||
/** records management action service */
|
||||
protected RecordsManagementActionService recordsManagementActionService;
|
||||
private RecordsManagementActionService recordsManagementActionService;
|
||||
|
||||
/** File Plan Service */
|
||||
protected FilePlanService filePlanService;
|
||||
private FilePlanService filePlanService;
|
||||
|
||||
/** bean name */
|
||||
private String name;
|
||||
|
||||
/** public condition */
|
||||
protected boolean publicCondition = true;
|
||||
private boolean publicCondition = true;
|
||||
|
||||
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
|
||||
*/
|
||||
@@ -95,7 +111,7 @@ public abstract class RecordsManagementActionConditionEvaluatorAbstractBase exte
|
||||
{
|
||||
public Void execute()
|
||||
{
|
||||
recordsManagementActionService.register(RecordsManagementActionConditionEvaluatorAbstractBase.this);
|
||||
getRecordsManagementActionService().register(RecordsManagementActionConditionEvaluatorAbstractBase.this);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@@ -60,15 +60,31 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
||||
private Map<String, RecordsManagementAction> dispositionActions = new HashMap<String, RecordsManagementAction>(5);
|
||||
|
||||
/** Policy component */
|
||||
PolicyComponent policyComponent;
|
||||
private PolicyComponent policyComponent;
|
||||
|
||||
/** Node service */
|
||||
NodeService nodeService;
|
||||
private NodeService nodeService;
|
||||
|
||||
/** Policy delegates */
|
||||
private ClassPolicyDelegate<BeforeRMActionExecution> beforeRMActionExecutionDelegate;
|
||||
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
|
||||
*
|
||||
@@ -95,8 +111,8 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
||||
public void init()
|
||||
{
|
||||
// Register the various policies
|
||||
beforeRMActionExecutionDelegate = policyComponent.registerClassPolicy(BeforeRMActionExecution.class);
|
||||
onRMActionExecutionDelegate = policyComponent.registerClassPolicy(OnRMActionExecution.class);
|
||||
beforeRMActionExecutionDelegate = getPolicyComponent().registerClassPolicy(BeforeRMActionExecution.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)
|
||||
{
|
||||
// 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
|
||||
BeforeRMActionExecution policy = beforeRMActionExecutionDelegate.get(qnames);
|
||||
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)
|
||||
{
|
||||
// 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
|
||||
OnRMActionExecution policy = onRMActionExecutionDelegate.get(qnames);
|
||||
policy.onRMActionExecution(nodeRef, name, parameters);
|
||||
@@ -260,7 +276,7 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
|
||||
// Execute action
|
||||
invokeBeforeRMActionExecution(nodeRef, name, parameters);
|
||||
RecordsManagementActionResult result = rmAction.execute(nodeRef, parameters);
|
||||
if (nodeService.exists(nodeRef))
|
||||
if (getNodeService().exists(nodeRef))
|
||||
{
|
||||
invokeOnRMActionExecution(nodeRef, name, parameters);
|
||||
}
|
||||
|
@@ -34,7 +34,7 @@ import org.alfresco.service.namespace.QName;
|
||||
/**
|
||||
* Records management IsKind evaluator that evaluates according to the file plan
|
||||
* component kind passed in.
|
||||
*
|
||||
*
|
||||
* @author Craig Tan
|
||||
* @since 2.1
|
||||
*/
|
||||
@@ -55,7 +55,7 @@ public class IsKindEvaluator extends RecordsManagementActionConditionEvaluatorAb
|
||||
boolean result = false;
|
||||
String kind = ((QName) actionCondition.getParameterValue(PARAM_KIND)).getLocalName();
|
||||
|
||||
FilePlanComponentKind filePlanComponentKind = filePlanService.getFilePlanComponentKind(actionedUponNodeRef);
|
||||
FilePlanComponentKind filePlanComponentKind = getFilePlanService().getFilePlanComponentKind(actionedUponNodeRef);
|
||||
|
||||
if (filePlanComponentKind != null &&
|
||||
filePlanComponentKind.toString().equals(kind))
|
||||
|
@@ -51,7 +51,27 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr
|
||||
{
|
||||
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
|
||||
@@ -120,15 +140,15 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr
|
||||
{
|
||||
try
|
||||
{
|
||||
if(mode == CopyMoveLinkFileToActionMode.MOVE)
|
||||
if(getMode() == CopyMoveLinkFileToActionMode.MOVE)
|
||||
{
|
||||
fileFolderService.move(actionedUponNodeRef, finalRecordFolder, null);
|
||||
}
|
||||
else if(mode == CopyMoveLinkFileToActionMode.COPY)
|
||||
else if(getMode() == CopyMoveLinkFileToActionMode.COPY)
|
||||
{
|
||||
fileFolderService.copy(actionedUponNodeRef, finalRecordFolder, null);
|
||||
}
|
||||
else if(mode == CopyMoveLinkFileToActionMode.LINK)
|
||||
else if(getMode() == CopyMoveLinkFileToActionMode.LINK)
|
||||
{
|
||||
recordService.link(actionedUponNodeRef, finalRecordFolder);
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
package org.alfresco.module.org_alfresco_module_rm.action.impl;
|
||||
|
||||
|
||||
/**
|
||||
* File To action implementation.
|
||||
*
|
||||
@@ -16,6 +15,6 @@ public class CopyToAction extends CopyMoveLinkFileToBaseAction
|
||||
public void init()
|
||||
{
|
||||
super.init();
|
||||
this.mode = CopyMoveLinkFileToActionMode.COPY;
|
||||
setMode(CopyMoveLinkFileToActionMode.COPY);
|
||||
}
|
||||
}
|
@@ -1,6 +1,5 @@
|
||||
package org.alfresco.module.org_alfresco_module_rm.action.impl;
|
||||
|
||||
|
||||
/**
|
||||
* File To action implementation.
|
||||
*
|
||||
@@ -16,6 +15,6 @@ public class FileToAction extends CopyMoveLinkFileToBaseAction
|
||||
public void init()
|
||||
{
|
||||
super.init();
|
||||
this.mode = CopyMoveLinkFileToActionMode.MOVE;
|
||||
setMode(CopyMoveLinkFileToActionMode.MOVE);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
package org.alfresco.module.org_alfresco_module_rm.action.impl;
|
||||
|
||||
|
||||
/**
|
||||
* Link To action implementation.
|
||||
*
|
||||
@@ -16,6 +15,6 @@ public class LinkToAction extends CopyMoveLinkFileToBaseAction
|
||||
public void init()
|
||||
{
|
||||
super.init();
|
||||
this.mode = CopyMoveLinkFileToActionMode.LINK;
|
||||
setMode(CopyMoveLinkFileToActionMode.LINK);
|
||||
}
|
||||
}
|
@@ -1,6 +1,5 @@
|
||||
package org.alfresco.module.org_alfresco_module_rm.action.impl;
|
||||
|
||||
|
||||
/**
|
||||
* File To action implementation.
|
||||
*
|
||||
@@ -16,6 +15,6 @@ public class MoveToAction extends CopyMoveLinkFileToBaseAction
|
||||
public void init()
|
||||
{
|
||||
super.init();
|
||||
this.mode = CopyMoveLinkFileToActionMode.MOVE;
|
||||
setMode(CopyMoveLinkFileToActionMode.MOVE);
|
||||
}
|
||||
}
|
@@ -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.model.RecordsManagementModel;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
|
||||
|
||||
/**
|
||||
* Class to represent an audit event
|
||||
*
|
||||
@@ -34,14 +34,14 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
||||
public class AuditEvent implements RecordsManagementModel, Comparable<AuditEvent>
|
||||
{
|
||||
/** Name */
|
||||
protected String name;
|
||||
|
||||
private String name;
|
||||
|
||||
/** Label */
|
||||
protected String label;
|
||||
|
||||
private String label;
|
||||
|
||||
/** Records management audit service */
|
||||
protected RecordsManagementAuditService recordsManagementAuditService;
|
||||
|
||||
protected RecordsManagementAuditService recordsManagementAuditService;
|
||||
|
||||
/**
|
||||
* @param recordsManagementAuditService records management audit service
|
||||
*/
|
||||
@@ -49,18 +49,18 @@ public class AuditEvent implements RecordsManagementModel, Comparable<AuditEvent
|
||||
{
|
||||
this.recordsManagementAuditService = recordsManagementAuditService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Init method
|
||||
*/
|
||||
public void init()
|
||||
{
|
||||
{
|
||||
ParameterCheck.mandatory("name", name);
|
||||
ParameterCheck.mandatory("label", label);
|
||||
|
||||
|
||||
recordsManagementAuditService.registerAuditEvent(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
@@ -68,10 +68,10 @@ public class AuditEvent implements RecordsManagementModel, Comparable<AuditEvent
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*
|
||||
*
|
||||
* @param name audit event name
|
||||
* @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("label", label);
|
||||
|
||||
this.name = name;
|
||||
this.label = label;
|
||||
|
||||
setName(name);
|
||||
setLabel(label);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return audit event name
|
||||
*/
|
||||
@@ -91,11 +91,11 @@ public class AuditEvent implements RecordsManagementModel, Comparable<AuditEvent
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param name audit event name
|
||||
*/
|
||||
public void setName(String name)
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
@@ -106,26 +106,26 @@ public class AuditEvent implements RecordsManagementModel, Comparable<AuditEvent
|
||||
public String getLabel()
|
||||
{
|
||||
String lookup = I18NUtil.getMessage(label);
|
||||
if (lookup == null)
|
||||
if (StringUtils.isBlank(lookup))
|
||||
{
|
||||
lookup = label;
|
||||
}
|
||||
return lookup;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param label audit event label
|
||||
*/
|
||||
public void setLabel(String label)
|
||||
public void setLabel(String label)
|
||||
{
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare by label.
|
||||
*
|
||||
*
|
||||
* @param compare compare to audit event
|
||||
* @return int
|
||||
* @return int
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(AuditEvent compare)
|
||||
|
@@ -26,7 +26,7 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
|
||||
/**
|
||||
* Audits the creation of file plan component objects
|
||||
*
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.1
|
||||
*/
|
||||
@@ -44,6 +44,6 @@ public class CreateObjectAuditEvent extends AuditEvent implements OnCreateNodePo
|
||||
)
|
||||
public void onCreateNode(ChildAssociationRef childAssocRef)
|
||||
{
|
||||
recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), name);
|
||||
recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName());
|
||||
}
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
|
||||
/**
|
||||
* Audits person creation.
|
||||
*
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.1
|
||||
*/
|
||||
@@ -44,6 +44,6 @@ public class CreatePersonAuditEvent extends AuditEvent implements OnCreateNodePo
|
||||
)
|
||||
public void onCreateNode(ChildAssociationRef childAssocRef)
|
||||
{
|
||||
recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), name);
|
||||
recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName());
|
||||
}
|
||||
}
|
||||
|
@@ -26,13 +26,13 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
/**
|
||||
* Audits file plan component delete
|
||||
*
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.1
|
||||
*/
|
||||
@BehaviourBean
|
||||
public class DeleteObjectAuditEvent extends AuditEvent implements BeforeDeleteNodePolicy
|
||||
{
|
||||
{
|
||||
/**
|
||||
* @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,
|
||||
type = "rma:filePlanComponent"
|
||||
)
|
||||
)
|
||||
public void beforeDeleteNode(NodeRef nodeRef)
|
||||
{
|
||||
recordsManagementAuditService.auditEvent(nodeRef, name, null, null, true, false);
|
||||
recordsManagementAuditService.auditEvent(nodeRef, getName(), null, null, true, false);
|
||||
}
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* Audits file plan component property updates
|
||||
*
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @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)
|
||||
{
|
||||
recordsManagementAuditService.auditEvent(nodeRef, name, before, after, false, true);
|
||||
recordsManagementAuditService.auditEvent(nodeRef, getName(), before, after, false, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -28,8 +28,6 @@ import org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoterException;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Abstract base policy implementation
|
||||
@@ -40,17 +38,14 @@ import org.apache.commons.logging.LogFactory;
|
||||
public abstract class AbstractBasePolicy extends RMSecurityCommon
|
||||
implements Policy
|
||||
{
|
||||
/** Logger */
|
||||
protected static Log logger = LogFactory.getLog(AbstractBasePolicy.class);
|
||||
|
||||
/** Capability service */
|
||||
protected CapabilityService capabilityService;
|
||||
private CapabilityService capabilityService;
|
||||
|
||||
/** Policy register */
|
||||
protected PolicyRegister policyRegister;
|
||||
private PolicyRegister policyRegister;
|
||||
|
||||
/** Policy name */
|
||||
protected String name;
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* @param name policy name
|
||||
@@ -69,6 +64,22 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Capability service
|
||||
*/
|
||||
protected CapabilityService getCapabilityService()
|
||||
{
|
||||
return this.capabilityService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Policy register
|
||||
*/
|
||||
protected PolicyRegister getPolicyRegister()
|
||||
{
|
||||
return this.policyRegister;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param capabilityService capability service
|
||||
*/
|
||||
@@ -90,7 +101,7 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
|
||||
*/
|
||||
public void init()
|
||||
{
|
||||
policyRegister.registerPolicy(this);
|
||||
getPolicyRegister().registerPolicy(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -26,13 +26,13 @@ public class AssocPolicy extends AbstractBasePolicy
|
||||
{
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public int evaluate(
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
public int evaluate(
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
ConfigAttributeDefinition cad)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
@@ -23,7 +23,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.1
|
||||
*/
|
||||
@@ -35,12 +35,12 @@ public class CapabilityPolicy extends AbstractBasePolicy
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public int evaluate(
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
ConfigAttributeDefinition cad)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
@@ -27,13 +27,13 @@ public class CreatePolicy extends AbstractBasePolicy
|
||||
{
|
||||
@SuppressWarnings("rawtypes")
|
||||
public int evaluate(
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
ConfigAttributeDefinition cad)
|
||||
{
|
||||
NodeRef linkee = null;
|
||||
QName assocType = null;
|
||||
|
||||
|
||||
// get the destination node
|
||||
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
|
||||
linkee = getTestNode(invocation, params, cad.getParameters().get(1), cad.isParent());
|
||||
|
||||
|
||||
// get the assoc type
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
@@ -25,13 +25,13 @@ public class DeclarePolicy extends AbstractBasePolicy
|
||||
{
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public int evaluate(
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
public int evaluate(
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
ConfigAttributeDefinition cad)
|
||||
{
|
||||
NodeRef declaree = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
|
||||
return capabilityService.getCapability("Declare").evaluate(declaree);
|
||||
return getCapabilityService().getCapability("Declare").evaluate(declaree);
|
||||
}
|
||||
|
||||
}
|
@@ -27,9 +27,9 @@ public class DeletePolicy extends AbstractBasePolicy
|
||||
{
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public int evaluate(
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
public int evaluate(
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
ConfigAttributeDefinition cad)
|
||||
{
|
||||
NodeRef deletee = null;
|
||||
@@ -40,7 +40,7 @@ public class DeletePolicy extends AbstractBasePolicy
|
||||
if (deletee != null)
|
||||
{
|
||||
|
||||
return capabilityService.getCapability("Delete").evaluate(deletee);
|
||||
return getCapabilityService().getCapability("Delete").evaluate(deletee);
|
||||
|
||||
}
|
||||
else
|
||||
|
@@ -28,8 +28,8 @@ public class MovePolicy extends AbstractBasePolicy
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public int evaluate(
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
ConfigAttributeDefinition cad)
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ public class MovePolicy extends AbstractBasePolicy
|
||||
|
||||
if ((movee != null) && (destination != null))
|
||||
{
|
||||
return capabilityService.getCapability("Move").evaluate(movee, destination);
|
||||
return getCapabilityService().getCapability("Move").evaluate(movee, destination);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -24,7 +24,7 @@ import org.aopalliance.intercept.MethodInvocation;
|
||||
|
||||
/**
|
||||
* Read method security policy.
|
||||
*
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.1
|
||||
*/
|
||||
@@ -33,11 +33,11 @@ public class ReadPolicy extends AbstractBasePolicy
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public int evaluate(
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
ConfigAttributeDefinition cad)
|
||||
{
|
||||
NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
|
||||
return capabilityService.getCapability(RMPermissionModel.VIEW_RECORDS).evaluate(testNodeRef);
|
||||
NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
|
||||
return getCapabilityService().getCapability(RMPermissionModel.VIEW_RECORDS).evaluate(testNodeRef);
|
||||
}
|
||||
}
|
@@ -30,16 +30,16 @@ public class ReadPropertyPolicy extends AbstractBasePolicy
|
||||
{
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public int evaluate(
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
public int evaluate(
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
ConfigAttributeDefinition cad)
|
||||
{
|
||||
NodeRef nodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
|
||||
QName propertyQName = getQName(invocation, params, cad.getParameters().get(1));
|
||||
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
|
||||
{
|
||||
|
@@ -47,7 +47,7 @@ public class UpdatePolicy extends AbstractBasePolicy
|
||||
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);
|
||||
}
|
||||
|
||||
|
@@ -24,13 +24,13 @@ import org.aopalliance.intercept.MethodInvocation;
|
||||
public class UpdatePropertiesPolicy extends AbstractBasePolicy
|
||||
{
|
||||
@SuppressWarnings("rawtypes")
|
||||
public int evaluate(
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
public int evaluate(
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
ConfigAttributeDefinition cad)
|
||||
{
|
||||
NodeRef nodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
|
||||
return capabilityService.getCapability("UpdateProperties").evaluate(nodeRef);
|
||||
return getCapabilityService().getCapability("UpdateProperties").evaluate(nodeRef);
|
||||
}
|
||||
|
||||
}
|
@@ -26,12 +26,12 @@ public class WriteContentPolicy extends AbstractBasePolicy
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public int evaluate(
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
MethodInvocation invocation,
|
||||
Class[] params,
|
||||
ConfigAttributeDefinition cad)
|
||||
{
|
||||
NodeRef updatee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
|
||||
return capabilityService.getCapability("WriteContent").evaluate(updatee);
|
||||
return getCapabilityService().getCapability("WriteContent").evaluate(updatee);
|
||||
}
|
||||
|
||||
}
|
@@ -69,10 +69,30 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
|
||||
protected static final String TRANSIENT_DISPOSITION_INSTRUCTIONS = "rmDispositionInstructions";
|
||||
|
||||
/** Disposition service */
|
||||
protected DispositionService dispositionService;
|
||||
private DispositionService dispositionService;
|
||||
|
||||
/** 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
|
||||
@@ -103,12 +123,12 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
|
||||
Form form,
|
||||
Map<String, Object> context)
|
||||
{
|
||||
if (filePlanService.isFilePlanComponent(nodeRef))
|
||||
if (getFilePlanService().isFilePlanComponent(nodeRef))
|
||||
{
|
||||
// add all the custom properties
|
||||
addCustomPropertyFieldsToGroup(form, nodeRef);
|
||||
|
||||
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
|
||||
FilePlanComponentKind kind = getFilePlanService().getFilePlanComponentKind(nodeRef);
|
||||
if (FilePlanComponentKind.RECORD.equals(kind))
|
||||
{
|
||||
// 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
|
||||
// level or folder level.
|
||||
DispositionSchedule schedule = new DispositionScheduleImpl(this.rmServiceRegistry, this.nodeService, nodeRef);
|
||||
if (dispositionService.hasDisposableItems(schedule))
|
||||
if (getDispositionService().hasDisposableItems(schedule))
|
||||
{
|
||||
protectRecordLevelDispositionPropertyField(form);
|
||||
}
|
||||
@@ -245,7 +265,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
|
||||
addTransientPropertyField(form, TRANSIENT_DECLARED, DataTypeDefinition.BOOLEAN, recordService.isDeclared(nodeRef));
|
||||
}
|
||||
|
||||
DispositionSchedule ds = dispositionService.getDispositionSchedule(nodeRef);
|
||||
DispositionSchedule ds = getDispositionService().getDispositionSchedule(nodeRef);
|
||||
if (ds != null)
|
||||
{
|
||||
String instructions = ds.getDispositionInstructions();
|
||||
@@ -254,7 +274,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
|
||||
addTransientPropertyField(form, TRANSIENT_DISPOSITION_INSTRUCTIONS, DataTypeDefinition.TEXT, instructions);
|
||||
}
|
||||
|
||||
NodeRef recordCategory = dispositionService.getAssociatedRecordsManagementContainer(ds);
|
||||
NodeRef recordCategory = getDispositionService().getAssociatedRecordsManagementContainer(ds);
|
||||
if (recordCategory != null)
|
||||
{
|
||||
String categoryId = (String)nodeService.getProperty(recordCategory, PROP_IDENTIFIER);
|
||||
|
@@ -52,16 +52,48 @@ public class FilePlanType extends BaseBehaviourBean
|
||||
NodeServicePolicies.OnDeleteNodePolicy
|
||||
{
|
||||
/** file plan service */
|
||||
protected FilePlanService filePlanService;
|
||||
private FilePlanService filePlanService;
|
||||
|
||||
/** record folder service */
|
||||
protected RecordFolderService recordFolderService;
|
||||
private RecordFolderService recordFolderService;
|
||||
|
||||
/** identifier service */
|
||||
protected IdentifierService identifierService;
|
||||
private IdentifierService identifierService;
|
||||
|
||||
/** 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
|
||||
@@ -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
|
||||
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.");
|
||||
}
|
||||
@@ -141,7 +173,7 @@ public class FilePlanType extends BaseBehaviourBean
|
||||
if (nodeService.hasAspect(filePlan, ASPECT_FILE_PLAN_COMPONENT) &&
|
||||
nodeService.getProperty(filePlan, PROP_IDENTIFIER) == null)
|
||||
{
|
||||
String id = identifierService.generateIdentifier(filePlan);
|
||||
String id = getIdentifierService().generateIdentifier(filePlan);
|
||||
nodeService.setProperty(filePlan, RecordsManagementModel.PROP_IDENTIFIER, id);
|
||||
}
|
||||
|
||||
@@ -150,7 +182,7 @@ public class FilePlanType extends BaseBehaviourBean
|
||||
});
|
||||
|
||||
// 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)
|
||||
{
|
||||
// tear down the file plan roles
|
||||
filePlanRoleService.tearDownFilePlanRoles(childAssocRef.getChildRef());
|
||||
getFilePlanRoleService().tearDownFilePlanRoles(childAssocRef.getChildRef());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user