mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Fixed major issues (Simplify Boolean Expression) reported in Sonar
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@89713 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -301,10 +301,10 @@ public class DeclarativeCapability extends AbstractCapability
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Check we are dealing with a file plan component
|
// Check we are dealing with a file plan component
|
||||||
if (getFilePlanService().isFilePlanComponent(nodeRef) == true)
|
if (getFilePlanService().isFilePlanComponent(nodeRef))
|
||||||
{
|
{
|
||||||
// Check the kind of the object, the permissions and the conditions
|
// Check the kind of the object, the permissions and the conditions
|
||||||
if (checkKinds(nodeRef) == true && checkPermissions(nodeRef) == true && checkConditions(nodeRef) == true)
|
if (checkKinds(nodeRef) && checkPermissions(nodeRef) && checkConditions(nodeRef))
|
||||||
{
|
{
|
||||||
// Opportunity for child implementations to extend
|
// Opportunity for child implementations to extend
|
||||||
result = evaluateImpl(nodeRef);
|
result = evaluateImpl(nodeRef);
|
||||||
@@ -319,7 +319,7 @@ public class DeclarativeCapability extends AbstractCapability
|
|||||||
result = onEvaluate(nodeRef, result);
|
result = onEvaluate(nodeRef, result);
|
||||||
|
|
||||||
// log access denied to help with debug
|
// log access denied to help with debug
|
||||||
if (LOGGER.isDebugEnabled() == true && AccessDecisionVoter.ACCESS_DENIED == result)
|
if (LOGGER.isDebugEnabled() && AccessDecisionVoter.ACCESS_DENIED == result)
|
||||||
{
|
{
|
||||||
LOGGER.debug("Capability " + getName() + " returned an Access Denied result during evaluation of node " + nodeRef.toString());
|
LOGGER.debug("Capability " + getName() + " returned an Access Denied result during evaluation of node " + nodeRef.toString());
|
||||||
}
|
}
|
||||||
|
@@ -348,7 +348,7 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
|
|||||||
containerType,
|
containerType,
|
||||||
properties).getChildRef();
|
properties).getChildRef();
|
||||||
|
|
||||||
// if (inheritPermissions == false)
|
// if (!inheritPermissions)
|
||||||
// {
|
// {
|
||||||
// set inheritance to false
|
// set inheritance to false
|
||||||
getPermissionService().setInheritParentPermissions(container, false);
|
getPermissionService().setInheritParentPermissions(container, false);
|
||||||
|
@@ -152,7 +152,7 @@ public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAut
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (getNodeService().hasAspect(nodeRef, ASPECT_EXTENDED_SECURITY) == true)
|
if (getNodeService().hasAspect(nodeRef, ASPECT_EXTENDED_SECURITY))
|
||||||
{
|
{
|
||||||
Set<String> authorities = getAuthorites(nodeRef);
|
Set<String> authorities = getAuthorites(nodeRef);
|
||||||
if (authorities != null)
|
if (authorities != null)
|
||||||
|
@@ -70,7 +70,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
|||||||
/** key used to indicate a recordable version */
|
/** key used to indicate a recordable version */
|
||||||
public static final String KEY_RECORDABLE_VERSION = "recordable-version";
|
public static final String KEY_RECORDABLE_VERSION = "recordable-version";
|
||||||
public static final String KEY_FILE_PLAN = "file-plan";
|
public static final String KEY_FILE_PLAN = "file-plan";
|
||||||
|
|
||||||
/** version record property */
|
/** version record property */
|
||||||
public static final String PROP_VERSION_RECORD = "RecordVersion";
|
public static final String PROP_VERSION_RECORD = "RecordVersion";
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
|||||||
|
|
||||||
/** authentication util helper */
|
/** authentication util helper */
|
||||||
protected AuthenticationUtil authenticationUtil;
|
protected AuthenticationUtil authenticationUtil;
|
||||||
|
|
||||||
/** relationship service */
|
/** relationship service */
|
||||||
protected RelationshipService relationshipService;
|
protected RelationshipService relationshipService;
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
|||||||
{
|
{
|
||||||
this.authenticationUtil = authenticationUtil;
|
this.authenticationUtil = authenticationUtil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param relationshipService relationship service
|
* @param relationshipService relationship service
|
||||||
*/
|
*/
|
||||||
@@ -321,21 +321,21 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
|||||||
|
|
||||||
// create record
|
// create record
|
||||||
final NodeRef record = createRecord(nodeRef, filePlan);
|
final NodeRef record = createRecord(nodeRef, filePlan);
|
||||||
|
|
||||||
// apply version record aspect to record
|
// apply version record aspect to record
|
||||||
PropertyMap versionRecordProps = new PropertyMap(3);
|
PropertyMap versionRecordProps = new PropertyMap(3);
|
||||||
versionRecordProps.put(PROP_VERSIONED_NODEREF, nodeRef);
|
versionRecordProps.put(PROP_VERSIONED_NODEREF, nodeRef);
|
||||||
versionRecordProps.put(RecordableVersionModel.PROP_VERSION_LABEL,
|
versionRecordProps.put(RecordableVersionModel.PROP_VERSION_LABEL,
|
||||||
standardVersionProperties.get(
|
standardVersionProperties.get(
|
||||||
QName.createQName(Version2Model.NAMESPACE_URI,
|
QName.createQName(Version2Model.NAMESPACE_URI,
|
||||||
Version2Model.PROP_VERSION_LABEL)));
|
Version2Model.PROP_VERSION_LABEL)));
|
||||||
versionRecordProps.put(RecordableVersionModel.PROP_VERSION_DESCRIPTION,
|
versionRecordProps.put(RecordableVersionModel.PROP_VERSION_DESCRIPTION,
|
||||||
standardVersionProperties.get(
|
standardVersionProperties.get(
|
||||||
QName.createQName(Version2Model.NAMESPACE_URI,
|
QName.createQName(Version2Model.NAMESPACE_URI,
|
||||||
Version2Model.PROP_VERSION_DESCRIPTION)));
|
Version2Model.PROP_VERSION_DESCRIPTION)));
|
||||||
nodeService.addAspect(record, ASPECT_VERSION_RECORD, versionRecordProps);
|
nodeService.addAspect(record, ASPECT_VERSION_RECORD, versionRecordProps);
|
||||||
|
|
||||||
// wire record up to previous record
|
// wire record up to previous record
|
||||||
VersionHistory versionHistory = getVersionHistory(nodeRef);
|
VersionHistory versionHistory = getVersionHistory(nodeRef);
|
||||||
if (versionHistory != null)
|
if (versionHistory != null)
|
||||||
{
|
{
|
||||||
@@ -355,7 +355,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
|||||||
relationshipService.addRelationship("versions", record, previousRecord);
|
relationshipService.addRelationship("versions", record, previousRecord);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -388,7 +388,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the auditable aspect is not there then add it to the 'version' node (after original aspects have been frozen)
|
// If the auditable aspect is not there then add it to the 'version' node (after original aspects have been frozen)
|
||||||
if (dbNodeService.hasAspect(versionNodeRef, ContentModel.ASPECT_AUDITABLE) == false)
|
if (!dbNodeService.hasAspect(versionNodeRef, ContentModel.ASPECT_AUDITABLE))
|
||||||
{
|
{
|
||||||
dbNodeService.addAspect(versionNodeRef, ContentModel.ASPECT_AUDITABLE, null);
|
dbNodeService.addAspect(versionNodeRef, ContentModel.ASPECT_AUDITABLE, null);
|
||||||
}
|
}
|
||||||
@@ -449,7 +449,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
|||||||
|
|
||||||
// create a copy of the original state and add it to the unfiled record container
|
// create a copy of the original state and add it to the unfiled record container
|
||||||
FileInfo recordInfo = fileFolderService.copy(nodeRef, unfiledRecordFolder, null);
|
FileInfo recordInfo = fileFolderService.copy(nodeRef, unfiledRecordFolder, null);
|
||||||
record = recordInfo.getNodeRef();
|
record = recordInfo.getNodeRef();
|
||||||
|
|
||||||
// remove added copy assocs
|
// remove added copy assocs
|
||||||
List<AssociationRef> recordAssocs = dbNodeService.getTargetAssocs(record, ContentModel.ASSOC_ORIGINAL);
|
List<AssociationRef> recordAssocs = dbNodeService.getTargetAssocs(record, ContentModel.ASSOC_ORIGINAL);
|
||||||
|
@@ -118,15 +118,15 @@ public class RMPermissionServiceImpl extends PermissionServiceImpl
|
|||||||
public AccessStatus hasPermission(NodeRef nodeRef, String perm)
|
public AccessStatus hasPermission(NodeRef nodeRef, String perm)
|
||||||
{
|
{
|
||||||
AccessStatus acs = super.hasPermission(nodeRef, perm);
|
AccessStatus acs = super.hasPermission(nodeRef, perm);
|
||||||
if (AccessStatus.DENIED.equals(acs) == true &&
|
if (AccessStatus.DENIED.equals(acs) &&
|
||||||
PermissionService.READ.equals(perm) == true &&
|
PermissionService.READ.equals(perm) &&
|
||||||
nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) == true)
|
nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT))
|
||||||
{
|
{
|
||||||
return super.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS);
|
return super.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS);
|
||||||
}
|
}
|
||||||
else if (AccessStatus.DENIED.equals(acs) == true &&
|
else if (AccessStatus.DENIED.equals(acs) &&
|
||||||
PermissionService.WRITE.equals(perm) == true &&
|
PermissionService.WRITE.equals(perm) &&
|
||||||
nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) == true)
|
nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT))
|
||||||
{
|
{
|
||||||
return super.hasPermission(nodeRef, RMPermissionModel.FILE_RECORDS);
|
return super.hasPermission(nodeRef, RMPermissionModel.FILE_RECORDS);
|
||||||
}
|
}
|
||||||
|
@@ -34,7 +34,7 @@ public abstract class BaseHoldWebScriptWithContentUnitTest extends BaseHoldWebSc
|
|||||||
boolean bFirst = true;
|
boolean bFirst = true;
|
||||||
for (NodeRef nodeRef : nodeRefs)
|
for (NodeRef nodeRef : nodeRefs)
|
||||||
{
|
{
|
||||||
if (bFirst == false)
|
if (!bFirst)
|
||||||
{
|
{
|
||||||
builder.append(",");
|
builder.append(",");
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ public abstract class BaseHoldWebScriptWithContentUnitTest extends BaseHoldWebSc
|
|||||||
boolean bFirst = true;
|
boolean bFirst = true;
|
||||||
for (NodeRef hold : holds)
|
for (NodeRef hold : holds)
|
||||||
{
|
{
|
||||||
if (bFirst == false)
|
if (!bFirst)
|
||||||
{
|
{
|
||||||
builder.append(",");
|
builder.append(",");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user