mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Fixed minor issues ("Collapsible If Statements") reported in Sonar
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@71949 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -444,12 +444,9 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
||||
result.add(item);
|
||||
}
|
||||
}
|
||||
else if (filePlanService.isRecordCategory(item))
|
||||
else if (filePlanService.isRecordCategory(item) && getAssociatedDispositionScheduleImpl(item) == null)
|
||||
{
|
||||
if (getAssociatedDispositionScheduleImpl(item) == null)
|
||||
{
|
||||
result.addAll(getDisposableItemsImpl(isRecordLevelDisposition, item));
|
||||
}
|
||||
result.addAll(getDisposableItemsImpl(isRecordLevelDisposition, item));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -972,7 +969,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
||||
applyCutoff(nodeRef);
|
||||
|
||||
// close the record folder if it isn't already closed!
|
||||
if (recordFolderService.isRecordFolder(nodeRef) &&
|
||||
if (recordFolderService.isRecordFolder(nodeRef) &&
|
||||
!recordFolderService.isRecordFolderClosed(nodeRef))
|
||||
{
|
||||
recordFolderService.closeRecordFolder(nodeRef);
|
||||
@@ -987,7 +984,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
||||
|
||||
/**
|
||||
* Helper method to apply the cut off
|
||||
*
|
||||
*
|
||||
* @param nodeRef node to cut off
|
||||
*/
|
||||
private void applyCutoff(final NodeRef nodeRef)
|
||||
@@ -1000,7 +997,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
||||
Map<QName, Serializable> cutOffProps = new HashMap<QName, Serializable>(1);
|
||||
cutOffProps.put(PROP_CUT_OFF_DATE, new Date());
|
||||
nodeService.addAspect(nodeRef, ASPECT_CUT_OFF, cutOffProps);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
@@ -203,18 +203,15 @@ public class DispositionProperty extends BaseBehaviourBean
|
||||
if (dispositionAction != null)
|
||||
{
|
||||
DispositionActionDefinition daDefinition = dispositionAction.getDispositionActionDefinition();
|
||||
if (daDefinition != null)
|
||||
// check whether the next disposition action matches this disposition property
|
||||
if (daDefinition != null && propertyName.equals(daDefinition.getPeriodProperty()))
|
||||
{
|
||||
// check whether the next disposition action matches this disposition property
|
||||
if (propertyName.equals(daDefinition.getPeriodProperty()))
|
||||
{
|
||||
Period period = daDefinition.getPeriod();
|
||||
Date updatedAsOf = period.getNextDate(updatedDateValue);
|
||||
Period period = daDefinition.getPeriod();
|
||||
Date updatedAsOf = period.getNextDate(updatedDateValue);
|
||||
|
||||
// update asOf date on the disposition action based on the new property value
|
||||
NodeRef daNodeRef = dispositionAction.getNodeRef();
|
||||
nodeService.setProperty(daNodeRef, PROP_DISPOSITION_AS_OF, updatedAsOf);
|
||||
}
|
||||
// update asOf date on the disposition action based on the new property value
|
||||
NodeRef daNodeRef = dispositionAction.getNodeRef();
|
||||
nodeService.setProperty(daNodeRef, PROP_DISPOSITION_AS_OF, updatedAsOf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -148,15 +148,12 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
|
||||
SiteService siteService = getSiteService();
|
||||
|
||||
SiteInfo siteInfo = siteService.getSite(siteId);
|
||||
if (siteInfo != null)
|
||||
if (siteInfo != null && siteService.hasContainer(siteId, FILE_PLAN_CONTAINER))
|
||||
{
|
||||
if (siteService.hasContainer(siteId, FILE_PLAN_CONTAINER))
|
||||
NodeRef nodeRef = siteService.getContainer(siteId, FILE_PLAN_CONTAINER);
|
||||
if (instanceOf(nodeRef, TYPE_FILE_PLAN))
|
||||
{
|
||||
NodeRef nodeRef = siteService.getContainer(siteId, FILE_PLAN_CONTAINER);
|
||||
if (instanceOf(nodeRef, TYPE_FILE_PLAN))
|
||||
{
|
||||
filePlan = nodeRef;
|
||||
}
|
||||
filePlan = nodeRef;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -345,18 +345,16 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
|
||||
// as read only
|
||||
QName qname = QName.createQName(prefixName, namespaceService);
|
||||
Serializable value = nodeService.getProperty(nodeRef, qname);
|
||||
if (value != null)
|
||||
if (value != null &&
|
||||
(prefixName.equals("cm:title") ||
|
||||
prefixName.equals("cm:author") ||
|
||||
prefixName.equals("dod:originator") ||
|
||||
prefixName.equals("dod:publicationDate") ||
|
||||
prefixName.equals("dod:dateReceived") ||
|
||||
prefixName.equals("dod:address") ||
|
||||
prefixName.equals("dod:otherAddress")))
|
||||
{
|
||||
if (prefixName.equals("cm:title") ||
|
||||
prefixName.equals("cm:author") ||
|
||||
prefixName.equals("dod:originator") ||
|
||||
prefixName.equals("dod:publicationDate") ||
|
||||
prefixName.equals("dod:dateReceived") ||
|
||||
prefixName.equals("dod:address") ||
|
||||
prefixName.equals("dod:otherAddress"))
|
||||
{
|
||||
fieldDef.setProtectedField(true);
|
||||
}
|
||||
fieldDef.setProtectedField(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -59,7 +59,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
{
|
||||
/** Permission service */
|
||||
protected PermissionService permissionService;
|
||||
|
||||
|
||||
/** Ownable service */
|
||||
protected OwnableService ownableService;
|
||||
|
||||
@@ -99,7 +99,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
{
|
||||
this.policyComponent = policyComponent;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ownableService ownable service
|
||||
*/
|
||||
@@ -124,12 +124,12 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
|
||||
// setup category permissions
|
||||
NodeRef parentNodeRef = nodeService.getPrimaryParent(recordCategory).getParentRef();
|
||||
setupPermissions(parentNodeRef, recordCategory);
|
||||
setupPermissions(parentNodeRef, recordCategory);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setup permissions on new unfiled record folder
|
||||
*
|
||||
*
|
||||
* @param childAssocRef child association reference
|
||||
*/
|
||||
@Behaviour
|
||||
@@ -146,7 +146,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
|
||||
/**
|
||||
* Setup permissions on new record folder
|
||||
*
|
||||
*
|
||||
* @param childAssocRef child association reference
|
||||
*/
|
||||
@Behaviour
|
||||
@@ -160,10 +160,10 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
{
|
||||
setupPermissions(childAssocRef.getParentRef(), childAssocRef.getChildRef());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setup permissions on newly created hold.
|
||||
*
|
||||
*
|
||||
* @param childAssocRef child association reference
|
||||
*/
|
||||
@Behaviour
|
||||
@@ -177,10 +177,10 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
{
|
||||
setupPermissions(childAssocRef.getParentRef(), childAssocRef.getChildRef());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setup permissions on newly created transfer.
|
||||
*
|
||||
*
|
||||
* @param childAssocRef child association reference
|
||||
*/
|
||||
@Behaviour
|
||||
@@ -194,10 +194,10 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
{
|
||||
setupPermissions(childAssocRef.getParentRef(), childAssocRef.getChildRef());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper method to setup permissions.
|
||||
*
|
||||
*
|
||||
* @param parent parent node reference
|
||||
* @param nodeRef child node reference
|
||||
*/
|
||||
@@ -205,12 +205,12 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
{
|
||||
ParameterCheck.mandatory("parent", parent);
|
||||
ParameterCheck.mandatory("nodeRef", nodeRef);
|
||||
|
||||
|
||||
if (nodeService.exists(nodeRef))
|
||||
{
|
||||
// initialise permissions
|
||||
initPermissions(nodeRef);
|
||||
|
||||
|
||||
if (nodeService.exists(parent))
|
||||
{
|
||||
runAsSystem(new AuthenticationUtil.RunAsWork<Object>()
|
||||
@@ -236,7 +236,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
{
|
||||
allow = true;
|
||||
}
|
||||
|
||||
|
||||
// set the permission on the target node
|
||||
permissionService.setPermission(
|
||||
nodeRef,
|
||||
@@ -246,17 +246,17 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper method to determine whether all or just filling permissions should be inherited.
|
||||
*
|
||||
*
|
||||
* @param parent parent node
|
||||
* @param child child node
|
||||
* @return boolean true if inherit filling only, false otherwise
|
||||
@@ -264,7 +264,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
private boolean inheritFillingOnly(NodeRef parent, NodeRef child)
|
||||
{
|
||||
boolean result = false;
|
||||
|
||||
|
||||
// if root category or
|
||||
// if in root of unfiled container or
|
||||
// if in root of hold container
|
||||
@@ -274,8 +274,8 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -326,15 +326,12 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
for (AccessPermission perm : origionalRecordPerms)
|
||||
{
|
||||
if (!ExtendedReaderDynamicAuthority.EXTENDED_READER.equals(perm.getAuthority()) &&
|
||||
!ExtendedWriterDynamicAuthority.EXTENDED_WRITER.equals(perm.getAuthority()))
|
||||
!ExtendedWriterDynamicAuthority.EXTENDED_WRITER.equals(perm.getAuthority()) &&
|
||||
(perm.getPermission().equals(RMPermissionModel.FILING) || perm.getPermission().equals(RMPermissionModel.FILE_RECORDS)) &&
|
||||
!origionalParentPerms.contains(perm))
|
||||
{
|
||||
if ((perm.getPermission().equals(RMPermissionModel.FILING) ||
|
||||
perm.getPermission().equals(RMPermissionModel.FILE_RECORDS)) &&
|
||||
!origionalParentPerms.contains(perm))
|
||||
{
|
||||
// then we can assume this is a permission we want to preserve
|
||||
keepPerms.add(perm);
|
||||
}
|
||||
// then we can assume this is a permission we want to preserve
|
||||
keepPerms.add(perm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,14 +368,14 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
{
|
||||
// break inheritance
|
||||
permissionService.setInheritParentPermissions(nodeRef, false);
|
||||
|
||||
|
||||
// clear all existing permissions
|
||||
permissionService.clearPermission(nodeRef, null);
|
||||
|
||||
// set extended reader permissions
|
||||
permissionService.setPermission(nodeRef, ExtendedReaderDynamicAuthority.EXTENDED_READER, RMPermissionModel.READ_RECORDS, true);
|
||||
permissionService.setPermission(nodeRef, ExtendedWriterDynamicAuthority.EXTENDED_WRITER, RMPermissionModel.FILING, true);
|
||||
|
||||
|
||||
// remove owner
|
||||
ownableService.setOwner(nodeRef, OwnableService.NO_OWNER);
|
||||
|
||||
@@ -413,7 +410,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
|
||||
{
|
||||
// set read permission to the parents of the node
|
||||
setReadPermissionUp(nodeRef, authority);
|
||||
|
||||
|
||||
// set the permission on the node and it's children
|
||||
setPermissionDown(nodeRef, authority, permission);
|
||||
}
|
||||
|
@@ -46,12 +46,9 @@ public final class RmDictionaryWebServiceUtils
|
||||
if (StringUtils.isNotBlank(siteId))
|
||||
{
|
||||
SiteInfo site = siteService.getSite(siteId);
|
||||
if (site != null)
|
||||
if (site != null && site.getSitePreset().equals(SITE_PRESET))
|
||||
{
|
||||
if (site.getSitePreset().equals(SITE_PRESET))
|
||||
{
|
||||
isRmSite = true;
|
||||
}
|
||||
isRmSite = true;
|
||||
}
|
||||
}
|
||||
return isRmSite;
|
||||
|
Reference in New Issue
Block a user