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:
Tuna Aksoy
2014-03-09 21:33:14 +00:00
parent dee5508911
commit 28b0a01065
22 changed files with 537 additions and 632 deletions

View File

@@ -43,156 +43,149 @@ import org.springframework.extensions.surf.util.I18NUtil;
/** /**
* Declare record action * Declare record action
* *
* @author Roy Wetherall * @author Roy Wetherall
*/ */
public class DeclareRecordAction extends RMActionExecuterAbstractBase public class DeclareRecordAction extends RMActionExecuterAbstractBase
{ {
/** I18N */ /** I18N */
private static final String MSG_UNDECLARED_ONLY_RECORDS = "rm.action.undeclared-only-records"; private static final String MSG_UNDECLARED_ONLY_RECORDS = "rm.action.undeclared-only-records";
private static final String MSG_NO_DECLARE_MAND_PROP = "rm.action.no-declare-mand-prop"; private static final String MSG_NO_DECLARE_MAND_PROP = "rm.action.no-declare-mand-prop";
/** Logger */ /** Logger */
private static Log logger = LogFactory.getLog(DeclareRecordAction.class); private static Log logger = LogFactory.getLog(DeclareRecordAction.class);
/** /**
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
*/ */
@Override @Override
protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef) protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef)
{ {
if (nodeService.exists(actionedUponNodeRef) == true && if (nodeService.exists(actionedUponNodeRef) == true &&
recordService.isRecord(actionedUponNodeRef) == true && recordService.isRecord(actionedUponNodeRef) == true &&
freezeService.isFrozen(actionedUponNodeRef) == false) freezeService.isFrozen(actionedUponNodeRef) == false)
{ {
if (recordService.isDeclared(actionedUponNodeRef) == false) if (recordService.isDeclared(actionedUponNodeRef) == false)
{
List<String> missingProperties = new ArrayList<String>(5);
// Aspect not already defined - check mandatory properties then add
if (mandatoryPropertiesSet(actionedUponNodeRef, missingProperties) == true)
{ {
recordService.disablePropertyEditableCheck(); List<String> missingProperties = new ArrayList<String>(5);
try // Aspect not already defined - check mandatory properties then add
{ if (mandatoryPropertiesSet(actionedUponNodeRef, missingProperties) == true)
// Add the declared aspect
Map<QName, Serializable> declaredProps = new HashMap<QName, Serializable>(2);
declaredProps.put(PROP_DECLARED_AT, new Date());
declaredProps.put(PROP_DECLARED_BY, AuthenticationUtil.getRunAsUser());
this.nodeService.addAspect(actionedUponNodeRef, ASPECT_DECLARED_RECORD, declaredProps);
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{
@Override
public Void doWork() throws Exception
{
// remove all owner related rights
ownableService.setOwner(actionedUponNodeRef, OwnableService.NO_OWNER);
return null;
}
});
}
finally
{ {
recordService.enablePropertyEditableCheck(); recordService.disablePropertyEditableCheck();
try
{
// Add the declared aspect
Map<QName, Serializable> declaredProps = new HashMap<QName, Serializable>(2);
declaredProps.put(PROP_DECLARED_AT, new Date());
declaredProps.put(PROP_DECLARED_BY, AuthenticationUtil.getRunAsUser());
this.nodeService.addAspect(actionedUponNodeRef, ASPECT_DECLARED_RECORD, declaredProps);
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{
@Override
public Void doWork() throws Exception
{
// remove all owner related rights
ownableService.setOwner(actionedUponNodeRef, OwnableService.NO_OWNER);
return null;
}
});
}
finally
{
recordService.enablePropertyEditableCheck();
}
}
else
{
logger.debug(buildMissingPropertiesErrorString(missingProperties));
action.setParameterValue(ActionExecuterAbstractBase.PARAM_RESULT, "missingProperties");
} }
} }
else }
{ else
logger.debug(buildMissingPropertiesErrorString(missingProperties)); {
action.setParameterValue(ActionExecuterAbstractBase.PARAM_RESULT, "missingProperties");
}
}
}
else
{
if (logger.isWarnEnabled()) if (logger.isWarnEnabled())
{ {
logger.warn(I18NUtil.getMessage(MSG_UNDECLARED_ONLY_RECORDS, actionedUponNodeRef.toString())); logger.warn(I18NUtil.getMessage(MSG_UNDECLARED_ONLY_RECORDS, actionedUponNodeRef.toString()));
} }
} }
}
private String buildMissingPropertiesErrorString(List<String> missingProperties)
{
StringBuilder builder = new StringBuilder(255);
builder.append(I18NUtil.getMessage(MSG_NO_DECLARE_MAND_PROP));
builder.append(" ");
for (String missingProperty : missingProperties)
{
builder.append(missingProperty)
.append(", ");
}
return builder.toString();
} }
/** private String buildMissingPropertiesErrorString(List<String> missingProperties)
* Helper method to check whether all the mandatory properties of the node have been set {
* StringBuilder builder = new StringBuilder(255);
* @param nodeRef node reference builder.append(I18NUtil.getMessage(MSG_NO_DECLARE_MAND_PROP));
* @return boolean true if all mandatory properties are set, false otherwise builder.append(" ");
*/ for (String missingProperty : missingProperties)
private boolean mandatoryPropertiesSet(NodeRef nodeRef, List<String> missingProperties) {
{ builder.append(missingProperty).append(", ");
boolean result = true; }
return builder.toString();
}
Map<QName, Serializable> nodeRefProps = this.nodeService.getProperties(nodeRef); /**
* Helper method to check whether all the mandatory properties of the node have been set
*
* @param nodeRef node reference
* @return boolean true if all mandatory properties are set, false otherwise
*/
private boolean mandatoryPropertiesSet(NodeRef nodeRef, List<String> missingProperties)
{
boolean result = true;
QName nodeRefType = this.nodeService.getType(nodeRef); Map<QName, Serializable> nodeRefProps = this.nodeService.getProperties(nodeRef);
TypeDefinition typeDef = this.dictionaryService.getType(nodeRefType); QName nodeRefType = this.nodeService.getType(nodeRef);
for (PropertyDefinition propDef : typeDef.getProperties().values())
{ TypeDefinition typeDef = this.dictionaryService.getType(nodeRefType);
if (propDef.isMandatory() == true) for (PropertyDefinition propDef : typeDef.getProperties().values())
{ {
if (nodeRefProps.get(propDef.getName()) == null) if (propDef.isMandatory() && nodeRefProps.get(propDef.getName()) == null)
{ {
logMissingProperty(propDef, missingProperties); logMissingProperty(propDef, missingProperties);
result = false; result = false;
break; break;
} }
} }
}
if (result != false) if (result != false)
{ {
Set<QName> aspects = this.nodeService.getAspects(nodeRef); Set<QName> aspects = this.nodeService.getAspects(nodeRef);
for (QName aspect : aspects) for (QName aspect : aspects)
{
AspectDefinition aspectDef = this.dictionaryService.getAspect(aspect);
for (PropertyDefinition propDef : aspectDef.getProperties().values())
{ {
if (propDef.isMandatory() == true) AspectDefinition aspectDef = this.dictionaryService.getAspect(aspect);
{ for (PropertyDefinition propDef : aspectDef.getProperties().values())
if (nodeRefProps.get(propDef.getName()) == null) {
{ if (propDef.isMandatory() && nodeRefProps.get(propDef.getName()) == null)
logMissingProperty(propDef, missingProperties); {
logMissingProperty(propDef, missingProperties);
result = false; result = false;
break; break;
} }
} }
} }
} }
}
return result; return result;
} }
/** /**
* Log information about missing properties. * Log information about missing properties.
* *
* @param propDef property definition * @param propDef property definition
* @param missingProperties missing properties * @param missingProperties missing properties
*/ */
private void logMissingProperty(PropertyDefinition propDef, List<String> missingProperties) private void logMissingProperty(PropertyDefinition propDef, List<String> missingProperties)
{ {
if (logger.isWarnEnabled()) if (logger.isWarnEnabled())
{ {
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
msg.append("Mandatory property missing: ").append(propDef.getName()); msg.append("Mandatory property missing: ").append(propDef.getName());
logger.warn(msg.toString()); logger.warn(msg.toString());
} }
missingProperties.add(propDef.getName().toString()); missingProperties.add(propDef.getName().toString());
} }
} }

View File

