Fixed major issues reported by sonar (Simplify Boolean Expression)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@63886 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2014-03-11 09:04:52 +00:00
parent b92d582589
commit c3ac745ffb
156 changed files with 1724 additions and 1724 deletions

View File

@@ -28,7 +28,7 @@ import org.springframework.context.ApplicationContextAware;
/**
* Auditable action executer abstract base
*
*
* @author Roy Wetherall
* @since 2.1
*/
@@ -42,7 +42,7 @@ public abstract class AuditableActionExecuterAbstractBase extends ActionExecuter
/** Application context */
protected ApplicationContext applicationContext;
/** Records management audit service */
private RecordsManagementAuditService auditService;
@@ -70,7 +70,7 @@ public abstract class AuditableActionExecuterAbstractBase extends ActionExecuter
{
this.applicationContext = applicationContext;
}
/**
* @return records management audit service
*/
@@ -82,7 +82,7 @@ public abstract class AuditableActionExecuterAbstractBase extends ActionExecuter
}
return auditService;
}
/**
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#init()
*/
@@ -93,13 +93,13 @@ public abstract class AuditableActionExecuterAbstractBase extends ActionExecuter
{
super.init();
}
if (auditable == true)
if (auditable)
{
getAuditService().registerAuditEvent(this.getActionDefinition().getName(), this.getActionDefinition().getTitle());
}
}
/**
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#execute(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
*/
@@ -107,9 +107,9 @@ public abstract class AuditableActionExecuterAbstractBase extends ActionExecuter
public void execute(Action action, NodeRef actionedUponNodeRef)
{
// audit the execution of the action
if (auditable == true)
if (auditable)
{
if (auditedImmediately == true)
if (auditedImmediately)
{
// To be audited immediately before the action is executed, eg. to audit before actionedUponNodeRef gets deleted during the execution.
getAuditService().auditEvent(actionedUponNodeRef, this.getActionDefinition().getName(), null, null, true);

View File

@@ -24,9 +24,9 @@ import org.alfresco.service.cmr.repository.NodeRef;
/**
* Extension to action implementation hierarchy to insert parameter substitution processing.
*
*
* NOTE: this should eventually be pushed into the core.
*
*
* @author Roy Wetherall
* @since 2.1
*/
@@ -34,10 +34,10 @@ public abstract class PropertySubActionExecuterAbstractBase extends AuditableAct
{
/** Parameter processor component */
protected ParameterProcessorComponent parameterProcessorComponent;
/** Indicates whether parameter substitutions are allowed */
protected boolean allowParameterSubstitutions = false;
/**
* @param parameterProcessorComponent parameter processor component
*/
@@ -45,7 +45,7 @@ public abstract class PropertySubActionExecuterAbstractBase extends AuditableAct
{
this.parameterProcessorComponent = parameterProcessorComponent;
}
/**
* @param allowParameterSubstitutions true if property subs allowed, false otherwise
*/
@@ -53,7 +53,7 @@ public abstract class PropertySubActionExecuterAbstractBase extends AuditableAct
{
this.allowParameterSubstitutions = allowParameterSubstitutions;
}
/**
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#execute(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
*/
@@ -61,11 +61,11 @@ public abstract class PropertySubActionExecuterAbstractBase extends AuditableAct
public void execute(Action action, NodeRef actionedUponNodeRef)
{
// do the property subs (if any exist)
if (allowParameterSubstitutions == true)
if (allowParameterSubstitutions)
{
parameterProcessorComponent.process(action, getActionDefinition(), actionedUponNodeRef);
}
super.execute(action, actionedUponNodeRef);
}
}

View File

@@ -522,7 +522,7 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe
{
for (EventCompletionDetails event : events)
{
if (event.isEventComplete() == true)
if (event.isEventComplete())
{
eligible = true;
break;

View File

@@ -117,15 +117,15 @@ public abstract class RMDispositionActionExecuterAbstractBase extends RMActionEx
{
// Check the eligibility of the action
if (checkEligibility(actionedUponNodeRef) == false ||
dispositionService.isNextDispositionActionEligible(actionedUponNodeRef) == true)
dispositionService.isNextDispositionActionEligible(actionedUponNodeRef))
{
if (di.isRecordLevelDisposition() == true)
if (di.isRecordLevelDisposition())
{
// Check that we do indeed have a record
if (recordService.isRecord(actionedUponNodeRef) == true)
if (recordService.isRecord(actionedUponNodeRef))
{
// Can only execute disposition action on record if declared
if (recordService.isDeclared(actionedUponNodeRef) == true)
if (recordService.isDeclared(actionedUponNodeRef))
{
// Indicate that the disposition action is underway
nodeService.setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_STARTED_AT, new Date());
@@ -134,8 +134,8 @@ public abstract class RMDispositionActionExecuterAbstractBase extends RMActionEx
// Execute record level disposition
executeRecordLevelDisposition(action, actionedUponNodeRef);
if (nodeService.exists(nextDispositionActionNodeRef) == true &&
getSetDispositionActionComplete() == true)
if (nodeService.exists(nextDispositionActionNodeRef) &&
getSetDispositionActionComplete())
{
nodeService.setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_AT, new Date());
nodeService.setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_BY, AuthenticationUtil.getRunAsUser());
@@ -153,9 +153,9 @@ public abstract class RMDispositionActionExecuterAbstractBase extends RMActionEx
}
else
{
if (recordFolderService.isRecordFolder(actionedUponNodeRef) == true)
if (recordFolderService.isRecordFolder(actionedUponNodeRef))
{
if (recordFolderService.isRecordFolderDeclared(actionedUponNodeRef) == true)
if (recordFolderService.isRecordFolderDeclared(actionedUponNodeRef))
{
// Indicate that the disposition action is underway
nodeService.setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_STARTED_AT, new Date());
@@ -164,8 +164,8 @@ public abstract class RMDispositionActionExecuterAbstractBase extends RMActionEx
executeRecordFolderLevelDisposition(action, actionedUponNodeRef);
// Indicate that the disposition action is compelte
if (nodeService.exists(nextDispositionActionNodeRef) == true &&
getSetDispositionActionComplete() == true)
if (nodeService.exists(nextDispositionActionNodeRef) &&
getSetDispositionActionComplete())
{
nodeService.setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_AT, new Date());
nodeService.setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_BY, AuthenticationUtil.getRunAsUser());
@@ -184,7 +184,7 @@ public abstract class RMDispositionActionExecuterAbstractBase extends RMActionEx
}
if (nodeService.exists(actionedUponNodeRef) == true && getSetDispositionActionComplete() == true)
if (nodeService.exists(actionedUponNodeRef) && getSetDispositionActionComplete())
{
// Update the disposition schedule
dispositionService.updateNextDispositionAction(actionedUponNodeRef);
@@ -251,7 +251,7 @@ public abstract class RMDispositionActionExecuterAbstractBase extends RMActionEx
}
}
if (checkNextDispositionAction(nodeRef) == true)
if (checkNextDispositionAction(nodeRef))
{
// Check this the next disposition action
NodeRef nextDispositionAction = nextDispositionActionNodeRef;

View File

@@ -108,7 +108,7 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
{
rmActions.put(rmAction.getName(), rmAction);
if (rmAction.isDispositionAction() == true)
if (rmAction.isDispositionAction())
{
dispositionActions.put(rmAction.getName(), rmAction);
}
@@ -261,7 +261,7 @@ public class RecordsManagementActionServiceImpl implements RecordsManagementActi
// Execute action
invokeBeforeRMActionExecution(nodeRef, name, parameters);
RecordsManagementActionResult result = rmAction.execute(nodeRef, parameters);
if (nodeService.exists(nodeRef) == true)
if (nodeService.exists(nodeRef))
{
invokeOnRMActionExecution(nodeRef, name, parameters);
}

View File

@@ -35,9 +35,9 @@ import org.quartz.JobExecutionException;
/**
* Scheduled disposition job.
*
*
* Automatically cuts off eligible nodes.
*
*
* @author Roy Wetherall
*/
public class ScheduledDispositionJob implements Job
@@ -53,7 +53,7 @@ public class ScheduledDispositionJob implements Job
RecordsManagementActionService rmActionService
= (RecordsManagementActionService)context.getJobDetail().getJobDataMap().get("recordsManagementActionService");
NodeService nodeService = (NodeService)context.getJobDetail().getJobDataMap().get("nodeService");
// Calculate the date range used in the query
Calendar cal = Calendar.getInstance();
@@ -63,11 +63,11 @@ public class ScheduledDispositionJob implements Job
//TODO These pad() calls are in RMActionExecuterAbstractBase. I've copied them
// here as I have no access to that class.
final String currentDate = padString(year, 2) + "-" + padString(month, 2) +
"-" + padString(dayOfMonth, 2) + "T00:00:00.00Z";
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
StringBuilder msg = new StringBuilder();
msg.append("Executing ")
@@ -76,28 +76,28 @@ public class ScheduledDispositionJob implements Job
.append(currentDate);
logger.debug(msg.toString());
}
//TODO Copied the 1970 start date from the old RM JavaScript impl.
String dateRange = "[\"1970-01-01T00:00:00.00Z\" TO \"" + currentDate + "\"]";
// Execute the query and process the results
String query = "+ASPECT:\"rma:record\" +ASPECT:\"rma:dispositionSchedule\" +@rma\\:dispositionAsOf:" + dateRange;
String query = "+ASPECT:\"rma:record\" +ASPECT:\"rma:dispositionSchedule\" +@rma\\:dispositionAsOf:" + dateRange;
SearchService search = (SearchService)context.getJobDetail().getJobDataMap().get("searchService");
ResultSet results = search.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_LUCENE, query);
List<NodeRef> resultNodes = results.getNodeRefs();
results.close();
if (logger.isDebugEnabled() == true)
{
if (logger.isDebugEnabled())
{
StringBuilder msg = new StringBuilder();
msg.append("Found ")
.append(resultNodes.size())
.append(" records eligible for disposition.");
logger.debug(msg.toString());
}
for (NodeRef node : resultNodes )
{
String dispActionName = (String)nodeService.getProperty(node, RecordsManagementModel.PROP_DISPOSITION_ACTION_NAME);
@@ -107,15 +107,15 @@ public class ScheduledDispositionJob implements Job
if (dispActionName != null && dispActionName.equalsIgnoreCase("cutoff"))
{
rmActionService.executeRecordsManagementAction(node, dispActionName);
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Performing " + dispActionName + " dispoition action on disposable item " + node.toString());
}
}
}
}
//TODO This has been pasted out of RMActionExecuterAbstractBase. To be relocated.
private String padString(String s, int len)
{

View File

@@ -129,7 +129,7 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase
if (nodeService.exists(actionedUponNodeRef) == false)
{
// do not create record if the actioned upon node does not exist!
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Can not create record, because " + actionedUponNodeRef.toString() + " does not exist.");
}
@@ -137,40 +137,40 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase
else if (dictionaryService.isSubClass(nodeService.getType(actionedUponNodeRef), ContentModel.TYPE_CONTENT) == false)
{
// TODO eventually we should support other types .. either as record folders or as composite records
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Can not create record, because " + actionedUponNodeRef.toString() + " is not a supported type.");
}
}
else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD) == true)
else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD))
{
// Do not create record if the actioned upon node is already a record!
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Can not create record, because " + actionedUponNodeRef.toString() + " is already a record.");
}
}
else if (nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY) == true)
else if (nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY))
{
// We can not create records from working copies
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Can node create record, because " + actionedUponNodeRef.toString() + " is a working copy.");
}
}
else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS) == true)
else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS))
{
// can not create a record from a previously rejected one
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Can not create record, because " + actionedUponNodeRef.toString() + " has previously been rejected.");
}
}
else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_SYNCED) == true)
else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_SYNCED))
{
// can't declare the record if the node is sync'ed
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Can't declare as record, because " + actionedUponNodeRef.toString() + " is synched content.");
}
@@ -193,7 +193,7 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase
// if the file plan is still null, raise an exception
if (filePlan == null)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Can not create record, because the default file plan can not be determined. Make sure at least one file plan has been created.");
}
@@ -205,7 +205,7 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase
// verify that the provided file plan is actually a file plan
if (filePlanService.isFilePlan(filePlan) == false)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Can not create record, because the provided file plan node reference is not a file plan.");
}

View File

@@ -38,7 +38,7 @@ import org.apache.commons.logging.LogFactory;
* @author Tuna Aksoy
* @since 2.1
*/
public class HideRecordAction extends AuditableActionExecuterAbstractBase
public class HideRecordAction extends AuditableActionExecuterAbstractBase
implements RecordsManagementModel
{
@@ -79,7 +79,7 @@ public class HideRecordAction extends AuditableActionExecuterAbstractBase
if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD) == false)
{
// we cannot hide a document which is not a record
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Cannot hide the document, because '" + actionedUponNodeRef.toString() + "' is not a record.");
}

View File

