mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Fixed minor issues reported by sonar (Collapsible If Statements)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@63800 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -119,8 +119,7 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase
|
||||
builder.append(" ");
|
||||
for (String missingProperty : missingProperties)
|
||||
{
|
||||
builder.append(missingProperty)
|
||||
.append(", ");
|
||||
builder.append(missingProperty).append(", ");
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
@@ -142,9 +141,7 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase
|
||||
TypeDefinition typeDef = this.dictionaryService.getType(nodeRefType);
|
||||
for (PropertyDefinition propDef : typeDef.getProperties().values())
|
||||
{
|
||||
if (propDef.isMandatory() == true)
|
||||
{
|
||||
if (nodeRefProps.get(propDef.getName()) == null)
|
||||
if (propDef.isMandatory() && nodeRefProps.get(propDef.getName()) == null)
|
||||
{
|
||||
logMissingProperty(propDef, missingProperties);
|
||||
|
||||
@@ -152,7 +149,6 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result != false)
|
||||
{
|
||||
@@ -162,9 +158,7 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase
|
||||
AspectDefinition aspectDef = this.dictionaryService.getAspect(aspect);
|
||||
for (PropertyDefinition propDef : aspectDef.getProperties().values())
|
||||
{
|
||||
if (propDef.isMandatory() == true)
|
||||
{
|
||||
if (nodeRefProps.get(propDef.getName()) == null)
|
||||
if (propDef.isMandatory() && nodeRefProps.get(propDef.getName()) == null)
|
||||
{
|
||||
logMissingProperty(propDef, missingProperties);
|
||||
|
||||
@@ -174,7 +168,6 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@@ -74,10 +74,9 @@ public class FileToAction extends RMActionExecuterAbstractBase
|
||||
@Override
|
||||
protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef)
|
||||
{
|
||||
if (nodeService.exists(actionedUponNodeRef) == true &&
|
||||
freezeService.isFrozen(actionedUponNodeRef) == false)
|
||||
{
|
||||
if (recordService.isFiled(actionedUponNodeRef) == false)
|
||||
if (nodeService.exists(actionedUponNodeRef) &&
|
||||
freezeService.isFrozen(actionedUponNodeRef) == false &&
|
||||
recordService.isFiled(actionedUponNodeRef) == false)
|
||||
{
|
||||
// first look to see if the destination record folder has been specified
|
||||
NodeRef recordFolder = (NodeRef)action.getParameterValue(PARAM_DESTINATION_RECORD_FOLDER);
|
||||
@@ -92,7 +91,7 @@ public class FileToAction extends RMActionExecuterAbstractBase
|
||||
throw new AlfrescoRuntimeException("Unable to execute file to action, because the destination record folder could not be determined.");
|
||||
}
|
||||
|
||||
if (recordFolderService.isRecordFolder(recordFolder) == true)
|
||||
if (recordFolderService.isRecordFolder(recordFolder))
|
||||
{
|
||||
final NodeRef finalRecordFolder = recordFolder;
|
||||
|
||||
@@ -120,7 +119,6 @@ public class FileToAction extends RMActionExecuterAbstractBase
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -164,7 +162,7 @@ public class FileToAction extends RMActionExecuterAbstractBase
|
||||
|
||||
if (recordFolder == null)
|
||||
{
|
||||
if (create == true)
|
||||
if (create)
|
||||
{
|
||||
// get the parent into which we are going to create the new record folder
|
||||
NodeRef parent = resolveParent(context, pathValues, create);
|
||||
@@ -259,7 +257,7 @@ public class FileToAction extends RMActionExecuterAbstractBase
|
||||
{
|
||||
NodeRef result = null;
|
||||
|
||||
if (ArrayUtils.isEmpty(pathValues) == true)
|
||||
if (ArrayUtils.isEmpty(pathValues))
|
||||
{
|
||||
// this should never occur since if the path is empty then the context it the resolution of the
|
||||
// path .. the context must already exist
|
||||
|
@@ -306,9 +306,9 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
@Override
|
||||
public Void doWork() throws Exception
|
||||
{
|
||||
if (nodeService.exists(nodeRef) == true &&
|
||||
dictionaryService.getAllModels().contains(RM_CUSTOM_MODEL) == true &&
|
||||
isCustomisable(aspectTypeQName) == true)
|
||||
if (nodeService.exists(nodeRef) &&
|
||||
dictionaryService.getAllModels().contains(RM_CUSTOM_MODEL) &&
|
||||
isCustomisable(aspectTypeQName))
|
||||
{
|
||||
QName customPropertyAspect = getCustomAspect(aspectTypeQName);
|
||||
nodeService.addAspect(nodeRef, customPropertyAspect, null);
|
||||
@@ -336,8 +336,8 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
@Override
|
||||
public Void doWork() throws Exception
|
||||
{
|
||||
if (nodeService.exists(nodeRef) == true &&
|
||||
isCustomisable(aspectTypeQName) == true)
|
||||
if (nodeService.exists(nodeRef) &&
|
||||
isCustomisable(aspectTypeQName))
|
||||
{
|
||||
QName customPropertyAspect = getCustomAspect(aspectTypeQName);
|
||||
nodeService.removeAspect(nodeRef, customPropertyAspect);
|
||||
@@ -367,13 +367,13 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
@Override
|
||||
public Void doWork() throws Exception
|
||||
{
|
||||
if (dictionaryService.getAllModels().contains(RecordsManagementCustomModel.RM_CUSTOM_MODEL) == true)
|
||||
if (dictionaryService.getAllModels().contains(RecordsManagementCustomModel.RM_CUSTOM_MODEL))
|
||||
{
|
||||
NodeRef nodeRef = childAssocRef.getChildRef();
|
||||
QName type = nodeService.getType(nodeRef);
|
||||
while (type != null && ContentModel.TYPE_CMOBJECT.equals(type) == false)
|
||||
{
|
||||
if (isCustomisable(type) == true)
|
||||
if (isCustomisable(type))
|
||||
{
|
||||
QName customPropertyAspect = getCustomAspect(type);
|
||||
nodeService.addAspect(nodeRef, customPropertyAspect, null);
|
||||
@@ -438,7 +438,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
while (type != null && ContentModel.TYPE_CMOBJECT.equals(type) == false)
|
||||
{
|
||||
// Add to the list if the type is customisable
|
||||
if (isCustomisable(type) == true)
|
||||
if (isCustomisable(type))
|
||||
{
|
||||
result.add(type);
|
||||
}
|
||||
@@ -463,7 +463,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
while (tempAspect != null)
|
||||
{
|
||||
// Add to the list if the aspect is customisable
|
||||
if (isCustomisable(tempAspect) == true)
|
||||
if (isCustomisable(tempAspect))
|
||||
{
|
||||
result.add(tempAspect);
|
||||
}
|
||||
@@ -499,35 +499,33 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
{
|
||||
AspectDefinition aspectDef = dictionaryService.getAspect(aspect);
|
||||
String name = aspectDef.getName().getLocalName();
|
||||
if (name.endsWith("Properties") == true)
|
||||
if (name.endsWith("Properties"))
|
||||
{
|
||||
QName type = null;
|
||||
String prefixString = aspectDef.getDescription(dictionaryService);
|
||||
if (prefixString == null)
|
||||
{
|
||||
// Backward compatibility from previous RM V1.0 custom models
|
||||
if (CompatibilityModel.NAME_CUSTOM_RECORD_PROPERTIES.equals(name) == true)
|
||||
if (CompatibilityModel.NAME_CUSTOM_RECORD_PROPERTIES.equals(name))
|
||||
{
|
||||
type = RecordsManagementModel.ASPECT_RECORD;
|
||||
}
|
||||
else if (CompatibilityModel.NAME_CUSTOM_RECORD_FOLDER_PROPERTIES.equals(name) == true)
|
||||
else if (CompatibilityModel.NAME_CUSTOM_RECORD_FOLDER_PROPERTIES.equals(name))
|
||||
{
|
||||
type = RecordsManagementModel.TYPE_RECORD_FOLDER;
|
||||
}
|
||||
else if (CompatibilityModel.NAME_CUSTOM_RECORD_CATEGORY_PROPERTIES.equals(name) == true)
|
||||
else if (CompatibilityModel.NAME_CUSTOM_RECORD_CATEGORY_PROPERTIES.equals(name))
|
||||
{
|
||||
type = RecordsManagementModel.TYPE_RECORD_CATEGORY;
|
||||
}
|
||||
else if (CompatibilityModel.NAME_CUSTOM_RECORD_SERIES_PROPERTIES.equals(name) == true)
|
||||
{
|
||||
else if (CompatibilityModel.NAME_CUSTOM_RECORD_SERIES_PROPERTIES.equals(name) &&
|
||||
// Only add the deprecated record series type as customisable if
|
||||
// a v1.0 installation has added custom properties
|
||||
if (aspectDef.getProperties().size() != 0)
|
||||
aspectDef.getProperties().size() != 0)
|
||||
{
|
||||
type = CompatibilityModel.TYPE_RECORD_SERIES;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
type = QName.createQName(prefixString, namespaceService);
|
||||
@@ -539,7 +537,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
customisableTypes.put(type, aspect);
|
||||
|
||||
// Remove customisable type from the pending list
|
||||
if (pendingCustomisableTypes != null && pendingCustomisableTypes.contains(type) == true)
|
||||
if (pendingCustomisableTypes != null && pendingCustomisableTypes.contains(type))
|
||||
{
|
||||
pendingCustomisableTypes.remove(type);
|
||||
}
|
||||
@@ -692,7 +690,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
ParameterCheck.mandatory("propertyName", propertyName);
|
||||
|
||||
boolean result = false;
|
||||
if (RM_CUSTOM_URI.equals(propertyName.getNamespaceURI()) == true &&
|
||||
if (RM_CUSTOM_URI.equals(propertyName.getNamespaceURI()) &&
|
||||
dictionaryService.getProperty(propertyName) != null)
|
||||
{
|
||||
result = true;
|
||||
@@ -1403,14 +1401,11 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
|
||||
|
||||
for (M2ClassAssociation assoc : customAssocsAspect.getAssociations())
|
||||
{
|
||||
if (refQName.toPrefixString(namespaceService).equals(assoc.getName()))
|
||||
{
|
||||
if (newTitle != null)
|
||||
if (refQName.toPrefixString(namespaceService).equals(assoc.getName()) && newTitle != null)
|
||||
{
|
||||
assoc.setTitle(newTitle);
|
||||
}
|
||||
}
|
||||
}
|
||||
writeCustomContentModel(modelRef, deserializedModel);
|
||||
|
||||
if (logger.isInfoEnabled())
|
||||
|
@@ -212,14 +212,11 @@ public class CapabilityServiceImpl implements CapabilityService
|
||||
for (Capability capability : getCapabilities())
|
||||
{
|
||||
Group group = capability.getGroup();
|
||||
if (group != null)
|
||||
{
|
||||
if (group.getId().equalsIgnoreCase(id))
|
||||
if (group != null && group.getId().equalsIgnoreCase(id))
|
||||
{
|
||||
capabilities.add(capability);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(capabilities, new Comparator<Capability>()
|
||||
{
|
||||
|
@@ -331,9 +331,7 @@ public class RMSecurityCommon implements ApplicationContextAware
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (AssociationRef.class.isAssignableFrom(params[position]))
|
||||
{
|
||||
if (invocation.getArguments()[position] != null)
|
||||
else if (AssociationRef.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null)
|
||||
{
|
||||
if (parent)
|
||||
{
|
||||
@@ -355,7 +353,6 @@ public class RMSecurityCommon implements ApplicationContextAware
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return testNodeRef;
|
||||
}
|
||||
}
|
||||
|
@@ -57,13 +57,10 @@ public class HasDispositionDateCapabilityCondition extends AbstractCapabilityCon
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
else if (filePlanService.isFilePlanComponent(nodeRef))
|
||||
{
|
||||
if (nodeService.getProperty(nodeRef, PROP_DISPOSITION_AS_OF) != null)
|
||||
else if (filePlanService.isFilePlanComponent(nodeRef) && nodeService.getProperty(nodeRef, PROP_DISPOSITION_AS_OF) != null)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@@ -62,21 +62,17 @@ public class MayBeScheduledCapabilityCondition extends AbstractCapabilityConditi
|
||||
boolean result = false;
|
||||
|
||||
DispositionSchedule dispositionSchedule = dispositionService.getDispositionSchedule(nodeRef);
|
||||
if (dispositionSchedule != null)
|
||||
{
|
||||
if (checkDispositionLevel(nodeRef, dispositionSchedule) == true)
|
||||
if (dispositionSchedule != null && checkDispositionLevel(nodeRef, dispositionSchedule))
|
||||
{
|
||||
for (DispositionActionDefinition dispositionActionDefinition : dispositionSchedule.getDispositionActionDefinitions())
|
||||
{
|
||||
if (dispositionActionDefinition.getName().equals(dispositionAction) == true)
|
||||
if (dispositionActionDefinition.getName().equals(dispositionAction))
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -91,11 +87,11 @@ public class MayBeScheduledCapabilityCondition extends AbstractCapabilityConditi
|
||||
{
|
||||
boolean result = false;
|
||||
boolean isRecordLevelDisposition = dispositionSchedule.isRecordLevelDisposition();
|
||||
if (recordService.isRecord(nodeRef) == true && isRecordLevelDisposition == true)
|
||||
if (recordService.isRecord(nodeRef) && isRecordLevelDisposition)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
else if (recordFolderService.isRecordFolder(nodeRef) == true && isRecordLevelDisposition == false)
|
||||
else if (recordFolderService.isRecordFolder(nodeRef) && isRecordLevelDisposition == false)
|
||||
|
||||
{
|
||||
result = true;
|
||||
|
@@ -49,27 +49,23 @@ public class ChangeOrDeleteReferencesCapability extends DeclarativeCapability
|
||||
{
|
||||
if (target != null)
|
||||
{
|
||||
if (getFilePlanService().isFilePlanComponent(target) == true)
|
||||
{
|
||||
if (checkConditions(source) == true && checkConditions(target) == true)
|
||||
{
|
||||
if (checkPermissions(source) == true && checkPermissions(target) == true)
|
||||
if (getFilePlanService().isFilePlanComponent(target) &&
|
||||
checkConditions(source) &&
|
||||
checkConditions(target) &&
|
||||
checkPermissions(source) &&
|
||||
checkPermissions(target))
|
||||
{
|
||||
return AccessDecisionVoter.ACCESS_GRANTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (checkConditions(source) == true)
|
||||
{
|
||||
if (checkPermissions(source) == true)
|
||||
if (checkConditions(source) &&
|
||||
checkPermissions(source))
|
||||
{
|
||||
return AccessDecisionVoter.ACCESS_GRANTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return AccessDecisionVoter.ACCESS_DENIED;
|
||||
}
|
||||
|
@@ -93,26 +93,23 @@ public class CreateCapability extends DeclarativeCapability
|
||||
{
|
||||
if ((assocType == null) || assocType.equals(ContentModel.ASSOC_CONTAINS) == false)
|
||||
{
|
||||
if(linkee == null)
|
||||
{
|
||||
if(recordService.isRecord(destination) && recordService.isDeclared(destination) == false)
|
||||
{
|
||||
if (permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED)
|
||||
if(linkee == null &&
|
||||
recordService.isRecord(destination) &&
|
||||
recordService.isDeclared(destination) == false &&
|
||||
permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED)
|
||||
{
|
||||
return AccessDecisionVoter.ACCESS_GRANTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(recordService.isRecord(linkee) && recordService.isRecord(destination) && recordService.isDeclared(destination) == false)
|
||||
{
|
||||
if (permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED)
|
||||
if (recordService.isRecord(linkee) &&
|
||||
recordService.isRecord(destination) &&
|
||||
recordService.isDeclared(destination) == false &&
|
||||
permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED)
|
||||
{
|
||||
return AccessDecisionVoter.ACCESS_GRANTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -123,42 +120,30 @@ public class CreateCapability extends DeclarativeCapability
|
||||
conditions.put("capabilityCondition.closed", Boolean.FALSE);
|
||||
conditions.put("capabilityCondition.cutoff", Boolean.FALSE);
|
||||
|
||||
if (checkConditions(destination, conditions) == true)
|
||||
{
|
||||
if (recordFolderService.isRecordFolder(destination))
|
||||
{
|
||||
if (permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED)
|
||||
if (checkConditions(destination, conditions) &&
|
||||
recordFolderService.isRecordFolder(destination) &&
|
||||
permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED)
|
||||
{
|
||||
return AccessDecisionVoter.ACCESS_GRANTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
conditions.put("capabilityCondition.closed", Boolean.TRUE);
|
||||
if (checkConditions(destination, conditions) == true)
|
||||
{
|
||||
if (recordFolderService.isRecordFolder(destination))
|
||||
{
|
||||
if (permissionService.hasPermission(getFilePlanService().getFilePlan(destination), RMPermissionModel.DECLARE_RECORDS_IN_CLOSED_FOLDERS) == AccessStatus.ALLOWED)
|
||||
if (checkConditions(destination, conditions) &&
|
||||
recordFolderService.isRecordFolder(destination) &&
|
||||
permissionService.hasPermission(getFilePlanService().getFilePlan(destination), RMPermissionModel.DECLARE_RECORDS_IN_CLOSED_FOLDERS) == AccessStatus.ALLOWED)
|
||||
{
|
||||
return AccessDecisionVoter.ACCESS_GRANTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
conditions.remove("capabilityCondition.closed");
|
||||
conditions.put("capabilityCondition.cutoff", Boolean.TRUE);
|
||||
if (checkConditions(destination, conditions) == true)
|
||||
{
|
||||
if (recordFolderService.isRecordFolder(destination))
|
||||
{
|
||||
if (permissionService.hasPermission(getFilePlanService().getFilePlan(destination), RMPermissionModel.CREATE_MODIFY_RECORDS_IN_CUTOFF_FOLDERS) == AccessStatus.ALLOWED)
|
||||
if (checkConditions(destination, conditions) &&
|
||||
recordFolderService.isRecordFolder(destination) &&
|
||||
permissionService.hasPermission(getFilePlanService().getFilePlan(destination), RMPermissionModel.CREATE_MODIFY_RECORDS_IN_CUTOFF_FOLDERS) == AccessStatus.ALLOWED)
|
||||
{
|
||||
return AccessDecisionVoter.ACCESS_GRANTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (capabilityService.getCapability(RMPermissionModel.CREATE_MODIFY_DESTROY_FOLDERS).evaluate(destination) == AccessDecisionVoter.ACCESS_GRANTED)
|
||||
{
|
||||
return AccessDecisionVoter.ACCESS_GRANTED;
|
||||
|
@@ -45,16 +45,16 @@ public class DeleteLinksCapability extends DeclarativeCapability
|
||||
*/
|
||||
public int evaluate(NodeRef source, NodeRef target)
|
||||
{
|
||||
if (getFilePlanService().isFilePlanComponent(source) == true &&
|
||||
getFilePlanService().isFilePlanComponent(target) == true)
|
||||
if (getFilePlanService().isFilePlanComponent(source) &&
|
||||
getFilePlanService().isFilePlanComponent(target))
|
||||
{
|
||||
if (checkConditions(source) == true && checkConditions(target) == true)
|
||||
{
|
||||
if (checkPermissions(source) == true && checkPermissions(target) == true)
|
||||
if (checkConditions(source) &&
|
||||
checkConditions(target) &&
|
||||
checkPermissions(source) &&
|
||||
checkPermissions(target))
|
||||
{
|
||||
return AccessDecisionVoter.ACCESS_GRANTED;
|
||||
}
|
||||
}
|
||||
return AccessDecisionVoter.ACCESS_DENIED;
|
||||
}
|
||||
else
|
||||
|
@@ -112,14 +112,11 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
|
||||
return qname;
|
||||
}
|
||||
}
|
||||
else if (NodeRef.class.isAssignableFrom(params[position]))
|
||||
{
|
||||
if (invocation.getArguments()[position] != null)
|
||||
else if (NodeRef.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null)
|
||||
{
|
||||
NodeRef nodeRef = (NodeRef) invocation.getArguments()[position];
|
||||
return nodeService.getType(nodeRef);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -134,14 +131,11 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
|
||||
@SuppressWarnings("rawtypes")
|
||||
protected QName getQName(MethodInvocation invocation, Class[] params, int position)
|
||||
{
|
||||
if (QName.class.isAssignableFrom(params[position]))
|
||||
{
|
||||
if (invocation.getArguments()[position] != null)
|
||||
if (QName.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null)
|
||||
{
|
||||
QName qname = (QName) invocation.getArguments()[position];
|
||||
return qname;
|
||||
}
|
||||
}
|
||||
throw new ACLEntryVoterException("Unknown type");
|
||||
}
|
||||
|
||||
@@ -159,14 +153,11 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (Serializable.class.isAssignableFrom(params[position]))
|
||||
{
|
||||
if (invocation.getArguments()[position] != null)
|
||||
if (Serializable.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null)
|
||||
{
|
||||
Serializable property = (Serializable) invocation.getArguments()[position];
|
||||
return property;
|
||||
}
|
||||
}
|
||||
throw new ACLEntryVoterException("Unknown type");
|
||||
}
|
||||
|
||||
@@ -184,14 +175,11 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (Map.class.isAssignableFrom(params[position]))
|
||||
{
|
||||
if (invocation.getArguments()[position] != null)
|
||||
if (Map.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null)
|
||||
{
|
||||
Map<QName, Serializable> properties = (Map<QName, Serializable>) invocation.getArguments()[position];
|
||||
return properties;
|
||||
}
|
||||
}
|
||||
throw new ACLEntryVoterException("Unknown type");
|
||||
}
|
||||
}
|
||||
|
@@ -37,21 +37,15 @@ public class UpdatePolicy extends AbstractBasePolicy
|
||||
{
|
||||
NodeRef updatee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
|
||||
QName aspectQName = null;
|
||||
if (cad.getParameters().size() > 1)
|
||||
{
|
||||
if (cad.getParameters().get(1) > -1)
|
||||
if (cad.getParameters().size() > 1 && cad.getParameters().get(1) > -1)
|
||||
{
|
||||
aspectQName = getQName(invocation, params, cad.getParameters().get(1));
|
||||
}
|
||||
}
|
||||
Map<QName, Serializable> properties = null;
|
||||
if (cad.getParameters().size() > 2)
|
||||
{
|
||||
if (cad.getParameters().get(2) > -1)
|
||||
if (cad.getParameters().size() > 2 && cad.getParameters().get(2) > -1)
|
||||
{
|
||||
properties = getProperties(invocation, params, cad.getParameters().get(2));
|
||||
}
|
||||
}
|
||||
|
||||
UpdateCapability updateCapability = (UpdateCapability)capabilityService.getCapability("Update");
|
||||
return updateCapability.evaluate(updatee, aspectQName, properties);
|
||||
|
@@ -543,9 +543,7 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
||||
List<String> allowedValues = new ArrayList<String>(0);
|
||||
|
||||
String userName = AuthenticationUtil.getRunAsUser();
|
||||
if (userName != null)
|
||||
{
|
||||
if (! (AuthenticationUtil.isMtEnabled() && AuthenticationUtil.isRunAsUserTheSystemUser()))
|
||||
if (userName != null && !(AuthenticationUtil.isMtEnabled() && AuthenticationUtil.isRunAsUserTheSystemUser()))
|
||||
{
|
||||
// note: userName and userGroupNames must not be null
|
||||
caveatConfig.get(constraintName);
|
||||
@@ -553,7 +551,6 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
|
||||
Set<String> userGroupFullNames = authorityService.getAuthoritiesForUser(userName);
|
||||
allowedValues = getRMAllowedValues(userName, userGroupFullNames, constraintName);
|
||||
}
|
||||
}
|
||||
|
||||
return allowedValues;
|
||||
}
|
||||
|
@@ -370,15 +370,12 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
|
||||
*/
|
||||
for(String newValue : allowedValueList)
|
||||
{
|
||||
if(!oldAllowedValues.contains(newValue))
|
||||
if(!oldAllowedValues.contains(newValue) && logger.isDebugEnabled())
|
||||
{
|
||||
// This is an addition
|
||||
if(logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("value added to list:" + listQName + ":" + newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deal with any deletions
|
||||
|
@@ -170,12 +170,10 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
{
|
||||
if (nodeService.exists(nodeRef) == true)
|
||||
{
|
||||
if (name.equals(actionName) == true)
|
||||
if (nodeService.exists(nodeRef) && name.equals(actionName))
|
||||
{
|
||||
QName type = nodeService.getType(nodeRef);
|
||||
if (TYPE_TRANSFER.equals(type) == true)
|
||||
if (TYPE_TRANSFER.equals(type))
|
||||
{
|
||||
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef assoc : assocs)
|
||||
@@ -188,7 +186,6 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
|
||||
processRecordFolder(nodeRef);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -200,11 +197,11 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
|
||||
|
||||
private void processRecordFolder(NodeRef recordFolder)
|
||||
{
|
||||
if (recordService.isRecord(recordFolder) == true)
|
||||
if (recordService.isRecord(recordFolder))
|
||||
{
|
||||
processRecord(recordFolder);
|
||||
}
|
||||
else if (recordFolderService.isRecordFolder(recordFolder) == true)
|
||||
else if (recordFolderService.isRecordFolder(recordFolder))
|
||||
{
|
||||
for (NodeRef record : recordService.getRecords(recordFolder))
|
||||
{
|
||||
@@ -218,7 +215,7 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
|
||||
List<AssociationRef> fromAssocs = recordsManagementAdminService.getCustomReferencesFrom(record);
|
||||
for (AssociationRef fromAssoc : fromAssocs)
|
||||
{
|
||||
if (reference.equals(fromAssoc.getTypeQName()) == true)
|
||||
if (reference.equals(fromAssoc.getTypeQName()))
|
||||
{
|
||||
NodeRef nodeRef = fromAssoc.getTargetRef();
|
||||
doEventComplete(nodeRef);
|
||||
@@ -228,7 +225,7 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
|
||||
List<AssociationRef> toAssocs = recordsManagementAdminService.getCustomReferencesTo(record);
|
||||
for (AssociationRef toAssoc : toAssocs)
|
||||
{
|
||||
if (reference.equals(toAssoc.getTypeQName()) == true)
|
||||
if (reference.equals(toAssoc.getTypeQName()))
|
||||
{
|
||||
NodeRef nodeRef = toAssoc.getSourceRef();
|
||||
doEventComplete(nodeRef);
|
||||
@@ -246,7 +243,7 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
|
||||
{
|
||||
RecordsManagementEvent rmEvent = recordsManagementEventService.getEvent(event.getEventName());
|
||||
if (event.isEventComplete() == false &&
|
||||
rmEvent.getType().equals(getName()) == true)
|
||||
rmEvent.getType().equals(getName()))
|
||||
{
|
||||
// Complete the event
|
||||
Map<String, Serializable> params = new HashMap<String, Serializable>(3);
|
||||
|
@@ -112,10 +112,8 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
|
||||
|
||||
// Run "retain" and "cutoff" actions.
|
||||
|
||||
if (dispAction != null)
|
||||
{
|
||||
if (dispAction.equalsIgnoreCase("cutoff") ||
|
||||
dispAction.equalsIgnoreCase("retain"))
|
||||
if (dispAction != null && (dispAction.equalsIgnoreCase("cutoff") ||
|
||||
dispAction.equalsIgnoreCase("retain")))
|
||||
{
|
||||
ChildAssociationRef parent = nodeService.getPrimaryParent(currentNode);
|
||||
if (parent.getTypeQName().equals(RecordsManagementModel.ASSOC_NEXT_DISPOSITION_ACTION))
|
||||
@@ -130,7 +128,6 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
};
|
||||
@@ -149,7 +146,7 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
|
||||
}
|
||||
catch (AlfrescoRuntimeException exception)
|
||||
{
|
||||
if (logger.isDebugEnabled() == true)
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(exception);
|
||||
}
|
||||
|
@@ -223,14 +223,12 @@ public abstract class BaseEvaluator implements RecordsManagementModel
|
||||
boolean result = false;
|
||||
|
||||
// Check that we are dealing with the correct kind of RM object
|
||||
if (kinds == null || checkKinds(nodeRef) == true)
|
||||
{
|
||||
if ((kinds == null || checkKinds(nodeRef) == true) &&
|
||||
// Check we have the required capabilities
|
||||
if (capabilities == null || checkCapabilities(nodeRef) == true)
|
||||
(capabilities == null || checkCapabilities(nodeRef) == true))
|
||||
{
|
||||
result = evaluateImpl(nodeRef);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@@ -206,7 +206,7 @@ public class ModelSecurityServiceImpl extends BaseBehaviourBean
|
||||
{
|
||||
for (Capability capability : artifact.getCapabilities())
|
||||
{
|
||||
if (capability.hasPermission(nodeRef).equals(AccessStatus.ALLOWED) == true)
|
||||
if (capability.hasPermission(nodeRef).equals(AccessStatus.ALLOWED))
|
||||
{
|
||||
result = true;
|
||||
break;
|
||||
@@ -277,12 +277,11 @@ public class ModelSecurityServiceImpl extends BaseBehaviourBean
|
||||
)
|
||||
public void beforeAddAspect(NodeRef nodeRef, QName aspect)
|
||||
{
|
||||
if (enabled == true)
|
||||
{
|
||||
if (AuthenticationUtil.getFullyAuthenticatedUser() != null &&
|
||||
if (enabled &&
|
||||
AuthenticationUtil.getFullyAuthenticatedUser() != null &&
|
||||
AuthenticationUtil.isRunAsUserTheSystemUser() == false &&
|
||||
isProtectedAspect(aspect) == true &&
|
||||
nodeService.exists(nodeRef) == true &&
|
||||
isProtectedAspect(aspect) &&
|
||||
nodeService.exists(nodeRef) &&
|
||||
canEditProtectedAspect(nodeRef, aspect) == false)
|
||||
{
|
||||
// the user can't edit the protected aspect
|
||||
@@ -292,7 +291,6 @@ public class ModelSecurityServiceImpl extends BaseBehaviourBean
|
||||
" from the node " + nodeRef.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.node.NodeServicePolicies.BeforeRemoveAspectPolicy#beforeRemoveAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
|
||||
@@ -306,12 +304,11 @@ public class ModelSecurityServiceImpl extends BaseBehaviourBean
|
||||
)
|
||||
public void beforeRemoveAspect(NodeRef nodeRef, QName aspect)
|
||||
{
|
||||
if (enabled == true)
|
||||
{
|
||||
if (AuthenticationUtil.getFullyAuthenticatedUser() != null &&
|
||||
if (enabled &&
|
||||
AuthenticationUtil.getFullyAuthenticatedUser() != null &&
|
||||
AuthenticationUtil.isRunAsUserTheSystemUser() == false &&
|
||||
isProtectedAspect(aspect) == true &&
|
||||
nodeService.exists(nodeRef) == true &&
|
||||
isProtectedAspect(aspect) &&
|
||||
nodeService.exists(nodeRef) &&
|
||||
canEditProtectedAspect(nodeRef, aspect) == false)
|
||||
{
|
||||
// the user can't edit the protected aspect
|
||||
@@ -321,7 +318,6 @@ public class ModelSecurityServiceImpl extends BaseBehaviourBean
|
||||
" from the node " + nodeRef.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map)
|
||||
@@ -335,15 +331,14 @@ public class ModelSecurityServiceImpl extends BaseBehaviourBean
|
||||
)
|
||||
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
|
||||
{
|
||||
if (enabled == true)
|
||||
{
|
||||
if (AuthenticationUtil.getFullyAuthenticatedUser() != null &&
|
||||
if (enabled &&
|
||||
AuthenticationUtil.getFullyAuthenticatedUser() != null &&
|
||||
AuthenticationUtil.isRunAsUserTheSystemUser() == false &&
|
||||
nodeService.exists(nodeRef) == true)
|
||||
nodeService.exists(nodeRef))
|
||||
{
|
||||
for (QName property : after.keySet())
|
||||
{
|
||||
if (isProtectedProperty(property) == true)
|
||||
if (isProtectedProperty(property))
|
||||
{
|
||||
// always allow if this is the first time we are setting the protected property
|
||||
if (before == null || before.isEmpty() || before.get(property) == null)
|
||||
@@ -365,4 +360,3 @@ public class ModelSecurityServiceImpl extends BaseBehaviourBean
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -536,9 +536,8 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
||||
{
|
||||
if (AuthenticationUtil.getFullyAuthenticatedUser() != null &&
|
||||
AuthenticationUtil.isRunAsUserTheSystemUser() == false &&
|
||||
nodeService.exists(nodeRef) )
|
||||
{
|
||||
if (isRecord(nodeRef) )
|
||||
nodeService.exists(nodeRef) &&
|
||||
isRecord(nodeRef))
|
||||
{
|
||||
for (QName property : after.keySet())
|
||||
{
|
||||
@@ -579,7 +578,6 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get map containing record metadata aspects.
|
||||
@@ -1189,13 +1187,11 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
||||
}
|
||||
}
|
||||
|
||||
if (permissionService.hasPermission(filePlan, RMPermissionModel.EDIT_NON_RECORD_METADATA).equals(AccessStatus.ALLOWED))
|
||||
{
|
||||
if (logger.isDebugEnabled() )
|
||||
if (permissionService.hasPermission(filePlan, RMPermissionModel.EDIT_NON_RECORD_METADATA).equals(AccessStatus.ALLOWED) &&
|
||||
logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(" ... user has the edit non record metadata permission on the file plan");
|
||||
}
|
||||
}
|
||||
|
||||
// END DEBUG ...
|
||||
|
||||
|
@@ -181,7 +181,7 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
|
||||
}
|
||||
|
||||
// apply the readers to any renditions of the content
|
||||
if (isRecord(nodeRef) == true)
|
||||
if (isRecord(nodeRef))
|
||||
{
|
||||
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef assoc : assocs)
|
||||
@@ -194,12 +194,12 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
|
||||
// add to the extended security roles
|
||||
addExtendedSecurityRoles(nodeRef, readers, writers);
|
||||
|
||||
if (applyToParents == true)
|
||||
if (applyToParents)
|
||||
{
|
||||
// apply the extended readers up the file plan primary hierarchy
|
||||
NodeRef parent = nodeService.getPrimaryParent(nodeRef).getParentRef();
|
||||
if (parent != null &&
|
||||
filePlanService.isFilePlanComponent(parent) == true)
|
||||
filePlanService.isFilePlanComponent(parent))
|
||||
{
|
||||
addExtendedSecurityImpl(parent, readers, null, applyToParents);
|
||||
addExtendedSecurityImpl(parent, writers, null, applyToParents);
|
||||
@@ -238,17 +238,13 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
|
||||
|
||||
for (String authority : authorities)
|
||||
{
|
||||
if (authority.equals(PermissionService.ALL_AUTHORITIES) == false &&
|
||||
authority.equals(PermissionService.OWNER_AUTHORITY) == false)
|
||||
{
|
||||
if (referenceCountMap == null ||
|
||||
referenceCountMap.containsKey(authority) == false)
|
||||
if ((authority.equals(PermissionService.ALL_AUTHORITIES) == false && authority.equals(PermissionService.OWNER_AUTHORITY) == false) &&
|
||||
(referenceCountMap == null || referenceCountMap.containsKey(authority) == false))
|
||||
{
|
||||
// add the authority to the role
|
||||
filePlanRoleService.assignRoleToAuthority(filePlan, roleName, authority);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update the reference count
|
||||
nodeService.setProperty(filePlan, propertyName, (Serializable)addToMap(referenceCountMap, authorities));
|
||||
@@ -273,7 +269,7 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
|
||||
{
|
||||
if (key.equals(PermissionService.ALL_AUTHORITIES) == false)
|
||||
{
|
||||
if (map.containsKey(key) == true)
|
||||
if (map.containsKey(key))
|
||||
{
|
||||
// increment reference count
|
||||
Integer count = map.get(key);
|
||||
@@ -305,12 +301,12 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
|
||||
@Override
|
||||
public void removeExtendedSecurity(NodeRef nodeRef, Set<String> readers, Set<String>writers, boolean applyToParents)
|
||||
{
|
||||
if (hasExtendedSecurity(nodeRef) == true)
|
||||
if (hasExtendedSecurity(nodeRef))
|
||||
{
|
||||
removeExtendedSecurityImpl(nodeRef, readers, writers);
|
||||
|
||||
// remove the readers from any renditions of the content
|
||||
if (isRecord(nodeRef) == true)
|
||||
if (isRecord(nodeRef))
|
||||
{
|
||||
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef assoc : assocs)
|
||||
@@ -320,12 +316,12 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
|
||||
}
|
||||
}
|
||||
|
||||
if (applyToParents == true)
|
||||
if (applyToParents)
|
||||
{
|
||||
// apply the extended readers up the file plan primary hierarchy
|
||||
NodeRef parent = nodeService.getPrimaryParent(nodeRef).getParentRef();
|
||||
if (parent != null &&
|
||||
filePlanService.isFilePlanComponent(parent) == true)
|
||||
filePlanService.isFilePlanComponent(parent))
|
||||
{
|
||||
removeExtendedSecurity(parent, readers, null, applyToParents);
|
||||
removeExtendedSecurity(parent, writers, null, applyToParents);
|
||||
@@ -394,7 +390,7 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
|
||||
}
|
||||
|
||||
// reset the map to null if now empty
|
||||
if (map != null && map.isEmpty() == true)
|
||||
if (map != null && map.isEmpty())
|
||||
{
|
||||
map = null;
|
||||
}
|
||||
@@ -417,7 +413,7 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
|
||||
@Override
|
||||
public void removeAllExtendedSecurity(NodeRef nodeRef, boolean applyToParents)
|
||||
{
|
||||
if (hasExtendedSecurity(nodeRef) == true)
|
||||
if (hasExtendedSecurity(nodeRef))
|
||||
{
|
||||
removeExtendedSecurity(nodeRef, getExtendedReaders(nodeRef), getExtendedWriters(nodeRef));
|
||||
}
|
||||
|
@@ -236,14 +236,11 @@ public class TransferServiceImpl extends ServiceBaseImpl implements TransferServ
|
||||
nodeService.deleteNode(nodeRef);
|
||||
|
||||
NodeRef transferNodeRef = (NodeRef) AlfrescoTransactionSupport.getResource(KEY_TRANSFER_NODEREF);
|
||||
if (transferNodeRef != null)
|
||||
{
|
||||
if (transferNodeRef.equals(nodeRef))
|
||||
if (transferNodeRef != null && transferNodeRef.equals(nodeRef))
|
||||
{
|
||||
AlfrescoTransactionSupport.bindResource(KEY_TRANSFER_NODEREF, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks the node complete
|
||||
|
Reference in New Issue
Block a user