@@ -74,50 +74,48 @@ public class FileToAction extends RMActionExecuterAbstractBase
@Override @Override
protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef) protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef)
{ {
if (nodeService.exists(actionedUponNodeRef) == true && if (nodeService.exists(actionedUponNodeRef) &&
freezeService.isFrozen(actionedUponNodeRef) == false) freezeService.isFrozen(actionedUponNodeRef) == false &&
recordService.isFiled(actionedUponNodeRef) == false)
{ {
if (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);
if (recordFolder == null)
{ {
// first look to see if the destination record folder has been specified // get the reference to the record folder based on the relative path
NodeRef recordFolder = (NodeRef)action.getParameterValue(PARAM_DESTINATION_RECORD_FOLDER); recordFolder = createOrResolveRecordFolder(action, actionedUponNodeRef);
if (recordFolder == null) }
{
// get the reference to the record folder based on the relative path
recordFolder = createOrResolveRecordFolder(action, actionedUponNodeRef);
}
if (recordFolder == null) if (recordFolder == null)
{ {
throw new AlfrescoRuntimeException("Unable to execute file to action, because the destination record folder could not be determined."); 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; final NodeRef finalRecordFolder = recordFolder;
AuthenticationUtil.runAsSystem(new RunAsWork<Void>() AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{
@Override
public Void doWork() throws Exception
{ {
@Override try
public Void doWork() throws Exception
{ {
try fileFolderService.move(actionedUponNodeRef, finalRecordFolder, null);
{
fileFolderService.move(actionedUponNodeRef, finalRecordFolder, null);
}
catch (FileNotFoundException fileNotFound)
{
throw new AlfrescoRuntimeException("Unable to execute file to action, because the move operation failed.", fileNotFound);
}
return null;
} }
}); catch (FileNotFoundException fileNotFound)
} {
else throw new AlfrescoRuntimeException("Unable to execute file to action, because the move operation failed.", fileNotFound);
{ }
throw new AlfrescoRuntimeException("Unable to execute file to action, becuase the destination was not a record folder.");
} return null;
}
});
}
else
{
throw new AlfrescoRuntimeException("Unable to execute file to action, becuase the destination was not a record folder.");
} }
} }
} }
@@ -164,7 +162,7 @@ public class FileToAction extends RMActionExecuterAbstractBase
if (recordFolder == null) if (recordFolder == null)
{ {
if (create == true) if (create)
{ {
// get the parent into which we are going to create the new record folder // get the parent into which we are going to create the new record folder
NodeRef parent = resolveParent(context, pathValues, create); NodeRef parent = resolveParent(context, pathValues, create);
@@ -259,7 +257,7 @@ public class FileToAction extends RMActionExecuterAbstractBase
{ {
NodeRef result = null; 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 // this should never occur since if the path is empty then the context it the resolution of the
// path .. the context must already exist // path .. the context must already exist

View File

@@ -306,9 +306,9 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
@Override @Override
public Void doWork() throws Exception public Void doWork() throws Exception
{ {
if (nodeService.exists(nodeRef) == true && if (nodeService.exists(nodeRef) &&
dictionaryService.getAllModels().contains(RM_CUSTOM_MODEL) == true && dictionaryService.getAllModels().contains(RM_CUSTOM_MODEL) &&
isCustomisable(aspectTypeQName) == true) isCustomisable(aspectTypeQName))
{ {
QName customPropertyAspect = getCustomAspect(aspectTypeQName); QName customPropertyAspect = getCustomAspect(aspectTypeQName);
nodeService.addAspect(nodeRef, customPropertyAspect, null); nodeService.addAspect(nodeRef, customPropertyAspect, null);
@@ -336,8 +336,8 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
@Override @Override
public Void doWork() throws Exception public Void doWork() throws Exception
{ {
if (nodeService.exists(nodeRef) == true && if (nodeService.exists(nodeRef) &&
isCustomisable(aspectTypeQName) == true) isCustomisable(aspectTypeQName))
{ {
QName customPropertyAspect = getCustomAspect(aspectTypeQName); QName customPropertyAspect = getCustomAspect(aspectTypeQName);
nodeService.removeAspect(nodeRef, customPropertyAspect); nodeService.removeAspect(nodeRef, customPropertyAspect);
@@ -367,13 +367,13 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
@Override @Override
public Void doWork() throws Exception 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(); NodeRef nodeRef = childAssocRef.getChildRef();
QName type = nodeService.getType(nodeRef); QName type = nodeService.getType(nodeRef);
while (type != null && ContentModel.TYPE_CMOBJECT.equals(type) == false) while (type != null && ContentModel.TYPE_CMOBJECT.equals(type) == false)
{ {
if (isCustomisable(type) == true) if (isCustomisable(type))
{ {
QName customPropertyAspect = getCustomAspect(type); QName customPropertyAspect = getCustomAspect(type);
nodeService.addAspect(nodeRef, customPropertyAspect, null); nodeService.addAspect(nodeRef, customPropertyAspect, null);
@@ -438,7 +438,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
while (type != null && ContentModel.TYPE_CMOBJECT.equals(type) == false) while (type != null && ContentModel.TYPE_CMOBJECT.equals(type) == false)
{ {
// Add to the list if the type is customisable // Add to the list if the type is customisable
if (isCustomisable(type) == true) if (isCustomisable(type))
{ {
result.add(type); result.add(type);
} }
@@ -463,7 +463,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
while (tempAspect != null) while (tempAspect != null)
{ {
// Add to the list if the aspect is customisable // Add to the list if the aspect is customisable
if (isCustomisable(tempAspect) == true) if (isCustomisable(tempAspect))
{ {
result.add(tempAspect); result.add(tempAspect);
} }
@@ -499,33 +499,31 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
{ {
AspectDefinition aspectDef = dictionaryService.getAspect(aspect); AspectDefinition aspectDef = dictionaryService.getAspect(aspect);
String name = aspectDef.getName().getLocalName(); String name = aspectDef.getName().getLocalName();
if (name.endsWith("Properties") == true) if (name.endsWith("Properties"))
{ {
QName type = null; QName type = null;
String prefixString = aspectDef.getDescription(dictionaryService); String prefixString = aspectDef.getDescription(dictionaryService);
if (prefixString == null) if (prefixString == null)
{ {
// Backward compatibility from previous RM V1.0 custom models // 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; 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; 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; 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
aspectDef.getProperties().size() != 0)
{ {
// Only add the deprecated record series type as customisable if type = CompatibilityModel.TYPE_RECORD_SERIES;
// a v1.0 installation has added custom properties
if (aspectDef.getProperties().size() != 0)
{
type = CompatibilityModel.TYPE_RECORD_SERIES;
}
} }
} }
else else
@@ -539,7 +537,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
customisableTypes.put(type, aspect); customisableTypes.put(type, aspect);
// Remove customisable type from the pending list // Remove customisable type from the pending list
if (pendingCustomisableTypes != null && pendingCustomisableTypes.contains(type) == true) if (pendingCustomisableTypes != null && pendingCustomisableTypes.contains(type))
{ {
pendingCustomisableTypes.remove(type); pendingCustomisableTypes.remove(type);
} }
@@ -692,7 +690,7 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
ParameterCheck.mandatory("propertyName", propertyName); ParameterCheck.mandatory("propertyName", propertyName);
boolean result = false; boolean result = false;
if (RM_CUSTOM_URI.equals(propertyName.getNamespaceURI()) == true && if (RM_CUSTOM_URI.equals(propertyName.getNamespaceURI()) &&
dictionaryService.getProperty(propertyName) != null) dictionaryService.getProperty(propertyName) != null)
{ {
result = true; result = true;
@@ -1403,12 +1401,9 @@ public class RecordsManagementAdminServiceImpl implements RecordsManagementAdmin
for (M2ClassAssociation assoc : customAssocsAspect.getAssociations()) for (M2ClassAssociation assoc : customAssocsAspect.getAssociations())
{ {
if (refQName.toPrefixString(namespaceService).equals(assoc.getName())) if (refQName.toPrefixString(namespaceService).equals(assoc.getName()) && newTitle != null)
{ {
if (newTitle != null) assoc.setTitle(newTitle);
{
assoc.setTitle(newTitle);
}
} }
} }
writeCustomContentModel(modelRef, deserializedModel); writeCustomContentModel(modelRef, deserializedModel);

View File

@@ -212,12 +212,9 @@ public class CapabilityServiceImpl implements CapabilityService
for (Capability capability : getCapabilities()) for (Capability capability : getCapabilities())
{ {
Group group = capability.getGroup(); Group group = capability.getGroup();
if (group != null) if (group != null && group.getId().equalsIgnoreCase(id))
{ {
if (group.getId().equalsIgnoreCase(id)) capabilities.add(capability);
{
capabilities.add(capability);
}
} }
} }

View File

@@ -64,16 +64,16 @@ public class RMSecurityCommon implements ApplicationContextAware
/** Application context */ /** Application context */
protected ApplicationContext applicationContext; protected ApplicationContext applicationContext;
/** /**
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
*/ */
@Override @Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
{ {
this.applicationContext = applicationContext; this.applicationContext = applicationContext;
} }
/** /**
* @param nodeService node service * @param nodeService node service
*/ */
@@ -101,7 +101,7 @@ public class RMSecurityCommon implements ApplicationContextAware
/** /**
* @return FilePlanService file plan service * @return FilePlanService file plan service
*/ */
protected FilePlanService getFilePlanService() protected FilePlanService getFilePlanService()
{ {
if (filePlanService == null) if (filePlanService == null)
{ {
@@ -331,28 +331,25 @@ public class RMSecurityCommon implements ApplicationContextAware
} }
} }
} }
else if (AssociationRef.class.isAssignableFrom(params[position])) else if (AssociationRef.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null)
{ {
if (invocation.getArguments()[position] != null) if (parent)
{ {
if (parent) testNodeRef = ((AssociationRef) invocation.getArguments()[position]).getSourceRef();
}
else
{
testNodeRef = ((AssociationRef) invocation.getArguments()[position]).getTargetRef();
}
if (logger.isDebugEnabled())
{
if (nodeService.exists(testNodeRef))
{ {
testNodeRef = ((AssociationRef) invocation.getArguments()[position]).getSourceRef(); logger.debug("\tPermission test on node " + nodeService.getPath(testNodeRef));
} }
else else
{ {
testNodeRef = ((AssociationRef) invocation.getArguments()[position]).getTargetRef(); logger.debug("\tPermission test on non-existing node " + testNodeRef);
}
if (logger.isDebugEnabled())
{
if (nodeService.exists(testNodeRef))
{
logger.debug("\tPermission test on node " + nodeService.getPath(testNodeRef));
}
else
{
logger.debug("\tPermission test on non-existing node " + testNodeRef);
}
} }
} }
} }

View File

@@ -57,12 +57,9 @@ public class HasDispositionDateCapabilityCondition extends AbstractCapabilityCon
result = true; result = true;
} }
} }
else if (filePlanService.isFilePlanComponent(nodeRef)) else if (filePlanService.isFilePlanComponent(nodeRef) && nodeService.getProperty(nodeRef, PROP_DISPOSITION_AS_OF) != null)
{ {
if (nodeService.getProperty(nodeRef, PROP_DISPOSITION_AS_OF) != null) result = true;
{
result = true;
}
} }
return result; return result;

View File

@@ -62,20 +62,16 @@ public class MayBeScheduledCapabilityCondition extends AbstractCapabilityConditi
boolean result = false; boolean result = false;
DispositionSchedule dispositionSchedule = dispositionService.getDispositionSchedule(nodeRef); DispositionSchedule dispositionSchedule = dispositionService.getDispositionSchedule(nodeRef);
if (dispositionSchedule != null) if (dispositionSchedule != null && checkDispositionLevel(nodeRef, dispositionSchedule))
{ {
if (checkDispositionLevel(nodeRef, dispositionSchedule) == true) for (DispositionActionDefinition dispositionActionDefinition : dispositionSchedule.getDispositionActionDefinitions())
{ {
for (DispositionActionDefinition dispositionActionDefinition : dispositionSchedule.getDispositionActionDefinitions()) if (dispositionActionDefinition.getName().equals(dispositionAction))
{ {
if (dispositionActionDefinition.getName().equals(dispositionAction) == true) result = true;
{ break;
result = true;
break;
}
} }
} }
} }
return result; return result;
} }
@@ -91,11 +87,11 @@ public class MayBeScheduledCapabilityCondition extends AbstractCapabilityConditi
{ {
boolean result = false; boolean result = false;
boolean isRecordLevelDisposition = dispositionSchedule.isRecordLevelDisposition(); boolean isRecordLevelDisposition = dispositionSchedule.isRecordLevelDisposition();
if (recordService.isRecord(nodeRef) == true && isRecordLevelDisposition == true) if (recordService.isRecord(nodeRef) && isRecordLevelDisposition)
{ {
result = true; result = true;
} }
else if (recordFolderService.isRecordFolder(nodeRef) == true && isRecordLevelDisposition == false) else if (recordFolderService.isRecordFolder(nodeRef) && isRecordLevelDisposition == false)
{ {
result = true; result = true;

View File

@@ -25,7 +25,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
/** /**
* Change or delete references capability * Change or delete references capability
* *
* @author Roy Wetherall * @author Roy Wetherall
*/ */
public class ChangeOrDeleteReferencesCapability extends DeclarativeCapability public class ChangeOrDeleteReferencesCapability extends DeclarativeCapability
@@ -39,7 +39,7 @@ public class ChangeOrDeleteReferencesCapability extends DeclarativeCapability
// Can't be sure, because we don't have information about the target so we still abstain // Can't be sure, because we don't have information about the target so we still abstain
return AccessDecisionVoter.ACCESS_ABSTAIN; return AccessDecisionVoter.ACCESS_ABSTAIN;
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.capability.AbstractCapability#evaluate(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) * @see org.alfresco.module.org_alfresco_module_rm.capability.AbstractCapability#evaluate(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef)
*/ */
@@ -49,25 +49,21 @@ public class ChangeOrDeleteReferencesCapability extends DeclarativeCapability
{ {
if (target != null) if (target != null)
{ {
if (getFilePlanService().isFilePlanComponent(target) == true) if (getFilePlanService().isFilePlanComponent(target) &&
checkConditions(source) &&
checkConditions(target) &&
checkPermissions(source) &&
checkPermissions(target))
{ {
if (checkConditions(source) == true && checkConditions(target) == true) return AccessDecisionVoter.ACCESS_GRANTED;
{
if (checkPermissions(source) == true && checkPermissions(target) == true)
{
return AccessDecisionVoter.ACCESS_GRANTED;
}
}
} }
} }
else else
{ {
if (checkConditions(source) == true) if (checkConditions(source) &&
checkPermissions(source))
{ {
if (checkPermissions(source) == true) return AccessDecisionVoter.ACCESS_GRANTED;
{
return AccessDecisionVoter.ACCESS_GRANTED;
}
} }
} }

View File

@@ -41,10 +41,10 @@ public class CreateCapability extends DeclarativeCapability
{ {
/** record service */ /** record service */
private RecordService recordService; private RecordService recordService;
/** record folder service */ /** record folder service */
private RecordFolderService recordFolderService; private RecordFolderService recordFolderService;
/** /**
* @param recordService record service * @param recordService record service
*/ */
@@ -60,7 +60,7 @@ public class CreateCapability extends DeclarativeCapability
{ {
this.recordFolderService = recordFolderService; this.recordFolderService = recordFolderService;
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#evaluate(org.alfresco.service.cmr.repository.NodeRef) * @see org.alfresco.module.org_alfresco_module_rm.capability.Capability#evaluate(org.alfresco.service.cmr.repository.NodeRef)
*/ */
@@ -93,24 +93,21 @@ public class CreateCapability extends DeclarativeCapability
{ {
if ((assocType == null) || assocType.equals(ContentModel.ASSOC_CONTAINS) == false) if ((assocType == null) || assocType.equals(ContentModel.ASSOC_CONTAINS) == false)
{ {
if(linkee == null) if(linkee == null &&
recordService.isRecord(destination) &&
recordService.isDeclared(destination) == false &&
permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED)
{ {
if(recordService.isRecord(destination) && recordService.isDeclared(destination) == false) return AccessDecisionVoter.ACCESS_GRANTED;
{
if (permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED)
{
return AccessDecisionVoter.ACCESS_GRANTED;
}
}
} }
else else
{ {
if(recordService.isRecord(linkee) && recordService.isRecord(destination) && recordService.isDeclared(destination) == false) if (recordService.isRecord(linkee) &&
recordService.isRecord(destination) &&
recordService.isDeclared(destination) == false &&
permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED)
{ {
if (permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED) return AccessDecisionVoter.ACCESS_GRANTED;
{
return AccessDecisionVoter.ACCESS_GRANTED;
}
} }
} }
@@ -123,40 +120,28 @@ public class CreateCapability extends DeclarativeCapability
conditions.put("capabilityCondition.closed", Boolean.FALSE); conditions.put("capabilityCondition.closed", Boolean.FALSE);
conditions.put("capabilityCondition.cutoff", Boolean.FALSE); conditions.put("capabilityCondition.cutoff", Boolean.FALSE);
if (checkConditions(destination, conditions) == true) if (checkConditions(destination, conditions) &&
recordFolderService.isRecordFolder(destination) &&
permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED)
{ {
if (recordFolderService.isRecordFolder(destination)) return AccessDecisionVoter.ACCESS_GRANTED;
{
if (permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED)
{
return AccessDecisionVoter.ACCESS_GRANTED;
}
}
} }
conditions.put("capabilityCondition.closed", Boolean.TRUE); conditions.put("capabilityCondition.closed", Boolean.TRUE);
if (checkConditions(destination, conditions) == true) if (checkConditions(destination, conditions) &&
recordFolderService.isRecordFolder(destination) &&
permissionService.hasPermission(getFilePlanService().getFilePlan(destination), RMPermissionModel.DECLARE_RECORDS_IN_CLOSED_FOLDERS) == AccessStatus.ALLOWED)
{ {
if (recordFolderService.isRecordFolder(destination)) return AccessDecisionVoter.ACCESS_GRANTED;
{
if (permissionService.hasPermission(getFilePlanService().getFilePlan(destination), RMPermissionModel.DECLARE_RECORDS_IN_CLOSED_FOLDERS) == AccessStatus.ALLOWED)
{
return AccessDecisionVoter.ACCESS_GRANTED;
}
}
} }
conditions.remove("capabilityCondition.closed"); conditions.remove("capabilityCondition.closed");
conditions.put("capabilityCondition.cutoff", Boolean.TRUE); conditions.put("capabilityCondition.cutoff", Boolean.TRUE);
if (checkConditions(destination, conditions) == true) if (checkConditions(destination, conditions) &&
recordFolderService.isRecordFolder(destination) &&
permissionService.hasPermission(getFilePlanService().getFilePlan(destination), RMPermissionModel.CREATE_MODIFY_RECORDS_IN_CUTOFF_FOLDERS) == AccessStatus.ALLOWED)
{ {
if (recordFolderService.isRecordFolder(destination)) return AccessDecisionVoter.ACCESS_GRANTED;
{
if (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) if (capabilityService.getCapability(RMPermissionModel.CREATE_MODIFY_DESTROY_FOLDERS).evaluate(destination) == AccessDecisionVoter.ACCESS_GRANTED)

View File

@@ -25,7 +25,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
/** /**
* Delete links capability. * Delete links capability.
* *
* @author Roy Wetherall * @author Roy Wetherall
*/ */
public class DeleteLinksCapability extends DeclarativeCapability public class DeleteLinksCapability extends DeclarativeCapability
@@ -45,15 +45,15 @@ public class DeleteLinksCapability extends DeclarativeCapability
*/ */
public int evaluate(NodeRef source, NodeRef target) public int evaluate(NodeRef source, NodeRef target)
{ {
if (getFilePlanService().isFilePlanComponent(source) == true && if (getFilePlanService().isFilePlanComponent(source) &&
getFilePlanService().isFilePlanComponent(target) == true) getFilePlanService().isFilePlanComponent(target))
{ {
if (checkConditions(source) == true && checkConditions(target) == true) if (checkConditions(source) &&
checkConditions(target) &&
checkPermissions(source) &&
checkPermissions(target))
{ {
if (checkPermissions(source) == true && checkPermissions(target) == true) return AccessDecisionVoter.ACCESS_GRANTED;
{
return AccessDecisionVoter.ACCESS_GRANTED;
}
} }
return AccessDecisionVoter.ACCESS_DENIED; return AccessDecisionVoter.ACCESS_DENIED;
} }

View File

@@ -32,26 +32,26 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
/** /**
* Abstract base policy implementation * Abstract base policy implementation
* *
* @author Roy Wetherall * @author Roy Wetherall
* @since 2.1 * @since 2.1
*/ */
public abstract class AbstractBasePolicy extends RMSecurityCommon public abstract class AbstractBasePolicy extends RMSecurityCommon
implements Policy implements Policy
{ {
/** Logger */ /** Logger */
protected static Log logger = LogFactory.getLog(AbstractBasePolicy.class); protected static Log logger = LogFactory.getLog(AbstractBasePolicy.class);
/** Capability service */ /** Capability service */
protected CapabilityService capabilityService; protected CapabilityService capabilityService;
/** Policy register */ /** Policy register */
protected PolicyRegister policyRegister; protected PolicyRegister policyRegister;
/** Policy name */ /** Policy name */
protected String name; protected String name;
/** /**
* @param name policy name * @param name policy name
*/ */
@@ -59,7 +59,7 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
{ {
this.name = name; this.name = name;
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.capability.policy.Policy#getName() * @see org.alfresco.module.org_alfresco_module_rm.capability.policy.Policy#getName()
*/ */
@@ -68,7 +68,7 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
{ {
return name; return name;
} }
/** /**
* @param capabilityService capability service * @param capabilityService capability service
*/ */
@@ -76,15 +76,15 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
{ {
this.capabilityService = capabilityService; this.capabilityService = capabilityService;
} }
/** /**
* @param policyRegister policy register * @param policyRegister policy register
*/ */
public void setPolicyRegister(PolicyRegister policyRegister) public void setPolicyRegister(PolicyRegister policyRegister)
{ {
this.policyRegister = policyRegister; this.policyRegister = policyRegister;
} }
/** /**
* Init method * Init method
*/ */
@@ -92,9 +92,9 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
{ {
policyRegister.registerPolicy(this); policyRegister.registerPolicy(this);
} }
/** /**
* *
* @param invocation * @param invocation
* @param params * @param params
* @param position * @param position
@@ -112,20 +112,17 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
return qname; return qname;
} }
} }
else if (NodeRef.class.isAssignableFrom(params[position])) else if (NodeRef.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null)
{ {
if (invocation.getArguments()[position] != null) NodeRef nodeRef = (NodeRef) invocation.getArguments()[position];
{ return nodeService.getType(nodeRef);
NodeRef nodeRef = (NodeRef) invocation.getArguments()[position];
return nodeService.getType(nodeRef);
}
} }
return null; return null;
} }
/** /**
* *
* @param invocation * @param invocation
* @param params * @param params
* @param position * @param position
@@ -134,19 +131,16 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
protected QName getQName(MethodInvocation invocation, Class[] params, int position) protected QName getQName(MethodInvocation invocation, Class[] params, int position)
{ {
if (QName.class.isAssignableFrom(params[position])) if (QName.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null)
{ {
if (invocation.getArguments()[position] != null) QName qname = (QName) invocation.getArguments()[position];
{ return qname;
QName qname = (QName) invocation.getArguments()[position];
return qname;
}
} }
throw new ACLEntryVoterException("Unknown type"); throw new ACLEntryVoterException("Unknown type");
} }
/** /**
* *
* @param invocation * @param invocation
* @param params * @param params
* @param position * @param position
@@ -159,19 +153,16 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
{ {
return null; return null;
} }
if (Serializable.class.isAssignableFrom(params[position])) if (Serializable.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null)
{ {
if (invocation.getArguments()[position] != null) Serializable property = (Serializable) invocation.getArguments()[position];
{ return property;
Serializable property = (Serializable) invocation.getArguments()[position];
return property;
}
} }
throw new ACLEntryVoterException("Unknown type"); throw new ACLEntryVoterException("Unknown type");
} }
/** /**
* *
* @param invocation * @param invocation
* @param params * @param params
* @param position * @param position
@@ -184,13 +175,10 @@ public abstract class AbstractBasePolicy extends RMSecurityCommon
{ {
return null; return null;
} }
if (Map.class.isAssignableFrom(params[position])) if (Map.class.isAssignableFrom(params[position]) && invocation.getArguments()[position] != null)
{ {
if (invocation.getArguments()[position] != null) Map<QName, Serializable> properties = (Map<QName, Serializable>) invocation.getArguments()[position];
{ return properties;
Map<QName, Serializable> properties = (Map<QName, Serializable>) invocation.getArguments()[position];
return properties;
}
} }
throw new ACLEntryVoterException("Unknown type"); throw new ACLEntryVoterException("Unknown type");
} }

View File

@@ -30,29 +30,23 @@ public class UpdatePolicy extends AbstractBasePolicy
{ {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public int evaluate( public int evaluate(
MethodInvocation invocation, MethodInvocation invocation,
Class[] params, Class[] params,
ConfigAttributeDefinition cad) ConfigAttributeDefinition cad)
{ {
NodeRef updatee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); NodeRef updatee = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
QName aspectQName = null; QName aspectQName = null;
if (cad.getParameters().size() > 1) if (cad.getParameters().size() > 1 && cad.getParameters().get(1) > -1)
{ {
if (cad.getParameters().get(1) > -1) aspectQName = getQName(invocation, params, cad.getParameters().get(1));
{
aspectQName = getQName(invocation, params, cad.getParameters().get(1));
}
} }
Map<QName, Serializable> properties = null; Map<QName, Serializable> properties = null;
if (cad.getParameters().size() > 2) if (cad.getParameters().size() > 2 && cad.getParameters().get(2) > -1)
{ {
if (cad.getParameters().get(2) > -1) properties = getProperties(invocation, params, cad.getParameters().get(2));
{
properties = getProperties(invocation, params, cad.getParameters().get(2));
}
} }
UpdateCapability updateCapability = (UpdateCapability)capabilityService.getCapability("Update"); UpdateCapability updateCapability = (UpdateCapability)capabilityService.getCapability("Update");
return updateCapability.evaluate(updatee, aspectQName, properties); return updateCapability.evaluate(updatee, aspectQName, properties);
} }

View File

@@ -543,16 +543,13 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon
List<String> allowedValues = new ArrayList<String>(0); List<String> allowedValues = new ArrayList<String>(0);
String userName = AuthenticationUtil.getRunAsUser(); String userName = AuthenticationUtil.getRunAsUser();
if (userName != null) if (userName != null && !(AuthenticationUtil.isMtEnabled() && AuthenticationUtil.isRunAsUserTheSystemUser()))
{ {
if (! (AuthenticationUtil.isMtEnabled() && AuthenticationUtil.isRunAsUserTheSystemUser())) // note: userName and userGroupNames must not be null
{ caveatConfig.get(constraintName);
// note: userName and userGroupNames must not be null
caveatConfig.get(constraintName);
Set<String> userGroupFullNames = authorityService.getAuthoritiesForUser(userName); Set<String> userGroupFullNames = authorityService.getAuthoritiesForUser(userName);
allowedValues = getRMAllowedValues(userName, userGroupFullNames, constraintName); allowedValues = getRMAllowedValues(userName, userGroupFullNames, constraintName);
}
} }
return allowedValues; return allowedValues;

View File

@@ -43,35 +43,35 @@ import org.apache.commons.logging.LogFactory;
/** /**
* RM Caveat Config Service impl * RM Caveat Config Service impl
* *
* @author janv * @author janv
*/ */
public class RMCaveatConfigServiceImpl implements RMCaveatConfigService public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
{ {
private static Log logger = LogFactory.getLog(RMCaveatConfigServiceImpl.class); private static Log logger = LogFactory.getLog(RMCaveatConfigServiceImpl.class);
private NamespaceService namespaceService; private NamespaceService namespaceService;
private DictionaryService dictionaryService; private DictionaryService dictionaryService;
private RMCaveatConfigComponent rmCaveatConfigComponent; private RMCaveatConfigComponent rmCaveatConfigComponent;
private RecordsManagementAdminService recordsManagementAdminService; private RecordsManagementAdminService recordsManagementAdminService;
public void setNamespaceService(NamespaceService namespaceService) public void setNamespaceService(NamespaceService namespaceService)
{ {
this.namespaceService = namespaceService; this.namespaceService = namespaceService;
} }
public void setDictionaryService(DictionaryService dictionaryService) public void setDictionaryService(DictionaryService dictionaryService)
{ {
this.dictionaryService = dictionaryService; this.dictionaryService = dictionaryService;
} }
public void setCaveatConfigComponent(RMCaveatConfigComponent rmCaveatConfigComponent) public void setCaveatConfigComponent(RMCaveatConfigComponent rmCaveatConfigComponent)
{ {
this.rmCaveatConfigComponent = rmCaveatConfigComponent; this.rmCaveatConfigComponent = rmCaveatConfigComponent;
} }
public void setRecordsManagementAdminService(RecordsManagementAdminService recordsManagementAdminService) public void setRecordsManagementAdminService(RecordsManagementAdminService recordsManagementAdminService)
{ {
this.recordsManagementAdminService = recordsManagementAdminService; this.recordsManagementAdminService = recordsManagementAdminService;
@@ -81,36 +81,36 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
{ {
return recordsManagementAdminService; return recordsManagementAdminService;
} }
public void init() public void init()
{ {
rmCaveatConfigComponent.init(); rmCaveatConfigComponent.init();
} }
public NodeRef updateOrCreateCaveatConfig(InputStream is) public NodeRef updateOrCreateCaveatConfig(InputStream is)
{ {
return rmCaveatConfigComponent.updateOrCreateCaveatConfig(is); return rmCaveatConfigComponent.updateOrCreateCaveatConfig(is);
} }
public NodeRef updateOrCreateCaveatConfig(File jsonFile) public NodeRef updateOrCreateCaveatConfig(File jsonFile)
{ {
return rmCaveatConfigComponent.updateOrCreateCaveatConfig(jsonFile); return rmCaveatConfigComponent.updateOrCreateCaveatConfig(jsonFile);
} }
public NodeRef updateOrCreateCaveatConfig(String jsonString) public NodeRef updateOrCreateCaveatConfig(String jsonString)
{ {
return rmCaveatConfigComponent.updateOrCreateCaveatConfig(jsonString); return rmCaveatConfigComponent.updateOrCreateCaveatConfig(jsonString);
} }
// Get allowed values for given caveat (for current user) // Get allowed values for given caveat (for current user)
public List<String> getRMAllowedValues(String constraintName) public List<String> getRMAllowedValues(String constraintName)
{ {
return rmCaveatConfigComponent.getRMAllowedValues(constraintName); return rmCaveatConfigComponent.getRMAllowedValues(constraintName);
} }
/** /**
* Check whether access to 'record component' node is vetoed for current user due to caveat(s) * Check whether access to 'record component' node is vetoed for current user due to caveat(s)
* *
* @param nodeRef * @param nodeRef
* @return false, if caveat(s) veto access otherwise return true * @return false, if caveat(s) veto access otherwise return true
*/ */
@@ -118,7 +118,7 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
{ {
return rmCaveatConfigComponent.hasAccess(nodeRef); return rmCaveatConfigComponent.hasAccess(nodeRef);
} }
/** /**
* add RM constraint list * add RM constraint list
* @param listName the name of the RMConstraintList * @param listName the name of the RMConstraintList
@@ -127,7 +127,7 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
{ {
return addRMConstraint(listName, title, values, MatchLogic.AND); return addRMConstraint(listName, title, values, MatchLogic.AND);
} }
public RMConstraintInfo addRMConstraint(String listName, String title, String[] values, MatchLogic matchLogic) public RMConstraintInfo addRMConstraint(String listName, String title, String[] values, MatchLogic matchLogic)
{ {
if(listName == null) if(listName == null)
@@ -136,15 +136,15 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
// FIXME: hardcoded namespace // FIXME: hardcoded namespace
listName = "rmc:" + UUID.randomUUID().toString(); listName = "rmc:" + UUID.randomUUID().toString();
} }
List<String>allowedValues = new ArrayList<String>(); List<String>allowedValues = new ArrayList<String>();
for(String value : values) for(String value : values)
{ {
allowedValues.add(value); allowedValues.add(value);
} }
QName listQName = QName.createQName(listName, namespaceService); QName listQName = QName.createQName(listName, namespaceService);
// TEMP review - if it already exists then change it for now // TEMP review - if it already exists then change it for now
try try
{ {
@@ -158,9 +158,9 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
recordsManagementAdminService.changeCustomConstraintTitle(listQName, title); recordsManagementAdminService.changeCustomConstraintTitle(listQName, title);
} }
} }
rmCaveatConfigComponent.addRMConstraint(listName); rmCaveatConfigComponent.addRMConstraint(listName);
RMConstraintInfo info = new RMConstraintInfo(); RMConstraintInfo info = new RMConstraintInfo();
info.setName(listQName.toPrefixString()); info.setName(listQName.toPrefixString());
info.setTitle(title); info.setTitle(title);
@@ -168,24 +168,24 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
info.setCaseSensitive(true); info.setCaseSensitive(true);
return info; return info;
} }
/** /**
* delete RM Constraint List * delete RM Constraint List
* *
* @param listName the name of the RMConstraintList * @param listName the name of the RMConstraintList
*/ */
public void deleteRMConstraint(String listName) public void deleteRMConstraint(String listName)
{ {
rmCaveatConfigComponent.deleteRMConstraint(listName); rmCaveatConfigComponent.deleteRMConstraint(listName);
QName listQName = QName.createQName(listName, namespaceService); QName listQName = QName.createQName(listName, namespaceService);
recordsManagementAdminService.removeCustomConstraintDefinition(listQName); recordsManagementAdminService.removeCustomConstraintDefinition(listQName);
} }
/** /**
* Add a single value to an authority in a list. The existing values of the list remain. * Add a single value to an authority in a list. The existing values of the list remain.
* *
* @param listName the name of the RMConstraintList * @param listName the name of the RMConstraintList
* @param authorityName * @param authorityName
* @param values * @param values
@@ -195,7 +195,7 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
{ {
rmCaveatConfigComponent.addRMConstraintListValue(listName, authorityName, value); rmCaveatConfigComponent.addRMConstraintListValue(listName, authorityName, value);
} }
/** /**
* Get the details of the specified list * Get the details of the specified list
* @param listName * @param listName
@@ -205,13 +205,13 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
{ {
return rmCaveatConfigComponent.getListDetails(listName); return rmCaveatConfigComponent.getListDetails(listName);
} }
/** /**
* Replace the values for an authority in a list. * Replace the values for an authority in a list.
* The existing values are removed. * The existing values are removed.
* *
* If the authority does not already exist in the list, it will be added * If the authority does not already exist in the list, it will be added
* *
* @param listName the name of the RMConstraintList * @param listName the name of the RMConstraintList
* @param authorityName * @param authorityName
* @param values * @param values
@@ -220,10 +220,10 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
{ {
rmCaveatConfigComponent.updateRMConstraintListAuthority(listName, authorityName, values); rmCaveatConfigComponent.updateRMConstraintListAuthority(listName, authorityName, values);
} }
/** /**
* Replace the authorities for a value in a list * Replace the authorities for a value in a list
* *
* @param listName * @param listName
* @param valueName * @param valueName
* @param authorities * @param authorities
@@ -232,10 +232,10 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
{ {
rmCaveatConfigComponent.updateRMConstraintListValue(listName, valueName, authorities); rmCaveatConfigComponent.updateRMConstraintListValue(listName, valueName, authorities);
} }
/** /**
* Remove an authority from a list * Remove an authority from a list
* *
* @param listName the name of the RMConstraintList * @param listName the name of the RMConstraintList
* @param authorityName * @param authorityName
* @param values * @param values
@@ -244,20 +244,20 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
{ {
rmCaveatConfigComponent.removeRMConstraintListAuthority(listName, authorityName); rmCaveatConfigComponent.removeRMConstraintListAuthority(listName, authorityName);
} }
/** /**
* Get all Constraint Lists * Get all Constraint Lists
*/ */
public Set<RMConstraintInfo> getAllRMConstraints() public Set<RMConstraintInfo> getAllRMConstraints()
{ {
Set<RMConstraintInfo> info = new HashSet<RMConstraintInfo>(); Set<RMConstraintInfo> info = new HashSet<RMConstraintInfo>();
List<ConstraintDefinition> defs = new ArrayList<ConstraintDefinition>(10); List<ConstraintDefinition> defs = new ArrayList<ConstraintDefinition>(10);
for (QName caveatModelQName : rmCaveatConfigComponent.getRMCaveatModels()) for (QName caveatModelQName : rmCaveatConfigComponent.getRMCaveatModels())
{ {
defs.addAll(recordsManagementAdminService.getCustomConstraintDefinitions(caveatModelQName)); defs.addAll(recordsManagementAdminService.getCustomConstraintDefinitions(caveatModelQName));
} }
for(ConstraintDefinition dictionaryDef : defs) for(ConstraintDefinition dictionaryDef : defs)
{ {
Constraint con = dictionaryDef.getConstraint(); Constraint con = dictionaryDef.getConstraint();
@@ -267,7 +267,7 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
RMConstraintInfo i = new RMConstraintInfo(); RMConstraintInfo i = new RMConstraintInfo();
i.setName(def.getShortName()); i.setName(def.getShortName());
i.setTitle(def.getTitle()); i.setTitle(def.getTitle());
// note: assumes only one caveat/LOV against a given property // note: assumes only one caveat/LOV against a given property
List<String> allowedValues = AuthenticationUtil.runAs(new RunAsWork<List<String>>() List<String> allowedValues = AuthenticationUtil.runAs(new RunAsWork<List<String>>()
{ {
@@ -276,17 +276,17 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
return def.getAllowedValues(); return def.getAllowedValues();
} }
}, AuthenticationUtil.getSystemUserName()); }, AuthenticationUtil.getSystemUserName());
i.setAllowedValues(allowedValues.toArray(new String[allowedValues.size()])); i.setAllowedValues(allowedValues.toArray(new String[allowedValues.size()]));
i.setCaseSensitive(def.isCaseSensitive()); i.setCaseSensitive(def.isCaseSensitive());
info.add(i); info.add(i);
} }
} }
return info; return info;
} }
/** /**
* Get an RMConstraintInfo * Get an RMConstraintInfo
* @param listQName * @param listQName
@@ -301,7 +301,7 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
if (con instanceof RMListOfValuesConstraint) if (con instanceof RMListOfValuesConstraint)
{ {
final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con; final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con;
RMConstraintInfo info = new RMConstraintInfo(); RMConstraintInfo info = new RMConstraintInfo();
info.setName(listQName.toPrefixString()); info.setName(listQName.toPrefixString());
info.setTitle(con.getTitle()); info.setTitle(con.getTitle());
@@ -312,7 +312,7 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
return def.getAllowedValues(); return def.getAllowedValues();
} }
}, AuthenticationUtil.getSystemUserName()); }, AuthenticationUtil.getSystemUserName());
info.setAllowedValues(allowedValues.toArray(new String[allowedValues.size()])); info.setAllowedValues(allowedValues.toArray(new String[allowedValues.size()]));
info.setCaseSensitive(def.isCaseSensitive()); info.setCaseSensitive(def.isCaseSensitive());
return info; return info;
@@ -320,30 +320,30 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
} }
return null; return null;
} }
/** /**
* Get RM Constraint detail. * Get RM Constraint detail.
* *
* @return the constraintInfo or null * @return the constraintInfo or null
*/ */
public RMConstraintInfo getRMConstraint(String listName) public RMConstraintInfo getRMConstraint(String listName)
{ {
QName listQName = QName.createQName(listName, namespaceService); QName listQName = QName.createQName(listName, namespaceService);
return getRMConstraint(listQName); return getRMConstraint(listQName);
} }
/** /**
* Update The allowed values for an RM Constraint. * Update The allowed values for an RM Constraint.
* *
* @param listName The name of the list. * @param listName The name of the list.
* @param allowedValues the new alowed values * @param allowedValues the new alowed values
* *
*/ */
public RMConstraintInfo updateRMConstraintAllowedValues(String listName, String[] allowedValues) public RMConstraintInfo updateRMConstraintAllowedValues(String listName, String[] allowedValues)
{ {
QName listQName = QName.createQName(listName, namespaceService); QName listQName = QName.createQName(listName, namespaceService);
if(allowedValues != null) if(allowedValues != null)
{ {
List<String>allowedValueList = new ArrayList<String>(); List<String>allowedValueList = new ArrayList<String>();
@@ -351,12 +351,12 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
{ {
allowedValueList.add(value); allowedValueList.add(value);
} }
ConstraintDefinition dictionaryDef = dictionaryService.getConstraint(listQName); ConstraintDefinition dictionaryDef = dictionaryService.getConstraint(listQName);
Constraint con = dictionaryDef.getConstraint(); Constraint con = dictionaryDef.getConstraint();
if (con instanceof RMListOfValuesConstraint) if (con instanceof RMListOfValuesConstraint)
{ {
final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con; final RMListOfValuesConstraint def = (RMListOfValuesConstraint)con;
List<String> oldAllowedValues = AuthenticationUtil.runAs(new RunAsWork<List<String>>() List<String> oldAllowedValues = AuthenticationUtil.runAs(new RunAsWork<List<String>>()
{ {
public List<String> doWork() public List<String> doWork()
@@ -364,22 +364,19 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
return def.getAllowedValues(); return def.getAllowedValues();
} }
}, AuthenticationUtil.getSystemUserName()); }, AuthenticationUtil.getSystemUserName());
/** /**
* Deal with any additions * Deal with any additions
*/ */
for(String newValue : allowedValueList) for(String newValue : allowedValueList)
{ {
if(!oldAllowedValues.contains(newValue)) if(!oldAllowedValues.contains(newValue) && logger.isDebugEnabled())
{ {
// This is an addition // This is an addition
if(logger.isDebugEnabled()) logger.debug("value added to list:" + listQName + ":" + newValue);
{
logger.debug("value added to list:" + listQName + ":" + newValue);
}
} }
} }
/** /**
* Deal with any deletions * Deal with any deletions
*/ */
@@ -396,13 +393,13 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
} }
} }
} }
recordsManagementAdminService.changeCustomConstraintValues(listQName, allowedValueList); recordsManagementAdminService.changeCustomConstraintValues(listQName, allowedValueList);
} }
return getRMConstraint(listName); return getRMConstraint(listName);
} }
/** /**
* Remove a value from a list and cascade delete. * Remove a value from a list and cascade delete.
*/ */
@@ -410,17 +407,17 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService
{ {
//TODO need to update the rm constraint definition //TODO need to update the rm constraint definition
// recordsManagementAdminService. // recordsManagementAdminService.
rmCaveatConfigComponent.removeRMConstraintListValue(listName, valueName); rmCaveatConfigComponent.removeRMConstraintListValue(listName, valueName);
} }
/** /**
* Update the title of this RM Constraint. * Update the title of this RM Constraint.
*/ */
public RMConstraintInfo updateRMConstraintTitle(String listName, String newTitle) public RMConstraintInfo updateRMConstraintTitle(String listName, String newTitle)
{ {
QName listQName = QName.createQName(listName, namespaceService); QName listQName = QName.createQName(listName, namespaceService);
recordsManagementAdminService.changeCustomConstraintTitle(listQName, newTitle); recordsManagementAdminService.changeCustomConstraintTitle(listQName, newTitle);
return getRMConstraint(listName); return getRMConstraint(listName);
} }

View File

@@ -170,24 +170,21 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
{ {
public Object doWork() throws Exception public Object doWork() throws Exception
{ {
if (nodeService.exists(nodeRef) == true) if (nodeService.exists(nodeRef) && name.equals(actionName))
{ {
if (name.equals(actionName) == true) QName type = nodeService.getType(nodeRef);
if (TYPE_TRANSFER.equals(type))
{ {
QName type = nodeService.getType(nodeRef); List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL);
if (TYPE_TRANSFER.equals(type) == true) for (ChildAssociationRef assoc : assocs)
{ {
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); processRecordFolder(assoc.getChildRef());
for (ChildAssociationRef assoc : assocs)
{
processRecordFolder(assoc.getChildRef());
}
}
else
{
processRecordFolder(nodeRef);
} }
} }
else
{
processRecordFolder(nodeRef);
}
} }
return null; return null;
@@ -200,11 +197,11 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
private void processRecordFolder(NodeRef recordFolder) private void processRecordFolder(NodeRef recordFolder)
{ {
if (recordService.isRecord(recordFolder) == true) if (recordService.isRecord(recordFolder))
{ {
processRecord(recordFolder); processRecord(recordFolder);
} }
else if (recordFolderService.isRecordFolder(recordFolder) == true) else if (recordFolderService.isRecordFolder(recordFolder))
{ {
for (NodeRef record : recordService.getRecords(recordFolder)) for (NodeRef record : recordService.getRecords(recordFolder))
{ {
@@ -218,7 +215,7 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
List<AssociationRef> fromAssocs = recordsManagementAdminService.getCustomReferencesFrom(record); List<AssociationRef> fromAssocs = recordsManagementAdminService.getCustomReferencesFrom(record);
for (AssociationRef fromAssoc : fromAssocs) for (AssociationRef fromAssoc : fromAssocs)
{ {
if (reference.equals(fromAssoc.getTypeQName()) == true) if (reference.equals(fromAssoc.getTypeQName()))
{ {
NodeRef nodeRef = fromAssoc.getTargetRef(); NodeRef nodeRef = fromAssoc.getTargetRef();
doEventComplete(nodeRef); doEventComplete(nodeRef);
@@ -228,7 +225,7 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
List<AssociationRef> toAssocs = recordsManagementAdminService.getCustomReferencesTo(record); List<AssociationRef> toAssocs = recordsManagementAdminService.getCustomReferencesTo(record);
for (AssociationRef toAssoc : toAssocs) for (AssociationRef toAssoc : toAssocs)
{ {
if (reference.equals(toAssoc.getTypeQName()) == true) if (reference.equals(toAssoc.getTypeQName()))
{ {
NodeRef nodeRef = toAssoc.getSourceRef(); NodeRef nodeRef = toAssoc.getSourceRef();
doEventComplete(nodeRef); doEventComplete(nodeRef);
@@ -246,7 +243,7 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
{ {
RecordsManagementEvent rmEvent = recordsManagementEventService.getEvent(event.getEventName()); RecordsManagementEvent rmEvent = recordsManagementEventService.getEvent(event.getEventName());
if (event.isEventComplete() == false && if (event.isEventComplete() == false &&
rmEvent.getType().equals(getName()) == true) rmEvent.getType().equals(getName()))
{ {
// Complete the event // Complete the event
Map<String, Serializable> params = new HashMap<String, Serializable>(3); Map<String, Serializable> params = new HashMap<String, Serializable>(3);

View File

@@ -41,11 +41,11 @@ import org.apache.commons.logging.LogFactory;
/** /**
* The Disposition Lifecycle Job Finds all disposition action nodes which are * The Disposition Lifecycle Job Finds all disposition action nodes which are
* for "retain" or "cutOff" actions Where asOf > now OR * for "retain" or "cutOff" actions Where asOf > now OR
* dispositionEventsEligible = true; * dispositionEventsEligible = true;
* *
* Runs the cut off or retain action for * Runs the cut off or retain action for
* elligible records. * elligible records.
* *
* @author mrogers * @author mrogers
*/ */
public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecuter public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecuter
@@ -53,26 +53,26 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
private static Log logger = LogFactory.getLog(DispositionLifecycleJobExecuter.class); private static Log logger = LogFactory.getLog(DispositionLifecycleJobExecuter.class);
private RecordsManagementActionService recordsManagementActionService; private RecordsManagementActionService recordsManagementActionService;
private NodeService nodeService; private NodeService nodeService;
private SearchService searchService; private SearchService searchService;
public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService)
{ {
this.recordsManagementActionService = recordsManagementActionService; this.recordsManagementActionService = recordsManagementActionService;
} }
public void setNodeService(NodeService nodeService) public void setNodeService(NodeService nodeService)
{ {
this.nodeService = nodeService; this.nodeService = nodeService;
} }
public void setSearchService(SearchService searchService) public void setSearchService(SearchService searchService)
{ {
this.searchService = searchService; this.searchService = searchService;
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJobExecuter#execute() * @see org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJobExecuter#execute()
*/ */
@@ -81,75 +81,72 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute
try try
{ {
logger.debug("Job Starting"); logger.debug("Job Starting");
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("+TYPE:\"rma:dispositionAction\" "); sb.append("+TYPE:\"rma:dispositionAction\" ");
sb.append("+(@rma\\:dispositionAction:(\"cutoff\" OR \"retain\"))"); sb.append("+(@rma\\:dispositionAction:(\"cutoff\" OR \"retain\"))");
sb.append("+ISNULL:\"rma:dispositionActionCompletedAt\" "); sb.append("+ISNULL:\"rma:dispositionActionCompletedAt\" ");
sb.append("+( "); sb.append("+( ");
sb.append("@rma\\:dispositionEventsEligible:true "); sb.append("@rma\\:dispositionEventsEligible:true ");
sb.append("OR @rma\\:dispositionAsOf:[MIN TO NOW] "); sb.append("OR @rma\\:dispositionAsOf:[MIN TO NOW] ");
sb.append(") "); sb.append(") ");
String query = sb.toString(); String query = sb.toString();
ResultSet results = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, ResultSet results = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE,
SearchService.LANGUAGE_LUCENE, query); SearchService.LANGUAGE_LUCENE, query);
List<NodeRef> resultNodes = results.getNodeRefs(); List<NodeRef> resultNodes = results.getNodeRefs();
results.close(); results.close();
for (NodeRef node : resultNodes) for (NodeRef node : resultNodes)
{ {
final NodeRef currentNode = node; final NodeRef currentNode = node;
RetryingTransactionCallback<Boolean> processTranCB = new RetryingTransactionCallback<Boolean>() RetryingTransactionCallback<Boolean> processTranCB = new RetryingTransactionCallback<Boolean>()
{ {
public Boolean execute() throws Throwable public Boolean execute() throws Throwable
{ {
final String dispAction = (String) nodeService.getProperty(currentNode, final String dispAction = (String) nodeService.getProperty(currentNode,
RecordsManagementModel.PROP_DISPOSITION_ACTION); RecordsManagementModel.PROP_DISPOSITION_ACTION);
// Run "retain" and "cutoff" actions. // Run "retain" and "cutoff" actions.
if (dispAction != null) if (dispAction != null && (dispAction.equalsIgnoreCase("cutoff") ||
dispAction.equalsIgnoreCase("retain")))
{ {
if (dispAction.equalsIgnoreCase("cutoff") || ChildAssociationRef parent = nodeService.getPrimaryParent(currentNode);
dispAction.equalsIgnoreCase("retain")) if (parent.getTypeQName().equals(RecordsManagementModel.ASSOC_NEXT_DISPOSITION_ACTION))
{ {
ChildAssociationRef parent = nodeService.getPrimaryParent(currentNode); Map<String, Serializable> props = new HashMap<String, Serializable>(1);
if (parent.getTypeQName().equals(RecordsManagementModel.ASSOC_NEXT_DISPOSITION_ACTION)) props.put(RMDispositionActionExecuterAbstractBase.PARAM_NO_ERROR_CHECK, Boolean.FALSE);
recordsManagementActionService.executeRecordsManagementAction(parent.getParentRef(), dispAction, props);
if (logger.isDebugEnabled())
{ {
Map<String, Serializable> props = new HashMap<String, Serializable>(1); logger.debug("Processed action: " + dispAction + "on" + parent);
props.put(RMDispositionActionExecuterAbstractBase.PARAM_NO_ERROR_CHECK, Boolean.FALSE);
recordsManagementActionService.executeRecordsManagementAction(parent.getParentRef(), dispAction, props);
if (logger.isDebugEnabled())
{
logger.debug("Processed action: " + dispAction + "on" + parent);
}
} }
return null;
} }
return null;
} }
return Boolean.TRUE; return Boolean.TRUE;
} }
}; };
/** /**
* Now do the work, one action in each transaction * Now do the work, one action in each transaction
*/ */
if (nodeService.exists(currentNode) == false) if (nodeService.exists(currentNode) == false)
{ {
retryingTransactionHelper.doInTransaction(processTranCB); retryingTransactionHelper.doInTransaction(processTranCB);
} }
} }
logger.debug("Job Finished"); logger.debug("Job Finished");
} }
catch (AlfrescoRuntimeException exception) catch (AlfrescoRuntimeException exception)
{ {
if (logger.isDebugEnabled() == true) if (logger.isDebugEnabled())
{ {
logger.debug(exception); logger.debug(exception);
} }

View File

@@ -223,13 +223,11 @@ public abstract class BaseEvaluator implements RecordsManagementModel
boolean result = false; boolean result = false;
// Check that we are dealing with the correct kind of RM object // 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
(capabilities == null || checkCapabilities(nodeRef) == true))
{ {
// Check we have the required capabilities result = evaluateImpl(nodeRef);
if (capabilities == null || checkCapabilities(nodeRef) == true)
{
result = evaluateImpl(nodeRef);
}
} }
return result; return result;

View File

@@ -59,7 +59,7 @@ public class ModelSecurityServiceImpl extends BaseBehaviourBean
/** Namespace service */ /** Namespace service */
private NamespaceService namespaceService; private NamespaceService namespaceService;
/** File plan service */ /** File plan service */
private FilePlanService filePlanService; private FilePlanService filePlanService;
@@ -100,27 +100,27 @@ public class ModelSecurityServiceImpl extends BaseBehaviourBean
{ {
this.filePlanService = filePlanService; this.filePlanService = filePlanService;
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#disable() * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#disable()
*/ */
@Override @Override
public void disable() public void disable()
{ {
getBehaviour("beforeAddAspect").disable(); getBehaviour("beforeAddAspect").disable();
getBehaviour("beforeRemoveAspect").disable(); getBehaviour("beforeRemoveAspect").disable();
getBehaviour("onUpdateProperties").disable(); getBehaviour("onUpdateProperties").disable();
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#enable() * @see org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService#enable()
*/ */
@Override @Override
public void enable() public void enable()
{ {
getBehaviour("beforeAddAspect").enable(); getBehaviour("beforeAddAspect").enable();
getBehaviour("beforeRemoveAspect").enable(); getBehaviour("beforeRemoveAspect").enable();
getBehaviour("onUpdateProperties").enable(); getBehaviour("onUpdateProperties").enable();
} }
/** /**
@@ -203,15 +203,15 @@ public class ModelSecurityServiceImpl extends BaseBehaviourBean
NodeRef filePlan = filePlanService.getFilePlan(nodeRef); NodeRef filePlan = filePlanService.getFilePlan(nodeRef);
if (filePlan != null) if (filePlan != null)
{ {
for (Capability capability : artifact.getCapabilities()) for (Capability capability : artifact.getCapabilities())
{ {
if (capability.hasPermission(nodeRef).equals(AccessStatus.ALLOWED) == true) if (capability.hasPermission(nodeRef).equals(AccessStatus.ALLOWED))
{ {
result = true; result = true;
break; break;
} }
} }
} }
return result; return result;
@@ -277,20 +277,18 @@ public class ModelSecurityServiceImpl extends BaseBehaviourBean
) )
public void beforeAddAspect(NodeRef nodeRef, QName aspect) public void beforeAddAspect(NodeRef nodeRef, QName aspect)
{ {
if (enabled == true) if (enabled &&
{ AuthenticationUtil.getFullyAuthenticatedUser() != null &&
if (AuthenticationUtil.getFullyAuthenticatedUser() != null &&
AuthenticationUtil.isRunAsUserTheSystemUser() == false && AuthenticationUtil.isRunAsUserTheSystemUser() == false &&
isProtectedAspect(aspect) == true && isProtectedAspect(aspect) &&
nodeService.exists(nodeRef) == true && nodeService.exists(nodeRef) &&
canEditProtectedAspect(nodeRef, aspect) == false) canEditProtectedAspect(nodeRef, aspect) == false)
{ {
// the user can't edit the protected aspect // the user can't edit the protected aspect
throw new ModelAccessDeniedException( throw new ModelAccessDeniedException(
"The user " + AuthenticationUtil.getFullyAuthenticatedUser() + "The user " + AuthenticationUtil.getFullyAuthenticatedUser() +
" does not have the permission to add the protected aspect " + aspect.toPrefixString(namespaceService) + " does not have the permission to add the protected aspect " + aspect.toPrefixString(namespaceService) +
" from the node " + nodeRef.toString()); " from the node " + nodeRef.toString());
}
} }
} }
@@ -306,20 +304,18 @@ public class ModelSecurityServiceImpl extends BaseBehaviourBean
) )
public void beforeRemoveAspect(NodeRef nodeRef, QName aspect) public void beforeRemoveAspect(NodeRef nodeRef, QName aspect)
{ {
if (enabled == true) if (enabled &&
{ AuthenticationUtil.getFullyAuthenticatedUser() != null &&
if (AuthenticationUtil.getFullyAuthenticatedUser() != null &&
AuthenticationUtil.isRunAsUserTheSystemUser() == false && AuthenticationUtil.isRunAsUserTheSystemUser() == false &&
isProtectedAspect(aspect) == true && isProtectedAspect(aspect) &&
nodeService.exists(nodeRef) == true && nodeService.exists(nodeRef) &&
canEditProtectedAspect(nodeRef, aspect) == false) canEditProtectedAspect(nodeRef, aspect) == false)
{ {
// the user can't edit the protected aspect // the user can't edit the protected aspect
throw new ModelAccessDeniedException( throw new ModelAccessDeniedException(
"The user " + AuthenticationUtil.getFullyAuthenticatedUser() + "The user " + AuthenticationUtil.getFullyAuthenticatedUser() +
" does not have the permission to remove the protected aspect " + aspect.toPrefixString(namespaceService) + " does not have the permission to remove the protected aspect " + aspect.toPrefixString(namespaceService) +
" from the node " + nodeRef.toString()); " from the node " + nodeRef.toString());
}
} }
} }
@@ -335,31 +331,29 @@ public class ModelSecurityServiceImpl extends BaseBehaviourBean
) )
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after) public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
{ {
if (enabled == true) if (enabled &&
{ AuthenticationUtil.getFullyAuthenticatedUser() != null &&
if (AuthenticationUtil.getFullyAuthenticatedUser() != null &&
AuthenticationUtil.isRunAsUserTheSystemUser() == false && AuthenticationUtil.isRunAsUserTheSystemUser() == false &&
nodeService.exists(nodeRef) == true) nodeService.exists(nodeRef))
{
for (QName property : after.keySet())
{ {
for (QName property : after.keySet()) if (isProtectedProperty(property))
{ {
if (isProtectedProperty(property) == true) // always allow if this is the first time we are setting the protected property
if (before == null || before.isEmpty() || before.get(property) == null)
{ {
// always allow if this is the first time we are setting the protected property return;
if (before == null || before.isEmpty() || before.get(property) == null) }
{
return;
}
if (EqualsHelper.nullSafeEquals(before.get(property), after.get(property)) == false && if (EqualsHelper.nullSafeEquals(before.get(property), after.get(property)) == false &&
canEditProtectedProperty(nodeRef, property) == false) canEditProtectedProperty(nodeRef, property) == false)
{ {
// the user can't edit the protected property // the user can't edit the protected property
throw new ModelAccessDeniedException( throw new ModelAccessDeniedException(
"The user " + AuthenticationUtil.getFullyAuthenticatedUser() + "The user " + AuthenticationUtil.getFullyAuthenticatedUser() +
" does not have the permission to edit the protected property " + property.toPrefixString(namespaceService) + " does not have the permission to edit the protected property " + property.toPrefixString(namespaceService) +
" on the node " + nodeRef.toString()); " on the node " + nodeRef.toString());
}
} }
} }
} }

View File

@@ -98,7 +98,7 @@ import org.springframework.extensions.surf.util.I18NUtil;
* @since 2.1 * @since 2.1
*/ */
@BehaviourBean @BehaviourBean
public class RecordServiceImpl extends BaseBehaviourBean public class RecordServiceImpl extends BaseBehaviourBean
implements RecordService, implements RecordService,
RecordsManagementModel, RecordsManagementModel,
RecordsManagementCustomModel, RecordsManagementCustomModel,
@@ -194,7 +194,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
/** list of available record meta-data aspects and the file plan types the are applicable to */ /** list of available record meta-data aspects and the file plan types the are applicable to */
private Map<QName, Set<QName>> recordMetaDataAspects; private Map<QName, Set<QName>> recordMetaDataAspects;
/** policies */ /** policies */
private ClassPolicyDelegate<BeforeFileRecord> beforeFileRecord; private ClassPolicyDelegate<BeforeFileRecord> beforeFileRecord;
private ClassPolicyDelegate<OnFileRecord> onFileRecord; private ClassPolicyDelegate<OnFileRecord> onFileRecord;
@@ -320,9 +320,9 @@ public class RecordServiceImpl extends BaseBehaviourBean
{ {
// bind policies // bind policies
beforeFileRecord = policyComponent.registerClassPolicy(BeforeFileRecord.class); beforeFileRecord = policyComponent.registerClassPolicy(BeforeFileRecord.class);
onFileRecord = policyComponent.registerClassPolicy(OnFileRecord.class); onFileRecord = policyComponent.registerClassPolicy(OnFileRecord.class);
// bind behaviours // bind behaviours
policyComponent.bindAssociationBehaviour( policyComponent.bindAssociationBehaviour(
NodeServicePolicies.OnCreateChildAssociationPolicy.QNAME, NodeServicePolicies.OnCreateChildAssociationPolicy.QNAME,
TYPE_RECORD_FOLDER, TYPE_RECORD_FOLDER,
@@ -332,11 +332,11 @@ public class RecordServiceImpl extends BaseBehaviourBean
NodeServicePolicies.BeforeDeleteChildAssociationPolicy.QNAME, NodeServicePolicies.BeforeDeleteChildAssociationPolicy.QNAME,
ContentModel.TYPE_FOLDER, ContentModel.TYPE_FOLDER,
ContentModel.ASSOC_CONTAINS, ContentModel.ASSOC_CONTAINS,
onDeleteDeclaredRecordLink); onDeleteDeclaredRecordLink);
} }
/** /**
* @see org.alfresco.repo.node.NodeServicePolicies.OnRemoveAspectPolicy#onRemoveAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) * @see org.alfresco.repo.node.NodeServicePolicies.OnRemoveAspectPolicy#onRemoveAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
*/ */
@@ -519,7 +519,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
{ {
getBehaviour("onUpdateProperties").enable(); getBehaviour("onUpdateProperties").enable();
} }
/** /**
* Ensure that the user only updates record properties that they have permission to. * Ensure that the user only updates record properties that they have permission to.
* *
@@ -536,56 +536,54 @@ public class RecordServiceImpl extends BaseBehaviourBean
{ {
if (AuthenticationUtil.getFullyAuthenticatedUser() != null && if (AuthenticationUtil.getFullyAuthenticatedUser() != null &&
AuthenticationUtil.isRunAsUserTheSystemUser() == false && AuthenticationUtil.isRunAsUserTheSystemUser() == false &&
nodeService.exists(nodeRef) ) nodeService.exists(nodeRef) &&
isRecord(nodeRef))
{ {
if (isRecord(nodeRef) ) for (QName property : after.keySet())
{ {
for (QName property : after.keySet()) Serializable beforeValue = null;
if (before != null)
{ {
Serializable beforeValue = null; beforeValue = before.get(property);
if (before != null) }
{
beforeValue = before.get(property);
}
Serializable afterValue = null; Serializable afterValue = null;
if (after != null) if (after != null)
{ {
afterValue = after.get(property); afterValue = after.get(property);
} }
boolean propertyUnchanged = false; boolean propertyUnchanged = false;
if (beforeValue != null && afterValue != null && if (beforeValue != null && afterValue != null &&
beforeValue instanceof Date && afterValue instanceof Date) beforeValue instanceof Date && afterValue instanceof Date)
{ {
// deal with date values // deal with date values
propertyUnchanged = (((Date)beforeValue).compareTo((Date)afterValue) == 0); propertyUnchanged = (((Date)beforeValue).compareTo((Date)afterValue) == 0);
} }
else else
{ {
// otherwise // otherwise
propertyUnchanged = EqualsHelper.nullSafeEquals(beforeValue, afterValue); propertyUnchanged = EqualsHelper.nullSafeEquals(beforeValue, afterValue);
} }
if (propertyUnchanged == false && if (propertyUnchanged == false &&
isPropertyEditable(nodeRef, property) == false) isPropertyEditable(nodeRef, property) == false)
{ {
// the user can't edit the record property // the user can't edit the record property
throw new ModelAccessDeniedException( throw new ModelAccessDeniedException(
"The user " + AuthenticationUtil.getFullyAuthenticatedUser() + "The user " + AuthenticationUtil.getFullyAuthenticatedUser() +
" does not have the permission to edit the record property " + property.toString() + " does not have the permission to edit the record property " + property.toString() +
" on the node " + nodeRef.toString()); " on the node " + nodeRef.toString());
}
} }
} }
} }
} }
/** /**
* Get map containing record metadata aspects. * Get map containing record metadata aspects.
* *
* @return {@link Map}<{@link QName}, {@link Set}<{@link QName}>> map containing record metadata aspects * @return {@link Map}<{@link QName}, {@link Set}<{@link QName}>> map containing record metadata aspects
* *
* @since 2.2 * @since 2.2
*/ */
protected Map<QName, Set<QName>> getRecordMetadataAspectsMap() protected Map<QName, Set<QName>> getRecordMetadataAspectsMap()
@@ -594,20 +592,20 @@ public class RecordServiceImpl extends BaseBehaviourBean
{ {
// create map // create map
recordMetaDataAspects = new HashMap<QName, Set<QName>>(); recordMetaDataAspects = new HashMap<QName, Set<QName>>();
// init with legacy aspects // init with legacy aspects
initRecordMetaDataMap(); initRecordMetaDataMap();
} }
return recordMetaDataAspects; return recordMetaDataAspects;
} }
/** /**
* Initialises the record meta-data map. * Initialises the record meta-data map.
* <p> * <p>
* This is here to support backwards compatibility in case an existing * This is here to support backwards compatibility in case an existing
* customization (pre 2.2) is still using the record meta-data aspect. * customization (pre 2.2) is still using the record meta-data aspect.
* *
* @since 2.2 * @since 2.2
*/ */
private void initRecordMetaDataMap() private void initRecordMetaDataMap()
@@ -636,9 +634,9 @@ public class RecordServiceImpl extends BaseBehaviourBean
{ {
ParameterCheck.mandatory("recordMetadataAspect", recordMetadataAspect); ParameterCheck.mandatory("recordMetadataAspect", recordMetadataAspect);
ParameterCheck.mandatory("filePlanType", filePlanType); ParameterCheck.mandatory("filePlanType", filePlanType);
Set<QName> filePlanTypes = null; Set<QName> filePlanTypes = null;
if (getRecordMetadataAspectsMap().containsKey(recordMetadataAspect)) if (getRecordMetadataAspectsMap().containsKey(recordMetadataAspect))
{ {
// get the current set of file plan types for this aspect // get the current set of file plan types for this aspect
@@ -650,9 +648,9 @@ public class RecordServiceImpl extends BaseBehaviourBean
filePlanTypes = new HashSet<QName>(1); filePlanTypes = new HashSet<QName>(1);
getRecordMetadataAspectsMap().put(recordMetadataAspect, filePlanTypes); getRecordMetadataAspectsMap().put(recordMetadataAspect, filePlanTypes);
} }
// add the file plan type // add the file plan type
filePlanTypes.add(filePlanType); filePlanTypes.add(filePlanType);
} }
/** /**
@@ -664,7 +662,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
{ {
return getRecordMetadataAspects(TYPE_FILE_PLAN); return getRecordMetadataAspects(TYPE_FILE_PLAN);
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#getRecordMetaDataAspects(org.alfresco.service.cmr.repository.NodeRef) * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#getRecordMetaDataAspects(org.alfresco.service.cmr.repository.NodeRef)
*/ */
@@ -672,16 +670,16 @@ public class RecordServiceImpl extends BaseBehaviourBean
public Set<QName> getRecordMetadataAspects(NodeRef nodeRef) public Set<QName> getRecordMetadataAspects(NodeRef nodeRef)
{ {
QName filePlanType = TYPE_FILE_PLAN; QName filePlanType = TYPE_FILE_PLAN;
if (nodeRef != null) if (nodeRef != null)
{ {
NodeRef filePlan = getFilePlan(nodeRef); NodeRef filePlan = getFilePlan(nodeRef);
filePlanType = nodeService.getType(filePlan); filePlanType = nodeService.getType(filePlan);
} }
return getRecordMetadataAspects(filePlanType); return getRecordMetadataAspects(filePlanType);
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#getRecordMetadataAspects(org.alfresco.service.namespace.QName) * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#getRecordMetadataAspects(org.alfresco.service.namespace.QName)
*/ */
@@ -689,7 +687,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
public Set<QName> getRecordMetadataAspects(QName filePlanType) public Set<QName> getRecordMetadataAspects(QName filePlanType)
{ {
Set<QName> result = new HashSet<QName>(getRecordMetadataAspectsMap().size()); Set<QName> result = new HashSet<QName>(getRecordMetadataAspectsMap().size());
for (Entry<QName, Set<QName>> entry : getRecordMetadataAspectsMap().entrySet()) for (Entry<QName, Set<QName>> entry : getRecordMetadataAspectsMap().entrySet())
{ {
if (entry.getValue().contains(filePlanType)) if (entry.getValue().contains(filePlanType))
@@ -697,8 +695,8 @@ public class RecordServiceImpl extends BaseBehaviourBean
result.add(entry.getKey()); result.add(entry.getKey());
} }
} }
return result; return result;
} }
/** /**
@@ -980,7 +978,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
{ {
// fire before file record policy // fire before file record policy
beforeFileRecord.get(getTypeAndApsects(record)).beforeFileRecord(record); beforeFileRecord.get(getTypeAndApsects(record)).beforeFileRecord(record);
// check whether this item is already an item or not // check whether this item is already an item or not
if (isRecord(record) == false) if (isRecord(record) == false)
{ {
@@ -994,12 +992,12 @@ public class RecordServiceImpl extends BaseBehaviourBean
Calendar fileCalendar = Calendar.getInstance(); Calendar fileCalendar = Calendar.getInstance();
nodeService.setProperty(record, PROP_DATE_FILED, fileCalendar.getTime()); nodeService.setProperty(record, PROP_DATE_FILED, fileCalendar.getTime());
} }
// file on file record policy // file on file record policy
onFileRecord.get(getTypeAndApsects(record)).onFileRecord(record); onFileRecord.get(getTypeAndApsects(record)).onFileRecord(record);
} }
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#hideRecord(org.alfresco.service.cmr.repository.NodeRef) * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#hideRecord(org.alfresco.service.cmr.repository.NodeRef)
*/ */
@@ -1189,12 +1187,10 @@ public class RecordServiceImpl extends BaseBehaviourBean
} }
} }
if (permissionService.hasPermission(filePlan, RMPermissionModel.EDIT_NON_RECORD_METADATA).equals(AccessStatus.ALLOWED)) if (permissionService.hasPermission(filePlan, RMPermissionModel.EDIT_NON_RECORD_METADATA).equals(AccessStatus.ALLOWED) &&
logger.isDebugEnabled())
{ {
if (logger.isDebugEnabled() ) logger.debug(" ... user has the edit non record metadata permission on the file plan");
{
logger.debug(" ... user has the edit non record metadata permission on the file plan");
}
} }
// END DEBUG ... // END DEBUG ...

View File

@@ -142,7 +142,7 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
/** /**
* Add extended security implementation method * Add extended security implementation method
* *
* @param nodeRef * @param nodeRef
* @param readers * @param readers
* @param writers * @param writers
@@ -181,7 +181,7 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
} }
// apply the readers to any renditions of the content // 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); List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef assoc : assocs) for (ChildAssociationRef assoc : assocs)
@@ -194,12 +194,12 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
// add to the extended security roles // add to the extended security roles
addExtendedSecurityRoles(nodeRef, readers, writers); addExtendedSecurityRoles(nodeRef, readers, writers);
if (applyToParents == true) if (applyToParents)
{ {
// apply the extended readers up the file plan primary hierarchy // apply the extended readers up the file plan primary hierarchy
NodeRef parent = nodeService.getPrimaryParent(nodeRef).getParentRef(); NodeRef parent = nodeService.getPrimaryParent(nodeRef).getParentRef();
if (parent != null && if (parent != null &&
filePlanService.isFilePlanComponent(parent) == true) filePlanService.isFilePlanComponent(parent))
{ {
addExtendedSecurityImpl(parent, readers, null, applyToParents); addExtendedSecurityImpl(parent, readers, null, applyToParents);
addExtendedSecurityImpl(parent, writers, null, applyToParents); addExtendedSecurityImpl(parent, writers, null, applyToParents);
@@ -238,15 +238,11 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
for (String authority : authorities) for (String authority : authorities)
{ {
if (authority.equals(PermissionService.ALL_AUTHORITIES) == false && if ((authority.equals(PermissionService.ALL_AUTHORITIES) == false && authority.equals(PermissionService.OWNER_AUTHORITY) == false) &&
authority.equals(PermissionService.OWNER_AUTHORITY) == false) (referenceCountMap == null || referenceCountMap.containsKey(authority) == false))
{ {
if (referenceCountMap == null || // add the authority to the role
referenceCountMap.containsKey(authority) == false) filePlanRoleService.assignRoleToAuthority(filePlan, roleName, authority);
{
// add the authority to the role
filePlanRoleService.assignRoleToAuthority(filePlan, roleName, authority);
}
} }
} }
@@ -273,7 +269,7 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
{ {
if (key.equals(PermissionService.ALL_AUTHORITIES) == false) if (key.equals(PermissionService.ALL_AUTHORITIES) == false)
{ {
if (map.containsKey(key) == true) if (map.containsKey(key))
{ {
// increment reference count // increment reference count
Integer count = map.get(key); Integer count = map.get(key);
@@ -305,12 +301,12 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
@Override @Override
public void removeExtendedSecurity(NodeRef nodeRef, Set<String> readers, Set<String>writers, boolean applyToParents) public void removeExtendedSecurity(NodeRef nodeRef, Set<String> readers, Set<String>writers, boolean applyToParents)
{ {
if (hasExtendedSecurity(nodeRef) == true) if (hasExtendedSecurity(nodeRef))
{ {
removeExtendedSecurityImpl(nodeRef, readers, writers); removeExtendedSecurityImpl(nodeRef, readers, writers);
// remove the readers from any renditions of the content // 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); List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef assoc : assocs) 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 // apply the extended readers up the file plan primary hierarchy
NodeRef parent = nodeService.getPrimaryParent(nodeRef).getParentRef(); NodeRef parent = nodeService.getPrimaryParent(nodeRef).getParentRef();
if (parent != null && if (parent != null &&
filePlanService.isFilePlanComponent(parent) == true) filePlanService.isFilePlanComponent(parent))
{ {
removeExtendedSecurity(parent, readers, null, applyToParents); removeExtendedSecurity(parent, readers, null, applyToParents);
removeExtendedSecurity(parent, writers, null, applyToParents); removeExtendedSecurity(parent, writers, null, applyToParents);
@@ -361,7 +357,7 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
/** /**
* Helper method to remove items from map or reduce reference count * Helper method to remove items from map or reduce reference count
* *
* @param map ref count map * @param map ref count map
* @param keys keys * @param keys keys
* @return Map<String, Integer> ref count map * @return Map<String, Integer> ref count map
@@ -394,7 +390,7 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
} }
// reset the map to null if now empty // reset the map to null if now empty
if (map != null && map.isEmpty() == true) if (map != null && map.isEmpty())
{ {
map = null; map = null;
} }
@@ -417,7 +413,7 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
@Override @Override
public void removeAllExtendedSecurity(NodeRef nodeRef, boolean applyToParents) public void removeAllExtendedSecurity(NodeRef nodeRef, boolean applyToParents)
{ {
if (hasExtendedSecurity(nodeRef) == true) if (hasExtendedSecurity(nodeRef))
{ {
removeExtendedSecurity(nodeRef, getExtendedReaders(nodeRef), getExtendedWriters(nodeRef)); removeExtendedSecurity(nodeRef, getExtendedReaders(nodeRef), getExtendedWriters(nodeRef));
} }

View File

@@ -149,7 +149,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
{ {
this.recordFolderService = recordFolderService; this.recordFolderService = recordFolderService;
} }
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService#setupRecordCategoryPermissions(org.alfresco.service.cmr.repository.NodeRef) * @see org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService#setupRecordCategoryPermissions(org.alfresco.service.cmr.repository.NodeRef)
*/ */
@@ -157,13 +157,13 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
public void setupRecordCategoryPermissions(final NodeRef recordCategory) public void setupRecordCategoryPermissions(final NodeRef recordCategory)
{ {
ParameterCheck.mandatory("recordCategory", recordCategory); ParameterCheck.mandatory("recordCategory", recordCategory);
// assert that we have a record category in our hands // assert that we have a record category in our hands
if (instanceOf(recordCategory, TYPE_RECORD_CATEGORY) == false) if (instanceOf(recordCategory, TYPE_RECORD_CATEGORY) == false)
{ {
throw new AlfrescoRuntimeException("Unable to setup record category permissions, because node is not a record category."); throw new AlfrescoRuntimeException("Unable to setup record category permissions, because node is not a record category.");
} }
// init permissions // init permissions
initPermissions(recordCategory); initPermissions(recordCategory);
@@ -405,7 +405,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl
/** /**
* Initiliase the permissions for the given node. * Initiliase the permissions for the given node.
* *
* @param nodeRef node reference * @param nodeRef node reference
*/ */
private void initPermissions(final NodeRef nodeRef) private void initPermissions(final NodeRef nodeRef)

View File

@@ -236,12 +236,9 @@ public class TransferServiceImpl extends ServiceBaseImpl implements TransferServ
nodeService.deleteNode(nodeRef); nodeService.deleteNode(nodeRef);
NodeRef transferNodeRef = (NodeRef) AlfrescoTransactionSupport.getResource(KEY_TRANSFER_NODEREF); NodeRef transferNodeRef = (NodeRef) AlfrescoTransactionSupport.getResource(KEY_TRANSFER_NODEREF);
if (transferNodeRef != null) if (transferNodeRef != null && transferNodeRef.equals(nodeRef))
{ {
if (transferNodeRef.equals(nodeRef)) AlfrescoTransactionSupport.bindResource(KEY_TRANSFER_NODEREF, null);
{
AlfrescoTransactionSupport.bindResource(KEY_TRANSFER_NODEREF, null);
}
} }
} }