@@ -36,7 +36,7 @@ import org.alfresco.service.namespace.QName;
/**
* Records management hasDispositionAction evaluator that evaluates whether the given node's disposition schedule has the specified disposition action.
*
*
* @author Craig Tan
* @since 2.1
*/
@@ -69,7 +69,7 @@ public class HasDispositionActionEvaluator extends RecordsManagementActionCondit
String action = ((QName) actionCondition.getParameterValue(PARAM_DISPOSITION_ACTION)).getLocalName();
if (dispositionService.isDisposableItem(actionedUponNodeRef) == true)
if (dispositionService.isDisposableItem(actionedUponNodeRef))
{
if (position.equals(DispositionActionRelativePositions.ANY.toString()))
@@ -80,7 +80,7 @@ public class HasDispositionActionEvaluator extends RecordsManagementActionCondit
{
for (DispositionActionDefinition dispositionActionDefinition : dispositionSchedule.getDispositionActionDefinitions())
{
if (dispositionActionDefinition.getName().equals(action) == true)
if (dispositionActionDefinition.getName().equals(action))
{
result = true;
break;
@@ -95,7 +95,7 @@ public class HasDispositionActionEvaluator extends RecordsManagementActionCondit
{
// Get the disposition actions name
String actionName = nextDispositionAction.getName();
if (actionName.equals(action) == true)
if (actionName.equals(action))
{
result = true;
}
@@ -108,7 +108,7 @@ public class HasDispositionActionEvaluator extends RecordsManagementActionCondit
{
// Get the disposition actions name
String actionName = lastCompletedDispositionAction.getName();
if (actionName.equals(action) == true)
if (actionName.equals(action))
{
result = true;
}

View File

@@ -61,14 +61,14 @@ public class AddRecordTypeAction extends RMActionExecuterAbstractBase
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
if (eligibleForAction(actionedUponNodeRef) == true)
if (eligibleForAction(actionedUponNodeRef))
{
for (String type : getRecordTypes(action))
{
recordService.addRecordType(actionedUponNodeRef, QName.createQName(type, namespaceService));
}
}
else if (logger.isWarnEnabled() == true)
else if (logger.isWarnEnabled())
{
logger.warn(I18NUtil.getMessage(MSG_ACTIONED_UPON_NOT_RECORD, this.getClass().getSimpleName(), actionedUponNodeRef.toString()));
}
@@ -88,9 +88,9 @@ public class AddRecordTypeAction extends RMActionExecuterAbstractBase
private boolean eligibleForAction(NodeRef actionedUponNodeRef)
{
boolean result = false;
if (nodeService.exists(actionedUponNodeRef) == true &&
if (nodeService.exists(actionedUponNodeRef) &&
freezeService.isFrozen(actionedUponNodeRef) == false &&
recordService.isRecord(actionedUponNodeRef) == true &&
recordService.isRecord(actionedUponNodeRef) &&
recordService.isDeclared(actionedUponNodeRef) == false)
{
result = true;

View File

@@ -40,15 +40,15 @@ import org.springframework.extensions.surf.util.I18NUtil;
/**
* This class applies the aspect specified in the spring bean property customTypeAspect.
* It is used to apply one of the 4 "custom type" aspects from the DOD 5015 model.
*
*
* @author Neil McErlean
*/
public class ApplyCustomTypeAction extends RMActionExecuterAbstractBase
{
/** I18N */
private static final String MSG_ACTIONED_UPON_NOT_RECORD = "rm.action.actioned-upon-not-record";
private static final String MSG_ACTIONED_UPON_NOT_RECORD = "rm.action.actioned-upon-not-record";
private static final String MSG_CUSTOM_ASPECT_NOT_RECOGNISED = "rm.action.custom-aspect-not-recognised";
private static Log logger = LogFactory.getLog(ApplyCustomTypeAction.class);
private QName customTypeAspect;
private List<ParameterDefinition> parameterDefinitions;
@@ -68,14 +68,14 @@ public class ApplyCustomTypeAction extends RMActionExecuterAbstractBase
{
logger.debug("Executing action [" + action.getActionDefinitionName() + "] on " + actionedUponNodeRef);
}
if (recordService.isRecord(actionedUponNodeRef) == true)
if (recordService.isRecord(actionedUponNodeRef))
{
// Apply the appropriate aspect and set the properties.
Map<QName, Serializable> aspectProps = getPropertyValues(action);
this.nodeService.addAspect(actionedUponNodeRef, customTypeAspect, aspectProps);
}
else if (logger.isWarnEnabled() == true)
else if (logger.isWarnEnabled())
{
logger.warn(I18NUtil.getMessage(MSG_ACTIONED_UPON_NOT_RECORD, this.getClass().getSimpleName(), actionedUponNodeRef.toString()));
}
@@ -105,14 +105,14 @@ public class ApplyCustomTypeAction extends RMActionExecuterAbstractBase
private Map<QName, Serializable> getPropertyValues(Action action)
{
Map<String, Serializable> paramValues = action.getParameterValues();
Map<QName, Serializable> result = new HashMap<QName, Serializable>(paramValues.size());
for (String paramName : paramValues.keySet())
{
QName propQName = QName.createQName(paramName, this.namespaceService);
result.put(propQName, paramValues.get(paramName));
}
return result;
}
@@ -127,11 +127,11 @@ public class ApplyCustomTypeAction extends RMActionExecuterAbstractBase
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_ASPECT_NOT_RECOGNISED, customTypeAspect));
}
Map<QName, PropertyDefinition> props = aspectDefinition.getProperties();
this.parameterDefinitions = new ArrayList<ParameterDefinition>(props.size());
for (QName qn : props.keySet())
{
String paramName = qn.toPrefixString(namespaceService);

View File

@@ -109,7 +109,7 @@ public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionEx
// has been updated
DispositionSchedule itemDs = dispositionService.getDispositionSchedule(disposableItem);
if (itemDs != null &&
itemDs.getNodeRef().equals(ds.getNodeRef()) == true)
itemDs.getNodeRef().equals(ds.getNodeRef()))
{
if (nodeService.hasAspect(disposableItem, ASPECT_DISPOSITION_LIFECYCLE))
{

View File

@@ -39,7 +39,7 @@ public class CloseRecordFolderAction extends RMActionExecuterAbstractBase
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
if (eligibleForAction(actionedUponNodeRef) == true)
if (eligibleForAction(actionedUponNodeRef))
{
recordFolderService.closeRecordFolder(actionedUponNodeRef);
}
@@ -57,7 +57,7 @@ public class CloseRecordFolderAction extends RMActionExecuterAbstractBase
private boolean eligibleForAction(NodeRef actionedUponNodeRef)
{
boolean result = false;
if (nodeService.exists(actionedUponNodeRef) == true &&
if (nodeService.exists(actionedUponNodeRef) &&
freezeService.isFrozen(actionedUponNodeRef) == false)
{
result = true;

View File

@@ -63,14 +63,14 @@ public class CompleteEventAction extends RMActionExecuterAbstractBase
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
if (nodeService.exists(actionedUponNodeRef) == true &&
if (nodeService.exists(actionedUponNodeRef) &&
freezeService.isFrozen(actionedUponNodeRef) == false)
{
String eventName = (String)action.getParameterValue(PARAM_EVENT_NAME);
String eventCompletedBy = (String)action.getParameterValue(PARAM_EVENT_COMPLETED_BY);
Date eventCompletedAt = (Date)action.getParameterValue(PARAM_EVENT_COMPLETED_AT);
if (this.nodeService.hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE) == true)
if (this.nodeService.hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE))
{
// Get the next disposition action
DispositionAction da = this.dispositionService.getNextDispositionAction(actionedUponNodeRef);
@@ -125,7 +125,7 @@ public class CompleteEventAction extends RMActionExecuterAbstractBase
List<EventCompletionDetails> events = da.getEventCompletionDetails();
for (EventCompletionDetails event : events)
{
if (eventName.equals(event.getEventName()) == true)
if (eventName.equals(event.getEventName()))
{
result = event;
break;

View File

@@ -52,7 +52,7 @@ public class CreateDispositionScheduleAction extends RMActionExecuterAbstractBas
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
if (eligibleForAction(actionedUponNodeRef) == true)
if (eligibleForAction(actionedUponNodeRef))
{
// Create the disposition schedule
dispositionService.createDispositionSchedule(actionedUponNodeRef, null);
@@ -75,8 +75,8 @@ public class CreateDispositionScheduleAction extends RMActionExecuterAbstractBas
private boolean eligibleForAction(NodeRef actionedUponNodeRef)
{
boolean result = false;
if (nodeService.exists(actionedUponNodeRef) == true &&
filePlanService.isRecordCategory(actionedUponNodeRef) == true)
if (nodeService.exists(actionedUponNodeRef) &&
filePlanService.isRecordCategory(actionedUponNodeRef))
{
result = true;
}

View File

@@ -61,15 +61,15 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase
@Override
protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef)
{
if (nodeService.exists(actionedUponNodeRef) == true &&
recordService.isRecord(actionedUponNodeRef) == true &&
if (nodeService.exists(actionedUponNodeRef) &&
recordService.isRecord(actionedUponNodeRef) &&
freezeService.isFrozen(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)
if (mandatoryPropertiesSet(actionedUponNodeRef, missingProperties))
{
recordService.disablePropertyEditableCheck();
try

View File

@@ -30,7 +30,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
* Records management action who's implementation is delegated to an existing Action.
* <p>
* Useful for creating a RM version of an existing action implementation.
*
*
* @author Roy Wetherall
* @since 2.1
*/
@@ -38,10 +38,10 @@ public class DelegateAction extends RMActionExecuterAbstractBase
{
/** Delegate action executer*/
private ActionExecuter delegateActionExecuter;
/** should we check whether the node is frozen */
private boolean checkFrozen = false;
/**
* @param delegateActionExecuter delegate action executer
*/
@@ -49,7 +49,7 @@ public class DelegateAction extends RMActionExecuterAbstractBase
{
this.delegateActionExecuter = delegateActionExecuter;
}
/**
* @param checkFrozen true if we check whether the actioned upon node reference is frozen, false otherwise
*/
@@ -64,19 +64,19 @@ public class DelegateAction extends RMActionExecuterAbstractBase
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
if (nodeService.exists(actionedUponNodeRef) == true &&
if (nodeService.exists(actionedUponNodeRef) &&
(checkFrozen == false || freezeService.isFrozen(actionedUponNodeRef) == false))
{
// do the property subs (if any exist)
if (allowParameterSubstitutions == true)
if (allowParameterSubstitutions)
{
parameterProcessorComponent.process(action, delegateActionExecuter.getActionDefinition(), actionedUponNodeRef);
}
delegateActionExecuter.execute(action, actionedUponNodeRef);
}
}
/**
* @see org.alfresco.repo.action.ParameterizedItemAbstractBase#getParameterDefintions()
*/

View File

@@ -105,7 +105,7 @@ public class DestroyAction extends RMDispositionActionExecuterAbstractBase
private boolean checkForDestroyRecordsCapability(NodeRef actionedUponNodeRef)
{
boolean result = true;
if (AccessStatus.ALLOWED.equals(capabilityService.getCapability("DestroyRecords").hasPermission(actionedUponNodeRef)) == true)
if (AccessStatus.ALLOWED.equals(capabilityService.getCapability("DestroyRecords").hasPermission(actionedUponNodeRef)))
{
result = false;
}
@@ -124,7 +124,7 @@ public class DestroyAction extends RMDispositionActionExecuterAbstractBase
executeRecordLevelDisposition(action, record);
}
if (ghostingEnabled == true)
if (ghostingEnabled)
{
nodeService.addAspect(recordFolder, ASPECT_GHOSTED, Collections.<QName, Serializable> emptyMap());
}
@@ -156,7 +156,7 @@ public class DestroyAction extends RMDispositionActionExecuterAbstractBase
// Clear thumbnail content
clearThumbnails(nodeRef);
if (ghostingEnabled == true)
if (ghostingEnabled)
{
// Add the ghosted aspect
nodeService.addAspect(nodeRef, ASPECT_GHOSTED, null);

View File

@@ -48,7 +48,7 @@ public class EditDispositionActionAsOfDateAction extends RMActionExecuterAbstrac
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
if (this.nodeService.hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE) == true)
if (this.nodeService.hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE))
{
// Get the action parameter
Date asOfDate = (Date)action.getParameterValue(PARAM_AS_OF_DATE);

View File

@@ -47,8 +47,8 @@ public class EditReviewAsOfDateAction extends RMActionExecuterAbstractBase
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
if (recordService.isRecord(actionedUponNodeRef) == true &&
nodeService.hasAspect(actionedUponNodeRef, ASPECT_VITAL_RECORD) == true)
if (recordService.isRecord(actionedUponNodeRef) &&
nodeService.hasAspect(actionedUponNodeRef, ASPECT_VITAL_RECORD))
{
// Get the action parameter
Date reviewAsOf = (Date)action.getParameterValue(PARAM_AS_OF_DATE);

View File

@@ -54,10 +54,10 @@ public class FreezeAction extends RMActionExecuterAbstractBase
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
// NOTE: we can only freeze records and record folders so ignore everything else
if (nodeService.exists(actionedUponNodeRef) == true &&
if (nodeService.exists(actionedUponNodeRef) &&
nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_PENDING_DELETE) == false &&
(recordService.isRecord(actionedUponNodeRef) == true ||
recordFolderService.isRecordFolder(actionedUponNodeRef) == true) &&
(recordService.isRecord(actionedUponNodeRef) ||
recordFolderService.isRecordFolder(actionedUponNodeRef)) &&
freezeService.isFrozen(actionedUponNodeRef) == false)
{
freezeService.freeze((String) action.getParameterValue(PARAM_REASON), actionedUponNodeRef);

View File

@@ -49,7 +49,7 @@ public class OpenRecordFolderAction extends RMActionExecuterAbstractBase
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
if (nodeService.exists(actionedUponNodeRef) == true &&
if (nodeService.exists(actionedUponNodeRef) &&
freezeService.isFrozen(actionedUponNodeRef) == false)
{
// TODO move re-open logic into a service method
@@ -64,10 +64,10 @@ public class OpenRecordFolderAction extends RMActionExecuterAbstractBase
}
}
if (recordFolderService.isRecordFolder(actionedUponNodeRef) == true)
if (recordFolderService.isRecordFolder(actionedUponNodeRef))
{
Boolean isClosed = (Boolean) nodeService.getProperty(actionedUponNodeRef, PROP_IS_CLOSED);
if (Boolean.TRUE.equals(isClosed) == true)
if (Boolean.TRUE.equals(isClosed))
{
nodeService.setProperty(actionedUponNodeRef, PROP_IS_CLOSED, false);
}

View File

@@ -47,7 +47,7 @@ public class RejectAction extends RMActionExecuterAbstractBase
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
if (nodeService.exists(actionedUponNodeRef) == true &&
if (nodeService.exists(actionedUponNodeRef) &&
freezeService.isFrozen(actionedUponNodeRef) == false &&
nodeService.getProperty(actionedUponNodeRef, PROP_RECORD_ORIGINATING_LOCATION) != null)
{

View File

@@ -79,9 +79,9 @@ public class RequestInfoAction extends RMActionExecuterAbstractBase
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
if (nodeService.exists(actionedUponNodeRef) == true &&
if (nodeService.exists(actionedUponNodeRef) &&
nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_PENDING_DELETE) == false &&
recordService.isRecord(actionedUponNodeRef) == true &&
recordService.isRecord(actionedUponNodeRef) &&
recordService.isDeclared(actionedUponNodeRef) == false)
{
String workflowDefinitionId = workflowService.getDefinitionByName(REQUEST_INFO_WORKFLOW_DEFINITION_NAME).getId();
@@ -96,7 +96,7 @@ public class RequestInfoAction extends RMActionExecuterAbstractBase
}
else
{
logger.info("Can't start the request information workflow for node '" + actionedUponNodeRef.toString() + "'." );
logger.info("Can't start the request information workflow for node '" + actionedUponNodeRef.toString() + "'.");
}
}

View File

@@ -84,7 +84,7 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase
Map<QName, AssociationDefinition> map = recordsManagementAdminService.getCustomReferenceDefinitions();
for (Map.Entry<QName, AssociationDefinition> entry : map.entrySet())
{
if (compoundId.equals(entry.getValue().getTitle(dictionaryService)) == true)
if (compoundId.equals(entry.getValue().getTitle(dictionaryService)))
{
relationshipQName = entry.getKey();
break;
@@ -107,12 +107,12 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase
// get node type
nodeService.getType(actionedUponNodeRef);
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("split email:" + actionedUponNodeRef);
}
if (recordService.isRecord(actionedUponNodeRef) == true)
if (recordService.isRecord(actionedUponNodeRef))
{
if (recordService.isDeclared(actionedUponNodeRef) == false)
{
@@ -124,7 +124,7 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase
List<AssociationRef> refs = nodeService.getTargetAssocs(actionedUponNodeRef, ImapModel.ASSOC_IMAP_ATTACHMENT);
if(refs.size() > 0)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("mail message has already been split - do nothing");
}

View File

@@ -43,8 +43,8 @@ public class UnCutoffAction extends RMActionExecuterAbstractBase
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE) == true &&
nodeService.hasAspect(actionedUponNodeRef, ASPECT_CUT_OFF) == true)
if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE) &&
nodeService.hasAspect(actionedUponNodeRef, ASPECT_CUT_OFF))
{
// Get the last disposition action
DispositionAction da = dispositionService.getLastCompletedDispostionAction(actionedUponNodeRef);
@@ -58,7 +58,7 @@ public class UnCutoffAction extends RMActionExecuterAbstractBase
// Remove the cutoff aspect
nodeService.removeAspect(actionedUponNodeRef, ASPECT_CUT_OFF);
if (recordFolderService.isRecordFolder(actionedUponNodeRef) == true)
if (recordFolderService.isRecordFolder(actionedUponNodeRef))
{
List<NodeRef> records = recordService.getRecords(actionedUponNodeRef);
for (NodeRef record : records)

View File

@@ -27,7 +27,7 @@ import org.springframework.extensions.surf.util.I18NUtil;
/**
* Undeclare record action
*
*
* @author Roy Wetherall
*/
public class UndeclareRecordAction extends RMActionExecuterAbstractBase
@@ -37,19 +37,19 @@ public class UndeclareRecordAction extends RMActionExecuterAbstractBase
/** I18N */
private static final String MSG_RECORDS_ONLY_UNDECLARED = "rm.action.records_only_undeclared";
/**
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
if (nodeService.exists(actionedUponNodeRef) == true)
if (nodeService.exists(actionedUponNodeRef))
{
if (recordService.isRecord(actionedUponNodeRef) == true)
if (recordService.isRecord(actionedUponNodeRef))
{
// repoen if already complete and not frozen
if (recordService.isDeclared(actionedUponNodeRef) == true &&
if (recordService.isDeclared(actionedUponNodeRef) &&
freezeService.isFrozen(actionedUponNodeRef) == false)
{
// Remove the declared aspect
@@ -64,5 +64,5 @@ public class UndeclareRecordAction extends RMActionExecuterAbstractBase
}
}
}
}
}
}

View File

@@ -34,17 +34,17 @@ import org.springframework.extensions.surf.util.I18NUtil;
/**
* Undo event action
*
*
* @author Roy Wetherall
*/
public class UndoEventAction extends RMActionExecuterAbstractBase
{
/** I18N */
private static final String MSG_EVENT_NOT_DONE = "rm.action.event-not-undone";
/** Params */
public static final String PARAM_EVENT_NAME = "eventName";
/**
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
*/
@@ -52,8 +52,8 @@ public class UndoEventAction extends RMActionExecuterAbstractBase
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
String eventName = (String)action.getParameterValue(PARAM_EVENT_NAME);
if (this.nodeService.hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE) == true)
if (this.nodeService.hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE))
{
// Get the next disposition action
DispositionAction da = this.dispositionService.getNextDispositionAction(actionedUponNodeRef);
@@ -70,10 +70,10 @@ public class UndoEventAction extends RMActionExecuterAbstractBase
props.put(PROP_EVENT_EXECUTION_COMPLETED_AT, null);
props.put(PROP_EVENT_EXECUTION_COMPLETED_BY, null);
this.nodeService.setProperties(eventNodeRef, props);
// Check to see if the events eligible property needs to be updated
updateEventEigible(da);
}
else
{
@@ -82,10 +82,10 @@ public class UndoEventAction extends RMActionExecuterAbstractBase
}
}
}
/**
* Get the event from the disposition action
*
*
* @param da
* @param eventName
* @return
@@ -96,7 +96,7 @@ public class UndoEventAction extends RMActionExecuterAbstractBase
List<EventCompletionDetails> events = da.getEventCompletionDetails();
for (EventCompletionDetails event : events)
{
if (eventName.equals(event.getEventName()) == true)
if (eventName.equals(event.getEventName()))
{
result = event;
break;
@@ -104,16 +104,16 @@ public class UndoEventAction extends RMActionExecuterAbstractBase
}
return result;
}
/**
*
*
* @param da
* @param nodeRef
*/
private void updateEventEigible(DispositionAction da)
{
List<EventCompletionDetails> events = da.getEventCompletionDetails();
boolean eligible = false;
if (da.getDispositionActionDefinition().eligibleOnFirstCompleteEvent() == false)
{
@@ -131,18 +131,18 @@ public class UndoEventAction extends RMActionExecuterAbstractBase
{
for (EventCompletionDetails event : events)
{
if (event.isEventComplete() == true)
if (event.isEventComplete())
{
eligible = true;
break;
}
}
}
// Update the property with the eligible value
this.nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_EVENTS_ELIGIBLE, eligible);
}
/**
* @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List)
@@ -153,5 +153,5 @@ public class UndoEventAction extends RMActionExecuterAbstractBase
// TODO add parameter definitions ....
// eventName
}
}
}

View File

@@ -291,7 +291,7 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
@Override
public void registerAuditEvent(AuditEvent auditEvent)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Registering audit event " + auditEvent.getName());
}
@@ -475,7 +475,7 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
public void auditEvent(NodeRef nodeRef, String eventName, Map<QName, Serializable> before, Map<QName, Serializable> after, boolean immediate, boolean removeIfNoPropertyChanged)
{
// deal with immediate auditing if required
if (immediate == true)
if (immediate)
{
Map<String, Serializable> auditMap = buildAuditMap(nodeRef, eventName, before, after, removeIfNoPropertyChanged);
auditComponent.recordAuditValues(RM_AUDIT_PATH_ROOT, auditMap);
@@ -552,7 +552,7 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
Pair<Map<QName, Serializable>, Map<QName, Serializable>> deltaPair = PropertyMap.getBeforeAndAfterMapsForChanges(propertiesBefore, propertiesAfter);
// If both the first and second Map in the deltaPair are empty and removeOnNoPropertyChange is true, the entire auditMap is discarded so it won't be audited.
if (deltaPair.getFirst().isEmpty() && deltaPair.getSecond().isEmpty() && removeOnNoPropertyChange == true)
if (deltaPair.getFirst().isEmpty() && deltaPair.getSecond().isEmpty() && removeOnNoPropertyChange)
{
auditMap.clear();
}
@@ -1371,7 +1371,7 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
json.put("fullName", entry.getFullName() == null ? "": entry.getFullName());
json.put("nodeRef", entry.getNodeRef() == null ? "": entry.getNodeRef());
if (entry.getEvent().equals("createPerson") == true && entry.getNodeRef() != null)
if (entry.getEvent().equals("createPerson") && entry.getNodeRef() != null)
{
NodeRef nodeRef = entry.getNodeRef();
String userName = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_USERNAME);

View File

@@ -29,7 +29,7 @@ import org.alfresco.service.namespace.QName;
/**
* Copy audit event.
*
*
* @author Roy Wetherall
* @since 2.1
*/
@@ -38,7 +38,7 @@ public class CopyAuditEvent extends AuditEvent implements OnCopyCompletePolicy
{
/**
* Audit copy of file plan components
*
*
* @see org.alfresco.repo.copy.CopyServicePolicies.OnCopyCompletePolicy#onCopyComplete(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, boolean, java.util.Map)
*/
@Override
@@ -47,15 +47,15 @@ public class CopyAuditEvent extends AuditEvent implements OnCopyCompletePolicy
kind = BehaviourKind.CLASS,
type = "rma:filePlanComponent"
)
public void onCopyComplete(QName classRef,
NodeRef sourceNodeRef,
NodeRef targetNodeRef,
public void onCopyComplete(QName classRef,
NodeRef sourceNodeRef,
NodeRef targetNodeRef,
boolean copyToNewNode,
Map<NodeRef, NodeRef> copyMap)
{
if (copyToNewNode == true)
if (copyToNewNode)
{
recordsManagementAuditService.auditEvent(targetNodeRef, getName());
}
}
}
}

View File

@@ -105,7 +105,7 @@ public abstract class AbstractCapability extends RMSecurityCommon
if (StringUtils.isBlank(title))
{
title = I18NUtil.getMessage("capability." + getName() + ".title");
if (StringUtils.isBlank(title) == true)
if (StringUtils.isBlank(title))
{
title = getName();
}

View File

@@ -81,7 +81,7 @@ public class CapabilityServiceImpl implements CapabilityService
public Set<Capability> getCapabilities(boolean includePrivate)
{
Set<Capability> result = null;
if (includePrivate == true)
if (includePrivate)
{
result = new HashSet<Capability>(capabilities.values());
}

View File

@@ -59,7 +59,7 @@ public class RMEntryVoter extends RMSecurityCommon
/** Policy map */
private HashMap<String, Policy> policies = new HashMap<String, Policy>();
/**
* @param capabilityService capability service
*/
@@ -125,7 +125,7 @@ public class RMEntryVoter extends RMSecurityCommon
{
MethodInvocation mi = (MethodInvocation)object;
if (TransactionalResourceHelper.isResourcePresent("voting") == true)
if (TransactionalResourceHelper.isResourcePresent("voting"))
{
if (logger.isDebugEnabled())
{

View File

@@ -173,11 +173,11 @@ public class RMSecurityCommon implements ApplicationContextAware
{
int result = AccessDecisionVoter.ACCESS_ABSTAIN;
if (nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)== true)
if (nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT))
{
result = checkRmRead(nodeRef);
}
else if (allowDMRead == true)
else if (allowDMRead)
{
// Check DM read for copy etc
// DM does not grant - it can only deny

View File

@@ -36,29 +36,29 @@ import org.apache.commons.logging.LogFactory;
/**
* Declarative capability implementation.
*
*
* @author Roy Wetherall
*/
public class DeclarativeCapability extends AbstractCapability
{
/** Logger */
protected static Log logger = LogFactory.getLog(DeclarativeCapability.class);
/** Required permissions */
protected List<String> permissions;
/** Map of conditions and expected evaluation result */
protected Map<String, Boolean> conditions;
/** List of file plan component kinds one of which must be satisfied */
protected List<String> kinds;
/** Capability to be evaluated against the target node reference */
protected Capability targetCapability;
/** Indicates whether to return an undetermined result */
protected boolean isUndetermined = false;
/**
* @param permissions permissions
*/
@@ -66,7 +66,7 @@ public class DeclarativeCapability extends AbstractCapability
{
this.permissions = permissions;
}
/**
* @param conditions conditions and expected values
*/
@@ -74,7 +74,7 @@ public class DeclarativeCapability extends AbstractCapability
{
this.conditions = conditions;
}
/**
* @return {@link Map}<String, Boolean> conditions and expected values
*/
@@ -82,15 +82,15 @@ public class DeclarativeCapability extends AbstractCapability
{
return conditions;
}
/**
* @param kinds list of file plan component kinds
* @param kinds list of file plan component kinds
*/
public void setKinds(List<String> kinds)
{
this.kinds = kinds;
}
/**
* @return {@link List}<@link String> list of expected file plan component kinds
*/
@@ -98,28 +98,28 @@ public class DeclarativeCapability extends AbstractCapability
{
return kinds;
}
/**
* Helper method to set a single kind.
*
*
* @param kind file plan component kind
*/
public void setKind(String kind)
{
this.kinds = Collections.singletonList(kind);
}
/**
* Sets whether the capability will return an undetermined result when evaluating permissions
* for a single node reference or not. The default is to return grant.
*
*
* @param isUndetermined true if undetermined result, false otherwise
*/
public void setUndetermined(boolean isUndetermined)
{
this.isUndetermined = isUndetermined;
}
/**
* @return
*/
@@ -127,10 +127,10 @@ public class DeclarativeCapability extends AbstractCapability
{
return isUndetermined;
}
/**
* Helper @see #setPermissions(List)
*
*
* @param permission permission
*/
public void setPermission(String permission)
@@ -139,7 +139,7 @@ public class DeclarativeCapability extends AbstractCapability
permissions.add(permission);
this.permissions = permissions;
}
/**
* @param targetCapability target capability
*/
@@ -147,18 +147,18 @@ public class DeclarativeCapability extends AbstractCapability
{
this.targetCapability = targetCapability;
}
/**
* Check the permissions passed.
*
*
* @param nodeRef node reference
* @return boolean true if the permissions are present, false otherwise
*/
protected boolean checkPermissionsImpl(NodeRef nodeRef, String ... permissions)
{
boolean result = true;
boolean result = true;
NodeRef filePlan = getFilePlanService().getFilePlan(nodeRef);
for (String permission : permissions)
{
if (permissionService.hasPermission(filePlan, permission) != AccessStatus.ALLOWED)
@@ -167,13 +167,13 @@ public class DeclarativeCapability extends AbstractCapability
break;
}
}
return result;
}
}
/**
* Checks the permissions required for the capability.
*
*
* @param nodeRef
* @return
*/
@@ -186,10 +186,10 @@ public class DeclarativeCapability extends AbstractCapability
}
return result;
}
/**
* Checks the passed conditions.
*
*
* @param nodeRef
* @return
*/
@@ -202,34 +202,34 @@ public class DeclarativeCapability extends AbstractCapability
{
boolean expected = entry.getValue().booleanValue();
String conditionName = entry.getKey();
CapabilityCondition condition = (CapabilityCondition)applicationContext.getBean(conditionName);
if (condition == null)
{
throw new AlfrescoRuntimeException("Capability condition " + conditionName + " does not exist. Check the configuration of the capability " + name + ".");
}
boolean actual = condition.evaluate(nodeRef);
if (expected != actual)
{
result = false;
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("FAIL: Condition " + condition.getName() + " failed for capability " + getName() + " on nodeRef " + nodeRef.toString());
}
break;
}
}
}
return result;
}
/**
/**
* Checks the set conditions.
*
*
* @param nodeRef node reference
* @return boolean true if conditions satisfied, false otherwise
*/
@@ -237,20 +237,20 @@ public class DeclarativeCapability extends AbstractCapability
{
return checkConditions(nodeRef, conditions);
}
/**
* Checks that the node ref is of the expected kind
*
*
* @param nodeRef
* @return
*/
protected boolean checkKinds(NodeRef nodeRef)
{
boolean result = false;
FilePlanComponentKind actualKind = getFilePlanService().getFilePlanComponentKind(nodeRef);
if (actualKind != null)
if (actualKind != null)
{
if (kinds != null && kinds.isEmpty() == false)
{
@@ -258,7 +258,7 @@ public class DeclarativeCapability extends AbstractCapability
for (String kindString : kinds)
{
FilePlanComponentKind kind = FilePlanComponentKind.valueOf(kindString);
if (actualKind.equals(kind) == true)
if (actualKind.equals(kind))
{
result = true;
break;
@@ -272,10 +272,10 @@ public class DeclarativeCapability extends AbstractCapability
result = true;
}
}
return result;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.AbstractCapability#hasPermissionImpl(org.alfresco.service.cmr.repository.NodeRef)
*/
@@ -283,14 +283,14 @@ public class DeclarativeCapability extends AbstractCapability
public int evaluate(NodeRef nodeRef)
{
int result = AccessDecisionVoter.ACCESS_ABSTAIN;
// Check we are dealing with a file plan component
if (getFilePlanService().isFilePlanComponent(nodeRef) == true)
if (getFilePlanService().isFilePlanComponent(nodeRef))
{
// Check the kind of the object, the permissions and the conditions
if (checkKinds(nodeRef) == true && checkPermissions(nodeRef) == true && checkConditions(nodeRef) == true)
if (checkKinds(nodeRef) && checkPermissions(nodeRef) && checkConditions(nodeRef))
{
// Opportunity for child implementations to extend
// Opportunity for child implementations to extend
result = evaluateImpl(nodeRef);
}
else
@@ -298,19 +298,19 @@ public class DeclarativeCapability extends AbstractCapability
result = AccessDecisionVoter.ACCESS_DENIED;
}
}
// Last chance for child implementations to veto/change the result
result = onEvaluate(nodeRef, result);
// log access denied to help with debug
if (logger.isDebugEnabled() == true && AccessDecisionVoter.ACCESS_DENIED == result)
if (logger.isDebugEnabled() && AccessDecisionVoter.ACCESS_DENIED == result)
{
logger.debug("FAIL: Capability " + getName() + " returned an Access Denied result during evaluation of node " + nodeRef.toString());
}
return result;
}
@Override
public int evaluate(NodeRef source, NodeRef target)
{
@@ -321,29 +321,29 @@ public class DeclarativeCapability extends AbstractCapability
}
return result;
}
/**
* Default implementation. Given extending classes a hook point for further checks.
*
*
* @param nodeRef node reference
* @return
*/
protected int evaluateImpl(NodeRef nodeRef)
{
int result = AccessDecisionVoter.ACCESS_GRANTED;
if (isUndetermined == true)
{
if (isUndetermined)
{
result = AccessDecisionVoter.ACCESS_ABSTAIN;
}
return result;
}
/**
* Default implementation.
*
* Default implementation.
*
* Called before evaluate completes. The result returned overwrites the already discovered result.
* Provides a hook point for child implementations that wish to veto the result.
*
*
* @param nodeRef
* @param result
* @return

View File

@@ -27,16 +27,16 @@ import org.alfresco.module.org_alfresco_module_rm.capability.CompositeCapability
import org.alfresco.service.cmr.repository.NodeRef;
/**
* Generic implementation of a composite capability
*
* Generic implementation of a composite capability
*
* @author Roy Wetherall
*/
public class DeclarativeCompositeCapability extends DeclarativeCapability
public class DeclarativeCompositeCapability extends DeclarativeCapability
implements CompositeCapability
{
/** set of capabilities */
private Set<Capability> capabilities;
/**
* @param capabilites set of capabilities
*/
@@ -44,7 +44,7 @@ public class DeclarativeCompositeCapability extends DeclarativeCapability
{
this.capabilities = capabilities;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.CompositeCapability#getCapabilities()
*/
@@ -53,25 +53,25 @@ public class DeclarativeCompositeCapability extends DeclarativeCapability
{
return this.capabilities;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
public int evaluateImpl(NodeRef nodeRef)
{
{
int result = AccessDecisionVoter.ACCESS_DENIED;
// Check each capability using 'OR' logic
for (Capability capability : capabilities)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Evaluating child capability " + capability.getName() + " on nodeRef " + nodeRef.toString() + " for composite capability " + name);
}
int capabilityResult = capability.evaluate(nodeRef);
if (capabilityResult != AccessDecisionVoter.ACCESS_DENIED)
if (capabilityResult != AccessDecisionVoter.ACCESS_DENIED)
{
result = AccessDecisionVoter.ACCESS_ABSTAIN;
if (isUndetermined() == false && capabilityResult == AccessDecisionVoter.ACCESS_GRANTED)
@@ -82,50 +82,50 @@ public class DeclarativeCompositeCapability extends DeclarativeCapability
}
else
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Access denied for child capability " + capability.getName() + " on nodeRef " + nodeRef.toString() + " for composite capability " + name);
}
}
}
return result;
}
/**
* If a target capability is specified then we evaluate that. Otherwise we combine the results of the provided capabilities.
*
*
* @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability#evaluate(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
public int evaluate(NodeRef source, NodeRef target)
{
int result = AccessDecisionVoter.ACCESS_ABSTAIN;
// Check we are dealing with a file plan component
if (getFilePlanService().isFilePlanComponent(source) == true &&
getFilePlanService().isFilePlanComponent(target) == true)
if (getFilePlanService().isFilePlanComponent(source) &&
getFilePlanService().isFilePlanComponent(target))
{
// Check the kind of the object, the permissions and the conditions
if (checkKinds(source) == true && checkPermissions(source) == true && checkConditions(source) == true)
if (checkKinds(source) && checkPermissions(source) && checkConditions(source))
{
if (targetCapability != null)
{
result = targetCapability.evaluate(target);
}
if (AccessDecisionVoter.ACCESS_DENIED != result)
{
// Check each capability using 'OR' logic
for (Capability capability : capabilities)
{
result = capability.evaluate(source, target);
if (result == AccessDecisionVoter.ACCESS_GRANTED)
{
if (result == AccessDecisionVoter.ACCESS_GRANTED)
{
break;
}
}
}
}
else
@@ -133,7 +133,7 @@ public class DeclarativeCompositeCapability extends DeclarativeCapability
result = AccessDecisionVoter.ACCESS_DENIED;
}
}
return result;
}
}

View File

@@ -27,14 +27,14 @@ import org.alfresco.service.cmr.repository.NodeRef;
/**
* Composite capability condition implementation that required at least one of the
* capability conditions to be true.
*
*
* @author Roy Wetherall
*/
public class AtLeastOneCondition extends AbstractCapabilityCondition
{
/** capability conditions */
private List<CapabilityCondition> conditions;
/**
* @param conditions capability conditions
*/
@@ -42,7 +42,7 @@ public class AtLeastOneCondition extends AbstractCapabilityCondition
{
this.conditions = conditions;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef)
*/
@@ -50,19 +50,19 @@ public class AtLeastOneCondition extends AbstractCapabilityCondition
public boolean evaluate(NodeRef nodeRef)
{
boolean result = false;
if (conditions != null)
{
for (CapabilityCondition condition : conditions)
{
if (condition.evaluate(nodeRef) == true)
if (condition.evaluate(nodeRef))
{
result = true;
break;
}
}
}
return result;
}
}

View File

@@ -38,18 +38,18 @@ public class ClosedCapabilityCondition extends AbstractCapabilityCondition
public boolean evaluate(NodeRef nodeRef)
{
boolean result = false;
if (recordFolderService.isRecordFolder(nodeRef) == true)
if (recordFolderService.isRecordFolder(nodeRef))
{
result = recordFolderService.isRecordFolderClosed(nodeRef);
}
else if (recordService.isRecord(nodeRef) == true)
else if (recordService.isRecord(nodeRef))
{
List<ChildAssociationRef> assocs = nodeService.getParentAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef assoc : assocs)
{
NodeRef parent = assoc.getParentRef();
if (recordFolderService.isRecordFolder(parent) == true &&
recordFolderService.isRecordFolderClosed(parent) == true)
if (recordFolderService.isRecordFolder(parent) &&
recordFolderService.isRecordFolderClosed(parent))
{
result = true;
break;

View File

@@ -31,7 +31,7 @@ public class DeclaredCapabilityCondition extends AbstractCapabilityCondition
public boolean evaluate(NodeRef nodeRef)
{
boolean result = false;
if (FilePlanComponentKind.RECORD.equals(filePlanService.getFilePlanComponentKind(nodeRef)) == true)
if (FilePlanComponentKind.RECORD.equals(filePlanService.getFilePlanComponentKind(nodeRef)))
{
result = recordService.isDeclared(nodeRef);
}

View File

@@ -27,17 +27,17 @@ import org.alfresco.service.cmr.repository.NodeRef;
public class FrozenCapabilityCondition extends AbstractCapabilityCondition
{
private boolean checkChildren = false;
public void setCheckChildren(boolean checkChildren)
{
this.checkChildren = checkChildren;
}
@Override
public boolean evaluate(NodeRef nodeRef)
{
boolean result = freezeService.isFrozen(nodeRef);
if (result == false && checkChildren == true)
if (result == false && checkChildren)
{
result = freezeService.hasFrozenChildren(nodeRef);
}

View File

@@ -25,14 +25,14 @@ import org.alfresco.service.cmr.repository.NodeRef;
/**
* Indicates whether a scheduled record or folder has events or not.
*
*
* @author Roy Wetherall
*/
public class HasEventsCapabilityCondition extends AbstractCapabilityCondition
{
/** Disposition service */
private DispositionService dispositionService;
/**
* @param dispositionService disposition service
*/
@@ -40,16 +40,16 @@ public class HasEventsCapabilityCondition extends AbstractCapabilityCondition
{
this.dispositionService = dispositionService;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
public boolean evaluate(NodeRef nodeRef)
{
boolean result = false;
if (dispositionService.isDisposableItem(nodeRef) == true)
boolean result = false;
if (dispositionService.isDisposableItem(nodeRef))
{
DispositionAction da = dispositionService.getNextDispositionAction(nodeRef);
if (da != null)
@@ -57,7 +57,7 @@ public class HasEventsCapabilityCondition extends AbstractCapabilityCondition
result = (da.getEventCompletionDetails().isEmpty() == false);
}
}
return result;
}
}

View File

@@ -25,17 +25,17 @@ import org.alfresco.service.cmr.repository.NodeRef;
/**
* Indicates whether the given disposition action is scheduled next
*
*
* @author Roy Wetherall
*/
public class IsScheduledCapabilityCondition extends AbstractCapabilityCondition
{
/** Disposition action */
private String dispositionAction;
/** Disposition service */
private DispositionService dispositionService;
/**
* @param dispositionAction disposition action
*/
@@ -43,7 +43,7 @@ public class IsScheduledCapabilityCondition extends AbstractCapabilityCondition
{
this.dispositionAction = dispositionAction;
}
/**
* @param dispositionService disposition service
*/
@@ -51,27 +51,27 @@ public class IsScheduledCapabilityCondition extends AbstractCapabilityCondition
{
this.dispositionService = dispositionService;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
public boolean evaluate(NodeRef nodeRef)
{
boolean result = false;
boolean result = false;
DispositionAction nextDispositionAction = dispositionService.getNextDispositionAction(nodeRef);
if (nextDispositionAction != null)
{
// Get the disposition actions name
String actionName = nextDispositionAction.getName();
if (actionName.equals(dispositionAction) == true &&
dispositionService.isNextDispositionActionEligible(nodeRef) == true)
String actionName = nextDispositionAction.getName();
if (actionName.equals(dispositionAction) &&
dispositionService.isNextDispositionActionEligible(nodeRef))
{
result = true;
result = true;
}
}
return result;
}
}

View File

@@ -34,9 +34,9 @@ public class IsTransferAccessionCapabilityCondition extends AbstractCapabilityCo
public boolean evaluate(NodeRef nodeRef)
{
boolean result = false;
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
if (FilePlanComponentKind.TRANSFER.equals(kind) == true)
if (FilePlanComponentKind.TRANSFER.equals(kind))
{
Boolean value = (Boolean)nodeService.getProperty(nodeRef, PROP_TRANSFER_ACCESSION_INDICATOR);
if (value != null)

View File

@@ -25,25 +25,25 @@ import org.alfresco.service.cmr.repository.NodeRef;
/**
* Last disposition action condition.
*
*
* @author Roy Wetherall
*/
public class LastDispositionActionCondition extends AbstractCapabilityCondition
{
private DispositionService dispositionService;
private String dispositionActionName;
public void setDispositionService(DispositionService dispositionService)
{
this.dispositionService = dispositionService;
}
public void setDispositionActionName(String dispositionActionName)
{
this.dispositionActionName = dispositionActionName;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef)
*/
@@ -52,11 +52,11 @@ public class LastDispositionActionCondition extends AbstractCapabilityCondition
{
boolean result = false;
DispositionAction dispositionAction = dispositionService.getLastCompletedDispostionAction(nodeRef);
if (dispositionAction != null &&
dispositionActionName.equals(dispositionAction.getName()) == true)
if (dispositionAction != null &&
dispositionActionName.equals(dispositionAction.getName()))
{
result = true;
}
return result;
return result;
}
}

View File

@@ -32,12 +32,12 @@ public class VitalRecordOrFolderCapabilityCondition extends AbstractCapabilityCo
{
boolean result = false;
if (recordService.isRecord(nodeRef) == true)
if (recordService.isRecord(nodeRef))
{
// Check the record for the vital record aspect
result = nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_VITAL_RECORD);
}
else if (recordFolderService.isRecordFolder(nodeRef) == true)
else if (recordFolderService.isRecordFolder(nodeRef))
{
// Check the folder for the vital record indicator
Boolean value = (Boolean)nodeService.getProperty(nodeRef, RecordsManagementModel.PROP_VITAL_RECORD_INDICATOR);

View File

@@ -27,7 +27,7 @@ public final class ViewRecordsCapability extends DeclarativeCapability
{
/** capability name */
public static final String NAME = "ViewRecords";
/**
* @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability#evaluate(org.alfresco.service.cmr.repository.NodeRef)
*/
@@ -35,19 +35,19 @@ public final class ViewRecordsCapability extends DeclarativeCapability
{
if (nodeRef != null)
{
if (getFilePlanService().isFilePlanComponent(nodeRef) == true)
if (getFilePlanService().isFilePlanComponent(nodeRef))
{
return checkRmRead(nodeRef);
}
else
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("View Records capability abstains, because node is not a file plan component. (nodeRef=" + nodeRef.toString() + ")");
}
}
}
return AccessDecisionVoter.ACCESS_ABSTAIN;
}
}

View File

@@ -355,7 +355,7 @@ public class DataSetServiceImpl implements DataSetService, RecordsManagementMode
logger.info("Bootstraping " + rmRoots.size() + " rm roots ...");
for (NodeRef rmRoot : rmRoots)
{
if (permissionService.getInheritParentPermissions(rmRoot) == true)
if (permissionService.getInheritParentPermissions(rmRoot))
{
logger.info("Updating permissions for rm root: " + rmRoot);
permissionService.setInheritParentPermissions(rmRoot, false);
@@ -397,7 +397,7 @@ public class DataSetServiceImpl implements DataSetService, RecordsManagementMode
String containerName = (String) nodeService.getProperty(container, ContentModel.PROP_NAME);
// Set permissions
if (permissionService.getInheritParentPermissions(container) == true)
if (permissionService.getInheritParentPermissions(container))
{
logger.info("Updating permissions for record container: " + containerName);
permissionService.setInheritParentPermissions(container, false);
@@ -422,7 +422,7 @@ public class DataSetServiceImpl implements DataSetService, RecordsManagementMode
String folderName = (String) nodeService.getProperty(recordFolder, ContentModel.PROP_NAME);
// Set permissions
if (permissionService.getInheritParentPermissions(recordFolder) == true)
if (permissionService.getInheritParentPermissions(recordFolder))
{
logger.info("Updating permissions for record folder: " + folderName);
permissionService.setInheritParentPermissions(recordFolder, false);

View File

@@ -34,38 +34,38 @@ import org.alfresco.service.namespace.QName;
/**
* Disposition action implementation
*
*
* @author Roy Wetherall
*/
public class DispositionActionDefinitionImpl implements DispositionActionDefinition, RecordsManagementModel
{
/** Name */
private String name;
/** Description */
private String description;
/** Label */
private String label;
/** Node service */
private NodeService nodeService;
/** Records management action service */
private RecordsManagementActionService recordsManagementActionService;
/** Records management event service */
private RecordsManagementEventService recordsManagementEventService;
/** Disposition action node reference */
private NodeRef dispositionActionNodeRef;
/** Action index */
private int index;
/**
* Constructor
*
*
* @param services service registry
* @param nodeRef disposition action node reference
* @param index index of disposition action
@@ -79,7 +79,7 @@ public class DispositionActionDefinitionImpl implements DispositionActionDefinit
this.dispositionActionNodeRef = nodeRef;
this.index = index;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getNodeRef()
*/
@@ -95,7 +95,7 @@ public class DispositionActionDefinitionImpl implements DispositionActionDefinit
{
return this.index;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getId()
*/
@@ -127,7 +127,7 @@ public class DispositionActionDefinitionImpl implements DispositionActionDefinit
}
return name;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getLabel()
*/
@@ -137,7 +137,7 @@ public class DispositionActionDefinitionImpl implements DispositionActionDefinit
{
String name = getName();
label = name;
// get the disposition action from the RM action service
RecordsManagementAction action = recordsManagementActionService.getDispositionAction(name);
if (action != null)
@@ -145,7 +145,7 @@ public class DispositionActionDefinitionImpl implements DispositionActionDefinit
label = action.getLabel();
}
}
return label;
}
@@ -168,7 +168,7 @@ public class DispositionActionDefinitionImpl implements DispositionActionDefinit
{
result = QName.createQName(value);
}
return result;
return result;
}
/**
@@ -194,21 +194,21 @@ public class DispositionActionDefinitionImpl implements DispositionActionDefinit
}
return events;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#eligibleOnFirstCompleteEvent()
*/
public boolean eligibleOnFirstCompleteEvent()
{
boolean result = true;
boolean result = true;
String value = (String)nodeService.getProperty(this.dispositionActionNodeRef, PROP_DISPOSITION_EVENT_COMBINATION);
if (value != null && value.equals("and") == true)
if (value != null && value.equals("and"))
{
result = false;
}
return result;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition#getLocation()
*/

View File

@@ -164,21 +164,21 @@ public class DispositionServiceImpl extends ServiceBaseImpl
{
this.dispositionSelectionStrategy = dispositionSelectionStrategy;
}
/**
* Behavior to initialize the disposition schedule of a newly filed record.
*
*
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnFileRecord#onFileRecord(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
@Behaviour(kind=BehaviourKind.CLASS, type="rma:record")
public void onFileRecord(NodeRef nodeRef)
public void onFileRecord(NodeRef nodeRef)
{
// initialise disposition details
if (nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE) == false)
{
DispositionSchedule di = getDispositionSchedule(nodeRef);
if (di != null && di.isRecordLevelDisposition() == true)
if (di != null && di.isRecordLevelDisposition())
{
nodeService.addAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE, null);
}
@@ -231,7 +231,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
for (DispositionProperty dispositionProperty : values)
{
boolean test = dispositionProperty.applies(isRecordLevel, dispositionAction);
if (test == true)
if (test)
{
result.add(dispositionProperty);
}
@@ -257,7 +257,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
{
DispositionSchedule di = null;
NodeRef diNodeRef = null;
if (isRecord(nodeRef) == true)
if (isRecord(nodeRef))
{
// Get the record folders for the record
List<NodeRef> recordFolders = recordFolderService.getRecordFolders(nodeRef);
@@ -292,7 +292,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
if (result == null)
{
NodeRef parent = this.nodeService.getPrimaryParent(nodeRef).getParentRef();
if (parent != null && filePlanService.isRecordCategory(parent) == true)
if (parent != null && filePlanService.isRecordCategory(parent))
{
result = getDispositionScheduleImpl(parent);
}
@@ -309,7 +309,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
// Check the noderef parameter
ParameterCheck.mandatory("nodeRef", nodeRef);
if (nodeService.exists(nodeRef) == true)
if (nodeService.exists(nodeRef))
{
// Get the associated disposition schedule node reference
NodeRef dsNodeRef = getAssociatedDispositionScheduleImpl(nodeRef);
@@ -340,7 +340,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
throw new AlfrescoRuntimeException("Can not find the associated disposition schedule for a non records management component. (nodeRef=" + nodeRef.toString() + ")");
}
if (this.nodeService.hasAspect(nodeRef, ASPECT_SCHEDULED) == true)
if (this.nodeService.hasAspect(nodeRef, ASPECT_SCHEDULED))
{
List<ChildAssociationRef> childAssocs = this.nodeService.getChildAssocs(nodeRef, ASSOC_DISPOSITION_SCHEDULE, RegexQNamePattern.MATCH_ALL);
if (childAssocs.size() != 0)
@@ -363,7 +363,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
NodeRef result = null;
NodeRef dsNodeRef = dispositionSchedule.getNodeRef();
if (nodeService.exists(dsNodeRef) == true)
if (nodeService.exists(dsNodeRef))
{
List<ChildAssociationRef> assocs = this.nodeService.getParentAssocs(dsNodeRef, ASSOC_DISPOSITION_SCHEDULE, RegexQNamePattern.MATCH_ALL);
if (assocs.size() != 0)
@@ -372,7 +372,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
{
// TODO in the future we should be able to support disposition schedule reuse, but for now just warn that
// only the first disposition schedule will be considered
if (logger.isWarnEnabled() == true)
if (logger.isWarnEnabled())
{
logger.warn("Disposition schedule has more than one associated records management container. " +
"This is not currently supported so only the first container will be considered. " +
@@ -434,9 +434,9 @@ public class DispositionServiceImpl extends ServiceBaseImpl
List<NodeRef> result = new ArrayList<NodeRef>(items.size());
for (NodeRef item : items)
{
if (recordFolderService.isRecordFolder(item) == true)
if (recordFolderService.isRecordFolder(item))
{
if (isRecordLevelDisposition == true)
if (isRecordLevelDisposition)
{
result.addAll(recordService.getRecords(item));
}
@@ -445,7 +445,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
result.add(item);
}
}
else if (filePlanService.isRecordCategory(item) == true)
else if (filePlanService.isRecordCategory(item))
{
if (getAssociatedDispositionScheduleImpl(item) == null)
{
@@ -564,7 +564,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
public void removeDispositionActionDefinition(DispositionSchedule schedule, DispositionActionDefinition actionDefinition)
{
// check first whether action definitions can be removed
if (hasDisposableItems(schedule) == true)
if (hasDisposableItems(schedule))
{
throw new AlfrescoRuntimeException("Can not remove action definitions from schedule '" +
schedule.getNodeRef() + "' as one or more record or record folders are present.");
@@ -703,13 +703,13 @@ public class DispositionServiceImpl extends ServiceBaseImpl
DispositionSchedule di = getDispositionSchedule(nodeRef);
NodeRef nextDa = getNextDispositionActionNodeRef(nodeRef);
if (di != null &&
this.nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE) == true &&
this.nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE) &&
nextDa != null)
{
// If it has an asOf date and it is greater than now the action is eligible
Date asOf = (Date)this.nodeService.getProperty(nextDa, PROP_DISPOSITION_AS_OF);
if (asOf != null &&
asOf.before(new Date()) == true)
asOf.before(new Date()))
{
result = true;
}
@@ -733,10 +733,10 @@ public class DispositionServiceImpl extends ServiceBaseImpl
isComplete = isCompleteValue.booleanValue();
// implement AND and OR combination of event completions
if (isComplete == true)
if (isComplete)
{
result = true;
if (firstComplete == true)
if (firstComplete)
{
break;
}
@@ -855,7 +855,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
{
// Get the current action node
NodeRef currentDispositionAction = null;
if (nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE) == true)
if (nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE))
{
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(nodeRef, ASSOC_NEXT_DISPOSITION_ACTION, RegexQNamePattern.MATCH_ALL);
if (assocs.size() > 0)
@@ -963,7 +963,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
}
}
}
return null;
}
};
@@ -978,7 +978,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
public void cutoffDisposableItem(NodeRef nodeRef)
{
ParameterCheck.mandatory("nodeRef", nodeRef);
// check that the node ref is a filed record or record folder
if (FilePlanComponentKind.RECORD_FOLDER.equals(filePlanService.getFilePlanComponentKind(nodeRef)) ||
FilePlanComponentKind.RECORD.equals(filePlanService.getFilePlanComponentKind(nodeRef)))
@@ -993,10 +993,10 @@ public class DispositionServiceImpl extends ServiceBaseImpl
applyCutoff(record);
}
}
// apply cut off
applyCutoff(nodeRef);
if (recordFolderService.isRecordFolder(nodeRef))
{
// close folder (manually since we can't normall close a folder that is cut off!!
@@ -1009,7 +1009,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
throw new AlfrescoRuntimeException("Unable to peform cutoff, because node is not a disposible item. (nodeRef=" + nodeRef.toString() + ")");
}
}
private void applyCutoff(NodeRef nodeRef)
{
// Apply the cut off aspect and set cut off date

View File

@@ -43,7 +43,7 @@ import org.alfresco.service.namespace.QName;
/**
* Disposition property implementation bean.
*
*
* @author Roy Wetherall
*/
@BehaviourBean
@@ -52,22 +52,22 @@ public class DispositionProperty extends BaseBehaviourBean
{
/** Property QName */
private QName propertyName;
/** Namespace service */
private NamespaceService namespaceService;
/** Disposition service */
private DispositionService dispositionService;
/** Indicates whether this disposition property applies to a folder level disposition */
private boolean appliesToFolderLevel = true;
/** Indicates whether this disposition property applies to a record level disposition */
private boolean appliesToRecordLevel = true;
/** Set of disposition actions this property does not apply to */
private Set<String> excludedDispositionActions;
/**
* @param namespaceService namespace service
*/
@@ -75,7 +75,7 @@ public class DispositionProperty extends BaseBehaviourBean
{
this.namespaceService = namespaceService;
}
/**
* @param dispositionService disposition service
*/
@@ -83,7 +83,7 @@ public class DispositionProperty extends BaseBehaviourBean
{
this.dispositionService = dispositionService;
}
/**
* @param propertyName property name (as string)
*/
@@ -91,7 +91,7 @@ public class DispositionProperty extends BaseBehaviourBean
{
this.propertyName = QName.createQName(propertyName, namespaceService);
}
/**
* @return property QName
*/
@@ -99,7 +99,7 @@ public class DispositionProperty extends BaseBehaviourBean
{
return this.propertyName;
}
/**
* @return property definition
*/
@@ -107,7 +107,7 @@ public class DispositionProperty extends BaseBehaviourBean
{
return dictionaryService.getProperty(propertyName);
}
/**
* @param excludedDispositionActions list of excluded disposition actions
*/
@@ -115,7 +115,7 @@ public class DispositionProperty extends BaseBehaviourBean
{
this.excludedDispositionActions = excludedDispositionActions;
}
/**
* @param appliesToFolderLevel
*/
@@ -123,7 +123,7 @@ public class DispositionProperty extends BaseBehaviourBean
{
this.appliesToFolderLevel = appliesToFolderLevel;
}
/**
* @param appliesToRecordLevel
*/
@@ -131,19 +131,19 @@ public class DispositionProperty extends BaseBehaviourBean
{
this.appliesToRecordLevel = appliesToRecordLevel;
}
/**
* Bean initialisation method
*/
public void init()
{
// register with disposition service
dispositionService.registerDispositionProperty(this);
dispositionService.registerDispositionProperty(this);
}
/**
* Indicates whether the disposition property applies given the context.
*
*
* @param isRecordLevel true if record level disposition schedule, false otherwise
* @param dispositionAction disposition action name
* @return boolean true if applies, false otherwise
@@ -151,9 +151,9 @@ public class DispositionProperty extends BaseBehaviourBean
public boolean applies(boolean isRecordLevel, String dispositionAction)
{
boolean result = false;
if ((isRecordLevel == true && appliesToRecordLevel == true) ||
(isRecordLevel == false && appliesToFolderLevel == true))
if ((isRecordLevel && appliesToRecordLevel) ||
(isRecordLevel == false && appliesToFolderLevel))
{
if (excludedDispositionActions != null && excludedDispositionActions.size() != 0)
{
@@ -167,7 +167,7 @@ public class DispositionProperty extends BaseBehaviourBean
result = true;
}
}
return result;
}
@@ -182,15 +182,15 @@ public class DispositionProperty extends BaseBehaviourBean
notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
)
public void onUpdateProperties(
final NodeRef nodeRef,
final Map<QName, Serializable> before,
final NodeRef nodeRef,
final Map<QName, Serializable> before,
final Map<QName, Serializable> after)
{
if (nodeService.exists(nodeRef) == true)
if (nodeService.exists(nodeRef))
{
// has the property we care about changed?
if (isPropertyUpdated(before, after) == true)
{
if (isPropertyUpdated(before, after))
{
AuthenticationUtil.runAs(new RunAsWork<Void>()
{
@Override
@@ -198,7 +198,7 @@ public class DispositionProperty extends BaseBehaviourBean
{
Date updatedDateValue = (Date)after.get(propertyName);
if (updatedDateValue != null)
{
{
DispositionAction dispositionAction = dispositionService.getNextDispositionAction(nodeRef);
if (dispositionAction != null)
{
@@ -206,11 +206,11 @@ public class DispositionProperty extends BaseBehaviourBean
if (daDefinition != null)
{
// check whether the next disposition action matches this disposition property
if (propertyName.equals(daDefinition.getPeriodProperty()) == true)
if (propertyName.equals(daDefinition.getPeriodProperty()))
{
Period period = daDefinition.getPeriod();
Date updatedAsOf = period.getNextDate(updatedDateValue);
// update asOf date on the disposition action based on the new property value
NodeRef daNodeRef = dispositionAction.getNodeRef();
nodeService.setProperty(daNodeRef, PROP_DISPOSITION_AS_OF, updatedAsOf);
@@ -224,22 +224,22 @@ public class DispositionProperty extends BaseBehaviourBean
if (before.get(propertyName) != null)
{
throw new AlfrescoRuntimeException(
"Error updating property " + propertyName.toPrefixString(namespaceService) +
"Error updating property " + propertyName.toPrefixString(namespaceService) +
" to null, because property is being used to determine a disposition date.");
}
}
return null;
}
}, AuthenticationUtil.getSystemUserName());
}, AuthenticationUtil.getSystemUserName());
}
}
}
/**
* Indicates whether the property has been updated or not.
*
*
* @param before
* @param after
* @return
@@ -247,10 +247,10 @@ public class DispositionProperty extends BaseBehaviourBean
private boolean isPropertyUpdated(Map<QName, Serializable> before, Map<QName, Serializable> after)
{
boolean result = false;
Serializable beforeValue = before.get(propertyName);
Serializable afterValue = after.get(propertyName);
if (beforeValue == null && afterValue != null)
{
result = true;
@@ -264,7 +264,7 @@ public class DispositionProperty extends BaseBehaviourBean
{
result = true;
}
return result;
}
}

View File

@@ -31,7 +31,7 @@ import org.alfresco.service.namespace.QName;
/**
* dod:dod5015record behaviour bean
*
*
* @author Roy Wetherall
* @since 2.2
*/
@@ -42,7 +42,7 @@ public class DOD5015RecordAspect extends BaseBehaviourBean
{
/** file plan service */
private FilePlanService filePlanService;
/**
* @param filePlanService file plan service
*/
@@ -50,10 +50,10 @@ public class DOD5015RecordAspect extends BaseBehaviourBean
{
this.filePlanService = filePlanService;
}
/**
* Ensure that the DOD record aspect meta-data is applied.
*
*
* @see org.alfresco.repo.node.NodeServicePolicies.OnAddAspectPolicy#onAddAspect(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName)
*/
@Behaviour
@@ -72,23 +72,23 @@ public class DOD5015RecordAspect extends BaseBehaviourBean
nodeService.addAspect(nodeRef, ASPECT_DOD_5015_RECORD, null);
}
}
/**
* Helper method to indicate whether the records file plan is a DOD one or not.
*
*
* @param record record node reference
* @return boolean true if in DOD file plan, false otherwise
*/
private boolean isDODFilePlan(NodeRef record)
{
boolean result = false;
NodeRef filePlan = filePlanService.getFilePlan(record);
if (filePlan != null && nodeService.exists(filePlan) == true)
if (filePlan != null && nodeService.exists(filePlan))
{
result = TYPE_DOD_5015_FILE_PLAN.equals(nodeService.getType(filePlan));
}
return result;
}
}
}

View File

@@ -150,7 +150,7 @@ public class CustomEmailMappingServiceImpl extends AbstractLifecycleBean impleme
if (customMappings == null)
{
// if we have a config file
if (nodeService.exists(CONFIG_NODE_REF) == true)
if (nodeService.exists(CONFIG_NODE_REF))
{
// load the contents of the config file
customMappings = loadConfig();
@@ -213,7 +213,7 @@ public class CustomEmailMappingServiceImpl extends AbstractLifecycleBean impleme
// check whether we already have this mapping or not
Set<CustomMapping> customMappings = getCustomMappings();
if (customMappings.contains(customMapping) == true)
if (customMappings.contains(customMapping))
{
throw new AlfrescoRuntimeException("Can not add custom email mapping, because duplicate mapping already exists.");
}
@@ -244,7 +244,7 @@ public class CustomEmailMappingServiceImpl extends AbstractLifecycleBean impleme
// check whether we already have this mapping or not
Set<CustomMapping> customMappings = getCustomMappings();
if (customMappings.contains(customMapping) == true)
if (customMappings.contains(customMapping))
{
// else remove the custom mapping (since we have already called getCustomMapping we can be sure
// the member variable is populated)
@@ -402,7 +402,7 @@ public class CustomEmailMappingServiceImpl extends AbstractLifecycleBean impleme
catch (Throwable e)
{
// log a warning
if (logger.isWarnEnabled() == true)
if (logger.isWarnEnabled())
{
logger.warn(e.getMessage());
}

View File

@@ -66,7 +66,7 @@ public class RFC822MetadataExtracter extends org.alfresco.repo.content.metadata.
Map<QName, Serializable> clone = new HashMap<QName, Serializable>(systemProperties);
for (QName propName : clone.keySet())
{
if (RecordsManagementModel.RM_URI.equals(propName.getNamespaceURI()) == true)
if (RecordsManagementModel.RM_URI.equals(propName.getNamespaceURI()))
{
systemProperties.remove(propName);
}

View File

@@ -109,7 +109,7 @@ public class OnReferenceCreateEventType extends SimpleRecordsManagementEventType
public Object doWork() throws Exception
{
// Check whether it is the reference type we care about
if (reference.equals(OnReferenceCreateEventType.this.reference) == true)
if (reference.equals(OnReferenceCreateEventType.this.reference))
{
DispositionAction da = dispositionService.getNextDispositionAction(toNodeRef);
if (da != null)
@@ -119,7 +119,7 @@ public class OnReferenceCreateEventType extends SimpleRecordsManagementEventType
{
RecordsManagementEvent rmEvent = recordsManagementEventService.getEvent(event.getEventName());
if (event.isEventComplete() == false &&
rmEvent.getType().equals(getName()) == true)
rmEvent.getType().equals(getName()))
{
// Complete the event
Map<String, Serializable> params = new HashMap<String, Serializable>(3);

View File

@@ -147,17 +147,17 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
boolean canCreateEvent = true;
if (existsEvent(eventName) == true)
if (existsEvent(eventName))
{
canCreateEvent = false;
}
if (canCreateEvent == true)
if (canCreateEvent)
{
for (Iterator iterator = getEventMap().values().iterator(); iterator.hasNext();)
{
RecordsManagementEvent recordsManagementEvent = (RecordsManagementEvent) iterator.next();
if (recordsManagementEvent.getDisplayLabel().equalsIgnoreCase(eventDisplayLabel) == true)
if (recordsManagementEvent.getDisplayLabel().equalsIgnoreCase(eventDisplayLabel))
{
canCreateEvent = false;
break;
@@ -188,9 +188,9 @@ public class RecordsManagementEventServiceImpl implements RecordsManagementEvent
for (Iterator iterator = getEventMap().values().iterator(); iterator.hasNext();)
{
RecordsManagementEvent recordsManagementEvent = (RecordsManagementEvent) iterator.next();
if (recordsManagementEvent.getDisplayLabel().equalsIgnoreCase(eventDisplayLabel) == true)
if (recordsManagementEvent.getDisplayLabel().equalsIgnoreCase(eventDisplayLabel))
{
if (recordsManagementEvent.getName().equalsIgnoreCase(eventName) == true)
if (recordsManagementEvent.getName().equalsIgnoreCase(eventName))
{
if (recordsManagementEvent.getType().equalsIgnoreCase(eventType) == false)
{

View File

@@ -179,8 +179,8 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
public boolean isFilePlanComponent(NodeRef nodeRef)
{
boolean result = false;
if (getInternalNodeService().exists(nodeRef) == true &&
getInternalNodeService().hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT) == true)
if (getInternalNodeService().exists(nodeRef) &&
getInternalNodeService().hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT))
{
result = true;
}
@@ -194,23 +194,23 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
{
FilePlanComponentKind result = null;
if (isFilePlanComponent(nodeRef) == true)
if (isFilePlanComponent(nodeRef))
{
result = FilePlanComponentKind.FILE_PLAN_COMPONENT;
if (isFilePlan(nodeRef) == true)
if (isFilePlan(nodeRef))
{
result = FilePlanComponentKind.FILE_PLAN;
}
else if (isRecordCategory(nodeRef) == true)
else if (isRecordCategory(nodeRef))
{
result = FilePlanComponentKind.RECORD_CATEGORY;
}
else if (getRecordFolderService().isRecordFolder(nodeRef) == true)
else if (getRecordFolderService().isRecordFolder(nodeRef))
{
result = FilePlanComponentKind.RECORD_FOLDER;
}
else if (getRecordService().isRecord(nodeRef) == true)
else if (getRecordService().isRecord(nodeRef))
{
result = FilePlanComponentKind.RECORD;
}
@@ -222,23 +222,23 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
{
result = FilePlanComponentKind.HOLD_CONTAINER_CHILD;
}
else if (getFreezeService().isHold(nodeRef) == true)
else if (getFreezeService().isHold(nodeRef))
{
result = FilePlanComponentKind.HOLD;
}
else if (getTransferService().isTransfer(nodeRef) == true)
else if (getTransferService().isTransfer(nodeRef))
{
result = FilePlanComponentKind.TRANSFER;
}
else if (instanceOf(nodeRef, TYPE_DISPOSITION_SCHEDULE) == true || instanceOf(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION) == true)
else if (instanceOf(nodeRef, TYPE_DISPOSITION_SCHEDULE) || instanceOf(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION))
{
result = FilePlanComponentKind.DISPOSITION_SCHEDULE;
}
else if (instanceOf(nodeRef, TYPE_UNFILED_RECORD_CONTAINER) == true)
else if (instanceOf(nodeRef, TYPE_UNFILED_RECORD_CONTAINER))
{
result = FilePlanComponentKind.UNFILED_RECORD_CONTAINER;
}
else if (instanceOf(nodeRef, TYPE_UNFILED_RECORD_CONTAINER_CHILD) == true)
else if (instanceOf(nodeRef, TYPE_UNFILED_RECORD_CONTAINER_CHILD))
{
result = FilePlanComponentKind.UNFILED_RECORD_CONTAINER_CHILD;
}
@@ -255,36 +255,36 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
{
FilePlanComponentKind result = null;
if (ASPECT_FILE_PLAN_COMPONENT.equals(type) == true)
if (ASPECT_FILE_PLAN_COMPONENT.equals(type))
{
result = FilePlanComponentKind.FILE_PLAN_COMPONENT;
}
else if (dictionaryService.isSubClass(type, ASPECT_RECORD) == true)
else if (dictionaryService.isSubClass(type, ASPECT_RECORD))
{
result = FilePlanComponentKind.RECORD;
}
else if (dictionaryService.isSubClass(type, TYPE_FILE_PLAN) == true)
else if (dictionaryService.isSubClass(type, TYPE_FILE_PLAN))
{
result = FilePlanComponentKind.FILE_PLAN;
}
else if (dictionaryService.isSubClass(type, TYPE_RECORD_CATEGORY) == true)
else if (dictionaryService.isSubClass(type, TYPE_RECORD_CATEGORY))
{
result = FilePlanComponentKind.RECORD_CATEGORY;
}
else if (dictionaryService.isSubClass(type, TYPE_RECORD_FOLDER) == true)
else if (dictionaryService.isSubClass(type, TYPE_RECORD_FOLDER))
{
result = FilePlanComponentKind.RECORD_FOLDER;
}
else if (dictionaryService.isSubClass(type, TYPE_HOLD) == true)
else if (dictionaryService.isSubClass(type, TYPE_HOLD))
{
result = FilePlanComponentKind.HOLD;
}
else if (dictionaryService.isSubClass(type, TYPE_TRANSFER) == true)
else if (dictionaryService.isSubClass(type, TYPE_TRANSFER))
{
result = FilePlanComponentKind.TRANSFER;
}
else if (dictionaryService.isSubClass(type, TYPE_DISPOSITION_SCHEDULE) == true ||
dictionaryService.isSubClass(type, TYPE_DISPOSITION_ACTION_DEFINITION) == true)
else if (dictionaryService.isSubClass(type, TYPE_DISPOSITION_SCHEDULE) ||
dictionaryService.isSubClass(type, TYPE_DISPOSITION_ACTION_DEFINITION))
{
result = FilePlanComponentKind.DISPOSITION_SCHEDULE;
}
@@ -326,7 +326,7 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
public boolean handle(Pair<Long, NodeRef> nodePair)
{
NodeRef nodeRef = nodePair.getSecond();
if (storeRef.equals(nodeRef.getStoreRef()) == true)
if (storeRef.equals(nodeRef.getStoreRef()))
{
results.add(nodeRef);
}
@@ -348,10 +348,10 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
SiteInfo siteInfo = getSiteService().getSite(siteId);
if (siteInfo != null)
{
if (getSiteService().hasContainer(siteId, FILE_PLAN_CONTAINER) == true)
if (getSiteService().hasContainer(siteId, FILE_PLAN_CONTAINER))
{
NodeRef nodeRef = getSiteService().getContainer(siteId, FILE_PLAN_CONTAINER);
if (instanceOf(nodeRef, TYPE_FILE_PLAN) == true)
if (instanceOf(nodeRef, TYPE_FILE_PLAN))
{
filePlan = nodeRef;
}
@@ -517,7 +517,7 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
// Check the parent is not already an RM component node
// ie: you can't create a rm root in an existing rm hierarchy
if (isFilePlanComponent(parent) == true)
if (isFilePlanComponent(parent))
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_DUP_ROOT));
}
@@ -742,16 +742,16 @@ public class FilePlanServiceImpl extends ServiceBaseImpl
NodeRef child = assoc.getChildRef();
QName childType = nodeService.getType(child);
if (typeFilter == null ||
typeFilter.equals(childType) == true ||
dictionaryService.isSubClass(childType, typeFilter) == true)
typeFilter.equals(childType) ||
dictionaryService.isSubClass(childType, typeFilter))
{
result.add(child);
}
// Inspect the containers and add children if deep
if (deep == true &&
(TYPE_RECORD_CATEGORY.equals(childType) == true ||
dictionaryService.isSubClass(childType, TYPE_RECORD_CATEGORY) == true))
if (deep &&
(TYPE_RECORD_CATEGORY.equals(childType) ||
dictionaryService.isSubClass(childType, TYPE_RECORD_CATEGORY)))
{
result.addAll(getContained(child, typeFilter, deep));
}

View File

@@ -142,7 +142,7 @@ public abstract class RecordsManagementFormFilter<ItemType> extends AbstractFilt
form.addField(field);
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Adding custom property .. " + prop.getName().toString() + " .. with value " + value + ".. to group .. " + setId);
}

View File

@@ -103,13 +103,13 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
Form form,
Map<String, Object> context)
{
if (filePlanService.isFilePlanComponent(nodeRef) == true)
if (filePlanService.isFilePlanComponent(nodeRef))
{
// add all the custom properties
addCustomPropertyFieldsToGroup(form, nodeRef);
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
if (FilePlanComponentKind.RECORD.equals(kind) == true)
if (FilePlanComponentKind.RECORD.equals(kind))
{
// add all the record meta-data aspect properties
addRecordMetadataPropertyFieldsToGroup(form, nodeRef);
@@ -129,7 +129,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
protectEmailExtractedFields(form, nodeRef);
}
}
else if (FilePlanComponentKind.RECORD_FOLDER.equals(kind) == true)
else if (FilePlanComponentKind.RECORD_FOLDER.equals(kind))
{
// add the supplemental marking list property
forceSupplementalMarkingListProperty(form, nodeRef);
@@ -137,13 +137,13 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
// add required transient properties
addTransientProperties(form, nodeRef);
}
else if (FilePlanComponentKind.DISPOSITION_SCHEDULE.equals(kind) == true)
else if (FilePlanComponentKind.DISPOSITION_SCHEDULE.equals(kind))
{
// use the same mechanism used to determine whether steps can be removed from the
// schedule to determine whether the disposition level can be changed i.e. record
// level or folder level.
DispositionSchedule schedule = new DispositionScheduleImpl(this.rmServiceRegistry, this.nodeService, nodeRef);
if (dispositionService.hasDisposableItems(schedule) == true)
if (dispositionService.hasDisposableItems(schedule))
{
protectRecordLevelDispositionPropertyField(form);
}
@@ -163,7 +163,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
// Compatibility support: don't show category properties if node of type series
QName type = nodeService.getType(nodeRef);
if (CompatibilityModel.TYPE_RECORD_SERIES.equals(type) == true)
if (CompatibilityModel.TYPE_RECORD_SERIES.equals(type))
{
// remove record category from the list of customisable types to apply to the form
customisables.remove(TYPE_RECORD_CATEGORY);
@@ -186,7 +186,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
for (QName aspect : aspects)
{
if (nodeService.hasAspect(nodeRef, aspect) == true)
if (nodeService.hasAspect(nodeRef, aspect))
{
String aspectName = aspect.getPrefixedQName(namespaceService).toPrefixString().replace(":", "-");
String setId = RM_METADATA_PREFIX + aspectName;
@@ -240,7 +240,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
*/
protected void addTransientProperties(Form form, NodeRef nodeRef)
{
if (recordService.isRecord(nodeRef) == true)
if (recordService.isRecord(nodeRef))
{
addTransientPropertyField(form, TRANSIENT_DECLARED, DataTypeDefinition.BOOLEAN, recordService.isDeclared(nodeRef));
}
@@ -308,7 +308,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
prefixName = fieldDef.getName();
}
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Checking property " + prefixName + " is editable by user " + AuthenticationUtil.getFullyAuthenticatedUser());
}
@@ -316,7 +316,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
QName qname = QName.createQName(prefixName, namespaceService);
if (recordService.isPropertyEditable(nodeRef, qname) == false)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... protected property");
}
@@ -360,7 +360,7 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter
}
}
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Set email related fields to be protected");
}

View File

@@ -86,14 +86,14 @@ public class RecordsManagementTypeFormFilter extends RecordsManagementFormFilter
* java.util.Map)
*/
public void afterGenerate(
TypeDefinition type,
List<String> fields,
List<String> forcedFields,
TypeDefinition type,
List<String> fields,
List<String> forcedFields,
Form form,
Map<String, Object> context)
{
QName typeName = type.getName();
if (rmAdminService.isCustomisable(typeName) == true)
if (rmAdminService.isCustomisable(typeName))
{
addCustomRMProperties(typeName, form);
}
@@ -102,28 +102,28 @@ public class RecordsManagementTypeFormFilter extends RecordsManagementFormFilter
Set<QName> aspects = type.getDefaultAspectNames();
for (QName aspect : aspects)
{
if (rmAdminService.isCustomisable(aspect) == true)
if (rmAdminService.isCustomisable(aspect))
{
addCustomRMProperties(aspect, form);
}
}
// set the id
// set the id
List<FieldDefinition> fieldDefs = form.getFieldDefinitions();
for (FieldDefinition fieldDef : fieldDefs)
{
String prefixName = fieldDef.getName();
if (prefixName.equals("rma:identifier") == true)
String prefixName = fieldDef.getName();
if (prefixName.equals("rma:identifier"))
{
String defaultId = identifierService.generateIdentifier(typeName, null);
String defaultId = identifierService.generateIdentifier(typeName, null);
fieldDef.setDefaultValue(defaultId);
}
// NOTE: we set these defaults in the form for backwards compatibility reasons (RM-753)
else if (prefixName.equals("rma:vitalRecordIndicator") == true)
else if (prefixName.equals("rma:vitalRecordIndicator"))
{
fieldDef.setDefaultValue(Boolean.FALSE.toString());
}
else if (prefixName.equals("rma:reviewPeriod") == true)
else if (prefixName.equals("rma:reviewPeriod"))
{
fieldDef.setDefaultValue("none|0");
}
@@ -147,7 +147,7 @@ public class RecordsManagementTypeFormFilter extends RecordsManagementFormFilter
if (customProps != null && customProps.isEmpty() == false)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Found " + customProps.size() + " custom properties for customisable type " + customisableType);
}

View File

@@ -612,7 +612,7 @@ public class FreezeServiceImpl extends ServiceBaseImpl
// Remove the freezes on the child records as long as there is no other
// hold referencing them
if (recordFolderService.isRecordFolder(nodeRef) == true)
if (recordFolderService.isRecordFolder(nodeRef))
{
if (logger.isDebugEnabled())
{

View File

@@ -39,30 +39,30 @@ import org.apache.commons.logging.LogFactory;
public class IdentifierServiceImpl implements IdentifierService
{
/** Logger */
private static Log logger = LogFactory.getLog(IdentifierServiceImpl.class);
private static Log logger = LogFactory.getLog(IdentifierServiceImpl.class);
/** Registry map */
private Map<QName, IdentifierGenerator> register = new HashMap<QName, IdentifierGenerator>(5);
/** Node service */
private NodeService nodeService;
/** Dictionary service */
private DictionaryService dictionaryService;
/**
* Set the node service
*
*
* @param nodeService node service
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/**
* Set the dictionary service
*
*
* @param dictionaryService dictionary service
*/
public void setDictionaryService(DictionaryService dictionaryService)
@@ -77,7 +77,7 @@ public class IdentifierServiceImpl implements IdentifierService
public String generateIdentifier(QName type, NodeRef parent)
{
ParameterCheck.mandatory("type", type);
// Build the context
Map<String, Serializable> context = new HashMap<String, Serializable>(2);
if (parent != null)
@@ -85,11 +85,11 @@ public class IdentifierServiceImpl implements IdentifierService
context.put(CONTEXT_PARENT_NODEREF, parent);
}
context.put(CONTEXT_ORIG_TYPE, type);
// Generate the id
return generateIdentifier(type, context);
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService#generateIdentifier(org.alfresco.service.cmr.repository.NodeRef)
*/
@@ -97,31 +97,31 @@ public class IdentifierServiceImpl implements IdentifierService
public String generateIdentifier(NodeRef nodeRef)
{
ParameterCheck.mandatory("nodeRef", nodeRef);
Map<String, Serializable> context = new HashMap<String, Serializable>(3);
// Set the original type
QName type = nodeService.getType(nodeRef);
context.put(CONTEXT_ORIG_TYPE, type);
// Set the parent reference
ChildAssociationRef assocRef = nodeService.getPrimaryParent(nodeRef);
if (assocRef != null && assocRef.getParentRef() != null)
{
context.put(CONTEXT_PARENT_NODEREF, assocRef.getParentRef());
}
// Set the node reference
context.put(CONTEXT_NODEREF, nodeRef);
// Generate the identifier
return generateIdentifier(type, context);
}
/**
* Generate an identifier for a given type of object with the accompanying context.
*
*
* @param type content type
* @param context context
* @return String identifier
@@ -129,19 +129,19 @@ public class IdentifierServiceImpl implements IdentifierService
private String generateIdentifier(QName type, Map<String, Serializable> context)
{
ParameterCheck.mandatory("type", type);
ParameterCheck.mandatory("context", context);
ParameterCheck.mandatory("context", context);
// Get the identifier generator
IdentifierGenerator idGen = lookupGenerator(type);
if (idGen == null)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Unable to generate id for object of type " + type.toString() + ", because no identifier generator was found.");
}
throw new AlfrescoRuntimeException("Unable to generate id for object of type " + type.toString() + ", because no identifier generator was found.");
}
// Generate the identifier
return idGen.generateId(context);
}
@@ -155,24 +155,24 @@ public class IdentifierServiceImpl implements IdentifierService
}
/**
*
*
* @param type content type (could be aspect or type)
* @return
*/
private IdentifierGenerator lookupGenerator(QName type)
{
ParameterCheck.mandatory("type", type);
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Looking for idGenerator for type " + type.toString());
}
// Look for the generator related to the type
IdentifierGenerator result = register.get(type);
if (result == null)
{
// Check the parent type
// Check the parent type
ClassDefinition typeDef = dictionaryService.getClass(type);
if (typeDef != null)
{
@@ -185,7 +185,7 @@ public class IdentifierServiceImpl implements IdentifierService
}
else
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Unable to find type definition for " + type.toString() + " when generating identifier.");
}

View File

@@ -37,40 +37,40 @@ import org.apache.commons.logging.LogFactory;
/**
* This job finds all Vital Records which are due for review, optionally
* excluding those for which notification has already been issued.
*
*
* @author Neil McErlean
*/
public class NotifyOfRecordsDueForReviewJobExecuter extends RecordsManagementJobExecuter
{
private static Log logger = LogFactory.getLog(NotifyOfRecordsDueForReviewJobExecuter.class);
private RecordsManagementNotificationHelper recordsManagementNotificationHelper;
private NodeService nodeService;
private SearchService searchService;
public void setRecordsManagementNotificationHelper(
RecordsManagementNotificationHelper recordsManagementNotificationHelper)
{
this.recordsManagementNotificationHelper = recordsManagementNotificationHelper;
}
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
public void setSearchService(SearchService searchService)
{
this.searchService = searchService;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJobExecuter#execute()
*/
public void executeImpl()
{
public void executeImpl()
{
if (logger.isDebugEnabled())
{
logger.debug("Job " + this.getClass().getSimpleName() + " starting.");
@@ -83,23 +83,23 @@ public class NotifyOfRecordsDueForReviewJobExecuter extends RecordsManagementJob
// Query is for all records that are due for review and for which
// notification has not been sent.
StringBuilder queryBuffer = new StringBuilder();
queryBuffer.append("+ASPECT:\"rma:vitalRecord\" ");
queryBuffer.append("+ASPECT:\"rma:vitalRecord\" ");
queryBuffer.append("+(@rma\\:reviewAsOf:[MIN TO NOW] ) ");
queryBuffer.append("+( ");
queryBuffer.append("@rma\\:notificationIssued:false ");
queryBuffer.append("@rma\\:notificationIssued:false ");
queryBuffer.append("OR ISNULL:\"rma:notificationIssued\" ");
queryBuffer.append(") ");
queryBuffer.append(") ");
String query = queryBuffer.toString();
ResultSet results = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_LUCENE, query);
ResultSet results = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_LUCENE, query);
final List<NodeRef> resultNodes = results.getNodeRefs();
results.close();
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Found " + resultNodes.size() + " nodes due for review and without notification.");
}
}
//If we have something to do and a template to do it with
if(resultNodes.size() != 0)
{
@@ -111,11 +111,11 @@ public class NotifyOfRecordsDueForReviewJobExecuter extends RecordsManagementJob
{
// Send notification
recordsManagementNotificationHelper.recordsDueForReviewEmailNotification(resultNodes);
return null;
}
};
RetryingTransactionCallback<Boolean> txUpdateNodesCallback = new RetryingTransactionCallback<Boolean>()
{
// Set the notification issued property.
@@ -128,7 +128,7 @@ public class NotifyOfRecordsDueForReviewJobExecuter extends RecordsManagementJob
return Boolean.TRUE;
}
};
/**
* Now do the work, one action in each transaction
*/
@@ -139,15 +139,15 @@ public class NotifyOfRecordsDueForReviewJobExecuter extends RecordsManagementJob
}
return null;
}
}, AuthenticationUtil.getSystemUserName());
if (logger.isDebugEnabled())
{
logger.debug("Job " + this.getClass().getSimpleName() + " finished");
}
}
} // end of execute method
}

View File

@@ -41,29 +41,29 @@ import org.apache.commons.logging.LogFactory;
/**
* Job to publish any pending updates on marked node references.
*
*
* @author Roy Wetherall
*/
public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
{
/** Logger */
private static Log logger = LogFactory.getLog(PublishUpdatesJobExecuter.class);
/** Node service */
private NodeService nodeService;
/** Search service */
private SearchService searchService;
private SearchService searchService;
/** Publish executor register */
private PublishExecutorRegistry publishExecutorRegistry;
/** Dictionary service */
private DictionaryService dictionaryService;
/** Behaviour filter */
private BehaviourFilter behaviourFilter;
/**
* @param nodeService node service
*/
@@ -71,7 +71,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
{
this.nodeService = nodeService;
}
/**
* @param searchService search service
*/
@@ -79,7 +79,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
{
this.searchService = searchService;
}
/**
* @param publishExecutorRegistry public executor registry
*/
@@ -87,29 +87,29 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
{
this.publishExecutorRegistry = publishExecutorRegistry;
}
/**
* @param behaviourFilter behaviour filter
*/
public void setBehaviourFilter(BehaviourFilter behaviourFilter)
{
this.behaviourFilter = behaviourFilter;
}
}
/**
* @param dictionaryService dictionary service
*/
public void setDictionaryService(DictionaryService dictionaryService)
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJobExecuter#executeImpl()
*/
public void executeImpl()
{
if (logger.isDebugEnabled() == true)
{
if (logger.isDebugEnabled())
{
logger.debug("Job Starting");
}
@@ -118,33 +118,33 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
{
public Object doWork() throws Exception
{
if (rmLoaded() == true)
{
if (rmLoaded())
{
// Get a list of the nodes that have updates that need to be published
List<NodeRef> nodeRefs = getUpdatedNodes();
// Deal with each updated disposition action in turn
for (NodeRef nodeRef : nodeRefs)
{
if (nodeService.exists(nodeRef) == true)
if (nodeService.exists(nodeRef))
{
// Mark the update node as publishing in progress
markPublishInProgress(nodeRef);
markPublishInProgress(nodeRef);
try
{
Date start = new Date();
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Starting publish of updates ...");
logger.debug(" - for " + nodeRef.toString());
logger.debug(" - at " + start.toString());
}
// Publish updates
publishUpdates(nodeRef);
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
Date end = new Date();
long duration = end.getTime() - start.getTime();
@@ -153,7 +153,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
logger.debug(" - at " + end.toString());
logger.debug(" - duration " + Long.toString(duration));
}
}
}
finally
{
// Ensure the update node has either completed the publish or is marked as no longer in progress
@@ -166,12 +166,12 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
};
}, AuthenticationUtil.getSystemUserName());
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Job Finished");
}
}
/**
* Helper method to determine whether the RM content model has been loaded yet.
*
@@ -180,24 +180,24 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
private boolean rmLoaded()
{
boolean result = false;
// ensure that the rm content model has been loaded
if (dictionaryService != null &&
dictionaryService.getAspect(ASPECT_UNPUBLISHED_UPDATE) != null)
{
result = true;
}
return result;
}
/**
* Get a list of the nodes with updates pending publish
* @return List<NodeRef> list of node refences with updates pending publication
*/
private List<NodeRef> getUpdatedNodes()
{
RetryingTransactionCallback<List<NodeRef>> execution =
RetryingTransactionCallback<List<NodeRef>> execution =
new RetryingTransactionHelper.RetryingTransactionCallback<List<NodeRef>>()
{
@Override
@@ -206,19 +206,19 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
// Build the query string
StringBuilder sb = new StringBuilder();
sb.append("+ASPECT:\"rma:").append(ASPECT_UNPUBLISHED_UPDATE.getLocalName()).append("\" ");
sb.append("@rma\\:").append(PROP_PUBLISH_IN_PROGRESS.getLocalName()).append(":false ");
sb.append("@rma\\:").append(PROP_PUBLISH_IN_PROGRESS.getLocalName()).append(":false ");
String query = sb.toString();
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Executing query " + query);
}
// Execute query to find updates awaiting publishing
List<NodeRef> resultNodes = null;
ResultSet results = searchService.query(
StoreRef.STORE_REF_WORKSPACE_SPACESSTORE,
SearchService.LANGUAGE_LUCENE,
SearchService.LANGUAGE_LUCENE,
query);
try
{
@@ -228,40 +228,40 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
{
results.close();
}
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Found " + resultNodes.size() + " disposition action definitions updates awaiting publishing.");
}
return resultNodes;
}
};
return retryingTransactionHelper.doInTransaction(execution, true);
}
/**
* Mark the node as publish in progress. This is often used as a marker to prevent any further updates
* Mark the node as publish in progress. This is often used as a marker to prevent any further updates
* to a node.
* @param nodeRef node reference
*/
private void markPublishInProgress(final NodeRef nodeRef)
{
RetryingTransactionHelper.RetryingTransactionCallback<Void> execution =
RetryingTransactionHelper.RetryingTransactionCallback<Void> execution =
new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
{
@Override
public Void execute() throws Throwable
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Marking updated node as publish in progress. (node=" + nodeRef.toString() + ")");
}
behaviourFilter.disableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION);
try
{
if (nodeService.exists(nodeRef) == true)
if (nodeService.exists(nodeRef))
{
// Mark the node as publish in progress
nodeService.setProperty(nodeRef, PROP_PUBLISH_IN_PROGRESS, true);
@@ -276,14 +276,14 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
};
retryingTransactionHelper.doInTransaction(execution, false, true);
}
/**
* Publish the updates made to the node.
* @param nodeRef node reference
*/
private void publishUpdates(final NodeRef nodeRef)
{
RetryingTransactionHelper.RetryingTransactionCallback<Void> execution =
RetryingTransactionHelper.RetryingTransactionCallback<Void> execution =
new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
{
@Override
@@ -291,48 +291,48 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
{
behaviourFilter.disableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION);
try
{
{
// Get the update to value for the node
String updateTo = (String)nodeService.getProperty(nodeRef, PROP_UPDATE_TO);
if (updateTo != null)
{
if (logger.isDebugEnabled() == true)
{
if (logger.isDebugEnabled())
{
logger.debug("Node update to " + updateTo + " (noderef=" + nodeRef.toString() + ")");
}
// Get the publish executor
PublishExecutor executor = publishExecutorRegistry.get(updateTo);
if (executor == null)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Unable to find a corresponding publish executor. (noderef=" + nodeRef.toString() + ", updateTo=" + updateTo + ")");
}
throw new AlfrescoRuntimeException("Unable to find a corresponding publish executor. (noderef=" + nodeRef.toString() + ", updateTo=" + updateTo + ")");
}
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Attempting to publish updates. (nodeRef=" + nodeRef.toString() + ")");
}
// Publish
// Publish
executor.publish(nodeRef);
}
else
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Unable to publish, because publish executor is not set.");
}
}
}
// Remove the unpublished update aspect
nodeService.removeAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE);
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Publish updates complete. (nodeRef=" + nodeRef.toString() + ")");
}
@@ -341,20 +341,20 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
{
behaviourFilter.enableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION);
}
return null;
}
};
retryingTransactionHelper.doInTransaction(execution);
}
/**
* Unmark node as publish in progress, assuming publish failed.
* @param nodeRef node reference
*/
private void unmarkPublishInProgress(final NodeRef nodeRef)
{
RetryingTransactionHelper.RetryingTransactionCallback<Void> execution =
RetryingTransactionHelper.RetryingTransactionCallback<Void> execution =
new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
{
@Override
@@ -364,14 +364,14 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
try
{
// Assuming the node still has unpublished information, then unmark it in progress
if (nodeService.exists(nodeRef) == true &&
nodeService.hasAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE) == true)
if (nodeService.exists(nodeRef) &&
nodeService.hasAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE))
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Removing publish in progress marker from updated node, because update was not successful. (node=" + nodeRef.toString() + ")");
}
nodeService.setProperty(nodeRef, PROP_PUBLISH_IN_PROGRESS, false);
}
}
@@ -379,7 +379,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter
{
behaviourFilter.enableBehaviour(nodeRef, TYPE_DISPOSITION_ACTION_DEFINITION);
}
return null;
}
};

View File

@@ -31,9 +31,9 @@ import org.mozilla.javascript.Scriptable;
/**
* Base records management script node
*
*
* NOTE: this could be removed, but is being kept as a place holder for future development
*
*
* @author Roy Wetherall
*/
public class ScriptRecordsManagmentNode extends ScriptNode
@@ -41,9 +41,9 @@ public class ScriptRecordsManagmentNode extends ScriptNode
private static final long serialVersionUID = 8872385533440938353L;
private RecordsManagementServiceRegistry rmServices;
public ScriptRecordsManagmentNode(NodeRef nodeRef, RecordsManagementServiceRegistry services, Scriptable scope)
{
{
super(nodeRef, services, scope);
rmServices = services;
}
@@ -53,17 +53,17 @@ public class ScriptRecordsManagmentNode extends ScriptNode
super(nodeRef, services);
rmServices = services;
}
public boolean hasCapability(String capabilityName)
{
boolean result = false;
CapabilityService capabilityService = (CapabilityService)rmServices.getCapabilityService();
Capability capability = capabilityService.getCapability(capabilityName);
if (capability != null)
{
Map<Capability, AccessStatus> map = capabilityService.getCapabilitiesAccessState(nodeRef, Collections.singletonList(capabilityName));
if (map.containsKey(capability) == true)
if (map.containsKey(capability))
{
AccessStatus accessStatus = map.get(capability);
if (accessStatus.equals(AccessStatus.DENIED) == false)
@@ -72,7 +72,7 @@ public class ScriptRecordsManagmentNode extends ScriptNode
}
}
}
return result;
}
}

View File

@@ -28,51 +28,51 @@ import org.alfresco.scripts.ScriptException;
/**
* Records management service
*
*
* @author Roy Wetherall
*/
public class ScriptRecordsManagmentService extends BaseScopableProcessorExtension
implements RecordsManagementModel
implements RecordsManagementModel
{
/** Records management service registry */
private RecordsManagementServiceRegistry rmServices;
/** Records management notification helper */
private RecordsManagementNotificationHelper notificationHelper;
/**
* Set records management service registry
*
* Set records management service registry
*
* @param rmServices records management service registry
*/
public void setRecordsManagementServiceRegistry(RecordsManagementServiceRegistry rmServices)
{
this.rmServices = rmServices;
}
/**
* Sets the notification helper
*
*
* @param notificationHelper notification helper
*/
public void setNotificationHelper(RecordsManagementNotificationHelper notificationHelper)
{
this.notificationHelper = notificationHelper;
}
/**
* Get records management node
*
*
* @param node script node
* @return ScriptRecordsManagementNode records management script node
*/
public ScriptRecordsManagmentNode getRecordsManagementNode(ScriptNode node)
{
ScriptRecordsManagmentNode result = null;
if (rmServices.getNodeService().hasAspect(node.getNodeRef(), ASPECT_FILE_PLAN_COMPONENT) == true)
if (rmServices.getNodeService().hasAspect(node.getNodeRef(), ASPECT_FILE_PLAN_COMPONENT))
{
// TODO .. at this point determine what type of records management node is it and
// TODO .. at this point determine what type of records management node is it and
// create the appropriate sub-type
result = new ScriptRecordsManagmentNode(node.getNodeRef(), rmServices);
}
@@ -80,13 +80,13 @@ public class ScriptRecordsManagmentService extends BaseScopableProcessorExtensio
{
throw new ScriptException("Node is not a records management node type.");
}
return result;
}
/**
* Set the RM permission
*
*
* @param node
* @param permission
* @param authority
@@ -96,10 +96,10 @@ public class ScriptRecordsManagmentService extends BaseScopableProcessorExtensio
FilePlanPermissionService filePlanPermissionService = rmServices.getFilePlanPermissionService();
filePlanPermissionService.setPermission(node.getNodeRef(), authority, permission);
}
/**
* Delete the RM permission
*
*
* @param node
* @param permission
* @param authority
@@ -109,10 +109,10 @@ public class ScriptRecordsManagmentService extends BaseScopableProcessorExtensio
FilePlanPermissionService filePlanPermissionService = rmServices.getFilePlanPermissionService();
filePlanPermissionService.deletePermission(node.getNodeRef(), authority, permission);
}
/**
* Send superseded notification
*
*
* @param record superseded record
*/
public void sendSupersededNotification(ScriptNode record)

View File

@@ -223,9 +223,9 @@ public abstract class BaseEvaluator implements RecordsManagementModel
boolean result = false;
// Check that we are dealing with the correct kind of RM object
if ((kinds == null || checkKinds(nodeRef) == true) &&
if ((kinds == null || checkKinds(nodeRef)) &&
// Check we have the required capabilities
(capabilities == null || checkCapabilities(nodeRef) == true))
(capabilities == null || checkCapabilities(nodeRef)))
{
result = evaluateImpl(nodeRef);
}
@@ -259,7 +259,7 @@ public abstract class BaseEvaluator implements RecordsManagementModel
Map<Capability, AccessStatus> accessStatus = capabilityService.getCapabilitiesAccessState(nodeRef, capabilities);
for (AccessStatus value : accessStatus.values())
{
if (AccessStatus.DENIED.equals(value) == true)
if (AccessStatus.DENIED.equals(value))
{
result = false;
break;

View File

@@ -110,13 +110,13 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
NodeRef nodeRef = nodeInfo.getNodeRef();
if (AccessStatus.ALLOWED.equals(capabilityService.getCapabilityAccessState(nodeRef,
RMPermissionModel.VIEW_RECORDS)) == true)
RMPermissionModel.VIEW_RECORDS)))
{
// Indicate whether the node is a RM object or not
boolean isFilePlanComponent = filePlanService.isFilePlanComponent(nodeInfo.getNodeRef());
rootJSONObject.put("isRmNode", isFilePlanComponent);
if (isFilePlanComponent == true)
if (isFilePlanComponent)
{
rootJSONObject.put("rmNode", setRmNodeValues(nodeRef, rootJSONObject, useShortQNames));
}
@@ -173,7 +173,7 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
for (BaseEvaluator indicator : indicators)
{
if (indicator.evaluate(nodeRef) == true)
if (indicator.evaluate(nodeRef))
{
jsonIndicators.add(indicator.getName());
}
@@ -192,7 +192,7 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
for (BaseEvaluator action : actions)
{
if (action.evaluate(nodeRef) == true)
if (action.evaluate(nodeRef))
{
jsonActions.add(action.getName());
}
@@ -226,7 +226,7 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
}
case RECORD_FOLDER:
{
if (recordService.isMetadataStub(nodeRef) == true)
if (recordService.isMetadataStub(nodeRef))
{
result = "metadata-stub-folder";
}
@@ -238,13 +238,13 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
}
case RECORD:
{
if (recordService.isMetadataStub(nodeRef) == true)
if (recordService.isMetadataStub(nodeRef))
{
result = "metadata-stub";
}
else
{
if (recordService.isDeclared(nodeRef) == true)
if (recordService.isDeclared(nodeRef))
{
result = "record";
}

View File

@@ -30,14 +30,14 @@ import org.alfresco.service.namespace.RegexQNamePattern;
/**
* Determines whether a node has multiple parents within a file plan
*
*
* @author Roy Wetherall
*/
public class MultiParentEvaluator extends BaseEvaluator
{
@Override
protected boolean evaluateImpl(final NodeRef nodeRef)
{
{
return AuthenticationUtil.runAsSystem(new RunAsWork<Boolean>()
{
@Override
@@ -47,13 +47,13 @@ public class MultiParentEvaluator extends BaseEvaluator
int count = 0;
for (ChildAssociationRef parent : parents)
{
if (nodeService.hasAspect(parent.getParentRef(), ASPECT_FILE_PLAN_COMPONENT) == true)
if (nodeService.hasAspect(parent.getParentRef(), ASPECT_FILE_PLAN_COMPONENT))
{
count++;
}
}
return (count > 1);
return (count > 1);
}
});
}

View File

@@ -29,21 +29,21 @@ import org.alfresco.service.namespace.QName;
public class NonElectronicEvaluator extends BaseEvaluator
{
private DictionaryService dictionaryService;
public void setDictionaryService(DictionaryService dictionaryService)
{
this.dictionaryService = dictionaryService;
}
@Override
protected boolean evaluateImpl(NodeRef nodeRef)
{
boolean result = false;
QName qName = nodeService.getType(nodeRef);
if (qName != null && dictionaryService.isSubClass(qName, TYPE_NON_ELECTRONIC_DOCUMENT) == true)
if (qName != null && dictionaryService.isSubClass(qName, TYPE_NON_ELECTRONIC_DOCUMENT))
{
result = true;
}
}
return result;
}
}

View File

@@ -26,15 +26,15 @@ import org.alfresco.service.cmr.repository.NodeRef;
/**
* Split EMail action evaluator
*
*
* @author Roy Wetherall
*/
public class SplitEmailActionEvaluator extends BaseEvaluator
{
{
@Override
protected boolean evaluateImpl(NodeRef nodeRef)
{
boolean result = false;
boolean result = false;
if (recordService.isDeclared(nodeRef) == false)
{
ContentData contentData = (ContentData)nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT);
@@ -42,8 +42,8 @@ public class SplitEmailActionEvaluator extends BaseEvaluator
{
String mimetype = contentData.getMimetype();
if (mimetype != null &&
(MimetypeMap.MIMETYPE_RFC822.equals(mimetype) == true ||
MimetypeMap.MIMETYPE_OUTLOOK_MSG.equals(mimetype) == true))
(MimetypeMap.MIMETYPE_RFC822.equals(mimetype) ||
MimetypeMap.MIMETYPE_OUTLOOK_MSG.equals(mimetype)))
{
result = true;
}

View File

@@ -1,5 +1,5 @@
/**
*
*
*/
package org.alfresco.module.org_alfresco_module_rm.model;
@@ -15,7 +15,7 @@ import org.apache.commons.logging.LogFactory;
/**
* Convenient base class for behaviour beans.
*
*
* @author Roy Wetherall
* @since 2.2
*/
@@ -25,13 +25,13 @@ public abstract class BaseBehaviourBean extends ServiceBaseImpl
{
/** Logger */
protected static Log logger = LogFactory.getLog(BaseBehaviourBean.class);
/** behaviour filter */
protected BehaviourFilter behaviourFilter;
/** behaviour map */
protected Map<String, org.alfresco.repo.policy.Behaviour> behaviours = new HashMap<String, org.alfresco.repo.policy.Behaviour>(7);
/**
* @param behaviourFilter behaviour filter
*/
@@ -46,11 +46,11 @@ public abstract class BaseBehaviourBean extends ServiceBaseImpl
@Override
public void registerBehaviour(String name, org.alfresco.repo.policy.Behaviour behaviour)
{
if (behaviours.containsKey(name) == true)
if (behaviours.containsKey(name))
{
throw new AlfrescoRuntimeException("Can not register behaviour, because name " + name + "has already been used.");
}
behaviours.put(name, behaviour);
}

View File

@@ -291,7 +291,7 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
*/
public void dispositionActionPropertiesUpdate(final NodeRef nodeRef, final Map<QName, Serializable> before, final Map<QName, Serializable> after)
{
if (nodeService.exists(nodeRef) == true)
if (nodeService.exists(nodeRef))
{
AuthenticationUtil.runAs(new RunAsWork<Void>()
{
@@ -299,7 +299,7 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
public Void doWork() throws Exception
{
ChildAssociationRef assoc = nodeService.getPrimaryParent(nodeRef);
if (assoc.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION) == true)
if (assoc.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION))
{
// Get the record (or record folder)
NodeRef record = assoc.getParentRef();
@@ -356,7 +356,7 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
@Override
public Void doWork() throws Exception
{
if (nodeService.exists(nodeRef) == true && nodeService.hasAspect(nodeRef, ASPECT_RECORD) == true)
if (nodeService.exists(nodeRef) && nodeService.hasAspect(nodeRef, ASPECT_RECORD))
{
applySearchAspect(nodeRef);
setupDispositionScheduleProperties(nodeRef);
@@ -380,7 +380,7 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
public Void doWork() throws Exception
{
NodeRef nodeRef = childAssocRef.getChildRef();
if (nodeService.exists(nodeRef) == true)
if (nodeService.exists(nodeRef))
{
applySearchAspect(nodeRef);
setupDispositionScheduleProperties(nodeRef);
@@ -424,8 +424,8 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
public void dispositionActionCreate(ChildAssociationRef childAssocRef)
{
NodeRef child = childAssocRef.getChildRef();
if (nodeService.exists(child) == true &&
childAssocRef.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION) == true)
if (nodeService.exists(child) &&
childAssocRef.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION))
{
// Get the record (or record folder)
NodeRef record = childAssocRef.getParentRef();
@@ -502,11 +502,11 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
NodeRef dispositionAction = childAssocRef.getParentRef();
NodeRef eventExecution = childAssocRef.getChildRef();
if (nodeService.exists(dispositionAction) == true &&
nodeService.exists(eventExecution) == true)
if (nodeService.exists(dispositionAction) &&
nodeService.exists(eventExecution))
{
ChildAssociationRef assoc = nodeService.getPrimaryParent(dispositionAction);
if (assoc.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION) == true)
if (assoc.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION))
{
// Get the record (or record folder)
NodeRef record = assoc.getParentRef();
@@ -538,7 +538,7 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
if (nodeService.exists(dispositionActionNode))
{
ChildAssociationRef assoc = nodeService.getPrimaryParent(dispositionActionNode);
if (assoc.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION) == true)
if (assoc.getTypeQName().equals(ASSOC_NEXT_DISPOSITION_ACTION))
{
// Get the record (or record folder)
NodeRef record = assoc.getParentRef();
@@ -596,7 +596,7 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
@Override
public Void doWork() throws Exception
{
if (nodeService.exists(nodeRef) == true)
if (nodeService.exists(nodeRef))
{
// Initialise the search parameteres as required
setVitalRecordDefintionDetails(nodeRef);
@@ -646,7 +646,7 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
public Void doWork() throws Exception
{
// Only care about record folders
if (nodeService.exists(nodeRef) && recordFolderService.isRecordFolder(nodeRef) == true)
if (nodeService.exists(nodeRef) && recordFolderService.isRecordFolder(nodeRef))
{
Set<QName> props = new HashSet<QName>(1);
props.add(PROP_REVIEW_PERIOD);
@@ -694,7 +694,7 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
{
VitalRecordDefinition vrd = vitalRecordService.getVitalRecordDefinition(nodeRef);
if (vrd != null && vrd.isEnabled() == true && vrd.getReviewPeriod() != null)
if (vrd != null && vrd.isEnabled() && vrd.getReviewPeriod() != null)
{
// Set the property values
nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD, vrd.getReviewPeriod().getPeriodType());
@@ -724,7 +724,7 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
*/
public void onRemoveFrozenAspect(NodeRef nodeRef, QName aspectTypeQName)
{
if (nodeService.exists(nodeRef) == true &&
if (nodeService.exists(nodeRef) &&
nodeService.hasAspect(nodeRef, ASPECT_RM_SEARCH))
{
nodeService.setProperty(nodeRef, PROP_RS_HOLD_REASON, null);
@@ -745,7 +745,7 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
@Override
public Void doWork() throws Exception
{
if (nodeService.exists(nodeRef) == true)
if (nodeService.exists(nodeRef))
{
// get the changed hold reason
String holdReason = (String)nodeService.getProperty(nodeRef, PROP_HOLD_REASON);
@@ -778,7 +778,7 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
*/
public void dispositionSchedulePropertiesUpdate(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
{
if (nodeService.exists(nodeRef) == true)
if (nodeService.exists(nodeRef))
{
// create the schedule object and get the record category for it
DispositionSchedule schedule = new DispositionScheduleImpl(recordsManagementServiceRegistry, nodeService, nodeRef);

View File

@@ -35,7 +35,7 @@ import org.alfresco.service.namespace.QName;
/**
* rma:dispositionLifecycle behaviour bean
*
*
* @author Roy Wetherall
* @since 2.2
*/
@@ -48,7 +48,7 @@ public class DispositionLifecycleAspect extends BaseBehaviourBean
{
/** disposition service */
protected DispositionService dispositionService;
/**
* @param dispositionService disposition service
*/
@@ -56,7 +56,7 @@ public class DispositionLifecycleAspect extends BaseBehaviourBean
{
this.dispositionService = dispositionService;
}
/**
* Copy callback for disposition lifecycle
*/
@@ -81,7 +81,7 @@ public class DispositionLifecycleAspect extends BaseBehaviourBean
)
public void onAddAspect(final NodeRef nodeRef, final QName aspect)
{
if (nodeService.exists(nodeRef) == true)
if (nodeService.exists(nodeRef))
{
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{
@@ -93,5 +93,5 @@ public class DispositionLifecycleAspect extends BaseBehaviourBean
}
});
}
}
}
}

View File

@@ -113,7 +113,7 @@ public class FilePlanComponentAspect extends BaseBehaviourBean
@Override
public Void doWork() throws Exception
{
if (nodeService.exists(nodeRef) == true)
if (nodeService.exists(nodeRef))
{
lookupAndExecuteScripts(nodeRef, before, after);
}
@@ -203,7 +203,7 @@ public class FilePlanComponentAspect extends BaseBehaviourBean
@Override
public Void doWork() throws Exception
{
if (nodeService.exists(nodeRef) == true)
if (nodeService.exists(nodeRef))
{
// Look up the root and set on the aspect if found
NodeRef root = filePlanService.getFilePlan(nodeRef);
@@ -234,8 +234,8 @@ public class FilePlanComponentAspect extends BaseBehaviourBean
@Override
public Void doWork() throws Exception
{
if (nodeService.exists(newChildAssocRef.getParentRef()) == true &&
nodeService.exists(newChildAssocRef.getChildRef()) == true)
if (nodeService.exists(newChildAssocRef.getParentRef()) &&
nodeService.exists(newChildAssocRef.getChildRef()))
{
// Look up the root and re-set the value currently stored on the aspect
NodeRef root = filePlanService.getFilePlan(newChildAssocRef.getParentRef());

View File

@@ -36,7 +36,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
/**
* rma:frozen behaviour bean
*
*
* @author Roy Wetherall
* @since 2.2
*/
@@ -49,10 +49,10 @@ public class FrozenAspect extends BaseBehaviourBean
{
/** file plan service */
protected FilePlanService filePlanService;
/** freeze service */
protected FreezeService freezeService;
/**
* @param filePlanService file plan service
*/
@@ -60,7 +60,7 @@ public class FrozenAspect extends BaseBehaviourBean
{
this.filePlanService = filePlanService;
}
/**
* @param freezeService freeze service
*/
@@ -68,10 +68,10 @@ public class FrozenAspect extends BaseBehaviourBean
{
this.freezeService = freezeService;
}
/**
* Ensure that no frozen node is deleted.
*
*
* @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
@@ -87,10 +87,10 @@ public class FrozenAspect extends BaseBehaviourBean
@Override
public Void doWork() throws Exception
{
if (nodeService.exists(nodeRef) == true &&
filePlanService.isFilePlanComponent(nodeRef) == true)
if (nodeService.exists(nodeRef) &&
filePlanService.isFilePlanComponent(nodeRef))
{
if (freezeService.isFrozen(nodeRef) == true)
if (freezeService.isFrozen(nodeRef))
{
// never allowed to delete a frozen node
throw new AccessDeniedException("Frozen nodes can not be deleted.");
@@ -115,10 +115,10 @@ public class FrozenAspect extends BaseBehaviourBean
for (ChildAssociationRef assoc : assocs)
{
// we only care about primary children
if (assoc.isPrimary() == true)
if (assoc.isPrimary())
{
NodeRef nodeRef = assoc.getChildRef();
if (freezeService.isFrozen(nodeRef) == true)
if (freezeService.isFrozen(nodeRef))
{
// never allowed to delete a node with a frozen child
throw new AccessDeniedException("Can not delete node, because it contains a frozen child node.");
@@ -129,5 +129,5 @@ public class FrozenAspect extends BaseBehaviourBean
}
}
}
}

View File

@@ -107,7 +107,7 @@ public class RecordAspect extends BaseBehaviourBean
{
NodeRef thumbnail = childAssocRef.getChildRef();
if (nodeService.exists(thumbnail) == true)
if (nodeService.exists(thumbnail))
{
// apply file plan component aspect to thumbnail
nodeService.addAspect(thumbnail, ASPECT_FILE_PLAN_COMPONENT, null);
@@ -139,7 +139,7 @@ public class RecordAspect extends BaseBehaviourBean
public void onCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference)
{
// Deal with versioned records
if (reference.equals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "versions")) == true)
if (reference.equals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "versions")))
{
// Apply the versioned aspect to the from node
nodeService.addAspect(fromNodeRef, ASPECT_VERSIONED_RECORD, null);
@@ -161,7 +161,7 @@ public class RecordAspect extends BaseBehaviourBean
public void onRemoveReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference)
{
// Deal with versioned records
if (reference.equals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "versions")) == true)
if (reference.equals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "versions")))
{
// Apply the versioned aspect to the from node
nodeService.removeAspect(fromNodeRef, ASPECT_VERSIONED_RECORD);
@@ -224,7 +224,7 @@ public class RecordAspect extends BaseBehaviourBean
{
public Object doWork() throws Exception
{
if (nodeService.exists(newNodeRef) == true)
if (nodeService.exists(newNodeRef))
{
// only remove the search details .. the rest will be resolved automatically
nodeService.removeAspect(newNodeRef, RecordsManagementSearchBehaviour.ASPECT_RM_SEARCH);

View File

@@ -30,7 +30,7 @@ import org.alfresco.service.namespace.QName;
/**
* Behaviour associated with the scheduled aspect
*
*
* @author Roy Wetherall
* @since 2.2
*/
@@ -38,12 +38,12 @@ import org.alfresco.service.namespace.QName;
(
defaultType = "rma:scheduled"
)
public class ScheduledAspect extends BaseBehaviourBean
public class ScheduledAspect extends BaseBehaviourBean
implements NodeServicePolicies.OnAddAspectPolicy
{
/** disposition service */
private DispositionService dispositionService;
/**
* @param dispositionService disposition service
*/
@@ -63,10 +63,10 @@ public class ScheduledAspect extends BaseBehaviourBean
)
public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName)
{
if (nodeService.exists(nodeRef) == true &&
if (nodeService.exists(nodeRef) &&
dispositionService.getAssociatedDispositionSchedule(nodeRef) == null)
{
dispositionService.createDispositionSchedule(nodeRef, null);
dispositionService.createDispositionSchedule(nodeRef, null);
}
}
}

View File

@@ -36,7 +36,7 @@ import org.alfresco.util.PropertyMap;
/**
* rma:ghosted behaviour bean
*
*
* @author Roy Wetherall
* @since 2.2
*/
@@ -49,10 +49,10 @@ public class VitalRecordDefinitionAspect extends BaseBehaviourBean
{
/** file plan authentication service */
protected FilePlanAuthenticationService filePlanAuthenticationService;
/** records management action service */
protected RecordsManagementActionService recordsManagementActionService;
/**
* @param filePlanAuthenticationService file plan authentication service
*/
@@ -60,7 +60,7 @@ public class VitalRecordDefinitionAspect extends BaseBehaviourBean
{
this.filePlanAuthenticationService = filePlanAuthenticationService;
}
/**
* @param recordsManagementActionService records management action service
*/
@@ -68,7 +68,7 @@ public class VitalRecordDefinitionAspect extends BaseBehaviourBean
{
this.recordsManagementActionService = recordsManagementActionService;
}
/**
* @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map)
*/
@@ -80,13 +80,13 @@ public class VitalRecordDefinitionAspect extends BaseBehaviourBean
)
public void onUpdateProperties(final NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
{
if (nodeService.exists(nodeRef) == true &&
nodeService.hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT) == true)
if (nodeService.exists(nodeRef) &&
nodeService.hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT))
{
// check that vital record definition has been changed in the first place
Map<QName, Serializable> changedProps = PropertyMap.getChangedProperties(before, after);
if (changedProps.containsKey(PROP_VITAL_RECORD_INDICATOR) == true ||
changedProps.containsKey(PROP_REVIEW_PERIOD) == true)
if (changedProps.containsKey(PROP_VITAL_RECORD_INDICATOR) ||
changedProps.containsKey(PROP_REVIEW_PERIOD))
{
filePlanAuthenticationService.runAsRmAdmin(new RunAsWork<Void>()
{
@@ -100,5 +100,5 @@ public class VitalRecordDefinitionAspect extends BaseBehaviourBean
}
}
}
}

View File

@@ -38,7 +38,7 @@ import org.springframework.extensions.surf.util.I18NUtil;
/**
* rma:dispositionActionDefinition behaviour bean
*
*
* @author Roy Wetherall
* @since 2.2
*/
@@ -51,7 +51,7 @@ public class DispositionActionDefinitionType extends BaseBehaviourBean
{
/** I18N */
private final static String MSG_UPDATE_DISP_ACT_DEF = "rm.service.update-disposition-action-def";
/**
* @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map)
*/
@@ -63,10 +63,10 @@ public class DispositionActionDefinitionType extends BaseBehaviourBean
)
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
{
if (nodeService.exists(nodeRef) == true)
if (nodeService.exists(nodeRef))
{
// Determine the properties that have changed
Set<QName> changedProps = new HashSet<QName>(PropertyMap.getChangedProperties(before, after).keySet());
Set<QName> changedProps = new HashSet<QName>(PropertyMap.getChangedProperties(before, after).keySet());
changedProps.addAll(PropertyMap.getAddedProperties(before, after).keySet());
if (nodeService.hasAspect(nodeRef, ASPECT_UNPUBLISHED_UPDATE) == false)
@@ -82,7 +82,7 @@ public class DispositionActionDefinitionType extends BaseBehaviourBean
Map<QName, Serializable> props = nodeService.getProperties(nodeRef);
// Check that there isn't a update currently being published
if ((Boolean)props.get(PROP_PUBLISH_IN_PROGRESS).equals(Boolean.TRUE) == true)
if ((Boolean)props.get(PROP_PUBLISH_IN_PROGRESS).equals(Boolean.TRUE))
{
// Can not update the disposition schedule since there is an outstanding update being published
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UPDATE_DISP_ACT_DEF));

View File

@@ -38,7 +38,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
/**
* rma:filePlan behaviour bean
*
*
* @author Roy Wetherall
* @since 2.2
*/
@@ -53,16 +53,16 @@ public class FilePlanType extends BaseBehaviourBean
{
/** file plan service */
protected FilePlanService filePlanService;
/** record folder service */
protected RecordFolderService recordFolderService;
/** identifier service */
protected IdentifierService identifierService;
/** file plan role service */
protected FilePlanRoleService filePlanRoleService;
/**
* @param filePlanService file plan service
*/
@@ -70,7 +70,7 @@ public class FilePlanType extends BaseBehaviourBean
{
this.filePlanService = filePlanService;
}
/**
* @param recordFolderService record folder service
*/
@@ -78,7 +78,7 @@ public class FilePlanType extends BaseBehaviourBean
{
this.recordFolderService = recordFolderService;
}
/**
* @param identifierService identifier service
*/
@@ -86,7 +86,7 @@ public class FilePlanType extends BaseBehaviourBean
{
this.identifierService = identifierService;
}
/**
* @param filePlanRoleService file plan role service
*/
@@ -94,7 +94,7 @@ public class FilePlanType extends BaseBehaviourBean
{
this.filePlanRoleService = filePlanRoleService;
}
/**
* @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean)
*/
@@ -107,14 +107,14 @@ public class FilePlanType extends BaseBehaviourBean
{
// ensure we are not trying to put content in the file plan root node
NodeRef nodeRef = childAssocRef.getChildRef();
if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true)
if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT))
{
throw new AlfrescoRuntimeException("Operation failed, because you can't place content in the root of the file plan.");
}
// ensure we are not trying to put a record folder in the root of the file plan
NodeRef parent = childAssocRef.getParentRef();
if (filePlanService.isFilePlan(parent) == true && recordFolderService.isRecordFolder(nodeRef) == true)
if (filePlanService.isFilePlan(parent) && recordFolderService.isRecordFolder(nodeRef))
{
throw new AlfrescoRuntimeException("Operation failed, because you can not place a record folder in the root of the file plan.");
}
@@ -133,22 +133,22 @@ public class FilePlanType extends BaseBehaviourBean
public void onCreateNode(final ChildAssociationRef childAssocRef)
{
final NodeRef filePlan = childAssocRef.getChildRef();
AuthenticationUtil.runAsSystem(new RunAsWork<Object>()
{
public Object doWork() throws Exception
{
if (nodeService.hasAspect(filePlan, ASPECT_FILE_PLAN_COMPONENT) == true &&
public Object doWork() throws Exception
{
if (nodeService.hasAspect(filePlan, ASPECT_FILE_PLAN_COMPONENT) &&
nodeService.getProperty(filePlan, PROP_IDENTIFIER) == null)
{
String id = identifierService.generateIdentifier(filePlan);
String id = identifierService.generateIdentifier(filePlan);
nodeService.setProperty(filePlan, RecordsManagementModel.PROP_IDENTIFIER, id);
}
return null;
}
});
// setup the file plan roles
filePlanRoleService.setupFilePlanRoles(filePlan);
}

View File

@@ -40,7 +40,7 @@ import org.alfresco.service.namespace.QName;
/**
* rma:recordCategory behaviour bean
*
*
* @author Roy Wetherall
* @since 2.2
*/
@@ -51,16 +51,16 @@ import org.alfresco.service.namespace.QName;
public class RecordCategoryType extends BaseBehaviourBean
implements NodeServicePolicies.OnCreateChildAssociationPolicy,
NodeServicePolicies.OnCreateNodePolicy
{
{
/** vital record service */
protected VitalRecordService vitalRecordService;
/** file plan permission service */
protected FilePlanPermissionService filePlanPermissionService;
/** record folder service */
private RecordFolderService recordFolderService;
/**
* @param vitalRecordService vital record service
*/
@@ -68,7 +68,7 @@ public class RecordCategoryType extends BaseBehaviourBean
{
this.vitalRecordService = vitalRecordService;
}
/**
* @param filePlanPermissionService file plan permission service
*/
@@ -76,7 +76,7 @@ public class RecordCategoryType extends BaseBehaviourBean
{
this.filePlanPermissionService = filePlanPermissionService;
}
/**
* @param recordFolderService record folder service
*/
@@ -84,10 +84,10 @@ public class RecordCategoryType extends BaseBehaviourBean
{
this.recordFolderService = recordFolderService;
}
/**
* On every event
*
*
* @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean)
*/
@Override
@@ -99,19 +99,19 @@ public class RecordCategoryType extends BaseBehaviourBean
{
// ensure content is not placed directly into a record category
NodeRef nodeRef = childAssocRef.getChildRef();
if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true)
if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT))
{
throw new AlfrescoRuntimeException("Operation failed, because you can't place content directly into a record category.");
}
}
// setup the record folder
// TODO review
recordFolderService.setupRecordFolder(nodeRef);
}
/**
* On transaction commit
*
*
* @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean)
*/
@Behaviour
@@ -123,7 +123,7 @@ public class RecordCategoryType extends BaseBehaviourBean
public void onCreateChildAssociationOnCommit(ChildAssociationRef childAssocRef, boolean bNew)
{
final NodeRef recordCategory = childAssocRef.getChildRef();
behaviourFilter.disableBehaviour();
try
{
@@ -142,7 +142,7 @@ public class RecordCategoryType extends BaseBehaviourBean
finally
{
behaviourFilter.enableBehaviour();
}
}
}
/**
@@ -156,11 +156,11 @@ public class RecordCategoryType extends BaseBehaviourBean
)
public void onCreateNode(final ChildAssociationRef childAssocRef)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("rma:recordCategory|alf:onCreateNode|this.onCreateNode()|TRANSATION_COMMIT");
}
// execute behaviour code as system user
AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
{
@@ -168,14 +168,14 @@ public class RecordCategoryType extends BaseBehaviourBean
public Void doWork() throws Exception
{
// setup record category permissions
filePlanPermissionService.setupRecordCategoryPermissions(childAssocRef.getChildRef());
filePlanPermissionService.setupRecordCategoryPermissions(childAssocRef.getChildRef());
return null;
}
});
}
/**
* Copy callback for record category
*/

View File

@@ -210,11 +210,11 @@ public class RecordFolderType extends BaseBehaviourBean
{
boolean result = true;
if (nodeService.getType(copyDetails.getTargetParentNodeRef()).equals(TYPE_RECORD_FOLDER) == true)
if (nodeService.getType(copyDetails.getTargetParentNodeRef()).equals(TYPE_RECORD_FOLDER))
{
result = false;
}
else if (ArrayUtils.contains(unwantedAspects, classQName) == true)
else if (ArrayUtils.contains(unwantedAspects, classQName))
{
result = false;
}
@@ -236,12 +236,12 @@ public class RecordFolderType extends BaseBehaviourBean
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew)
{
NodeRef nodeRef = childAssocRef.getChildRef();
if (nodeService.exists(nodeRef) == true && instanceOf(nodeRef, TYPE_RECORD_FOLDER))
if (nodeService.exists(nodeRef) && instanceOf(nodeRef, TYPE_RECORD_FOLDER))
{
// ensure nothing is being added to a closed record folder
NodeRef recordFolder = childAssocRef.getParentRef();
Boolean isClosed = (Boolean) nodeService.getProperty(recordFolder, PROP_IS_CLOSED);
if (isClosed != null && Boolean.TRUE.equals(isClosed) == true)
if (isClosed != null && Boolean.TRUE.equals(isClosed))
{
throw new AlfrescoRuntimeException("You can't add new items to a closed record folder.");
}
@@ -295,7 +295,7 @@ public class RecordFolderType extends BaseBehaviourBean
// Remove unwanted aspects
for (QName aspect : unwantedAspects)
{
if (nodeService.hasAspect(nodeRef, aspect) == true)
if (nodeService.hasAspect(nodeRef, aspect))
{
nodeService.removeAspect(nodeRef, aspect);
}

View File

@@ -98,14 +98,14 @@ public class RecordsManagementContainerType extends BaseBehaviourBean
{
// Get the elements of the created association
final NodeRef child = childAssocRef.getChildRef();
if (nodeService.exists(child) == true)
if (nodeService.exists(child))
{
QName childType = nodeService.getType(child);
// We only care about "folder" or sub-types
if (dictionaryService.isSubClass(childType, ContentModel.TYPE_FOLDER) == true)
if (dictionaryService.isSubClass(childType, ContentModel.TYPE_FOLDER))
{
if (dictionaryService.isSubClass(childType, ContentModel.TYPE_SYSTEM_FOLDER) == true)
if (dictionaryService.isSubClass(childType, ContentModel.TYPE_SYSTEM_FOLDER))
{
// this is a rule container, make sure it is an file plan component
nodeService.addAspect(child, ASPECT_FILE_PLAN_COMPONENT, null);
@@ -174,7 +174,7 @@ public class RecordsManagementContainerType extends BaseBehaviourBean
{
public Object doWork() throws Exception
{
if (nodeService.hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT) == true &&
if (nodeService.hasAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT) &&
nodeService.getProperty(nodeRef, PROP_IDENTIFIER) == null)
{
String id = identifierService.generateIdentifier(nodeRef);

View File

@@ -146,13 +146,13 @@ public class RmSiteType extends BaseBehaviourBean
final NodeRef rmSite = childAssocRef.getChildRef();
// Do not execute behaviour if this has been created in the archive store
if(rmSite.getStoreRef().equals(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE) == true)
if(rmSite.getStoreRef().equals(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE))
{
// This is not the spaces store - probably the archive store
return;
}
if (nodeService.exists(rmSite) == true)
if (nodeService.exists(rmSite))
{
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
{
@@ -189,7 +189,7 @@ public class RmSiteType extends BaseBehaviourBean
// check to see if there is an 'override' for the file plan type given the site type
QName siteType = nodeService.getType(siteInfo.getNodeRef());
if (mapFilePlanType.containsKey(siteType) == true)
if (mapFilePlanType.containsKey(siteType))
{
result = mapFilePlanType.get(siteType);
}
@@ -211,10 +211,10 @@ public class RmSiteType extends BaseBehaviourBean
)
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before, Map<QName, Serializable> after)
{
if (nodeService.exists(nodeRef) == true)
if (nodeService.exists(nodeRef))
{
Map<QName, Serializable> changed = PropertyMap.getChangedProperties(before, after);
if (changed.containsKey(SiteModel.PROP_SITE_VISIBILITY) == true &&
if (changed.containsKey(SiteModel.PROP_SITE_VISIBILITY) &&
changed.get(SiteModel.PROP_SITE_VISIBILITY) != null &&
SiteVisibility.PUBLIC.equals(changed.get(SiteModel.PROP_SITE_VISIBILITY)) == false)
{
@@ -252,7 +252,7 @@ public class RmSiteType extends BaseBehaviourBean
{
// determine whether the current user has delete capability on the file plan node
AccessStatus accessStatus = capabilityService.getCapabilityAccessState(filePlan, "Delete");
if (AccessStatus.DENIED.equals(accessStatus) == true)
if (AccessStatus.DENIED.equals(accessStatus))
{
throw new AlfrescoRuntimeException("The records management site can not be deleted, because the user doesn't have sufficient privillages to delete the file plan.");
}

View File

@@ -238,7 +238,7 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
NodeRef root = getRMRoot(records.get(0));
String groupName = getGroupName(root);
if (doesGroupContainUsers(groupName) == true)
if (doesGroupContainUsers(groupName))
{
NotificationContext notificationContext = new NotificationContext();
notificationContext.setSubject(I18NUtil.getMessage(MSG_SUBJECT_RECORDS_DUE_FOR_REVIEW));
@@ -257,7 +257,7 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
}
else
{
if (logger.isWarnEnabled() == true)
if (logger.isWarnEnabled())
{
logger.warn("Unable to send record due for review email notification, because notification group was empty.");
}
@@ -279,7 +279,7 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
NodeRef root = getRMRoot(record);
String groupName = getGroupName(root);
if (doesGroupContainUsers(groupName) == true)
if (doesGroupContainUsers(groupName))
{
NotificationContext notificationContext = new NotificationContext();
notificationContext.setSubject(I18NUtil.getMessage(MSG_SUBJECT_RECORD_SUPERCEDED));
@@ -298,7 +298,7 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
}
else
{
if (logger.isWarnEnabled() == true)
if (logger.isWarnEnabled())
{
logger.warn("Unable to send record superseded email notification, because notification group was empty.");
}
@@ -314,7 +314,7 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
{
ParameterCheck.mandatory("record", record);
if (canSendRejectEmail(record, recordCreator) == true)
if (canSendRejectEmail(record, recordCreator))
{
String site = siteService.getSite(record).getShortName();
String rejectReason = (String) nodeService.getProperty(record, PROP_RECORD_REJECTION_REASON);
@@ -361,17 +361,17 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
result = false;
logger.warn(msg1 + "the site which should contain the node '" + record.toString() + "'" + msg2);
}
if (StringUtils.isBlank(recordCreator) == true)
if (StringUtils.isBlank(recordCreator))
{
result = false;
logger.warn(msg1 + "the user, who created the record" + msg2);
}
if (StringUtils.isBlank((String) nodeService.getProperty(record, PROP_RECORD_REJECTION_REASON)) == true)
if (StringUtils.isBlank((String) nodeService.getProperty(record, PROP_RECORD_REJECTION_REASON)))
{
result = false;
logger.warn(msg1 + "the reason for rejection" + msg2);
}
if (StringUtils.isBlank((String) nodeService.getProperty(record, PROP_RECORD_REJECTION_USER_ID)) == true)
if (StringUtils.isBlank((String) nodeService.getProperty(record, PROP_RECORD_REJECTION_USER_ID)))
{
result = false;
logger.warn(msg1 + "the user, who rejected the record" + msg2);

View File

@@ -26,7 +26,7 @@ import org.springframework.beans.factory.BeanNameAware;
/**
* Abstract module patch implementation.
*
*
* @author Roy Wetherall
* @since 2.2
*/
@@ -34,31 +34,31 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
{
/** logger */
protected static Log logger = LogFactory.getLog(ModulePatch.class);
/** module patch service */
private ModulePatchExecuter modulePatchExecuter;
/** transaction service */
protected TransactionService transactionService;
/** module patch id */
private String id;
/** module patch description */
private String description;
/** module id */
private String moduleId;
/** module patch fixes from module schema number */
private int fixesFromSchema;
/** module patch fixes to module schema number */
private int fixesToSchema;
/** module patch target module schema number */
private int targetSchema;
/**
* Initiialisation method
*/
@@ -66,7 +66,7 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
{
modulePatchExecuter.register(this);
}
/**
* @param modulePatchExecuter module patch executer
*/
@@ -74,7 +74,7 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
{
this.modulePatchExecuter = modulePatchExecuter;
}
/**
* @param transactionService transaction service
*/
@@ -82,7 +82,7 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
{
this.transactionService = transactionService;
}
/**
* @param id module patch id
*/
@@ -90,7 +90,7 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
{
this.id = id;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getId()
*/
@@ -99,7 +99,7 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
{
return id;
}
/**
* Convenience method to set the module patch id to the bean name (if not already specified)
*/
@@ -109,7 +109,7 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
if (id == null)
{
id = beanName;
}
}
}
/**
@@ -119,7 +119,7 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
{
this.description = description;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getDescription()
*/
@@ -136,7 +136,7 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
{
this.moduleId = moduleId;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getModuleId()
*/
@@ -150,7 +150,7 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
{
this.fixesFromSchema = fixesFromSchema;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getFixesFromSchema()
*/
@@ -164,7 +164,7 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
{
this.fixesToSchema = fixesToSchema;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getFixesToSchema()
*/
@@ -178,7 +178,7 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
{
this.targetSchema = targetSchema;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.patch.ModulePatch#getTargetSchema()
*/
@@ -194,36 +194,36 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
@Override
public void apply()
{
if (logger.isInfoEnabled() == true)
if (logger.isInfoEnabled())
{
logger.info("Executing module patch \"" + description + "\"");
}
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... id=" + id +
",moduleId=" + moduleId +
",from=" + fixesFromSchema +
",to=" + fixesToSchema +
logger.debug(" ... id=" + id +
",moduleId=" + moduleId +
",from=" + fixesFromSchema +
",to=" + fixesToSchema +
",target=" + targetSchema);
}
transactionService.getRetryingTransactionHelper().doInTransaction(
new ApplyCallback(),
true,
false);
if (logger.isDebugEnabled() == true)
new ApplyCallback(),
true,
false);
if (logger.isDebugEnabled())
{
logger.debug(" ... module patch applied");
}
}
/**
* Apply patch internal method. Implementations can assume a transaction has
* been started.
*/
public abstract void applyInternal();
/**
* Apply callback worker class implementation
*/
@@ -237,9 +237,9 @@ public abstract class AbstractModulePatch implements ModulePatch, BeanNameAware
{
applyInternal();
return null;
}
}
}
/**
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/

View File

@@ -85,7 +85,7 @@ public class ModulePatchExecuterImpl extends AbstractModuleComponent
throw new AlfrescoRuntimeException("Unable to register module patch, becuase module id is invalid.");
}
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Registering module patch " + modulePatch.getId() + " for module " + getModuleId());
}
@@ -102,7 +102,7 @@ public class ModulePatchExecuterImpl extends AbstractModuleComponent
// get current schema version
int currentSchema = getCurrentSchema();
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Running module patch executer (currentSchema=" + currentSchema + ", configuredSchema=" + moduleSchema + ")");
}
@@ -140,7 +140,7 @@ public class ModulePatchExecuterImpl extends AbstractModuleComponent
protected int getCurrentSchema()
{
Integer result = START_SCHEMA;
if (attributeService.exists(KEY_MODULE_SCHEMA, getModuleId()) == true)
if (attributeService.exists(KEY_MODULE_SCHEMA, getModuleId()))
{
result = (Integer)attributeService.getAttribute(KEY_MODULE_SCHEMA, getModuleId());
}

View File

@@ -28,7 +28,7 @@ import org.apache.commons.logging.LogFactory;
/**
* Module patch component base class.
*
*
* @author Roy Wetherall
* @since 2.1
*/
@@ -37,16 +37,16 @@ public abstract class ModulePatchComponent extends AbstractModuleComponent
{
/** logger */
protected static Log logger = LogFactory.getLog(ModulePatchComponent.class);
/** Retrying transaction helper */
protected RetryingTransactionHelper retryingTransactionHelper;
/** Behaviour filter */
protected BehaviourFilter behaviourFilter;
/** module patch executer */
protected ModulePatchExecuterImpl modulePatchExecuter;
/**
* @param retryingTransactionHelper retrying transaction helper
*/
@@ -54,7 +54,7 @@ public abstract class ModulePatchComponent extends AbstractModuleComponent
{
this.retryingTransactionHelper = retryingTransactionHelper;
}
/**
* @param behaviourFilter behaviour filter
*/
@@ -62,7 +62,7 @@ public abstract class ModulePatchComponent extends AbstractModuleComponent
{
this.behaviourFilter = behaviourFilter;
}
/**
* @param modulePatchExecuter module patch executer
*/
@@ -70,17 +70,17 @@ public abstract class ModulePatchComponent extends AbstractModuleComponent
{
this.modulePatchExecuter = modulePatchExecuter;
}
/**
* Init method
*/
@Override
public void init()
{
super.init();
super.init();
modulePatchExecuter.getDependsOn().add(this);
}
/**
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@@ -89,14 +89,14 @@ public abstract class ModulePatchComponent extends AbstractModuleComponent
{
try
{
if (logger.isInfoEnabled() == true)
if (logger.isInfoEnabled())
{
logger.info("Module patch component '" + getName() + "' is executing ...");
}
// execute path within an isolated transaction
retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
{
{
@Override
public Void execute() throws Throwable
{
@@ -111,10 +111,10 @@ public abstract class ModulePatchComponent extends AbstractModuleComponent
}
return null;
}
}, false, true);
if (logger.isInfoEnabled() == true)
if (logger.isInfoEnabled())
{
logger.info(" ... completed module patch '" + getName() + "'");
}
@@ -122,17 +122,17 @@ public abstract class ModulePatchComponent extends AbstractModuleComponent
catch (Throwable exception)
{
// record the exception otherwise it gets swallowed
if (logger.isInfoEnabled() == true)
if (logger.isInfoEnabled())
{
logger.info(" ... error encountered. " + exception.getMessage(), exception);
}
throw exception;
}
}
/**
* Execute patch work.
*
*
* @throws Throwable
*/
protected abstract void executePatch() throws Throwable;

View File

@@ -41,7 +41,7 @@ import org.springframework.beans.factory.BeanNameAware;
/**
* Notification template patch implementation
*
*
* @author Roy Wetherall
* @since 2.0
*/
@@ -145,7 +145,7 @@ public class NotificationTemplatePatch extends ModulePatchComponent
{
if (template == null || nodeService.exists(template) == false)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Skipping template update, because template has not been bootstraped.");
}
@@ -156,7 +156,7 @@ public class NotificationTemplatePatch extends ModulePatchComponent
String lastPatchUpdate = (String)nodeService.getProperty(template, PROP_LAST_PATCH_UPDATE);
if (lastPatchUpdate == null || name.equals(lastPatchUpdate) == false)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Applying update to template. (template=" + template.toString() + ", templateUpdate=" + templateUpdate + ")");
}
@@ -192,7 +192,7 @@ public class NotificationTemplatePatch extends ModulePatchComponent
}
else
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug("Skipping template update, because template has already been patched. (template=" + template.toString() + ")");
}

View File

@@ -42,14 +42,14 @@ import org.springframework.beans.factory.BeanNameAware;
/**
* RM v2.0 File Plan Node Ref Patch
*
*
* @author Roy Wetherall
* @since 2.0
*/
@SuppressWarnings("deprecation")
public class RMv2FilePlanNodeRefPatch extends ModulePatchComponent
public class RMv2FilePlanNodeRefPatch extends ModulePatchComponent
implements BeanNameAware, RecordsManagementModel, DOD5015Model
{
{
private NodeService nodeService;
private PatchDAO patchDAO;
private NodeDAO nodeDAO;
@@ -57,27 +57,27 @@ public class RMv2FilePlanNodeRefPatch extends ModulePatchComponent
private PermissionService permissionService;
private FilePlanService filePlanService;
private FilePlanRoleService filePlanRoleService;
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
public void setPatchDAO(PatchDAO patchDAO)
{
this.patchDAO = patchDAO;
}
public void setNodeDAO(NodeDAO nodeDAO)
{
this.nodeDAO = nodeDAO;
}
public void setQnameDAO(QNameDAO qnameDAO)
{
this.qnameDAO = qnameDAO;
}
/**
* @param permissionService permission service
*/
@@ -85,58 +85,58 @@ public class RMv2FilePlanNodeRefPatch extends ModulePatchComponent
{
this.permissionService = permissionService;
}
/**
* @param filePlanRoleService file plan role service
*/
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService)
{
this.filePlanRoleService = filePlanRoleService;
}
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@Override
protected void executePatch() throws Throwable
{
{
Pair<Long, QName> aspectPair = qnameDAO.getQName(RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT);
if (aspectPair != null)
{
List<Long> filePlanComponents = patchDAO.getNodesByAspectQNameId(aspectPair.getFirst(), 0L, patchDAO.getMaxAdmNodeID());
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... updating " + filePlanComponents.size() + " items" );
logger.debug(" ... updating " + filePlanComponents.size() + " items");
}
for (Long filePlanComponent : filePlanComponents)
{
Pair<Long, NodeRef> recordPair = nodeDAO.getNodePair(filePlanComponent);
NodeRef filePlanComponentNodeRef = recordPair.getSecond();
NodeRef filePlan = filePlanService.getFilePlan(filePlanComponentNodeRef);
// set the file plan node reference
if (nodeService.getProperty(filePlanComponentNodeRef, PROP_ROOT_NODEREF) == null)
{
nodeService.setProperty(filePlanComponentNodeRef, PROP_ROOT_NODEREF, filePlan);
}
}
// only set the rmadmin permissions on record categories, record folders and records
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(filePlanComponentNodeRef);
if (FilePlanComponentKind.RECORD_CATEGORY.equals(kind) == true ||
FilePlanComponentKind.RECORD_FOLDER.equals(kind) == true ||
FilePlanComponentKind.RECORD.equals(kind) == true )
if (FilePlanComponentKind.RECORD_CATEGORY.equals(kind) ||
FilePlanComponentKind.RECORD_FOLDER.equals(kind) ||
FilePlanComponentKind.RECORD.equals(kind))
{
// ensure the that the records management role has read and file on the node
Role adminRole = filePlanRoleService.getRole(filePlan, "Administrator");
@@ -144,7 +144,7 @@ public class RMv2FilePlanNodeRefPatch extends ModulePatchComponent
{
permissionService.setPermission(filePlanComponentNodeRef, adminRole.getRoleGroupName(), RMPermissionModel.FILING, true);
}
// ensure that the default vital record default values have been set (RM-753)
Serializable vitalRecordIndicator = nodeService.getProperty(filePlanComponentNodeRef, PROP_VITAL_RECORD_INDICATOR);
if (vitalRecordIndicator == null)
@@ -157,7 +157,7 @@ public class RMv2FilePlanNodeRefPatch extends ModulePatchComponent
nodeService.setProperty(filePlanComponentNodeRef, PROP_REVIEW_PERIOD, new Period("none|0"));
}
}
}
}
}
}
}

View File

@@ -33,35 +33,35 @@ import org.springframework.beans.factory.BeanNameAware;
/**
* RM v2.0 Model Updates Patch
*
*
* @author Roy Wetherall
* @since 2.0
*/
@SuppressWarnings("deprecation")
public class RMv2ModelPatch extends ModulePatchComponent
public class RMv2ModelPatch extends ModulePatchComponent
implements BeanNameAware, RecordsManagementModel, DOD5015Model
{
private static long BATCH_SIZE = 100000L;
private PatchDAO patchDAO;
private NodeDAO nodeDAO;
private QNameDAO qnameDAO;
public void setPatchDAO(PatchDAO patchDAO)
{
this.patchDAO = patchDAO;
}
public void setNodeDAO(NodeDAO nodeDAO)
{
this.nodeDAO = nodeDAO;
}
public void setQnameDAO(QNameDAO qnameDAO)
{
this.qnameDAO = qnameDAO;
}
/**
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@@ -71,23 +71,23 @@ public class RMv2ModelPatch extends ModulePatchComponent
updateQName(QName.createQName(DOD_URI, "filePlan"), TYPE_FILE_PLAN, "TYPE");
updateQName(QName.createQName(DOD_URI, "recordCategory"), TYPE_RECORD_CATEGORY, "TYPE");
updateQName(QName.createQName(DOD_URI, "ghosted"), ASPECT_GHOSTED, "ASPECT");
}
private void updateQName(QName qnameBefore, QName qnameAfter, String reindexClass)
{
}
private void updateQName(QName qnameBefore, QName qnameAfter, String reindexClass)
{
Work work = new Work(qnameBefore, qnameAfter, reindexClass);
retryingTransactionHelper.doInTransaction(work, false, true);
}
private class Work implements RetryingTransactionHelper.RetryingTransactionCallback<Integer>
{
private QName qnameBefore;
private QName qnameBefore;
private QName qnameAfter;
private String reindexClass;
/**
* Constructor
*
* Constructor
*
* @param qnameBefore qname before
* @param qnameAfter qname after
* @param reindexClass reindex class
@@ -106,9 +106,9 @@ public class RMv2ModelPatch extends ModulePatchComponent
public Integer execute() throws Throwable
{
Long maxNodeId = patchDAO.getMaxAdmNodeID();
Pair<Long, QName> before = qnameDAO.getQName(qnameBefore);
if (before != null)
{
for (Long i = 0L; i < maxNodeId; i+=BATCH_SIZE)
@@ -124,24 +124,24 @@ public class RMv2ModelPatch extends ModulePatchComponent
nodeDAO.touchNodes(nodeDAO.getCurrentTransactionId(true), nodeIds);
}
}
qnameDAO.updateQName(qnameBefore, qnameAfter);
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... updated qname " + qnameBefore.toString());
}
}
else
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... no need to update qname " + qnameBefore.toString());
}
}
//nothing to do
return 0;
}
}
}
}
}

View File

@@ -34,26 +34,26 @@ import org.springframework.beans.factory.BeanNameAware;
/**
* RM v2.0 Saved Search Patch
*
*
* @author Roy Wetherall
* @since 2.0
*/
@SuppressWarnings("deprecation")
public class RMv2SavedSearchPatch extends ModulePatchComponent
public class RMv2SavedSearchPatch extends ModulePatchComponent
implements BeanNameAware, RecordsManagementModel, DOD5015Model
{
{
/** RM site id */
private static final String RM_SITE_ID = "rm";
/** Records management search service */
private RecordsManagementSearchService recordsManagementSearchService;
/** Site service */
private SiteService siteService;
/** Content service */
private ContentService contentService;
/**
* @param recordsManagementSearchService records management search service
*/
@@ -61,7 +61,7 @@ public class RMv2SavedSearchPatch extends ModulePatchComponent
{
this.recordsManagementSearchService = recordsManagementSearchService;
}
/**
* @param siteService site service
*/
@@ -69,7 +69,7 @@ public class RMv2SavedSearchPatch extends ModulePatchComponent
{
this.siteService = siteService;
}
/**
* @param contentService content service
*/
@@ -77,7 +77,7 @@ public class RMv2SavedSearchPatch extends ModulePatchComponent
{
this.contentService = contentService;
}
/**
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@@ -88,30 +88,30 @@ public class RMv2SavedSearchPatch extends ModulePatchComponent
{
// get the saved searches
List<SavedSearchDetails> savedSearches = recordsManagementSearchService.getSavedSearches(RM_SITE_ID);
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... updating " + savedSearches.size() + " saved searches");
}
for (SavedSearchDetails savedSearchDetails : savedSearches)
{
// refresh the query
String refreshedJSON = savedSearchDetails.toJSONString();
NodeRef nodeRef = savedSearchDetails.getNodeRef();
NodeRef nodeRef = savedSearchDetails.getNodeRef();
if (nodeRef != null)
{
ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
writer.putContent(refreshedJSON);
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... updated saved search " + savedSearchDetails.getName() + " (nodeRef=" + nodeRef.toString() + ")");
}
}
}
}
}
}
}
}

View File

@@ -87,7 +87,7 @@ public class NotificationTemplatePatch_v21 extends RMv21PatchComponent
NodeRef nodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, CONFIG_NODEID);
// get the parent node
NodeRef supersededTemplate = notificationHelper.getSupersededTemplate();
if (nodeService.exists(nodeRef) == false && nodeService.exists(supersededTemplate) == true)
if (nodeService.exists(nodeRef) == false && nodeService.exists(supersededTemplate))
{
NodeRef parent = nodeService.getPrimaryParent(supersededTemplate).getParentRef();

View File

@@ -40,13 +40,13 @@ import org.springframework.beans.factory.BeanNameAware;
* This patch creates a new "Records Management Behavior Scripts" folder and moves existing behavior scripts from the old "Records Management Scripts" folder to the new folder.
* This is to compensate for any non-behavior RM scripts so that they can live in the old "Records Management Scripts" folder for its intended purpose and be picked up by the
* execute script rule action.
*
*
* @author Craig Tan
* @since 2.1
*/
@SuppressWarnings("deprecation")
public class RMv21BehaviorScriptsPatch extends RMv21PatchComponent implements BeanNameAware
{
{
/** rm config folder root lookup */
protected static final NodeRef RM_CONFIG = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_config_folder");
@@ -55,7 +55,7 @@ public class RMv21BehaviorScriptsPatch extends RMv21PatchComponent implements Be
/** new behavior scripts folder root lookup */
protected static NodeRef newBehaviorScriptsFolder = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_behavior_scripts");
/** name of example script */
protected static final String IS_CLOSED_JS = "rma_isClosed.js";
@@ -64,7 +64,7 @@ public class RMv21BehaviorScriptsPatch extends RMv21PatchComponent implements Be
/** File Folder Service */
private FileFolderService fileFolderService;
/**
* @param nodeService node service
*/
@@ -86,22 +86,22 @@ public class RMv21BehaviorScriptsPatch extends RMv21PatchComponent implements Be
*/
@Override
protected void executePatch() throws Throwable
{
{
// check that the rm config root has been correctly bootstrapped
if (nodeService.exists(RM_CONFIG) == false)
{
// we don't need to do anything
return;
}
// check that the behavior scripts folder exists
if (nodeService.exists(newBehaviorScriptsFolder) == false)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... creating RM Behavior Scripts folder");
}
String newBehaviorScriptsFolderName = "Records Management Behavior Scripts";
String newBehaviorScriptsNodeUUID = "rm_behavior_scripts";
String newBehaviorScriptsAssocQName = "records_management_behavior_scripts";
@@ -118,7 +118,7 @@ public class RMv21BehaviorScriptsPatch extends RMv21PatchComponent implements Be
}
// move to the new behavior scripts folder if the old behavior scripts folder exists and contains files
if (nodeService.exists(OLD_BEHAVIOR_SCRIPTS_FOLDER) == true)
if (nodeService.exists(OLD_BEHAVIOR_SCRIPTS_FOLDER))
{
// run the following code as System
AuthenticationUtil.runAs(new RunAsWork<Object>()
@@ -137,7 +137,7 @@ public class RMv21BehaviorScriptsPatch extends RMv21PatchComponent implements Be
if (oldBehaviorScripts != null && oldBehaviorScripts.isEmpty() != true)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... moving files from RM Scripts folder to RM Behavior Scripts folder");
}
@@ -147,7 +147,7 @@ public class RMv21BehaviorScriptsPatch extends RMv21PatchComponent implements Be
// move the old script to the new location
fileFolderService.moveFrom(script.getNodeRef(), OLD_BEHAVIOR_SCRIPTS_FOLDER, RMv21BehaviorScriptsPatch.newBehaviorScriptsFolder, script.getName());
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ...... moved " + script.getName());
}

View File

@@ -79,7 +79,7 @@ public class RMv21CapabilityPatch extends RMv21PatchComponent
{
return filePlanService.getFilePlans();
}
/**
* Adds a new capability to the specified roles.
*
@@ -107,7 +107,7 @@ public class RMv21CapabilityPatch extends RMv21PatchComponent
// only update if the capability is missing
if (capabilities.contains(capability) == false)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... adding capability " + capabilityName + " to role " + role.getName());
}
@@ -118,7 +118,7 @@ public class RMv21CapabilityPatch extends RMv21PatchComponent
}
}
}
/**
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@@ -127,14 +127,14 @@ public class RMv21CapabilityPatch extends RMv21PatchComponent
{
Set<NodeRef> filePlans = getFilePlans();
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... updating " + filePlans.size() + " file plans");
}
for (NodeRef filePlan : filePlans)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... updating file plan " + filePlan.toString());
}

View File

@@ -43,12 +43,12 @@ import org.springframework.beans.factory.BeanNameAware;
/**
* RM v2.1 patch to support InPlace functional updates
*
*
* @author Roy Wetherall
* @since 2.1
*/
@SuppressWarnings("deprecation")
public class RMv21InPlacePatch extends RMv21PatchComponent
public class RMv21InPlacePatch extends RMv21PatchComponent
implements BeanNameAware, RecordsManagementModel, DOD5015Model
{
/** Extended reader and writer role details */
@@ -65,25 +65,25 @@ public class RMv21InPlacePatch extends RMv21PatchComponent
"ViewRecords",
"EditNonRecordMetadata"
};
/** file plan role service */
private FilePlanRoleService filePlanRoleService;
/** file plan service */
private FilePlanService filePlanService;
/** File plan permission service */
private FilePlanPermissionService filePlanPermissionService;
/** capability service */
private CapabilityService capabilityService;
/** rule service */
private RuleService ruleService;
/** node service */
private NodeService nodeService;
/**
* @param filePlanRoleService file plan role service
*/
@@ -91,7 +91,7 @@ public class RMv21InPlacePatch extends RMv21PatchComponent
{
this.filePlanRoleService = filePlanRoleService;
}
/**
* @param filePlanPermissionService file plan permission service
*/
@@ -99,7 +99,7 @@ public class RMv21InPlacePatch extends RMv21PatchComponent
{
this.filePlanPermissionService = filePlanPermissionService;
}
/**
* @param filePlanService file plan service
*/
@@ -107,7 +107,7 @@ public class RMv21InPlacePatch extends RMv21PatchComponent
{
this.filePlanService = filePlanService;
}
/**
* @param capabilityService capability service
*/
@@ -115,7 +115,7 @@ public class RMv21InPlacePatch extends RMv21PatchComponent
{
this.capabilityService = capabilityService;
}
/**
* @param ruleService rule service
*/
@@ -123,7 +123,7 @@ public class RMv21InPlacePatch extends RMv21PatchComponent
{
this.ruleService = ruleService;
}
/**
* @param nodeService node service
*/
@@ -131,47 +131,47 @@ public class RMv21InPlacePatch extends RMv21PatchComponent
{
this.nodeService = nodeService;
}
/**
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@Override
protected void executePatch() throws Throwable
{
{
Set<NodeRef> filePlans = filePlanService.getFilePlans();
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... updating " + filePlans.size() + " file plans");
}
for (NodeRef filePlan : filePlans)
{
if (filePlanService.getUnfiledContainer(filePlan) == null)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... updating file plan " + filePlan.toString());
}
}
ruleService.disableRules();
try
{
// set permissions
filePlanPermissionService.setPermission(filePlan, ExtendedReaderDynamicAuthority.EXTENDED_READER, RMPermissionModel.READ_RECORDS);
filePlanPermissionService.setPermission(filePlan, ExtendedWriterDynamicAuthority.EXTENDED_WRITER, RMPermissionModel.FILING);
// create fileplan containers
filePlanService.createHoldContainer(filePlan);
filePlanService.createTransferContainer(filePlan);
filePlanService.createUnfiledContainer(filePlan);
filePlanService.createUnfiledContainer(filePlan);
// move any existing holds to new container
moveExistingHolds(filePlan);
// move any existing transfers to new container
moveExistingTransfers(filePlan);
// add the inplace roles
filePlanRoleService.createRole(filePlan, ROLE_READERS, ROLE_READERS_LABEL, getCapabilities(ROLE_READERS_CAPABILITIES));
filePlanRoleService.createRole(filePlan, ROLE_WRITERS, ROLE_WRITERS_LABEL, getCapabilities(ROLE_WRITERS_CAPABILITIES));
@@ -182,8 +182,8 @@ public class RMv21InPlacePatch extends RMv21PatchComponent
}
}
}
}
}
private Set<Capability> getCapabilities(String[] capabilityNames)
{
Set<Capability> capabilities = new HashSet<Capability>(3);
@@ -193,16 +193,16 @@ public class RMv21InPlacePatch extends RMv21PatchComponent
}
return capabilities;
}
private void moveExistingHolds(NodeRef filePlan)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... moving existing holds for file plan " + filePlan.toString());
}
NodeRef container = filePlanService.getHoldContainer(filePlan);
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(filePlan, ASSOC_HOLDS, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef assoc : assocs)
{
@@ -211,16 +211,16 @@ public class RMv21InPlacePatch extends RMv21PatchComponent
nodeService.moveNode(hold, container, ContentModel.ASSOC_CONTAINS, QName.createQName(RM_URI, name));
}
}
private void moveExistingTransfers(NodeRef filePlan)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... moving existing transfers for file plan " + filePlan.toString());
}
NodeRef container = filePlanService.getTransferContainer(filePlan);
List<ChildAssociationRef> assocs = nodeService.getChildAssocs(filePlan, ASSOC_TRANSFERS, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef assoc : assocs)
{
@@ -228,6 +228,6 @@ public class RMv21InPlacePatch extends RMv21PatchComponent
String name = (String)nodeService.getProperty(transfer, ContentModel.PROP_NAME);
nodeService.moveNode(transfer, container, ContentModel.ASSOC_CONTAINS, QName.createQName(RM_URI, name));
}
}
}

View File

@@ -37,7 +37,7 @@ import org.springframework.extensions.surf.util.I18NUtil;
/**
* RM v2.1: RM admin user patch
*
*
* @author Roy Wetherall
*/
@SuppressWarnings("deprecation")
@@ -49,30 +49,30 @@ public class RMv21RMAdminUserPatch extends RMv21PatchComponent implements BeanNa
/** generate rm admin password */
private String password = GUID.generate();
/** mutable authenticaiton service */
private MutableAuthenticationService authenticationService;
/** person service */
private PersonService personService;
/** file plan service */
private FilePlanService filePlanService;
/** file plan role service */
private FilePlanRoleService filePlanRoleService;
/** file plan authentication service */
private FilePlanAuthenticationService filePlanAuthenticationService;
/**
/**
* @param personService person service
*/
public void setPersonService(PersonService personService)
{
this.personService = personService;
}
/**
* @param authenticationService mutable authentication service
*/
@@ -80,7 +80,7 @@ public class RMv21RMAdminUserPatch extends RMv21PatchComponent implements BeanNa
{
this.authenticationService = authenticationService;
}
/**
* @param filePlanService file plan service
*/
@@ -96,7 +96,7 @@ public class RMv21RMAdminUserPatch extends RMv21PatchComponent implements BeanNa
{
this.filePlanRoleService = filePlanRoleService;
}
/**
* @param filePlanAuthenticationService file plan authentication service
*/
@@ -104,7 +104,7 @@ public class RMv21RMAdminUserPatch extends RMv21PatchComponent implements BeanNa
{
this.filePlanAuthenticationService = filePlanAuthenticationService;
}
/**
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@@ -117,20 +117,20 @@ public class RMv21RMAdminUserPatch extends RMv21PatchComponent implements BeanNa
if (authenticationService.authenticationExists(user) == false)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... creating RM Admin user");
}
authenticationService.createAuthentication(user, password.toCharArray());
if (personService.personExists(user) == false)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... creating RM Admin person");
}
Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
properties.put(ContentModel.PROP_USERNAME, user);
properties.put(ContentModel.PROP_FIRSTNAME, firstName);
@@ -139,17 +139,17 @@ public class RMv21RMAdminUserPatch extends RMv21PatchComponent implements BeanNa
}
else
{
if (logger.isInfoEnabled() == true)
if (logger.isInfoEnabled())
{
logger.debug(" ... RM Admin person already exists");
}
}
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... assigning RM Admin user to file plans");
}
Set<NodeRef> filePlans = filePlanService.getFilePlans();
for (NodeRef filePlan : filePlans)
{

View File

@@ -35,29 +35,29 @@ import org.springframework.beans.factory.BeanNameAware;
/**
* RM v2.1 patch to change the record inheritance of permissions.
*
*
* @author Roy Wetherall
* @since 2.1
*/
@SuppressWarnings("deprecation")
public class RMv21RecordInheritancePatch extends RMv21PatchComponent
public class RMv21RecordInheritancePatch extends RMv21PatchComponent
implements BeanNameAware, RecordsManagementModel, DOD5015Model
{
{
/** file plan permission service */
private FilePlanPermissionServiceImpl filePlanPermissionServiceImpl;
/** node service */
private NodeService nodeService;
/** patch DAO */
private PatchDAO patchDAO;
/** qname DAO */
private QNameDAO qnameDAO;
/** node DAO */
private NodeDAO nodeDAO;
/**
* @param patchDAO patch DAO
*/
@@ -65,7 +65,7 @@ public class RMv21RecordInheritancePatch extends RMv21PatchComponent
{
this.patchDAO = patchDAO;
}
/**
* @param qnameDAO qname DAO
*/
@@ -73,7 +73,7 @@ public class RMv21RecordInheritancePatch extends RMv21PatchComponent
{
this.qnameDAO = qnameDAO;
}
/**
* @param nodeDAO node DAO
*/
@@ -81,7 +81,7 @@ public class RMv21RecordInheritancePatch extends RMv21PatchComponent
{
this.nodeDAO = nodeDAO;
}
/**
* @param filePlanPermissionServiceImpl file plan permission service implementation
*/
@@ -89,7 +89,7 @@ public class RMv21RecordInheritancePatch extends RMv21PatchComponent
{
this.filePlanPermissionServiceImpl = filePlanPermissionServiceImpl;
}
/**
* @param nodeService node service
*/
@@ -97,7 +97,7 @@ public class RMv21RecordInheritancePatch extends RMv21PatchComponent
{
this.nodeService = nodeService;
}
/**
* @see org.alfresco.repo.module.AbstractModuleComponent#executeInternal()
*/
@@ -108,30 +108,30 @@ public class RMv21RecordInheritancePatch extends RMv21PatchComponent
if (aspectPair != null)
{
List<Long> records = patchDAO.getNodesByAspectQNameId(aspectPair.getFirst(), 0L, patchDAO.getMaxAdmNodeID());
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... updating " + records.size() + " records" );
logger.debug(" ... updating " + records.size() + " records");
}
for (Long record : records)
{
Pair<Long, NodeRef> recordPair = nodeDAO.getNodePair(record);
NodeRef recordNodeRef = recordPair.getSecond();
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... updating record " + recordNodeRef.toString());
// get the primary parent
ChildAssociationRef assoc = nodeService.getPrimaryParent(recordNodeRef);
NodeRef parent = assoc.getParentRef();
if (parent != null)
{
{
filePlanPermissionServiceImpl.initialiseRecordPermissions(recordNodeRef, parent);
}
}
}
}
}
}
}

View File

@@ -44,17 +44,17 @@ import org.springframework.beans.factory.BeanNameAware;
public class RMv21ReportServicePatch extends RMv21PatchComponent
implements BeanNameAware
{
private static final NodeRef TEMPLATE_ROOT = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_report_templates");
private static final NodeRef TEMPLATE_ROOT = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_report_templates");
private static final NodeRef RM_CONFIG_FOLDER = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_config_folder");
private static final String PATH_DESTRUCTION_TEMPLATE = "alfresco/module/org_alfresco_module_rm/bootstrap/report/report_rmr_destructionReport.html.ftl";
/** node service */
private NodeService nodeService;
/** content service */
private ContentService contentService;
/**
* @param nodeService node service
*/
@@ -62,49 +62,49 @@ public class RMv21ReportServicePatch extends RMv21PatchComponent
{
this.nodeService = nodeService;
}
public void setContentService(ContentService contentService)
{
this.contentService = contentService;
}
@Override
protected void executePatch() throws Throwable
{
// check whether report dir exists or not
if (nodeService.exists(RM_CONFIG_FOLDER) == true && nodeService.exists(TEMPLATE_ROOT) == false)
if (nodeService.exists(RM_CONFIG_FOLDER) && nodeService.exists(TEMPLATE_ROOT) == false)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... adding template root folder");
}
// create report dir
NodeRef templateRoot = createNode(ContentModel.TYPE_FOLDER,
RM_CONFIG_FOLDER,
"rm_report_templates",
"Records Management Report Templates",
"rm_report_templates",
"Records Management Report Templates",
RM_CONFIG_FOLDER,
"rm_report_templates",
"Records Management Report Templates",
"rm_report_templates",
"Records Management Report Templates",
"Records management report templates.");
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... adding destruction report template");
}
// create report templates
NodeRef destructionTemplate = createNode(
ContentModel.TYPE_CONTENT,
templateRoot,
"rmr_destructionReport",
"report_rmr_destructionReport.html.ftl",
"report_rmr_destructionReport.html.ftl",
"Destruction Report Template",
templateRoot,
"rmr_destructionReport",
"report_rmr_destructionReport.html.ftl",
"report_rmr_destructionReport.html.ftl",
"Destruction Report Template",
"Desruction report template.");
nodeService.addAspect(destructionTemplate, ContentModel.ASPECT_TITLED, null);
nodeService.addAspect(destructionTemplate, ContentModel.ASPECT_AUTHOR, null);
// put the content
ContentWriter writer = contentService.getWriter(destructionTemplate, ContentModel.PROP_CONTENT, true);
InputStream is = getClass().getClassLoader().getResourceAsStream(PATH_DESTRUCTION_TEMPLATE);
@@ -113,7 +113,7 @@ public class RMv21ReportServicePatch extends RMv21PatchComponent
writer.putContent(is);
}
}
private NodeRef createNode(QName type, NodeRef parent, String id, String name, String assocName, String title, String description)
{
Map<QName, Serializable> props = new HashMap<QName, Serializable>(4);
@@ -124,7 +124,7 @@ public class RMv21ReportServicePatch extends RMv21PatchComponent
// get the assoc qname
QName assocQName = QName.createQName(
NamespaceService.CONTENT_MODEL_1_0_URI,
NamespaceService.CONTENT_MODEL_1_0_URI,
QName.createValidLocalName(assocName));
// create the node

View File

@@ -41,10 +41,10 @@ public class RMv21RolesPatch extends RMv21PatchComponent implements BeanNameAwar
{
/** file plan service */
private FilePlanService filePlanService;
/** file plan role service */
private FilePlanRoleService filePlanRoleService;
/** authority service */
private AuthorityService authorityService;
@@ -70,26 +70,26 @@ public class RMv21RolesPatch extends RMv21PatchComponent implements BeanNameAwar
protected void executePatch() throws Throwable
{
Set<NodeRef> filePlans = filePlanService.getFilePlans();
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... updating " + filePlans.size() + " file plans");
}
for (NodeRef filePlan : filePlans)
{
boolean parentAddedToZone = false;
Set<Role> roles = filePlanRoleService.getRoles(filePlan);
for (Role role : roles)
{
String roleGroupName = role.getRoleGroupName();
String roleGroupName = role.getRoleGroupName();
if (authorityService.getAuthorityZones(roleGroupName).contains(RMAuthority.ZONE_APP_RM) == false)
{
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger.debug(" ... updating " + roleGroupName + " in file plan " + filePlan.toString());
}
addAuthorityToZone(roleGroupName);
if (parentAddedToZone == false)
{

Some files were not shown because too many files have changed in this diff Show More