mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fixed major issues reported by sonar (Unnecessary Local Before Return)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@64827 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1196,31 +1196,28 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
invokeOnRemoveReference(fromNode, toNode, assocId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomReferencesFrom(org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
public List<AssociationRef> getCustomReferencesFrom(NodeRef node)
|
||||
{
|
||||
List<AssociationRef> retrievedAssocs = nodeService.getTargetAssocs(node, RegexQNamePattern.MATCH_ALL);
|
||||
return retrievedAssocs;
|
||||
}
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomReferencesFrom(org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
public List<AssociationRef> getCustomReferencesFrom(NodeRef node)
|
||||
{
|
||||
return nodeService.getTargetAssocs(node, RegexQNamePattern.MATCH_ALL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomChildReferences(org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
public List<ChildAssociationRef> getCustomChildReferences(NodeRef node)
|
||||
{
|
||||
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(node);
|
||||
return childAssocs;
|
||||
}
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomChildReferences(org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
public List<ChildAssociationRef> getCustomChildReferences(NodeRef node)
|
||||
{
|
||||
return nodeService.getChildAssocs(node);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomReferencesTo(org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomReferencesTo(org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
public List<AssociationRef> getCustomReferencesTo(NodeRef node)
|
||||
{
|
||||
List<AssociationRef> retrievedAssocs = nodeService.getSourceAssocs(node, RegexQNamePattern.MATCH_ALL);
|
||||
return retrievedAssocs;
|
||||
return nodeService.getSourceAssocs(node, RegexQNamePattern.MATCH_ALL);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1228,8 +1225,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
*/
|
||||
public List<ChildAssociationRef> getCustomParentReferences(NodeRef node)
|
||||
{
|
||||
List<ChildAssociationRef> result = nodeService.getParentAssocs(node);
|
||||
return result;
|
||||
return nodeService.getParentAssocs(node);
|
||||
}
|
||||
|
||||
// note: currently RMC custom assocs only
|
||||
|
@@ -421,8 +421,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon
|
||||
{
|
||||
ResultSet raw = returnedObject.getWrapped();
|
||||
ResultSet filteredForPermissions = decide(authentication, object, config, raw);
|
||||
PagingLuceneResultSet newPaging = new PagingLuceneResultSet(filteredForPermissions, returnedObject.getResultSetMetaData().getSearchParameters(), nodeService);
|
||||
return newPaging;
|
||||
return new PagingLuceneResultSet(filteredForPermissions, returnedObject.getResultSetMetaData().getSearchParameters(), nodeService);
|
||||
}
|
||||
|
||||
private ResultSet decide(Authentication authentication, Object object, ConfigAttributeDefinition config, ResultSet returnedObject) throws AccessDeniedException
|
||||
|
@@ -108,8 +108,7 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
|
||||
{
|
||||
if (invocation.getArguments()[position] != null)
|
||||
{
|
||||
QName qname = (QName) invocation.getArguments()[position];
|
||||
return qname;
|
||||
return (QName) invocation.getArguments()[position];
|
||||
}
|
||||
}
|
||||
else if (NodeRef.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null)
|
||||
@@ -133,8 +132,7 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
|
||||
{
|
||||
if (QName.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null)
|
||||
{
|
||||
QName qname = (QName) invocation.getArguments()[position];
|
||||
return qname;
|
||||
return (QName) invocation.getArguments()[position];
|
||||
}
|
||||
throw new ACLEntryVoterException("Unknown type");
|
||||
}
|
||||
@@ -155,8 +153,7 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
|
||||
}
|
||||
if (Serializable.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null)
|
||||
{
|
||||
Serializable property = (Serializable) invocation.getArguments()[position];
|
||||
return property;
|
||||
return (Serializable) invocation.getArguments()[position];
|
||||
}
|
||||
throw new ACLEntryVoterException("Unknown type");
|
||||
}
|
||||
@@ -177,8 +174,7 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
|
||||
}
|
||||
if (Map.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null)
|
||||
{
|
||||
Map<QName, Serializable> properties = (Map<QName, Serializable>) invocation.getArguments()[position];
|
||||
return properties;
|
||||
return (Map<QName, Serializable>) invocation.getArguments()[position];
|
||||
}
|
||||
throw new ACLEntryVoterException("Unknown type");
|
||||
}
|
||||
|
@@ -67,8 +67,7 @@ public class ScriptConstraint implements Serializable
|
||||
|
||||
public String getName()
|
||||
{
|
||||
String xxx = info.getName().replace(":", "_");
|
||||
return xxx;
|
||||
return info.getName().replace(":", "_");
|
||||
}
|
||||
|
||||
public boolean isCaseSensitive()
|
||||
@@ -257,9 +256,7 @@ public class ScriptConstraint implements Serializable
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ScriptConstraintValue[] retVal = constraints.toArray(new ScriptConstraintValue[constraints.size()]);
|
||||
return retVal;
|
||||
return constraints.toArray(new ScriptConstraintValue[constraints.size()]);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@ public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension
|
||||
{
|
||||
return caveatConfigService;
|
||||
}
|
||||
|
||||
|
||||
public void setAuthorityService(AuthorityService authorityService)
|
||||
{
|
||||
this.authorityService = authorityService;
|
||||
@@ -54,36 +54,36 @@ public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension
|
||||
{
|
||||
return authorityService;
|
||||
}
|
||||
|
||||
|
||||
public ScriptConstraint getConstraint(String listName)
|
||||
{
|
||||
//TODO Temporary conversion
|
||||
String xxx = listName.replace("_", ":");
|
||||
|
||||
|
||||
RMConstraintInfo info = caveatConfigService.getRMConstraint(xxx);
|
||||
|
||||
|
||||
if(info != null)
|
||||
{
|
||||
return new ScriptConstraint(info, caveatConfigService, getAuthorityService());
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public ScriptConstraint[] getAllConstraints()
|
||||
{
|
||||
return getConstraints(true);
|
||||
}
|
||||
|
||||
|
||||
public ScriptConstraint[] getConstraintsWithoutEmptyList()
|
||||
{
|
||||
return getConstraints(false);
|
||||
}
|
||||
|
||||
|
||||
private ScriptConstraint[] getConstraints(boolean includeEmptyList)
|
||||
{
|
||||
Set<RMConstraintInfo> values = caveatConfigService.getAllRMConstraints();
|
||||
|
||||
|
||||
List<ScriptConstraint> vals = new ArrayList<ScriptConstraint>(values.size());
|
||||
for(RMConstraintInfo value : values)
|
||||
{
|
||||
@@ -100,10 +100,10 @@ public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return vals.toArray(new ScriptConstraint[vals.size()]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete list
|
||||
* @param listName
|
||||
@@ -115,18 +115,18 @@ public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension
|
||||
String xxx = listName.replace("_", ":");
|
||||
caveatConfigService.deleteRMConstraint(xxx);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Update value
|
||||
*/
|
||||
public void updateConstraintValues(String listName, String authorityName, String[]values)
|
||||
{
|
||||
{
|
||||
List<String> vals = new ArrayList<String>();
|
||||
caveatConfigService.updateRMConstraintListAuthority(listName, authorityName, vals);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete the constraint values. i.e remove an authority from a constraint list
|
||||
*/
|
||||
@@ -134,10 +134,10 @@ public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension
|
||||
{
|
||||
//TODO Temporary conversion
|
||||
String xxx = listName.replace("_", ":");
|
||||
|
||||
|
||||
caveatConfigService.removeRMConstraintListAuthority(xxx, authorityName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete the constraint values. i.e remove a value from a constraint list
|
||||
*/
|
||||
@@ -145,22 +145,21 @@ public class ScriptRMCaveatConfigService extends BaseScopableProcessorExtension
|
||||
{
|
||||
//TODO Temporary conversion
|
||||
String xxx = listName.replace("_", ":");
|
||||
|
||||
|
||||
caveatConfigService.removeRMConstraintListValue(xxx, valueName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public ScriptConstraint createConstraint(String listName, String title, String[] allowedValues)
|
||||
{
|
||||
{
|
||||
//TODO Temporary conversion
|
||||
if(listName != null)
|
||||
{
|
||||
listName = listName.replace("_", ":");
|
||||
}
|
||||
|
||||
|
||||
RMConstraintInfo info = caveatConfigService.addRMConstraint(listName, title, allowedValues);
|
||||
ScriptConstraint c = new ScriptConstraint(info, caveatConfigService, getAuthorityService());
|
||||
return c;
|
||||
return new ScriptConstraint(info, caveatConfigService, getAuthorityService());
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
/**
|
||||
* Basic identifier generator implementation.
|
||||
*
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
*/
|
||||
public class BasicIdentifierGenerator extends IdentifierGeneratorBase
|
||||
@@ -48,10 +48,9 @@ public class BasicIdentifierGenerator extends IdentifierGeneratorBase
|
||||
{
|
||||
dbId = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
|
||||
Calendar fileCalendar = Calendar.getInstance();
|
||||
String year = Integer.toString(fileCalendar.get(Calendar.YEAR));
|
||||
String identifier = year + "-" + padString(dbId.toString(), 10);
|
||||
return identifier;
|
||||
return year + "-" + padString(dbId.toString(), 10);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user