mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fixed minor issues ("Empty Statement") reported in Sonar
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@71951 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -88,7 +88,7 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr
|
|||||||
String actionName = action.getActionDefinitionName();
|
String actionName = action.getActionDefinitionName();
|
||||||
if (isOkToProceedWithAction(actionedUponNodeRef, actionName))
|
if (isOkToProceedWithAction(actionedUponNodeRef, actionName))
|
||||||
{
|
{
|
||||||
QName actionedUponType = nodeService.getType(actionedUponNodeRef);;
|
QName actionedUponType = nodeService.getType(actionedUponNodeRef);
|
||||||
|
|
||||||
boolean targetIsUnfiledRecords;
|
boolean targetIsUnfiledRecords;
|
||||||
if (ACTION_FILETO.equals(action.getActionDefinitionName()))
|
if (ACTION_FILETO.equals(action.getActionDefinitionName()))
|
||||||
|
@@ -28,14 +28,14 @@ import org.alfresco.service.namespace.RegexQNamePattern;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Evaluates whether the node in question is transferring is either a transfer or accession.
|
* Evaluates whether the node in question is transferring is either a transfer or accession.
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
*/
|
*/
|
||||||
public class TransferEvaluator extends BaseEvaluator
|
public class TransferEvaluator extends BaseEvaluator
|
||||||
{
|
{
|
||||||
/** indicates whether we are looking for accessions or transfers */
|
/** indicates whether we are looking for accessions or transfers */
|
||||||
private boolean transferAccessionIndicator = false;
|
private boolean transferAccessionIndicator = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param transferAccessionIndicator true if accession, false otherwise
|
* @param transferAccessionIndicator true if accession, false otherwise
|
||||||
*/
|
*/
|
||||||
@@ -43,7 +43,7 @@ public class TransferEvaluator extends BaseEvaluator
|
|||||||
{
|
{
|
||||||
this.transferAccessionIndicator = transferAccessionIndicator;
|
this.transferAccessionIndicator = transferAccessionIndicator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef)
|
* @see org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef)
|
||||||
*/
|
*/
|
||||||
@@ -51,29 +51,29 @@ public class TransferEvaluator extends BaseEvaluator
|
|||||||
protected boolean evaluateImpl(NodeRef nodeRef)
|
protected boolean evaluateImpl(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
|
|
||||||
NodeRef transfer = getTransferNodeRef(nodeRef);
|
NodeRef transfer = getTransferNodeRef(nodeRef);
|
||||||
if (transfer != null)
|
if (transfer != null)
|
||||||
{
|
{
|
||||||
boolean actual = ((Boolean)nodeService.getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR)).booleanValue();
|
boolean actual = ((Boolean)nodeService.getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR)).booleanValue();
|
||||||
result = (actual == transferAccessionIndicator);
|
result = (actual == transferAccessionIndicator);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to get the transfer node reference.
|
* Helper method to get the transfer node reference.
|
||||||
* <p>
|
* <p>
|
||||||
* Takes into account records in tranferred record folders.
|
* Takes into account records in tranferred record folders.
|
||||||
*
|
*
|
||||||
* @param nodeRef node reference
|
* @param nodeRef node reference
|
||||||
* @return {@link NodeRef} transfer node
|
* @return {@link NodeRef} transfer node
|
||||||
*/
|
*/
|
||||||
private NodeRef getTransferNodeRef(NodeRef nodeRef)
|
private NodeRef getTransferNodeRef(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
NodeRef result = null;
|
NodeRef result = null;
|
||||||
|
|
||||||
List<ChildAssociationRef> parents = nodeService.getParentAssocs(nodeRef, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL);
|
List<ChildAssociationRef> parents = nodeService.getParentAssocs(nodeRef, RecordsManagementModel.ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL);
|
||||||
if (parents.size() == 1)
|
if (parents.size() == 1)
|
||||||
{
|
{
|
||||||
@@ -90,10 +90,10 @@ public class TransferEvaluator extends BaseEvaluator
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
* <p>
|
* <p>
|
||||||
* Provides a way to record information about the capabilities being executed and report
|
* Provides a way to record information about the capabilities being executed and report
|
||||||
* when an access denied exception is thrown.
|
* when an access denied exception is thrown.
|
||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
* @since 2.2
|
* @since 2.2
|
||||||
*/
|
*/
|
||||||
@@ -28,20 +28,20 @@ public class RMMethodSecurityInterceptor extends MethodSecurityInterceptor
|
|||||||
{
|
{
|
||||||
/** logger */
|
/** logger */
|
||||||
protected static Log logger = LogFactory.getLog(RMMethodSecurityInterceptor.class);
|
protected static Log logger = LogFactory.getLog(RMMethodSecurityInterceptor.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper class to hold capability report information
|
* Helper class to hold capability report information
|
||||||
*/
|
*/
|
||||||
private static class CapabilityReport
|
private static class CapabilityReport
|
||||||
{
|
{
|
||||||
public String name;
|
public String name;
|
||||||
public AccessStatus status;
|
public AccessStatus status;
|
||||||
public Map<String, Boolean> conditions = new HashMap<String, Boolean>();
|
public Map<String, Boolean> conditions = new HashMap<String, Boolean>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to translate vote to access status.
|
* Helper method to translate vote to access status.
|
||||||
*
|
*
|
||||||
* @param vote vote
|
* @param vote vote
|
||||||
* @return {@link AccessStatus} access status
|
* @return {@link AccessStatus} access status
|
||||||
*/
|
*/
|
||||||
@@ -59,7 +59,7 @@ public class RMMethodSecurityInterceptor extends MethodSecurityInterceptor
|
|||||||
return AccessStatus.UNDETERMINED;
|
return AccessStatus.UNDETERMINED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current capability report details.
|
* Current capability report details.
|
||||||
* <p>
|
* <p>
|
||||||
@@ -68,17 +68,17 @@ public class RMMethodSecurityInterceptor extends MethodSecurityInterceptor
|
|||||||
private static final ThreadLocal<Map<String, CapabilityReport>> capabilities = new ThreadLocal<Map<String, CapabilityReport>>()
|
private static final ThreadLocal<Map<String, CapabilityReport>> capabilities = new ThreadLocal<Map<String, CapabilityReport>>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, CapabilityReport> initialValue()
|
protected Map<String, CapabilityReport> initialValue()
|
||||||
{
|
{
|
||||||
return new HashMap<String, CapabilityReport>();
|
return new HashMap<String, CapabilityReport>();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get capability report object from the thread local, creating one for
|
* Get capability report object from the thread local, creating one for
|
||||||
* the given capability name if one does not already exist.
|
* the given capability name if one does not already exist.
|
||||||
*
|
*
|
||||||
* @param name capability name
|
* @param name capability name
|
||||||
* @return {@link CapabilityReport} object containing information about the capability
|
* @return {@link CapabilityReport} object containing information about the capability
|
||||||
*/
|
*/
|
||||||
private static final CapabilityReport getCapabilityReport(String name)
|
private static final CapabilityReport getCapabilityReport(String name)
|
||||||
@@ -89,15 +89,15 @@ public class RMMethodSecurityInterceptor extends MethodSecurityInterceptor
|
|||||||
{
|
{
|
||||||
capability = new CapabilityReport();
|
capability = new CapabilityReport();
|
||||||
capability.name = name;
|
capability.name = name;
|
||||||
|
|
||||||
map.put(name, capability);
|
map.put(name, capability);
|
||||||
}
|
}
|
||||||
return capability;
|
return capability;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report capability status.
|
* Report capability status.
|
||||||
*
|
*
|
||||||
* @param name capability name
|
* @param name capability name
|
||||||
* @param status capability status
|
* @param status capability status
|
||||||
*/
|
*/
|
||||||
@@ -106,13 +106,13 @@ public class RMMethodSecurityInterceptor extends MethodSecurityInterceptor
|
|||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
CapabilityReport capability = getCapabilityReport(name);
|
CapabilityReport capability = getCapabilityReport(name);
|
||||||
capability.status = translate(status);;
|
capability.status = translate(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report capability condition.
|
* Report capability condition.
|
||||||
*
|
*
|
||||||
* @param name capability name
|
* @param name capability name
|
||||||
* @param conditionName capability condition name
|
* @param conditionName capability condition name
|
||||||
* @param expected expected value
|
* @param expected expected value
|
||||||
@@ -130,23 +130,23 @@ public class RMMethodSecurityInterceptor extends MethodSecurityInterceptor
|
|||||||
capability.conditions.put(conditionName, (expected == actual));
|
capability.conditions.put(conditionName, (expected == actual));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the failure report for the currently recorded capabilities.
|
* Gets the failure report for the currently recorded capabilities.
|
||||||
*
|
*
|
||||||
* @return {@link String} capability error report
|
* @return {@link String} capability error report
|
||||||
*/
|
*/
|
||||||
public String getFailureReport()
|
public String getFailureReport()
|
||||||
{
|
{
|
||||||
String result = null;
|
String result = null;
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
Collection<CapabilityReport> capabilities = RMMethodSecurityInterceptor.capabilities.get().values();
|
Collection<CapabilityReport> capabilities = RMMethodSecurityInterceptor.capabilities.get().values();
|
||||||
|
|
||||||
if (!capabilities.isEmpty())
|
if (!capabilities.isEmpty())
|
||||||
{
|
{
|
||||||
StringBuffer buffer = new StringBuffer("\n");
|
StringBuffer buffer = new StringBuffer("\n");
|
||||||
for (CapabilityReport capability : capabilities)
|
for (CapabilityReport capability : capabilities)
|
||||||
{
|
{
|
||||||
buffer.append(" ").append(capability.name).append(" (").append(capability.status).append(")\n");
|
buffer.append(" ").append(capability.name).append(" (").append(capability.status).append(")\n");
|
||||||
@@ -167,14 +167,14 @@ public class RMMethodSecurityInterceptor extends MethodSecurityInterceptor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = buffer.toString();
|
result = buffer.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see net.sf.acegisecurity.intercept.AbstractSecurityInterceptor#beforeInvocation(java.lang.Object)
|
* @see net.sf.acegisecurity.intercept.AbstractSecurityInterceptor#beforeInvocation(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
@@ -186,7 +186,7 @@ public class RMMethodSecurityInterceptor extends MethodSecurityInterceptor
|
|||||||
{
|
{
|
||||||
// clear the capability report information
|
// clear the capability report information
|
||||||
RMMethodSecurityInterceptor.capabilities.remove();
|
RMMethodSecurityInterceptor.capabilities.remove();
|
||||||
|
|
||||||
result = super.beforeInvocation(object);
|
result = super.beforeInvocation(object);
|
||||||
}
|
}
|
||||||
catch (AccessDeniedException exception)
|
catch (AccessDeniedException exception)
|
||||||
@@ -204,21 +204,21 @@ public class RMMethodSecurityInterceptor extends MethodSecurityInterceptor
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor#invoke(org.aopalliance.intercept.MethodInvocation)
|
* @see net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor#invoke(org.aopalliance.intercept.MethodInvocation)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object invoke(MethodInvocation mi) throws Throwable
|
public Object invoke(MethodInvocation mi) throws Throwable
|
||||||
{
|
{
|
||||||
Object result = null;
|
Object result = null;
|
||||||
InterceptorStatusToken token = beforeInvocation(mi);
|
InterceptorStatusToken token = beforeInvocation(mi);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
result = mi.proceed();
|
result = mi.proceed();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
result = super.afterInvocation(token, result);
|
result = super.afterInvocation(token, result);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user