diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/AuditableActionExecuterAbstractBase.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/AuditableActionExecuterAbstractBase.java index 8dd8c19404..64508772f7 100755 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/AuditableActionExecuterAbstractBase.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/AuditableActionExecuterAbstractBase.java @@ -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); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/PropertySubActionExecuterAbstractBase.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/PropertySubActionExecuterAbstractBase.java index 16f40e2ada..86b1ca6b02 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/PropertySubActionExecuterAbstractBase.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/PropertySubActionExecuterAbstractBase.java @@ -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); } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java index b0384f3e5a..a5c4999925 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java @@ -522,7 +522,7 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe { for (EventCompletionDetails event : events) { - if (event.isEventComplete() == true) + if (event.isEventComplete()) { eligible = true; break; diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMDispositionActionExecuterAbstractBase.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMDispositionActionExecuterAbstractBase.java index 9130a583ef..c99fa4d18a 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMDispositionActionExecuterAbstractBase.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMDispositionActionExecuterAbstractBase.java @@ -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; diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java index 5d72aac6e0..49611a16b9 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RecordsManagementActionServiceImpl.java @@ -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); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/ScheduledDispositionJob.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/ScheduledDispositionJob.java index d4dc38e8bf..841e5bc60e 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/ScheduledDispositionJob.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/ScheduledDispositionJob.java @@ -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 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) { diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java index 7b7314a3a0..2692a7a097 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/CreateRecordAction.java @@ -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."); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/HideRecordAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/HideRecordAction.java index 2e9af8715e..4a7ff6abfb 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/HideRecordAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/HideRecordAction.java @@ -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."); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/HasDispositionActionEvaluator.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/HasDispositionActionEvaluator.java index 9a3353848e..65f47a249d 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/HasDispositionActionEvaluator.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/evaluator/HasDispositionActionEvaluator.java @@ -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; } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/AddRecordTypeAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/AddRecordTypeAction.java index 13d8bbb380..c379ec4b73 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/AddRecordTypeAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/AddRecordTypeAction.java @@ -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; diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/ApplyCustomTypeAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/ApplyCustomTypeAction.java index a96dd6e1bb..f610719e25 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/ApplyCustomTypeAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/ApplyCustomTypeAction.java @@ -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 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 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 getPropertyValues(Action action) { Map paramValues = action.getParameterValues(); - + Map result = new HashMap(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 props = aspectDefinition.getProperties(); - + this.parameterDefinitions = new ArrayList(props.size()); - + for (QName qn : props.keySet()) { String paramName = qn.toPrefixString(namespaceService); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/BroadcastDispositionActionDefinitionUpdateAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/BroadcastDispositionActionDefinitionUpdateAction.java index fe5bb8c10e..e5ac936c32 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/BroadcastDispositionActionDefinitionUpdateAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/BroadcastDispositionActionDefinitionUpdateAction.java @@ -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)) { diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CloseRecordFolderAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CloseRecordFolderAction.java index a1587032c5..3002f466d9 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CloseRecordFolderAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CloseRecordFolderAction.java @@ -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; diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CompleteEventAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CompleteEventAction.java index 82d258c4c6..9d4417b2db 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CompleteEventAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CompleteEventAction.java @@ -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 events = da.getEventCompletionDetails(); for (EventCompletionDetails event : events) { - if (eventName.equals(event.getEventName()) == true) + if (eventName.equals(event.getEventName())) { result = event; break; diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CreateDispositionScheduleAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CreateDispositionScheduleAction.java index 186b5d7f86..651c9e8a59 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CreateDispositionScheduleAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CreateDispositionScheduleAction.java @@ -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; } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeclareRecordAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeclareRecordAction.java index e4af363cd6..bb74a1b0cb 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeclareRecordAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeclareRecordAction.java @@ -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 missingProperties = new ArrayList(5); // Aspect not already defined - check mandatory properties then add - if (mandatoryPropertiesSet(actionedUponNodeRef, missingProperties) == true) + if (mandatoryPropertiesSet(actionedUponNodeRef, missingProperties)) { recordService.disablePropertyEditableCheck(); try diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DelegateAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DelegateAction.java index 977c245160..aac7b1cf7a 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DelegateAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DelegateAction.java @@ -30,7 +30,7 @@ import org.alfresco.service.cmr.repository.NodeRef; * Records management action who's implementation is delegated to an existing Action. *

* 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() */ diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DestroyAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DestroyAction.java index 79bbe51268..44f67d1afa 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DestroyAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DestroyAction.java @@ -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. 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); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditDispositionActionAsOfDateAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditDispositionActionAsOfDateAction.java index 9dba95a060..707a936980 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditDispositionActionAsOfDateAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditDispositionActionAsOfDateAction.java @@ -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); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditReviewAsOfDateAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditReviewAsOfDateAction.java index bea0bea7e0..d3ccd2cd4c 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditReviewAsOfDateAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditReviewAsOfDateAction.java @@ -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); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FreezeAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FreezeAction.java index 36ee27dda1..3c73252e12 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FreezeAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FreezeAction.java @@ -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); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/OpenRecordFolderAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/OpenRecordFolderAction.java index fe51bc255f..8d141be0fd 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/OpenRecordFolderAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/OpenRecordFolderAction.java @@ -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); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RejectAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RejectAction.java index cc2aacd104..9a5be259dc 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RejectAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RejectAction.java @@ -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) { diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RequestInfoAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RequestInfoAction.java index 6d7fe79d5e..a923b4678f 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RequestInfoAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RequestInfoAction.java @@ -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() + "'."); } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/SplitEmailAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/SplitEmailAction.java index 770d25527b..d2ae7498ce 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/SplitEmailAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/SplitEmailAction.java @@ -84,7 +84,7 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase Map map = recordsManagementAdminService.getCustomReferenceDefinitions(); for (Map.Entry 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 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"); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnCutoffAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnCutoffAction.java index 1db93650dc..1ee8cfe115 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnCutoffAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnCutoffAction.java @@ -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 records = recordService.getRecords(actionedUponNodeRef); for (NodeRef record : records) diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndeclareRecordAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndeclareRecordAction.java index 40ccf95d07..2e44b4cbb7 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndeclareRecordAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndeclareRecordAction.java @@ -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 } } } - } + } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndoEventAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndoEventAction.java index b896d7ee93..091bac7ff1 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndoEventAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndoEventAction.java @@ -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 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 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 - } + } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java index 35d5339514..7f250a59cb 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java @@ -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 before, Map after, boolean immediate, boolean removeIfNoPropertyChanged) { // deal with immediate auditing if required - if (immediate == true) + if (immediate) { Map 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> 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); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CopyAuditEvent.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CopyAuditEvent.java index f4bb16e2d6..c3cadc56a7 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CopyAuditEvent.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/CopyAuditEvent.java @@ -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 copyMap) { - if (copyToNewNode == true) + if (copyToNewNode) { recordsManagementAuditService.auditEvent(targetNodeRef, getName()); } - } + } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/AbstractCapability.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/AbstractCapability.java index 203350eea2..9332435b09 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/AbstractCapability.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/AbstractCapability.java @@ -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(); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityServiceImpl.java index 972181d4da..b8c21934f0 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/CapabilityServiceImpl.java @@ -81,7 +81,7 @@ public class CapabilityServiceImpl implements CapabilityService public Set getCapabilities(boolean includePrivate) { Set result = null; - if (includePrivate == true) + if (includePrivate) { result = new HashSet(capabilities.values()); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java index 85698ef443..0cd20a2a86 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java @@ -59,7 +59,7 @@ public class RMEntryVoter extends RMSecurityCommon /** Policy map */ private HashMap policies = new HashMap(); - + /** * @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()) { diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java index b69cf43929..265b35ab21 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java @@ -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 diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java index 8d5b439d7a..1504132e42 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java @@ -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 permissions; - + /** Map of conditions and expected evaluation result */ protected Map conditions; - + /** List of file plan component kinds one of which must be satisfied */ protected List 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} 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 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 diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCompositeCapability.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCompositeCapability.java index 4ceaac1025..b41c70cb6d 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCompositeCapability.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCompositeCapability.java @@ -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 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; } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/AtLeastOneCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/AtLeastOneCondition.java index 3f2d23d392..ee66b916e7 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/AtLeastOneCondition.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/AtLeastOneCondition.java @@ -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 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; } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/ClosedCapabilityCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/ClosedCapabilityCondition.java index 4d2f77723c..7ea7ee0660 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/ClosedCapabilityCondition.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/ClosedCapabilityCondition.java @@ -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 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; diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DeclaredCapabilityCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DeclaredCapabilityCondition.java index 6b3a9441ae..9b6f08b466 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DeclaredCapabilityCondition.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/DeclaredCapabilityCondition.java @@ -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); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityCondition.java index 4dcf1c302f..a0d519ae64 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityCondition.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityCondition.java @@ -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); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasEventsCapabilityCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasEventsCapabilityCondition.java index c2270ddced..448917e07f 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasEventsCapabilityCondition.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HasEventsCapabilityCondition.java @@ -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; } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsScheduledCapabilityCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsScheduledCapabilityCondition.java index afea96f7eb..312f5f45f0 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsScheduledCapabilityCondition.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsScheduledCapabilityCondition.java @@ -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; } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsTransferAccessionCapabilityCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsTransferAccessionCapabilityCondition.java index ae9a5b68b3..c49f237238 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsTransferAccessionCapabilityCondition.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/IsTransferAccessionCapabilityCondition.java @@ -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) diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/LastDispositionActionCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/LastDispositionActionCondition.java index bfcfea81f3..9416bc1d2d 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/LastDispositionActionCondition.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/LastDispositionActionCondition.java @@ -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; } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/VitalRecordOrFolderCapabilityCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/VitalRecordOrFolderCapabilityCondition.java index b8c21b8606..06f06c9742 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/VitalRecordOrFolderCapabilityCondition.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/VitalRecordOrFolderCapabilityCondition.java @@ -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); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ViewRecordsCapability.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ViewRecordsCapability.java index 3fab7e42ac..f37b3a17d5 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ViewRecordsCapability.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ViewRecordsCapability.java @@ -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; } } \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java index a53b341ff3..80bbd15bde 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java @@ -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); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinitionImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinitionImpl.java index e6d4b4061b..c7e7423c02 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinitionImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionActionDefinitionImpl.java @@ -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() */ diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java index c7347c2012..a179474c0c 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java @@ -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 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 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 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 result = new ArrayList(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 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 diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/property/DispositionProperty.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/property/DispositionProperty.java index 949202ad3c..23d9101bb3 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/property/DispositionProperty.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/property/DispositionProperty.java @@ -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 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 before, + final NodeRef nodeRef, + final Map before, final Map 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() { @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 before, Map 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; } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/model/dod/aspect/DOD5015RecordAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/model/dod/aspect/DOD5015RecordAspect.java index ec7f6c5dad..2fe42f9690 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/model/dod/aspect/DOD5015RecordAspect.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/dod5015/model/dod/aspect/DOD5015RecordAspect.java @@ -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; - } + } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingServiceImpl.java index 778d5666b0..4aebda8101 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/CustomEmailMappingServiceImpl.java @@ -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 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 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()); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/RFC822MetadataExtracter.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/RFC822MetadataExtracter.java index a8f846f3dc..b22383508e 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/RFC822MetadataExtracter.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/email/RFC822MetadataExtracter.java @@ -66,7 +66,7 @@ public class RFC822MetadataExtracter extends org.alfresco.repo.content.metadata. Map clone = new HashMap(systemProperties); for (QName propName : clone.keySet()) { - if (RecordsManagementModel.RM_URI.equals(propName.getNamespaceURI()) == true) + if (RecordsManagementModel.RM_URI.equals(propName.getNamespaceURI())) { systemProperties.remove(propName); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferenceCreateEventType.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferenceCreateEventType.java index 3e67c5439a..ad3b05f41c 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferenceCreateEventType.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferenceCreateEventType.java @@ -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 params = new HashMap(3); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventServiceImpl.java index 8fd5b899ed..100c0a2823 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/event/RecordsManagementEventServiceImpl.java @@ -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) { diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java index 1c05f217ed..2177546717 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java @@ -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 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)); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementFormFilter.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementFormFilter.java index 99d285277b..86cad26636 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementFormFilter.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementFormFilter.java @@ -142,7 +142,7 @@ public abstract class RecordsManagementFormFilter 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); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java index 09baf1cf56..d762590c1a 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java @@ -103,13 +103,13 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter Form form, Map 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"); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilter.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilter.java index 38ec9f9ecd..f239fabc49 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilter.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementTypeFormFilter.java @@ -86,14 +86,14 @@ public class RecordsManagementTypeFormFilter extends RecordsManagementFormFilter * java.util.Map) */ public void afterGenerate( - TypeDefinition type, - List fields, - List forcedFields, + TypeDefinition type, + List fields, + List forcedFields, Form form, Map 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 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 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); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeServiceImpl.java index ad5bf17117..9592c9cf23 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/freeze/FreezeServiceImpl.java @@ -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()) { diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierServiceImpl.java index 148865d15b..497f91eef9 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/identifier/IdentifierServiceImpl.java @@ -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 register = new HashMap(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 context = new HashMap(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 context = new HashMap(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 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."); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/NotifyOfRecordsDueForReviewJobExecuter.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/NotifyOfRecordsDueForReviewJobExecuter.java index 1266b45962..a5a5950098 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/NotifyOfRecordsDueForReviewJobExecuter.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/NotifyOfRecordsDueForReviewJobExecuter.java @@ -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 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 txUpdateNodesCallback = new RetryingTransactionCallback() { // 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 - + } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/PublishUpdatesJobExecuter.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/PublishUpdatesJobExecuter.java index 6035fc2ac8..2ad50d2e13 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/PublishUpdatesJobExecuter.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/PublishUpdatesJobExecuter.java @@ -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 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 list of node refences with updates pending publication */ private List getUpdatedNodes() { - RetryingTransactionCallback> execution = + RetryingTransactionCallback> execution = new RetryingTransactionHelper.RetryingTransactionCallback>() { @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 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 execution = + RetryingTransactionHelper.RetryingTransactionCallback execution = new RetryingTransactionHelper.RetryingTransactionCallback() { @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 execution = + RetryingTransactionHelper.RetryingTransactionCallback execution = new RetryingTransactionHelper.RetryingTransactionCallback() { @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 execution = + RetryingTransactionHelper.RetryingTransactionCallback execution = new RetryingTransactionHelper.RetryingTransactionCallback() { @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; } }; diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentNode.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentNode.java index 53c10255dd..3e8aca198b 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentNode.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentNode.java @@ -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 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; } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentService.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentService.java index 3cec52667f..e8e828d488 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentService.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/ScriptRecordsManagmentService.java @@ -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) diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/BaseEvaluator.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/BaseEvaluator.java index 7845cb9447..13a4b2547a 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/BaseEvaluator.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/BaseEvaluator.java @@ -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 accessStatus = capabilityService.getCapabilitiesAccessState(nodeRef, capabilities); for (AccessStatus value : accessStatus.values()) { - if (AccessStatus.DENIED.equals(value) == true) + if (AccessStatus.DENIED.equals(value)) { result = false; break; diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java index 94ab8458c9..244699c2de 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java @@ -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"; } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/MultiParentEvaluator.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/MultiParentEvaluator.java index a90b49c491..22eb57b1d1 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/MultiParentEvaluator.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/MultiParentEvaluator.java @@ -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() { @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); } }); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/NonElectronicEvaluator.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/NonElectronicEvaluator.java index 2c88c5d0ac..32f3eab4aa 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/NonElectronicEvaluator.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/NonElectronicEvaluator.java @@ -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; } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/SplitEmailActionEvaluator.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/SplitEmailActionEvaluator.java index 574da9ed1e..75f1476137 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/SplitEmailActionEvaluator.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/SplitEmailActionEvaluator.java @@ -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; } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/BaseBehaviourBean.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/BaseBehaviourBean.java index d39f7b0229..991325f678 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/BaseBehaviourBean.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/BaseBehaviourBean.java @@ -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 behaviours = new HashMap(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); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordsManagementSearchBehaviour.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordsManagementSearchBehaviour.java index 137b1fcc73..0f56712f2b 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordsManagementSearchBehaviour.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/behaviour/RecordsManagementSearchBehaviour.java @@ -291,7 +291,7 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel */ public void dispositionActionPropertiesUpdate(final NodeRef nodeRef, final Map before, final Map after) { - if (nodeService.exists(nodeRef) == true) + if (nodeService.exists(nodeRef)) { AuthenticationUtil.runAs(new RunAsWork() { @@ -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 props = new HashSet(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 before, Map 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); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DispositionLifecycleAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DispositionLifecycleAspect.java index 2d8a9a884f..c152759abc 100755 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DispositionLifecycleAspect.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/DispositionLifecycleAspect.java @@ -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() { @@ -93,5 +93,5 @@ public class DispositionLifecycleAspect extends BaseBehaviourBean } }); } - } + } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FilePlanComponentAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FilePlanComponentAspect.java index eb952998c6..4e30431550 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FilePlanComponentAspect.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FilePlanComponentAspect.java @@ -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()); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java index 2bf7595da1..a9cfe417eb 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/FrozenAspect.java @@ -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 } } } - + } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java index f513365b06..b37bce7ae0 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java @@ -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); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ScheduledAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ScheduledAspect.java index 6d0419e9ca..376f483dab 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ScheduledAspect.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/ScheduledAspect.java @@ -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); } } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordDefinitionAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordDefinitionAspect.java index 7ae1f16fc5..14128ed886 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordDefinitionAspect.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/VitalRecordDefinitionAspect.java @@ -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 before, Map 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 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() { @@ -100,5 +100,5 @@ public class VitalRecordDefinitionAspect extends BaseBehaviourBean } } } - + } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/DispositionActionDefinitionType.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/DispositionActionDefinitionType.java index 70cdac423c..54954d55a2 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/DispositionActionDefinitionType.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/DispositionActionDefinitionType.java @@ -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 before, Map after) { - if (nodeService.exists(nodeRef) == true) + if (nodeService.exists(nodeRef)) { // Determine the properties that have changed - Set changedProps = new HashSet(PropertyMap.getChangedProperties(before, after).keySet()); + Set changedProps = new HashSet(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 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)); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/FilePlanType.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/FilePlanType.java index 3d1c655d5e..533eacee5f 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/FilePlanType.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/FilePlanType.java @@ -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() { - 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); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordCategoryType.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordCategoryType.java index 40b407a4fd..564019db31 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordCategoryType.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordCategoryType.java @@ -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() { @@ -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 */ diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderType.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderType.java index ad96791f62..64acd44cba 100755 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderType.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderType.java @@ -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); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java index 638778b472..b55ed050e0 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java @@ -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); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java index 5ecfc139ee..18c31d6dd8 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RmSiteType.java @@ -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() { @@ -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 before, Map after) { - if (nodeService.exists(nodeRef) == true) + if (nodeService.exists(nodeRef)) { Map 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."); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/notification/RecordsManagementNotificationHelper.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/notification/RecordsManagementNotificationHelper.java index 392d0844be..fcb80a08ec 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/notification/RecordsManagementNotificationHelper.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/notification/RecordsManagementNotificationHelper.java @@ -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); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/AbstractModulePatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/AbstractModulePatch.java index 097c3ebba2..19e43d1bda 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/AbstractModulePatch.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/AbstractModulePatch.java @@ -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) */ diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatchExecuterImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatchExecuterImpl.java index 882a89174b..d6e66d2ab3 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatchExecuterImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/ModulePatchExecuterImpl.java @@ -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()); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/compatibility/ModulePatchComponent.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/compatibility/ModulePatchComponent.java index b9dffa8015..1ee7b2f305 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/compatibility/ModulePatchComponent.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/compatibility/ModulePatchComponent.java @@ -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() - { + { @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; diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/NotificationTemplatePatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/NotificationTemplatePatch.java index 74a09160a2..81b6accab9 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/NotificationTemplatePatch.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/NotificationTemplatePatch.java @@ -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() + ")"); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2FilePlanNodeRefPatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2FilePlanNodeRefPatch.java index 212a2a0947..24662a88dc 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2FilePlanNodeRefPatch.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2FilePlanNodeRefPatch.java @@ -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 aspectPair = qnameDAO.getQName(RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT); if (aspectPair != null) { List 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 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")); } } - } + } } } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2ModelPatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2ModelPatch.java index 65f22ed719..c68e896c42 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2ModelPatch.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2ModelPatch.java @@ -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 { - 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 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; - } - } + } + } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2SavedSearchPatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2SavedSearchPatch.java index e97256f02a..9e1617ba1b 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2SavedSearchPatch.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v20/RMv2SavedSearchPatch.java @@ -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 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() + ")"); } - } + } } - } + } } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/NotificationTemplatePatch_v21.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/NotificationTemplatePatch_v21.java index 2bd10940a3..2ce6e3823d 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/NotificationTemplatePatch_v21.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/NotificationTemplatePatch_v21.java @@ -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(); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21BehaviorScriptsPatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21BehaviorScriptsPatch.java index ccc17d1444..e4f2a70cb5 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21BehaviorScriptsPatch.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21BehaviorScriptsPatch.java @@ -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() @@ -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()); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21CapabilityPatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21CapabilityPatch.java index 159b2712aa..e4f9515c9d 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21CapabilityPatch.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21CapabilityPatch.java @@ -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 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()); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21InPlacePatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21InPlacePatch.java index 7a4ef261c5..7b8236e19b 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21InPlacePatch.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21InPlacePatch.java @@ -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 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 getCapabilities(String[] capabilityNames) { Set capabilities = new HashSet(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 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 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)); } - + } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RMAdminUserPatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RMAdminUserPatch.java index 5b4b42e391..bae1ecee72 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RMAdminUserPatch.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RMAdminUserPatch.java @@ -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 properties = new HashMap(); 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 filePlans = filePlanService.getFilePlans(); for (NodeRef filePlan : filePlans) { diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RecordInheritancePatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RecordInheritancePatch.java index 86bf79d8a1..2b5db72332 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RecordInheritancePatch.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RecordInheritancePatch.java @@ -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 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 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); } } } } - } + } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21ReportServicePatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21ReportServicePatch.java index f32688a230..ff08dd92d5 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21ReportServicePatch.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21ReportServicePatch.java @@ -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 props = new HashMap(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 diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RolesPatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RolesPatch.java index 8215e7f297..b039efdd21 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RolesPatch.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21RolesPatch.java @@ -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 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 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) { diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatch.java index 00f47a7865..ca1b915c70 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatch.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatch.java @@ -108,7 +108,7 @@ public class RMv22CapabilityPatch extends AbstractModulePatch // 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()); } @@ -128,14 +128,14 @@ public class RMv22CapabilityPatch extends AbstractModulePatch { Set 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()); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22DODModelSeparationModulePatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22DODModelSeparationModulePatch.java index f5794a8bca..8f09127177 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22DODModelSeparationModulePatch.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22DODModelSeparationModulePatch.java @@ -32,27 +32,27 @@ import org.alfresco.util.Pair; /** * DOD model separation module patch implementation - * + * * @author Roy Wetherall * @since 2.2 */ -public class RMv22DODModelSeparationModulePatch extends AbstractModulePatch +public class RMv22DODModelSeparationModulePatch extends AbstractModulePatch implements RecordsManagementModel { /** query batch size */ private static long BATCH_SIZE = 100000L; - + /** QName DAO */ private QNameDAO qnameDAO; - + /** Patch DAO */ private PatchDAO patchDAO; - + /** Node DAO */ private NodeDAO nodeDAO; - + /** qnames to update (switch to dod namespace) */ - private QName[] qnames = + private QName[] qnames = { DOD5015Model.PROP_ORIGINATOR, DOD5015Model.PROP_ORIGINATING_ORGANIZATION, @@ -61,7 +61,7 @@ public class RMv22DODModelSeparationModulePatch extends AbstractModulePatch DOD5015Model.PROP_FORMAT, DOD5015Model.PROP_DATE_RECEIVED }; - + /** * @param qnameDAO QName DAO */ @@ -69,7 +69,7 @@ public class RMv22DODModelSeparationModulePatch extends AbstractModulePatch { this.qnameDAO = qnameDAO; } - + /** * @param patchDAO patch DAO */ @@ -77,7 +77,7 @@ public class RMv22DODModelSeparationModulePatch extends AbstractModulePatch { this.patchDAO = patchDAO; } - + /** * @param nodeDAO node DAO */ @@ -85,7 +85,7 @@ public class RMv22DODModelSeparationModulePatch extends AbstractModulePatch { this.nodeDAO = nodeDAO; } - + /** * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() */ @@ -93,7 +93,7 @@ public class RMv22DODModelSeparationModulePatch extends AbstractModulePatch public void applyInternal() { Long maxNodeId = patchDAO.getMaxAdmNodeID(); - + // switch each qname from the rma namespace to the dod namespace for (QName qname : qnames) { @@ -103,13 +103,13 @@ public class RMv22DODModelSeparationModulePatch extends AbstractModulePatch qnameDAO.updateQName(origional, qname); } } - + long recordCount = patchDAO.getCountNodesWithAspects(Collections.singleton(ASPECT_RECORD)); - if (logger.isDebugEnabled() == true) + if (logger.isDebugEnabled()) { logger.debug(" ... updating " + recordCount + " records"); } - + // apply the DOD record aspect to all exiting records int completed = 0; Pair recordAspect = qnameDAO.getQName(ASPECT_RECORD); @@ -122,9 +122,9 @@ public class RMv22DODModelSeparationModulePatch extends AbstractModulePatch { nodeDAO.addNodeAspects(nodeId, Collections.singleton(DOD5015Model.ASPECT_DOD_5015_RECORD)); } - + completed += completed + nodeIds.size(); - if (logger.isDebugEnabled() == true) + if (logger.isDebugEnabled()) { logger.debug(" ... completed " + completed + " of " + recordCount); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22ReportTemplatePatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22ReportTemplatePatch.java index 2fa4a4eb54..ad903c7ef3 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22ReportTemplatePatch.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22ReportTemplatePatch.java @@ -79,7 +79,7 @@ public class RMv22ReportTemplatePatch extends AbstractModulePatch { NodeRef transferReport = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, TRANSFER_REPORT); NodeRef destructionReport = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, DESTRUCTION_REPORT); - if (nodeService.exists(transferReport) == false && nodeService.exists(destructionReport) == true) + if (nodeService.exists(transferReport) == false && nodeService.exists(destructionReport)) { NodeRef parent = nodeService.getPrimaryParent(destructionReport).getParentRef(); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java index d3e58d9298..f5222dc78a 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java @@ -349,7 +349,7 @@ public class RecordServiceImpl extends BaseBehaviourBean public void onRemoveAspect(NodeRef nodeRef, QName aspect) { - if (nodeService.hasAspect(nodeRef, ASPECT_RECORD) ) + if (nodeService.hasAspect(nodeRef, ASPECT_RECORD)) { ContentData contentData = (ContentData) nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); @@ -363,7 +363,7 @@ public class RecordServiceImpl extends BaseBehaviourBean { // check whether filling is pending aspect removal Set pendingFilling = TransactionalResourceHelper.getSet("pendingFilling"); - if (pendingFilling.contains(nodeRef) ) + if (pendingFilling.contains(nodeRef)) { file(nodeRef); } @@ -394,7 +394,7 @@ public class RecordServiceImpl extends BaseBehaviourBean { try { - if (nodeService.hasAspect(nodeRef, ASPECT_RECORD) ) + if (nodeService.hasAspect(nodeRef, ASPECT_RECORD)) { String origionalName = (String)nodeService.getProperty(nodeRef, PROP_ORIGIONAL_NAME); if (origionalName != null) @@ -407,21 +407,21 @@ public class RecordServiceImpl extends BaseBehaviourBean } catch (FileExistsException e) { - if (logger.isDebugEnabled() ) + if (logger.isDebugEnabled()) { logger.debug(e.getMessage()); } } catch (InvalidNodeRefException e) { - if (logger.isDebugEnabled() ) + if (logger.isDebugEnabled()) { logger.debug(e.getMessage()); } } catch (FileNotFoundException e) { - if (logger.isDebugEnabled() ) + if (logger.isDebugEnabled()) { logger.debug(e.getMessage()); } @@ -450,7 +450,7 @@ public class RecordServiceImpl extends BaseBehaviourBean nodeService.getType(nodeRef).equals(TYPE_RECORD_FOLDER) == false && nodeService.getType(nodeRef).equals(TYPE_RECORD_CATEGORY) == false) { - if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_NO_CONTENT) ) + if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_NO_CONTENT)) { // we need to postpone filling until the NO_CONTENT aspect is removed Set pendingFilling = TransactionalResourceHelper.getSet("pendingFilling"); @@ -617,7 +617,7 @@ public class RecordServiceImpl extends BaseBehaviourBean if (def != null) { QName parent = def.getParentName(); - if (parent != null && ASPECT_RECORD_META_DATA.equals(parent) ) + if (parent != null && ASPECT_RECORD_META_DATA.equals(parent)) { recordMetaDataAspects.put(aspect, Collections.singleton(TYPE_FILE_PLAN)); } @@ -785,7 +785,7 @@ public class RecordServiceImpl extends BaseBehaviourBean // make the document a record makeRecord(nodeRef); - if (isLinked ) + if (isLinked) { // turn off rules ruleService.disableRules(); @@ -828,7 +828,7 @@ public class RecordServiceImpl extends BaseBehaviourBean ParameterCheck.mandatory("name", name); NodeRef destination = nodeRef; - if (filePlanService.isFilePlan(nodeRef) ) + if (filePlanService.isFilePlan(nodeRef)) { // get the unfiled record container for the file plan destination = filePlanService.getUnfiledContainer(nodeRef); @@ -908,7 +908,7 @@ public class RecordServiceImpl extends BaseBehaviourBean String recordName = prefix + " (" + recordId + ")" + postfix; fileFolderService.rename(document, recordName); - if (logger.isDebugEnabled() ) + if (logger.isDebugEnabled()) { logger.debug("Rename " + name + " to " + recordName); } @@ -940,13 +940,13 @@ public class RecordServiceImpl extends BaseBehaviourBean boolean result = false; - if (isRecord(nodeRef) ) + if (isRecord(nodeRef)) { ChildAssociationRef childAssocRef = nodeService.getPrimaryParent(nodeRef); if (childAssocRef != null) { NodeRef parent = childAssocRef.getParentRef(); - if (parent != null && recordFolderService.isRecordFolder(parent) ) + if (parent != null && recordFolderService.isRecordFolder(parent)) { result = true; } @@ -973,7 +973,7 @@ public class RecordServiceImpl extends BaseBehaviourBean // TODO composite record support needs to file containers too QName type = nodeService.getType(record); if (ContentModel.TYPE_CONTENT.equals(type) || - dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT) ) + dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT)) { // fire before file record policy beforeFileRecord.get(getTypeAndApsects(record)).beforeFileRecord(record); @@ -1075,7 +1075,7 @@ public class RecordServiceImpl extends BaseBehaviourBean Set aspects = nodeService.getAspects(nodeRef); for (QName aspect : aspects) { - if (RM_URI.equals(aspect.getNamespaceURI()) ) + if (RM_URI.equals(aspect.getNamespaceURI())) { // remove the aspect nodeService.removeAspect(nodeRef, aspect); @@ -1093,7 +1093,7 @@ public class RecordServiceImpl extends BaseBehaviourBean { fileFolderService.rename(nodeRef, origionalName); - if (logger.isDebugEnabled() ) + if (logger.isDebugEnabled()) { String name = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); logger.debug("Rename " + name + " to " + origionalName); @@ -1141,7 +1141,7 @@ public class RecordServiceImpl extends BaseBehaviourBean throw new AlfrescoRuntimeException("Can not check if the property " + property.toString() + " is editable, because node reference is not a record."); } - if (logger.isDebugEnabled() ) + if (logger.isDebugEnabled()) { logger.debug("Checking whether property " + property.toString() + " is editable for user " + AuthenticationUtil.getRunAsUser()); } @@ -1150,28 +1150,28 @@ public class RecordServiceImpl extends BaseBehaviourBean NodeRef filePlan = filePlanService.getFilePlan(record); Set roles = filePlanRoleService.getRolesByUser(filePlan, AuthenticationUtil.getRunAsUser()); - if (logger.isDebugEnabled() ) + if (logger.isDebugEnabled()) { logger.debug(" ... users roles"); } for (Role role : roles) { - if (logger.isDebugEnabled() ) + if (logger.isDebugEnabled()) { logger.debug(" ... user has role " + role.getName() + " with capabilities "); } for (Capability cap : role.getCapabilities()) { - if (logger.isDebugEnabled() ) + if (logger.isDebugEnabled()) { logger.debug(" ... " + cap.getName()); } } } - if (logger.isDebugEnabled() ) + if (logger.isDebugEnabled()) { logger.debug(" ... user has the following set permissions on the file plan"); } @@ -1195,9 +1195,9 @@ public class RecordServiceImpl extends BaseBehaviourBean // END DEBUG ... boolean result = alwaysEditProperty(property); - if (result ) + if (result) { - if (logger.isDebugEnabled() ) + if (logger.isDebugEnabled()) { logger.debug(" ... property marked as always editable."); } @@ -1211,9 +1211,9 @@ public class RecordServiceImpl extends BaseBehaviourBean AccessStatus accessDeclaredRecord = capabilityService.getCapabilityAccessState(record, RMPermissionModel.EDIT_DECLARED_RECORD_METADATA); AccessStatus accessRecord = capabilityService.getCapabilityAccessState(record, RMPermissionModel.EDIT_RECORD_METADATA); - if (AccessStatus.ALLOWED.equals(accessNonRecord) ) + if (AccessStatus.ALLOWED.equals(accessNonRecord)) { - if (logger.isDebugEnabled() ) + if (logger.isDebugEnabled()) { logger.debug(" ... user has edit nonrecord metadata capability"); } @@ -1222,9 +1222,9 @@ public class RecordServiceImpl extends BaseBehaviourBean } if (AccessStatus.ALLOWED.equals(accessRecord) || - AccessStatus.ALLOWED.equals(accessDeclaredRecord) ) + AccessStatus.ALLOWED.equals(accessDeclaredRecord)) { - if (logger.isDebugEnabled() ) + if (logger.isDebugEnabled()) { logger.debug(" ... user has edit record or declared metadata capability"); } @@ -1234,7 +1234,7 @@ public class RecordServiceImpl extends BaseBehaviourBean if (allowNonRecordEdit && allowRecordEdit) { - if (logger.isDebugEnabled() ) + if (logger.isDebugEnabled()) { logger.debug(" ... so all properties can be edited."); } @@ -1246,7 +1246,7 @@ public class RecordServiceImpl extends BaseBehaviourBean // can only edit non record properties if (isRecordMetadata(property) == false) { - if (logger.isDebugEnabled() ) + if (logger.isDebugEnabled()) { logger.debug(" ... property is not considered record metadata so editable."); } @@ -1255,18 +1255,18 @@ public class RecordServiceImpl extends BaseBehaviourBean } else { - if (logger.isDebugEnabled() ) + if (logger.isDebugEnabled()) { logger.debug(" ... property is considered record metadata so not editable."); } } } - else if (allowNonRecordEdit == false && allowRecordEdit ) + else if (allowNonRecordEdit == false && allowRecordEdit) { // can only edit record properties - if (isRecordMetadata(property) ) + if (isRecordMetadata(property)) { - if (logger.isDebugEnabled() ) + if (logger.isDebugEnabled()) { logger.debug(" ... property is considered record metadata so editable."); } @@ -1275,7 +1275,7 @@ public class RecordServiceImpl extends BaseBehaviourBean } else { - if (logger.isDebugEnabled() ) + if (logger.isDebugEnabled()) { logger.debug(" ... property is not considered record metadata so not editable."); } @@ -1302,7 +1302,7 @@ public class RecordServiceImpl extends BaseBehaviourBean if (def != null) { ClassDefinition parent = def.getContainerClass(); - if (parent != null && parent.isAspect() ) + if (parent != null && parent.isAspect()) { result = getRecordMetaDataAspects().contains(parent.getName()); } @@ -1368,7 +1368,7 @@ public class RecordServiceImpl extends BaseBehaviourBean for (ChildAssociationRef assoc : assocs) { NodeRef child = assoc.getChildRef(); - if (isRecord(child) ) + if (isRecord(child)) { result.add(child); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderServiceImpl.java index 21588b887a..49eb839b5b 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/recordfolder/RecordFolderServiceImpl.java @@ -194,7 +194,7 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl // "properties" is not mandatory // Check that we are not trying to create a record folder in a root container - if (filePlanService.isFilePlan(rmContainer) == true) + if (filePlanService.isFilePlan(rmContainer)) { throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PARENT_RECORD_FOLDER_ROOT)); } @@ -265,13 +265,13 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl ParameterCheck.mandatory("record", record); List result = new ArrayList(1); - if (recordService.isRecord(record) == true) + if (recordService.isRecord(record)) { List assocs = nodeService.getParentAssocs(record, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef assoc : assocs) { NodeRef parent = assoc.getParentRef(); - if (isRecordFolder(parent) == true) + if (isRecordFolder(parent)) { result.add(parent); } @@ -297,7 +297,7 @@ public class RecordFolderServiceImpl extends ServiceBaseImpl } } - if (isRecordFolder(nodeRef) == true) + if (isRecordFolder(nodeRef)) { if (isRecordFolderClosed(nodeRef) == false) { diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/report/action/BaseReportAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/report/action/BaseReportAction.java index 932caf993e..2e6e891cae 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/report/action/BaseReportAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/report/action/BaseReportAction.java @@ -99,7 +99,7 @@ public abstract class BaseReportAction extends RMActionExecuterAbstractBase impl private String getParameterValue(Action action, String parameter) { String paramValue = (String) action.getParameterValue(parameter); - if (StringUtils.isBlank(paramValue) == true) + if (StringUtils.isBlank(paramValue)) { throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PARAM_NOT_SUPPLIED, parameter)); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/report/action/TransferReportAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/report/action/TransferReportAction.java index fbd904daeb..0fc13819db 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/report/action/TransferReportAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/report/action/TransferReportAction.java @@ -94,7 +94,7 @@ public class TransferReportAction extends BaseReportAction boolean isFolder = dictionaryService.isSubClass(nodeService.getType(childRef), ContentModel.TYPE_FOLDER); transferNodeProperties.put("isFolder", isFolder); - if (isFolder == true) + if (isFolder) { Map folderProperties = getFolderProperties(childRef); transferNodeProperties.putAll(folderProperties); @@ -121,7 +121,7 @@ public class TransferReportAction extends BaseReportAction for (ChildAssociationRef child : assocs) { NodeRef record = child.getChildRef(); - if (nodeService.hasAspect(record, RecordsManagementModel.ASPECT_RECORD) == true) + if (nodeService.hasAspect(record, RecordsManagementModel.ASPECT_RECORD)) { Map recordProperties = getRecordProperties(record); TransferNode transferNode = new TransferNode(record, recordProperties); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleServiceImpl.java index ed835574f8..44c4c3374a 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleServiceImpl.java @@ -198,13 +198,13 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService, public void setupFilePlanRoles(final NodeRef filePlan) { // Do not execute behaviour if this has been created in the archive store - if(filePlan.getStoreRef().equals(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE) == true) + if(filePlan.getStoreRef().equals(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE)) { // This is not the spaces store - probably the archive store return; } - if (nodeService.exists(filePlan) == true) + if (nodeService.exists(filePlan)) { List systemContainers = AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork>() { @@ -320,10 +320,10 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService, // Get the name of the role String name = null; - if (object.has("name") == true) + if (object.has("name")) { name = object.getString("name"); - if (existsRole(filePlan, name) == true) + if (existsRole(filePlan, name)) { throw new AlfrescoRuntimeException("The bootstrap role " + name + " already exists on the rm root node " + filePlan.toString()); } @@ -336,21 +336,21 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService, // Get the role's display label String displayLabel = name; - if (object.has("displayLabel") == true) + if (object.has("displayLabel")) { displayLabel = object.getString("displayLabel"); } // Determine whether the role is an admin role or not boolean isAdmin = false; - if (object.has("isAdmin") == true) + if (object.has("isAdmin")) { isAdmin = object.getBoolean("isAdmin"); } // Get the roles capabilities Set capabilities = new HashSet(30); - if (object.has("capabilities") == true) + if (object.has("capabilities")) { JSONArray arrCaps = object.getJSONArray("capabilities"); for (int index = 0; index < arrCaps.length(); index++) @@ -369,7 +369,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService, Role role = createRole(filePlan, name, displayLabel, capabilities); // Add any additional admin permissions - if (isAdmin == true) + if (isAdmin) { // Admin has filing permissionService.setPermission(filePlan, role.getRoleGroupName(), RMPermissionModel.FILING, true); @@ -485,7 +485,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService, Set roleAuthorities = authorityService.getAllAuthoritiesInZone(getZoneName(rmRootNode), AuthorityType.GROUP); for (String roleAuthority : roleAuthorities) { - if (includeSystemRoles == true || isSystemRole(roleAuthority) == false) + if (includeSystemRoles || isSystemRole(roleAuthority) == false) { String groupShortName = authorityService.getShortName(roleAuthority); String name = getShortRoleName(groupShortName, rmRootNode); @@ -531,7 +531,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService, for (String roleAuthority : roleAuthorities) { Set users = authorityService.getContainedAuthorities(AuthorityType.USER, roleAuthority, false); - if (users.contains(user) == true && (includeSystemRoles == true || isSystemRole(roleAuthority) == false)) + if (users.contains(user) && (includeSystemRoles || isSystemRole(roleAuthority) == false)) { String groupShortName = authorityService.getShortName(roleAuthority); String name = getShortRoleName(groupShortName, rmRootNode); @@ -599,7 +599,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService, Role result = null; String roleAuthority = authorityService.getName(AuthorityType.GROUP, getFullRoleName(role, rmRootNode)); - if (authorityService.authorityExists(roleAuthority) == true) + if (authorityService.authorityExists(roleAuthority)) { String name = getShortRoleName(authorityService.getShortName(roleAuthority), rmRootNode); String displayLabel = authorityService.getAuthorityDisplayName(roleAuthority); @@ -625,7 +625,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService, Set capabilities = new HashSet(52); for (AccessPermission permission : permissions) { - if (permission.getAuthority().equals(roleAuthority) == true) + if (permission.getAuthority().equals(roleAuthority)) { String capabilityName = permission.getPermission(); Capability capability = capabilityService.getCapability(capabilityName); @@ -778,7 +778,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService, public void deleteRole(final NodeRef rmRootNode, final String role) { // ensure that we are not trying to delete the admin role - if (ROLE_ADMIN.equals(role) == true) + if (ROLE_ADMIN.equals(role)) { throw new AlfrescoRuntimeException("Can not delete the records management administration role."); } @@ -920,7 +920,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService, if (authenticationService.authenticationExists(user) == false) { - if (logger.isDebugEnabled() == true) + if (logger.isDebugEnabled()) { logger.debug(" ... creating RM Admin user"); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseCustomPropertyWebScript.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseCustomPropertyWebScript.java index c6664e04d1..e96e4046e5 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseCustomPropertyWebScript.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseCustomPropertyWebScript.java @@ -24,34 +24,34 @@ import org.alfresco.service.namespace.QName; /** * Base class for all custom property webscripts. - * + * * @author Roy Wetherall */ public class BaseCustomPropertyWebScript extends AbstractRmWebScript { /** - * Takes the element name and maps it to the QName of the customisable type. The passed element name should be a prefixed + * Takes the element name and maps it to the QName of the customisable type. The passed element name should be a prefixed * qname string, but to support previous versions of this API a couple of hard coded checks are made first. - * + * * @param elementName * @return */ protected QName mapToTypeQName(String elementName) { // Direct matching provided for backward compatibility with RM 1.0 - if ("recordFolder".equalsIgnoreCase(elementName) == true) + if ("recordFolder".equalsIgnoreCase(elementName)) { return RecordsManagementModel.TYPE_RECORD_FOLDER; } - else if ("record".equalsIgnoreCase(elementName) == true) + else if ("record".equalsIgnoreCase(elementName)) { return RecordsManagementModel.ASPECT_RECORD; } - else if ("recordCategory".equalsIgnoreCase(elementName) == true) + else if ("recordCategory".equalsIgnoreCase(elementName)) { return RecordsManagementModel.TYPE_RECORD_CATEGORY; } - else if ("recordSeries".equalsIgnoreCase(elementName) == true) + else if ("recordSeries".equalsIgnoreCase(elementName)) { return CompatibilityModel.TYPE_RECORD_SERIES; } @@ -59,6 +59,6 @@ public class BaseCustomPropertyWebScript extends AbstractRmWebScript { // Try and convert the string to a qname return QName.createQName(elementName, namespaceService); - } + } } } \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java index 97d8acd532..5567c8e124 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java @@ -243,7 +243,7 @@ public class BootstrapTestDataGet extends DeclarativeWebScript 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); @@ -286,7 +286,7 @@ public class BootstrapTestDataGet extends DeclarativeWebScript 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); @@ -309,7 +309,7 @@ public class BootstrapTestDataGet extends DeclarativeWebScript 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); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefsGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefsGet.java index 1c5a938886..b9de6781d1 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefsGet.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefsGet.java @@ -64,16 +64,16 @@ public class CustomRefsGet extends AbstractRmWebScript /** logger */ private static Log logger = LogFactory.getLog(CustomRefsGet.class); - + /** records management admin service */ private RecordsManagementAdminService rmAdminService; - + /** dictionary service */ private DictionaryService dictionaryService; - + /** capability service */ private CapabilityService capabilityService; - + /** * @param rmAdminService records management admin service */ @@ -89,7 +89,7 @@ public class CustomRefsGet extends AbstractRmWebScript { this.dictionaryService = dictionaryService; } - + /** * @param capabilityService capability service */ @@ -166,8 +166,8 @@ public class CustomRefsGet extends AbstractRmWebScript AssociationDefinition assDef = rmAdminService.getCustomReferenceDefinitions().get(typeQName); if (assDef != null && - hasView(childAssRef.getParentRef()) == true && - hasView(childAssRef.getChildRef()) == true) + hasView(childAssRef.getParentRef()) && + hasView(childAssRef.getChildRef())) { String compoundTitle = assDef.getTitle(dictionaryService); @@ -200,9 +200,9 @@ public class CustomRefsGet extends AbstractRmWebScript QName typeQName = assRef.getTypeQName(); AssociationDefinition assDef = rmAdminService.getCustomReferenceDefinitions().get(typeQName); - if (assDef != null && - hasView(assRef.getTargetRef()) == true && - hasView(assRef.getSourceRef()) == true) + if (assDef != null && + hasView(assRef.getTargetRef()) && + hasView(assRef.getSourceRef())) { data.put(LABEL, assDef.getTitle(dictionaryService)); data.put(REF_ID, typeQName.getLocalName()); @@ -214,19 +214,19 @@ public class CustomRefsGet extends AbstractRmWebScript } } } - + /** * Determine whether the current user has view capabilities on the given node. - * + * * @param nodeRef node reference * @return boolean true if current user has view capability, false otherwise */ private boolean hasView(NodeRef nodeRef) { boolean result = false; - + Capability viewRecordCapability = capabilityService.getCapability(ViewRecordsCapability.NAME); - if (AccessStatus.ALLOWED.equals(viewRecordCapability.hasPermission(nodeRef)) == true) + if (AccessStatus.ALLOWED.equals(viewRecordCapability.hasPermission(nodeRef))) { result = true; } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionAbstractBase.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionAbstractBase.java index 4afd717642..c35e1e3dc5 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionAbstractBase.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionAbstractBase.java @@ -61,7 +61,7 @@ public class DispositionAbstractBase extends AbstractRmWebScript // make sure the node passed in has a disposition schedule attached DispositionSchedule schedule = null; - if (inherited == true) + if (inherited) { schedule = this.dispositionService.getDispositionSchedule(nodeRef); } @@ -195,7 +195,7 @@ public class DispositionAbstractBase extends AbstractRmWebScript for (DispositionActionDefinition actionDef : schedule.getDispositionActionDefinitions()) { NodeRef actionDefNodeRef = actionDef.getNodeRef(); - if (nodeService.hasAspect(actionDefNodeRef, RecordsManagementModel.ASPECT_UNPUBLISHED_UPDATE) == true) + if (nodeService.hasAspect(actionDefNodeRef, RecordsManagementModel.ASPECT_UNPUBLISHED_UPDATE)) { unpublishedUpdates = true; publishInProgress = ((Boolean)nodeService.getProperty(actionDefNodeRef, RecordsManagementModel.PROP_PUBLISH_IN_PROGRESS)).booleanValue(); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/RmActionPost.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/RmActionPost.java index b1f811a8f0..bac9e1f77e 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/RmActionPost.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/RmActionPost.java @@ -94,18 +94,18 @@ public class RmActionPost extends DeclarativeWebScript JSONObject jsonObj = new JSONObject(new JSONTokener(reqContentAsString)); // Get the action name - if (jsonObj.has(PARAM_NAME) == true) + if (jsonObj.has(PARAM_NAME)) { actionName = jsonObj.getString(PARAM_NAME); } // Get the target references - if (jsonObj.has(PARAM_NODE_REF) == true) + if (jsonObj.has(PARAM_NODE_REF)) { NodeRef nodeRef = new NodeRef(jsonObj.getString(PARAM_NODE_REF)); targetNodeRefs.add(nodeRef); } - if (jsonObj.has(PARAM_NODE_REFS) == true) + if (jsonObj.has(PARAM_NODE_REFS)) { JSONArray jsonArray = jsonObj.getJSONArray(PARAM_NODE_REFS); if (jsonArray.length() != 0) @@ -131,7 +131,7 @@ public class RmActionPost extends DeclarativeWebScript // Check for date values if (nextValue instanceof JSONObject) { - if (((JSONObject)nextValue).has("iso8601") == true) + if (((JSONObject)nextValue).has("iso8601")) { String dateStringValue = ((JSONObject)nextValue).getString("iso8601"); nextValue = ISO8601DateFormat.parse(dateStringValue); @@ -167,7 +167,7 @@ public class RmActionPost extends DeclarativeWebScript } // Build the string - if (firstTime == true) + if (firstTime) { firstTime = false; } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferReportPost.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferReportPost.java index 4859fb5965..3e7bc3f559 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferReportPost.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/TransferReportPost.java @@ -254,7 +254,7 @@ public class TransferReportPost extends BaseTransferWebScript writer.write("\n"); writer.write("\n\n"); Boolean isAccession = (Boolean)this.nodeService.getProperty(transferNode, PROP_TRANSFER_ACCESSION_INDICATOR); - if (isAccession == true) + if (isAccession) { writer.write("Accession Report\n"); } @@ -270,7 +270,7 @@ public class TransferReportPost extends BaseTransferWebScript writer.write(".nodeName { font-weight: bold; }\n"); writer.write(".transferred-item { background-color: #eee; padding: 10px; margin-bottom: 15px; }\n"); writer.write("\n"); - if (isAccession == true) + if (isAccession) { writer.write("\n

Accession Report

\n"); } @@ -285,7 +285,7 @@ public class TransferReportPost extends BaseTransferWebScript writer.write(StringEscapeUtils.escapeHtml(transferDate.toString())); writer.write(""); writer.write("Transfer Location:"); - if (isAccession == true) + if (isAccession) { writer.write("NARA"); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RMEventBase.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RMEventBase.java index 7483eb7ef9..1d82925b3c 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RMEventBase.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RMEventBase.java @@ -44,7 +44,7 @@ public class RMEventBase extends DeclarativeWebScript protected String getValue(JSONObject json, String key) throws JSONException { String result = null; - if (json.has(key) == true) + if (json.has(key)) { result = json.getString(key); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventPut.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventPut.java index 41898285c2..a125979837 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventPut.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RmEventPut.java @@ -94,7 +94,7 @@ public class RmEventPut extends RMEventBase // Check if the event can be edited or not RecordsManagementEvent event = null; - if (canEditEvent(eventDisplayLabel, eventName, eventType) == true) + if (canEditEvent(eventDisplayLabel, eventName, eventType)) { // Create event event = rmEventService.addEvent(eventType, eventName, eventDisplayLabel); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RoleDeclarativeWebScript.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RoleDeclarativeWebScript.java index 819615b5f5..0c38847f94 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RoleDeclarativeWebScript.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RoleDeclarativeWebScript.java @@ -103,7 +103,7 @@ public class RoleDeclarativeWebScript extends DeclarativeWebScript { StoreRef storeRef = new StoreRef(storeType, storeId); NodeRef nodeRef = new NodeRef(storeRef, id); - if (filePlanService.isFilePlan(nodeRef) == true) + if (filePlanService.isFilePlan(nodeRef)) { filePlan = nodeRef; } @@ -145,7 +145,7 @@ public class RoleDeclarativeWebScript extends DeclarativeWebScript for (Role role : roles) { RoleItem item = null; - if (showAuths == true) + if (showAuths) { item = new RoleItem(role, createAuthorityItems(filePlanRoleService.getUsersAssignedToRole(filePlan, role.getName())), diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/capability/CapabilitiesGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/capability/CapabilitiesGet.java index 2e5b71509a..a352f59744 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/capability/CapabilitiesGet.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/capability/CapabilitiesGet.java @@ -46,7 +46,7 @@ public class CapabilitiesGet extends DeclarativeWebScript { /** File plan service */ private FilePlanService filePlanService; - + /** Capability service */ private CapabilityService capabilityService; @@ -61,11 +61,11 @@ public class CapabilitiesGet extends DeclarativeWebScript /** * @param filePlanService file plan service */ - public void setFilePlanService(FilePlanService filePlanService) + public void setFilePlanService(FilePlanService filePlanService) { this.filePlanService = filePlanService; } - + /** * @see org.alfresco.repo.web.scripts.content.StreamContent#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) */ @@ -101,7 +101,7 @@ public class CapabilitiesGet extends DeclarativeWebScript } Map model = new TreeMap(); - if (grouped == true) + if (grouped) { // Construct the map which is needed to build the model Map groupedCapabilitiesMap = new TreeMap(); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesPost.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesPost.java index 2d36073c58..d5ac7e5832 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesPost.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSavedSearchesPost.java @@ -38,20 +38,20 @@ import org.springframework.extensions.webscripts.WebScriptRequest; /** * Records management saved search POST web script. - * + * * @author Roy Wetherall */ public class RMSavedSearchesPost extends DeclarativeWebScript { /** Records management search service */ protected RecordsManagementSearchService recordsManagementSearchService; - + /** Site service */ protected SiteService siteService; - + /** Namespace service */ protected NamespaceService namespaceService; - + /** * @param recordsManagementSearchService records management search service */ @@ -59,7 +59,7 @@ public class RMSavedSearchesPost extends DeclarativeWebScript { this.recordsManagementSearchService = recordsManagementSearchService; } - + /** * @param siteService site service */ @@ -67,7 +67,7 @@ public class RMSavedSearchesPost extends DeclarativeWebScript { this.siteService = siteService; } - + /** * @param namespaceService namespace service */ @@ -75,7 +75,7 @@ public class RMSavedSearchesPost extends DeclarativeWebScript { this.namespaceService = namespaceService; } - + /** * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) */ @@ -83,7 +83,7 @@ public class RMSavedSearchesPost extends DeclarativeWebScript protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) { // Get the site id and confirm it is valid - Map templateVars = req.getServiceMatch().getTemplateVars(); + Map templateVars = req.getServiceMatch().getTemplateVars(); String siteId = templateVars.get("site"); if (siteId == null || siteId.length() == 0) { @@ -93,7 +93,7 @@ public class RMSavedSearchesPost extends DeclarativeWebScript { throw new WebScriptException(Status.STATUS_NOT_FOUND, "Site not found."); } - + // Example format of posted Saved Search JSON: // { // "name": "search name", @@ -103,12 +103,12 @@ public class RMSavedSearchesPost extends DeclarativeWebScript // "params": "terms=keywords:xyz&undeclared=true", // "sort": "cm:name/asc" //} - + try { // Parse the JSON passed in the request JSONObject json = new JSONObject(new JSONTokener(req.getContent().getContent())); - + // Get the details of the saved search if (json.has("name") == false) { @@ -117,12 +117,12 @@ public class RMSavedSearchesPost extends DeclarativeWebScript } String name = json.getString("name"); String description = null; - if (json.has("description") == true) + if (json.has("description")) { description = json.getString("description"); } boolean isPublic = true; - if (json.has("public") == true) + if (json.has("public")) { isPublic = json.getBoolean("public"); } @@ -134,11 +134,11 @@ public class RMSavedSearchesPost extends DeclarativeWebScript } String params = json.getString("params"); String sort = null; - if (json.has("sort") == true) + if (json.has("sort")) { sort = json.getString("sort"); - } - + } + // Use the compatibility class to create a saved search details and save String search = SavedSearchDetailsCompatibility.getSearchFromParams(params); if (search == null) @@ -148,7 +148,7 @@ public class RMSavedSearchesPost extends DeclarativeWebScript } RecordsManagementSearchParameters searchParameters = SavedSearchDetailsCompatibility.createSearchParameters(params, sort, namespaceService); recordsManagementSearchService.saveSearch(siteId, name, description, search, searchParameters, isPublic); - + } catch (IOException iox) { @@ -159,8 +159,8 @@ public class RMSavedSearchesPost extends DeclarativeWebScript { throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not parse JSON from req.", je); - } - + } + // Indicate success in the model Map model = new HashMap(1); model.put("success", true); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchGet.java index eb46eb54fb..a097e393c1 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchGet.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchGet.java @@ -259,7 +259,7 @@ public class RMSearchGet extends DeclarativeWebScript // Determine if container or not isContainer = true; - if (dictionaryService.isSubClass(nodeRefType, ContentModel.TYPE_CONTENT) == true) + if (dictionaryService.isSubClass(nodeRefType, ContentModel.TYPE_CONTENT)) { isContainer = false; } @@ -272,7 +272,7 @@ public class RMSearchGet extends DeclarativeWebScript parent = assoc.getParentRef(); } - if (isContainer == true) + if (isContainer) { this.size = -1; diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/forms/RMMetaDataGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/forms/RMMetaDataGet.java index 54da6c6157..b8a03e2229 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/forms/RMMetaDataGet.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/forms/RMMetaDataGet.java @@ -109,7 +109,7 @@ public class RMMetaDataGet extends DeclarativeWebScript if (type != null && type.length() != 0 && type.indexOf(':') != -1) { Matcher m = QNAME_PATTERN.matcher(type); - if (m.matches() == true) + if (m.matches()) { QName qname = QName.createQName(type, namespaceService); FilePlanComponentKind kind = filePlanService.getFilePlanComponentKindFromType(qname); @@ -140,7 +140,7 @@ public class RMMetaDataGet extends DeclarativeWebScript if (extendedValue != null && extendedValue.length() != 0) { extended = Boolean.parseBoolean(extendedValue); - if (extended == true) + if (extended) { // get the aspects of the node model.put("aspects", getAspects(nodeRefObj)); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchParameters.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchParameters.java index 009679f6b3..8cadadeba3 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchParameters.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchParameters.java @@ -150,37 +150,37 @@ public class RecordsManagementSearchParameters RecordsManagementSearchParameters searchParameters = new RecordsManagementSearchParameters(); // Get the search parameter properties - if (jsonObject.has(JSON_MAXITEMS) == true) + if (jsonObject.has(JSON_MAXITEMS)) { searchParameters.setMaxItems(jsonObject.getInt(JSON_MAXITEMS)); } - if (jsonObject.has(JSON_RECORDS) == true) + if (jsonObject.has(JSON_RECORDS)) { searchParameters.setIncludeRecords(jsonObject.getBoolean(JSON_RECORDS)); } - if (jsonObject.has(JSON_UNDECLAREDRECORDS) == true) + if (jsonObject.has(JSON_UNDECLAREDRECORDS)) { searchParameters.setIncludeUndeclaredRecords(jsonObject.getBoolean(JSON_UNDECLAREDRECORDS)); } - if (jsonObject.has(JSON_VITALRECORDS) == true) + if (jsonObject.has(JSON_VITALRECORDS)) { searchParameters.setIncludeVitalRecords(jsonObject.getBoolean(JSON_VITALRECORDS)); } - if (jsonObject.has(JSON_RECORDFOLDERES) == true) + if (jsonObject.has(JSON_RECORDFOLDERES)) { searchParameters.setIncludeRecordFolders(jsonObject.getBoolean(JSON_RECORDFOLDERES)); } - if (jsonObject.has(JSON_FROZEN) == true) + if (jsonObject.has(JSON_FROZEN)) { searchParameters.setIncludeFrozen(jsonObject.getBoolean(JSON_FROZEN)); } - if (jsonObject.has(JSON_CUTOFF) == true) + if (jsonObject.has(JSON_CUTOFF)) { searchParameters.setIncludeCutoff(jsonObject.getBoolean(JSON_CUTOFF)); } // Get container types - if (jsonObject.has(JSON_CONTAINERTYPES) == true) + if (jsonObject.has(JSON_CONTAINERTYPES)) { JSONArray jsonArray = jsonObject.getJSONArray(JSON_CONTAINERTYPES); List containerTypes = new ArrayList(jsonArray.length()); @@ -193,15 +193,15 @@ public class RecordsManagementSearchParameters } // Get sort details - if (jsonObject.has(JSON_SORT) == true) + if (jsonObject.has(JSON_SORT)) { JSONArray jsonArray = jsonObject.getJSONArray(JSON_SORT); List sortOrder = new ArrayList(jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject sortJSONObject = jsonArray.getJSONObject(i); - if (sortJSONObject.has(JSON_FIELD) == true && - sortJSONObject.has(JSON_ASCENDING) == true) + if (sortJSONObject.has(JSON_FIELD) && + sortJSONObject.has(JSON_ASCENDING)) { sortOrder.add(new SortItem( QName.createQName(sortJSONObject.getString(JSON_FIELD), namespaceService), diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchServiceImpl.java index 6383d99598..23eed25666 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/search/RecordsManagementSearchServiceImpl.java @@ -141,7 +141,7 @@ public class RecordsManagementSearchServiceImpl implements RecordsManagementSear // Get the description String description = ""; - if (report.has(SavedSearchDetails.DESCRIPTION) == true) + if (report.has(SavedSearchDetails.DESCRIPTION)) { description = report.getString(SavedSearchDetails.DESCRIPTION); String translatedDescription = I18NUtil.getMessage(description); @@ -152,7 +152,7 @@ public class RecordsManagementSearchServiceImpl implements RecordsManagementSear } RecordsManagementSearchParameters searchParameters = new RecordsManagementSearchParameters(); - if (report.has("searchparams") == true) + if (report.has("searchparams")) { searchParameters = RecordsManagementSearchParameters.createFromJSON(report.getJSONObject("searchparams"), namespaceService); } @@ -221,21 +221,21 @@ public class RecordsManagementSearchServiceImpl implements RecordsManagementSear /*package*/ String buildQueryString(String queryTerm, RecordsManagementSearchParameters searchParameters) { StringBuilder aspectQuery = new StringBuilder(); - if (searchParameters.isIncludeRecords() == true) + if (searchParameters.isIncludeRecords()) { appendAspect(aspectQuery, "rma:record"); if (searchParameters.isIncludeUndeclaredRecords() == false) { appendAspect(aspectQuery, "rma:declaredRecord"); } - if (searchParameters.isIncludeVitalRecords() == true) + if (searchParameters.isIncludeVitalRecords()) { appendAspect(aspectQuery, "rma:vitalRecord"); } } StringBuilder typeQuery = new StringBuilder(); - if (searchParameters.isIncludeRecordFolders() == true) + if (searchParameters.isIncludeRecordFolders()) { appendType(typeQuery, "rma:recordFolder"); } @@ -256,7 +256,7 @@ public class RecordsManagementSearchServiceImpl implements RecordsManagementSear } else { - if (isComplexQueryTerm(queryTerm) == true) + if (isComplexQueryTerm(queryTerm)) { query.append(queryTerm); } @@ -290,7 +290,7 @@ public class RecordsManagementSearchServiceImpl implements RecordsManagementSear } } - if (searchParameters.isIncludeFrozen() == true) + if (searchParameters.isIncludeFrozen()) { appendAspect(fullQuery, "rma:frozen"); } @@ -298,7 +298,7 @@ public class RecordsManagementSearchServiceImpl implements RecordsManagementSear { appendNotAspect(fullQuery, "rma:frozen"); } - if (searchParameters.isIncludeCutoff() == true) + if (searchParameters.isIncludeCutoff()) { appendAspect(fullQuery, "rma:cutOff"); } @@ -543,7 +543,7 @@ public class RecordsManagementSearchServiceImpl implements RecordsManagementSear // Get the search node for the saved query NodeRef searchNode = getSearchNodeRef(siteId, name); - if (searchNode != null && fileFolderService.exists(searchNode) == true) + if (searchNode != null && fileFolderService.exists(searchNode)) { fileFolderService.delete(searchNode); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetails.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetails.java index 245b2c1d66..62fe7b2d0b 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetails.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetails.java @@ -127,7 +127,7 @@ public class SavedSearchDetails extends ReportDetails // Get the site id String siteId = DEFAULT_SITE_ID; - if (search.has(SITE_ID) == true) + if (search.has(SITE_ID)) { siteId = search.getString(SITE_ID); } @@ -141,7 +141,7 @@ public class SavedSearchDetails extends ReportDetails // Get the description String description = ""; - if (search.has(DESCRIPTION) == true) + if (search.has(DESCRIPTION)) { description = search.getString(DESCRIPTION); String translated = I18NUtil.getMessage(description); @@ -156,7 +156,7 @@ public class SavedSearchDetails extends ReportDetails if (search.has(SEARCH) == false) { // We are probably dealing with a "old" style saved search - if (search.has(PARAMS) == true) + if (search.has(PARAMS)) { String oldParams = search.getString(PARAMS); query = SavedSearchDetailsCompatibility.getSearchFromParams(oldParams); @@ -174,14 +174,14 @@ public class SavedSearchDetails extends ReportDetails // Get the search parameters RecordsManagementSearchParameters searchParameters = new RecordsManagementSearchParameters(); - if (search.has(SEARCHPARAMS) == true) + if (search.has(SEARCHPARAMS)) { searchParameters = RecordsManagementSearchParameters.createFromJSON(search.getJSONObject(SEARCHPARAMS), namespaceService); } else { // See if we are dealing with the old style of saved search - if (search.has(PARAMS) == true) + if (search.has(PARAMS)) { String oldParams = search.getString(PARAMS); String oldSort = search.getString(SORT); @@ -191,14 +191,14 @@ public class SavedSearchDetails extends ReportDetails // Determine whether the saved query is public or not boolean isPublic = true; - if (search.has(PUBLIC) == true) + if (search.has(PUBLIC)) { isPublic = search.getBoolean(PUBLIC); } // Determine whether the saved query is a report or not boolean isReport = false; - if (search.has(REPORT) == true) + if (search.has(REPORT)) { isReport = search.getBoolean(REPORT); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetailsCompatibility.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetailsCompatibility.java index 0acc5dcb89..6bde482623 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetailsCompatibility.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/search/SavedSearchDetailsCompatibility.java @@ -29,7 +29,7 @@ import org.alfresco.service.namespace.QName; /** * Compatibility class. - * + * * Used to bridge between the old style of saved search passed and required by the UI and the new actual saved search details. * Eventually will be factored out as web scripts are brought up to date. */ @@ -37,10 +37,10 @@ public class SavedSearchDetailsCompatibility implements RecordsManagementModel { /** Saved search details */ private final SavedSearchDetails savedSearchDetails; - + /** Namespace service */ private final NamespaceService namespaceService; - + /** Records management search service implementation */ private final RecordsManagementSearchServiceImpl searchService; @@ -51,11 +51,11 @@ public class SavedSearchDetailsCompatibility implements RecordsManagementModel */ public static String getSearchFromParams(String params) { - String search = null; + String search = null; String[] values = params.split("&"); for (String value : values) { - if (value.startsWith("terms") == true) + if (value.startsWith("terms")) { String[] terms = value.trim().split("="); try @@ -70,17 +70,17 @@ public class SavedSearchDetailsCompatibility implements RecordsManagementModel break; } } - + return search; } - + public static RecordsManagementSearchParameters createSearchParameters(String params, String sort, NamespaceService namespaceService) { return createSearchParameters(params, new String[]{"&", "="}, sort, namespaceService); } - + /** - * + * * @param params * @param sort * @param namespaceService @@ -90,7 +90,7 @@ public class SavedSearchDetailsCompatibility implements RecordsManagementModel { RecordsManagementSearchParameters result = new RecordsManagementSearchParameters(); List includedContainerTypes = new ArrayList(2); - + // Map the param values into the search parameter object String[] values = params.split(paramsDelim[0]); for (String value : values) @@ -98,37 +98,37 @@ public class SavedSearchDetailsCompatibility implements RecordsManagementModel String[] paramValues = value.split(paramsDelim[1]); String paramName = paramValues[0].trim(); String paramValue = paramValues[1].trim(); - if ("records".equals(paramName) == true) + if ("records".equals(paramName)) { result.setIncludeRecords(Boolean.parseBoolean(paramValue)); } - else if ("undeclared".equals(paramName) == true) + else if ("undeclared".equals(paramName)) { result.setIncludeUndeclaredRecords(Boolean.parseBoolean(paramValue)); } - else if ("vital".equals(paramName) == true) + else if ("vital".equals(paramName)) { result.setIncludeVitalRecords(Boolean.parseBoolean(paramValue)); } - else if ("folders".equals(paramName) == true) + else if ("folders".equals(paramName)) { result.setIncludeRecordFolders(Boolean.parseBoolean(paramValue)); } - else if ("frozen".equals(paramName) == true) + else if ("frozen".equals(paramName)) { result.setIncludeFrozen(Boolean.parseBoolean(paramValue)); } - else if ("cutoff".equals(paramName) == true) + else if ("cutoff".equals(paramName)) { result.setIncludeCutoff(Boolean.parseBoolean(paramValue)); } - else if ("categories".equals(paramName) == true && Boolean.parseBoolean(paramValue) == true) + else if ("categories".equals(paramName) && Boolean.parseBoolean(paramValue)) { includedContainerTypes.add(TYPE_RECORD_CATEGORY); } } result.setIncludedContainerTypes(includedContainerTypes); - + if (sort != null) { // Map the sort string into the search details @@ -139,7 +139,7 @@ public class SavedSearchDetailsCompatibility implements RecordsManagementModel String[] sortPair = sortPairString.split("/"); QName field = QName.createQName(sortPair[0], namespaceService); Boolean isAcsending = Boolean.FALSE; - if ("asc".equals(sortPair[1]) == true) + if ("asc".equals(sortPair[1])) { isAcsending = Boolean.TRUE; } @@ -147,15 +147,15 @@ public class SavedSearchDetailsCompatibility implements RecordsManagementModel } result.setSortOrder(sortOrder); } - + return result; } - + /** * Constructor * @param savedSearchDetails */ - public SavedSearchDetailsCompatibility(SavedSearchDetails savedSearchDetails, + public SavedSearchDetailsCompatibility(SavedSearchDetails savedSearchDetails, NamespaceService namespaceService, RecordsManagementSearchServiceImpl searchService) { @@ -163,7 +163,7 @@ public class SavedSearchDetailsCompatibility implements RecordsManagementModel this.namespaceService = namespaceService; this.searchService = searchService; } - + /** * Get the sort string from the saved search details * @return @@ -171,16 +171,16 @@ public class SavedSearchDetailsCompatibility implements RecordsManagementModel public String getSort() { StringBuilder builder = new StringBuilder(64); - + for (SortItem entry : this.savedSearchDetails.getSearchParameters().getSortOrder()) { if (builder.length() !=0) { builder.append(","); } - + String order = "desc"; - if (entry.assc == true) + if (entry.assc) { order = "asc"; } @@ -188,18 +188,18 @@ public class SavedSearchDetailsCompatibility implements RecordsManagementModel .append("/") .append(order); } - + return builder.toString(); } - + /** * Get the parameter string from the saved search details * @return */ public String getParams() { - List includeContainerTypes = this.savedSearchDetails.getSearchParameters().getIncludedContainerTypes(); - StringBuilder builder = new StringBuilder(128); + List includeContainerTypes = this.savedSearchDetails.getSearchParameters().getIncludedContainerTypes(); + StringBuilder builder = new StringBuilder(128); builder.append("terms=").append(this.savedSearchDetails.getSearch()).append("&") .append("records=").append(this.savedSearchDetails.getSearchParameters().isIncludeRecords()).append("&") .append("undeclared=").append(this.savedSearchDetails.getSearchParameters().isIncludeUndeclaredRecords()).append("&") @@ -208,10 +208,10 @@ public class SavedSearchDetailsCompatibility implements RecordsManagementModel .append("frozen=").append(this.savedSearchDetails.getSearchParameters().isIncludeFrozen()).append("&") .append("cutoff=").append(this.savedSearchDetails.getSearchParameters().isIncludeCutoff()).append("&") .append("categories=").append(includeContainerTypes.contains(TYPE_RECORD_CATEGORY)).append("&") - .append("series=").append(false); + .append("series=").append(false); return builder.toString(); } - + /** * Build the full query string * @return diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityBaseDynamicAuthority.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityBaseDynamicAuthority.java index d13facebea..7d01c36e0e 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityBaseDynamicAuthority.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityBaseDynamicAuthority.java @@ -33,29 +33,29 @@ import org.springframework.context.ApplicationContextAware; /** * Extended readers dynamic authority implementation. - * + * * @author Roy Wetherall * @since 2.1 */ -public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAuthority, - RecordsManagementModel, +public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAuthority, + RecordsManagementModel, ApplicationContextAware { /** Authority service */ private AuthorityService authorityService; - + /** Extended security service */ private ExtendedSecurityService extendedSecurityService; - + /** Node service */ private NodeService nodeService; - + /** Application context */ protected ApplicationContext applicationContext; - + // NOTE: we get the services directly from the application context in this way to avoid // cyclic relationships and issues when loading the application context - + /** * @return authority service */ @@ -67,7 +67,7 @@ public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAut } return authorityService; } - + /** * @return extended security service */ @@ -79,7 +79,7 @@ public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAut } return extendedSecurityService; } - + /** * @return node service */ @@ -100,11 +100,11 @@ public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAut { this.applicationContext = applicationContext; } - + /** * Gets a list of the authorities from the extended security aspect that this dynamic * authority is checking against. - * + * * @param nodeRef * @return */ @@ -117,26 +117,26 @@ public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAut public boolean hasAuthority(NodeRef nodeRef, String userName) { boolean result = false; - - if (getNodeService().hasAspect(nodeRef, ASPECT_EXTENDED_SECURITY) == true) + + if (getNodeService().hasAspect(nodeRef, ASPECT_EXTENDED_SECURITY)) { Set authorities = getAuthorites(nodeRef); if (authorities != null) { for (String authority : authorities) { - if ("GROUP_EVERYONE".equals(authority) == true) + if ("GROUP_EVERYONE".equals(authority)) { // 'eveyone' is there so break result = true; break; } - else if (authority.startsWith("GROUP_") == true) + else if (authority.startsWith("GROUP_")) { // check group to see if the user is contained Set contained = getAuthorityService().getContainedAuthorities(AuthorityType.USER, authority, false); - if (contained.isEmpty() == false && - contained.contains(userName) == true) + if (contained.isEmpty() == false && + contained.contains(userName)) { result = true; break; @@ -145,7 +145,7 @@ public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAut else { // presume we have a user - if (authority.equals(userName) == true) + if (authority.equals(userName)) { result = true; break; @@ -154,13 +154,13 @@ public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAut } } } - + return result; - } - + } + /** * Base implementation - * + * * @see org.alfresco.repo.security.permissions.DynamicAuthority#requiredFor() */ @Override diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java index 9394bdefcc..294ad47179 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java @@ -169,7 +169,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl // Pull any permissions found on the parent (ie the record category) final NodeRef parentNodeRef = nodeService.getPrimaryParent(recordCategory).getParentRef(); - if (parentNodeRef != null && nodeService.exists(parentNodeRef) == true) + if (parentNodeRef != null && nodeService.exists(parentNodeRef)) { AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() { @@ -182,11 +182,11 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl for (AccessPermission perm : perms) { if (fillingOnly == false || - RMPermissionModel.FILING.equals(perm.getPermission()) == true) + RMPermissionModel.FILING.equals(perm.getPermission())) { AccessStatus accessStatus = perm.getAccessStatus(); boolean allow = false; - if (AccessStatus.ALLOWED.equals(accessStatus) == true) + if (AccessStatus.ALLOWED.equals(accessStatus)) { allow = true; } @@ -216,7 +216,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl // Pull any permissions found on the parent (ie the record category) final NodeRef catNodeRef = childAssocRef.getParentRef(); - if (nodeService.exists(catNodeRef) == true) + if (nodeService.exists(catNodeRef)) { AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() { @@ -230,7 +230,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl { AccessStatus accessStatus = perm.getAccessStatus(); boolean allow = false; - if (AccessStatus.ALLOWED.equals(accessStatus) == true) + if (AccessStatus.ALLOWED.equals(accessStatus)) { allow = true; } @@ -262,7 +262,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl { public Object doWork() { - if (nodeService.exists(record) == true && nodeService.hasAspect(record, aspectTypeQName) == true) + if (nodeService.exists(record) && nodeService.hasAspect(record, aspectTypeQName)) { NodeRef recordFolder = nodeService.getPrimaryParent(record).getParentRef(); initialiseRecordPermissions(record, recordFolder); @@ -285,7 +285,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl public Void doWork() { NodeRef nodeRef = childAssocRef.getChildRef(); - if (nodeService.exists(nodeRef) == true) + if (nodeService.exists(nodeRef)) { initPermissions(nodeRef); @@ -298,7 +298,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl { AccessStatus accessStatus = perm.getAccessStatus(); boolean allow = false; - if (AccessStatus.ALLOWED.equals(accessStatus) == true) + if (AccessStatus.ALLOWED.equals(accessStatus)) { allow = true; } @@ -336,7 +336,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl { AccessStatus accessStatus = perm.getAccessStatus(); boolean allow = false; - if (AccessStatus.ALLOWED.equals(accessStatus) == true) + if (AccessStatus.ALLOWED.equals(accessStatus)) { allow = true; } @@ -363,7 +363,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl public Void doWork() { NodeRef record = sourceAssocRef.getChildRef(); - if (nodeService.exists(record) == true && nodeService.hasAspect(record, ASPECT_RECORD) == true) + if (nodeService.exists(record) && nodeService.hasAspect(record, ASPECT_RECORD)) { Set keepPerms = new HashSet(5); @@ -375,8 +375,8 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl if (ExtendedReaderDynamicAuthority.EXTENDED_READER.equals(perm.getAuthority()) == false && ExtendedWriterDynamicAuthority.EXTENDED_WRITER.equals(perm.getAuthority()) == false) { - if ((perm.getPermission().equals(RMPermissionModel.FILING) == true || - perm.getPermission().equals(RMPermissionModel.FILE_RECORDS) == true) && + if ((perm.getPermission().equals(RMPermissionModel.FILING) || + perm.getPermission().equals(RMPermissionModel.FILE_RECORDS)) && origionalParentPerms.contains(perm) == false) { // then we can assume this is a permission we want to preserve @@ -410,7 +410,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl */ private void initPermissions(final NodeRef nodeRef) { - if (nodeService.exists(nodeRef) == true) + if (nodeService.exists(nodeRef)) { AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() { @@ -442,20 +442,20 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl { public Boolean doWork() throws Exception { - if (filePlanService.isFilePlan(nodeRef) == true) + if (filePlanService.isFilePlan(nodeRef)) { setPermissionDown(nodeRef, authority, permission); } - else if (filePlanService.isFilePlanContainer(nodeRef) == true || - recordFolderService.isRecordFolder(nodeRef) == true || - recordService.isRecord(nodeRef) == true) + else if (filePlanService.isFilePlanContainer(nodeRef) || + recordFolderService.isRecordFolder(nodeRef) || + recordService.isRecord(nodeRef)) { setReadPermissionUp(nodeRef, authority); setPermissionDown(nodeRef, authority, permission); } else { - if (logger.isWarnEnabled() == true) + if (logger.isWarnEnabled()) { logger.warn("Setting permissions for this node is not supported. (nodeRef=" + nodeRef + ", authority=" + authority + ", permission=" + permission + ")"); } @@ -475,7 +475,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl private void setReadPermissionUp(NodeRef nodeRef, String authority) { NodeRef parent = nodeService.getPrimaryParent(nodeRef).getParentRef(); - if (parent != null && filePlanService.isFilePlanComponent(parent) == true) + if (parent != null && filePlanService.isFilePlanComponent(parent)) { setReadPermissionUpImpl(parent, authority); } @@ -492,7 +492,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl setPermissionImpl(nodeRef, authority, RMPermissionModel.READ_RECORDS); NodeRef parent = nodeService.getPrimaryParent(nodeRef).getParentRef(); - if (parent != null && filePlanService.isFilePlanComponent(parent) == true) + if (parent != null && filePlanService.isFilePlanComponent(parent)) { setReadPermissionUpImpl(parent, authority); } @@ -513,18 +513,18 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl // set permissions setPermissionImpl(nodeRef, authority, permission); - if (filePlanService.isFilePlanContainer(nodeRef) == true || - recordFolderService.isRecordFolder(nodeRef) == true) + if (filePlanService.isFilePlanContainer(nodeRef) || + recordFolderService.isRecordFolder(nodeRef)) { List assocs = nodeService.getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef assoc : assocs) { NodeRef child = assoc.getChildRef(); - if (filePlanService.isFilePlanContainer(child) == true || - recordFolderService.isRecordFolder(child) == true || - recordService.isRecord(child) == true || - instanceOf(child, TYPE_HOLD) == true || - instanceOf(child, TYPE_TRANSFER) == true) + if (filePlanService.isFilePlanContainer(child) || + recordFolderService.isRecordFolder(child) || + recordService.isRecord(child) || + instanceOf(child, TYPE_HOLD) || + instanceOf(child, TYPE_TRANSFER)) { setPermissionDown(child, authority, permission); } @@ -542,7 +542,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl */ private void setPermissionImpl(NodeRef nodeRef, String authority, String permission) { - if (RMPermissionModel.FILING.equals(permission) == true) + if (RMPermissionModel.FILING.equals(permission)) { // Remove record read permission before adding filing permission permissionService.deletePermission(nodeRef, authority, RMPermissionModel.READ_RECORDS); @@ -566,18 +566,18 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl // Delete permission on this node permissionService.deletePermission(nodeRef, authority, permission); - if (filePlanService.isFilePlanContainer(nodeRef) == true || - recordFolderService.isRecordFolder(nodeRef) == true) + if (filePlanService.isFilePlanContainer(nodeRef) || + recordFolderService.isRecordFolder(nodeRef)) { List assocs = nodeService.getChildAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef assoc : assocs) { NodeRef child = assoc.getChildRef(); - if (filePlanService.isFilePlanContainer(child) == true || - recordFolderService.isRecordFolder(child) == true || - recordService.isRecord(child) == true|| - instanceOf(child, TYPE_HOLD) == true || - instanceOf(child, TYPE_TRANSFER) == true) + if (filePlanService.isFilePlanContainer(child) || + recordFolderService.isRecordFolder(child) || + recordService.isRecord(child)|| + instanceOf(child, TYPE_HOLD) || + instanceOf(child, TYPE_TRANSFER)) { deletePermission(child, authority, permission); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityPostProcessor.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityPostProcessor.java index 30038c5f33..1881b5e2d4 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityPostProcessor.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityPostProcessor.java @@ -36,38 +36,38 @@ import org.springframework.beans.factory.config.TypedStringValue; /** * Records management method security post processor. *

- * Combines RM method security configuration with that of the core server before the security + * Combines RM method security configuration with that of the core server before the security * bean is instantiated. - * + * * @author Roy Wetherall */ public class RMMethodSecurityPostProcessor implements BeanFactoryPostProcessor { private static Log logger = LogFactory.getLog(RMMethodSecurityPostProcessor.class); - + public static final String PROP_OBJECT_DEFINITION_SOURCE = "objectDefinitionSource"; public static final String PROPERTY_PREFIX = "rm.methodsecurity."; public static final String SECURITY_BEAN_POSTFIX = "_security"; - + /** Security bean names */ - private Set securityBeanNames; + private Set securityBeanNames; private Set securityBeanNameCache; - + /** Configuration properties */ private Properties properties; - + /** * Set of security beans to apply RM configuration to. *

* Used in the case where the security bean does not follow the standard naming convention. - * + * * @param securityBeanNames security bean names */ public void setSecurityBeanNames(Set securityBeanNames) { this.securityBeanNames = securityBeanNames; - } - + } + /** * @param properties configuration properties */ @@ -75,7 +75,7 @@ public class RMMethodSecurityPostProcessor implements BeanFactoryPostProcessor { this.properties = properties; } - + /** * @see org.springframework.beans.factory.config.BeanFactoryPostProcessor#postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory) */ @@ -83,16 +83,16 @@ public class RMMethodSecurityPostProcessor implements BeanFactoryPostProcessor public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { for (String bean : getSecurityBeanNames(beanFactory)) - { - if (beanFactory.containsBeanDefinition(bean) == true) + { + if (beanFactory.containsBeanDefinition(bean)) { - if (logger.isDebugEnabled() == true) + if (logger.isDebugEnabled()) { logger.debug("Adding RM method security definitions for " + bean); } - - BeanDefinition beanDef = beanFactory.getBeanDefinition(bean); - PropertyValue beanValue = beanDef.getPropertyValues().getPropertyValue(PROP_OBJECT_DEFINITION_SOURCE); + + BeanDefinition beanDef = beanFactory.getBeanDefinition(bean); + PropertyValue beanValue = beanDef.getPropertyValues().getPropertyValue(PROP_OBJECT_DEFINITION_SOURCE); if (beanValue != null) { String beanStringValue = (String)((TypedStringValue)beanValue.getValue()).getValue(); @@ -102,10 +102,10 @@ public class RMMethodSecurityPostProcessor implements BeanFactoryPostProcessor } } } - + /** * Get all the security bean names by looking at the property values set. - * + * * @param beanFactory * @return */ @@ -118,56 +118,56 @@ public class RMMethodSecurityPostProcessor implements BeanFactoryPostProcessor { securityBeanNameCache.addAll(securityBeanNames); } - + for (Object key : properties.keySet()) - { + { String[] split = ((String)key).split("\\."); int index = split.length - 2; String securityBeanName = split[index] + SECURITY_BEAN_POSTFIX; - if (securityBeanNameCache.contains(securityBeanName) == false && beanFactory.containsBean(securityBeanName) == true) + if (securityBeanNameCache.contains(securityBeanName) == false && beanFactory.containsBean(securityBeanName)) { - if (logger.isDebugEnabled() == true) + if (logger.isDebugEnabled()) { logger.debug("Adding " + securityBeanName + " to list from properties."); } - + securityBeanNameCache.add(securityBeanName); - } + } } } - + return securityBeanNameCache; } - + /** * @param beanStringValue * @param rmBeanStringValue * @return */ - private String merge(String beanStringValue) + private String merge(String beanStringValue) { Map map = convertToMap(beanStringValue); - + for (Map.Entry entry : map.entrySet()) { String key = entry.getKey(); String propKey = PROPERTY_PREFIX + key; - if (properties.containsKey(propKey) == true) + if (properties.containsKey(propKey)) { map.put(key, entry.getValue() + "," + properties.getProperty(propKey)); } else { - if (logger.isWarnEnabled() == true) - { - logger.warn("Missing RM security definition for method " + key); + if (logger.isWarnEnabled()) + { + logger.warn("Missing RM security definition for method " + key); } } } - + return convertToString(map); } - + /** * @param stringValue * @return @@ -177,13 +177,13 @@ public class RMMethodSecurityPostProcessor implements BeanFactoryPostProcessor String[] values = stringValue.trim().split("\n"); Map map = new HashMap(values.length); for (String value : values) - { + { String[] pair = value.trim().split("="); map.put(pair[0], pair[1]); } return map; } - + /** * @param map * @return @@ -193,9 +193,9 @@ public class RMMethodSecurityPostProcessor implements BeanFactoryPostProcessor StringBuffer buffer = new StringBuffer(256); for (Map.Entry entry : map.entrySet()) { - buffer.append(entry.getKey()).append("=").append(entry.getValue()).append("\n"); - } - + buffer.append(entry.getKey()).append("=").append(entry.getValue()).append("\n"); + } + return buffer.toString(); } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferServiceImpl.java index 6b87c90a27..7d9ece2618 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferServiceImpl.java @@ -167,7 +167,7 @@ public class TransferServiceImpl extends ServiceBaseImpl implements TransferServ List transferredAlready = nodeService.getChildAssocs(transferNodeRef, ASSOC_TRANSFERRED, ASSOC_TRANSFERRED); for(ChildAssociationRef car : transferredAlready) { - if(car.getChildRef().equals(nodeRef) == true) + if(car.getChildRef().equals(nodeRef)) { throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NODE_ALREADY_TRANSFER, nodeRef.toString())); @@ -197,7 +197,7 @@ public class TransferServiceImpl extends ServiceBaseImpl implements TransferServ */ private void setPDFIndicationFlag(NodeRef transferNodeRef, NodeRef dispositionLifeCycleNodeRef) { - if (recordFolderService.isRecordFolder(dispositionLifeCycleNodeRef) == true) + if (recordFolderService.isRecordFolder(dispositionLifeCycleNodeRef)) { List records = recordService.getRecords(dispositionLifeCycleNodeRef); for (NodeRef record : records) @@ -209,7 +209,7 @@ public class TransferServiceImpl extends ServiceBaseImpl implements TransferServ { ContentData contentData = (ContentData)nodeService.getProperty(dispositionLifeCycleNodeRef, ContentModel.PROP_CONTENT); if (contentData != null && - MimetypeMap.MIMETYPE_PDF.equals(contentData.getMimetype()) == true) + MimetypeMap.MIMETYPE_PDF.equals(contentData.getMimetype())) { // Set the property indicator nodeService.setProperty(transferNodeRef, PROP_TRANSFER_PDF_INDICATOR, true); @@ -264,7 +264,7 @@ public class TransferServiceImpl extends ServiceBaseImpl implements TransferServ // Determine which marker aspect to use QName markerAspectQName = null; - if (accessionIndicator == true) + if (accessionIndicator) { markerAspectQName = ASPECT_ASCENDED; } @@ -275,7 +275,7 @@ public class TransferServiceImpl extends ServiceBaseImpl implements TransferServ // Mark the object and children accordingly nodeService.addAspect(nodeRef, markerAspectQName, null); - if (recordFolderService.isRecordFolder(nodeRef) == true) + if (recordFolderService.isRecordFolder(nodeRef)) { List records = recordService.getRecords(nodeRef); for (NodeRef record : records) diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImpl.java index 26b99c49fe..caa0cdc5e4 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImpl.java @@ -33,7 +33,7 @@ import org.alfresco.util.PropertyMap; /** * Helper base class for service implementations. - * + * * @author Roy Wetherall * @since 2.1 */ @@ -41,10 +41,10 @@ public class ServiceBaseImpl implements RecordsManagementModel { /** Node service */ protected NodeService nodeService; - + /** Dictionary service */ protected DictionaryService dictionaryService; - + /** * @param nodeService node service */ @@ -52,7 +52,7 @@ public class ServiceBaseImpl implements RecordsManagementModel { this.nodeService = nodeService; } - + /** * @param dictionaryService dictionary service */ @@ -60,10 +60,10 @@ public class ServiceBaseImpl implements RecordsManagementModel { this.dictionaryService = dictionaryService; } - + /** * Indicates whether the given node reference is a record or not. - * + * * @param nodeRef node reference * @return boolean true if node reference is a record, false otherwise */ @@ -73,10 +73,10 @@ public class ServiceBaseImpl implements RecordsManagementModel return nodeService.hasAspect(nodeRef, ASPECT_RECORD); } - + /** * Gets the file plan that a given file plan component resides within. - * + * * @param nodeRef node reference * @return {@link NodeRef} file plan, null if none */ @@ -93,7 +93,7 @@ public class ServiceBaseImpl implements RecordsManagementModel NodeRef result = (NodeRef)nodeService.getProperty(nodeRef, PROP_ROOT_NODEREF); if (result == null) { - if (instanceOf(nodeRef, TYPE_FILE_PLAN) == true) + if (instanceOf(nodeRef, TYPE_FILE_PLAN)) { result = nodeRef; } @@ -106,21 +106,21 @@ public class ServiceBaseImpl implements RecordsManagementModel } } } - + return result; } - + }; - + result = AuthenticationUtil.runAsSystem(runAsWork); } return result; } - + /** * Utility method to safely and quickly determine if a node is a type (or sub-type) of the one specified. - * + * * @param nodeRef node reference * @param ofClassName class name to check */ @@ -129,20 +129,20 @@ public class ServiceBaseImpl implements RecordsManagementModel ParameterCheck.mandatory("nodeRef", nodeRef); ParameterCheck.mandatory("ofClassName", ofClassName); boolean result = false; - if (nodeService.exists(nodeRef) == true && - (ofClassName.equals(nodeService.getType(nodeRef)) == true || - dictionaryService.isSubClass(nodeService.getType(nodeRef), ofClassName) == true)) + if (nodeService.exists(nodeRef) && + (ofClassName.equals(nodeService.getType(nodeRef)) || + dictionaryService.isSubClass(nodeService.getType(nodeRef), ofClassName))) { result = true; - } + } return result; } - + /** - * Utility method to get the next counter for a node. + * Utility method to get the next counter for a node. *

* If the node is not already countable, then rma:countable is added and 0 returned. - * + * * @param nodeRef node reference * @return int next counter value */ @@ -163,25 +163,25 @@ public class ServiceBaseImpl implements RecordsManagementModel { counter = value.intValue() + 1; } - else + else { counter = 1; } nodeService.setProperty(nodeRef, PROP_COUNT, counter); - + } return counter; } - + /** * Helper method to get a set containing the node's type and all it's aspects - * + * * @param nodeRef nodeRef * @return Set set of qname's */ protected Set getTypeAndApsects(NodeRef nodeRef) { - Set result = nodeService.getAspects(nodeRef); + Set result = nodeService.getAspects(nodeRef); result.add(nodeService.getType(nodeRef)); return result; } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/BroadcastVitalRecordDefinitionAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/BroadcastVitalRecordDefinitionAction.java index 695144f4c1..833fba1e76 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/BroadcastVitalRecordDefinitionAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/BroadcastVitalRecordDefinitionAction.java @@ -95,11 +95,11 @@ public class BroadcastVitalRecordDefinitionAction extends RMActionExecuterAbstra { NodeRef nextChild = nextAssoc.getChildRef(); - if (filePlanService.isFilePlanComponent(nextChild) == true && + if (filePlanService.isFilePlanComponent(nextChild) && freezeService.isFrozen(nextChild) == false) { // If the child is a record, then the VitalRecord aspect needs to be applied or updated - if (recordService.isRecord(nextChild) == true) + if (recordService.isRecord(nextChild)) { if (parentVri) { diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/ReviewedAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/ReviewedAction.java index f41dbdd24d..3eaacdd8df 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/ReviewedAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/ReviewedAction.java @@ -44,13 +44,13 @@ public class ReviewedAction extends RMActionExecuterAbstractBase protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { VitalRecordDefinition vrDef = vitalRecordService.getVitalRecordDefinition(actionedUponNodeRef); - if (vrDef != null && vrDef.isEnabled() == true) + if (vrDef != null && vrDef.isEnabled()) { - if (recordService.isRecord(actionedUponNodeRef) == true) + if (recordService.isRecord(actionedUponNodeRef)) { reviewRecord(actionedUponNodeRef, vrDef); } - else if (recordFolderService.isRecordFolder(actionedUponNodeRef) == true) + else if (recordFolderService.isRecordFolder(actionedUponNodeRef)) { for (NodeRef record : recordService.getRecords(actionedUponNodeRef)) { diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordServiceImpl.java index 0d9e339055..947f15fae6 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/VitalRecordServiceImpl.java @@ -61,7 +61,7 @@ public class VitalRecordServiceImpl extends ServiceBaseImpl /** * Behavior to initialize vital record. - * + * * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnFileRecord#onFileRecord(org.alfresco.service.cmr.repository.NodeRef) * @since 2.2 */ @@ -71,14 +71,14 @@ public class VitalRecordServiceImpl extends ServiceBaseImpl { // Calculate the review schedule VitalRecordDefinition viDef = getVitalRecordDefinition(nodeRef); - if (viDef != null && viDef.isEnabled() == true) + if (viDef != null && viDef.isEnabled()) { Date reviewAsOf = viDef.getNextReviewDate(); if (reviewAsOf != null) { Map reviewProps = new HashMap(1); reviewProps.put(RecordsManagementModel.PROP_REVIEW_AS_OF, reviewAsOf); - + if (nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD) == false) { nodeService.addAspect(nodeRef, RecordsManagementModel.ASPECT_VITAL_RECORD, reviewProps); @@ -94,7 +94,7 @@ public class VitalRecordServiceImpl extends ServiceBaseImpl else { // if we are re-filling then remove the vital aspect if it is not longer a vital record - if (nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD) == true) + if (nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD)) { nodeService.removeAspect(nodeRef, ASPECT_VITAL_RECORD); } @@ -110,19 +110,19 @@ public class VitalRecordServiceImpl extends ServiceBaseImpl // get the current review period value Period currentReviewPeriod = (Period)nodeService.getProperty(nodeRef, PROP_REVIEW_PERIOD); if (currentReviewPeriod == null || - PERIOD_NONE.equals(currentReviewPeriod) == true) + PERIOD_NONE.equals(currentReviewPeriod)) { // get the immediate parent NodeRef parentRef = nodeService.getPrimaryParent(nodeRef).getParentRef(); // is the parent a record category if (parentRef != null && - FilePlanComponentKind.RECORD_CATEGORY.equals(filePlanService.getFilePlanComponentKind(parentRef)) == true) + FilePlanComponentKind.RECORD_CATEGORY.equals(filePlanService.getFilePlanComponentKind(parentRef))) { // is the child a record category or folder FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); - if (kind.equals(FilePlanComponentKind.RECORD_CATEGORY) == true || - kind.equals(FilePlanComponentKind.RECORD_FOLDER) == true) + if (kind.equals(FilePlanComponentKind.RECORD_CATEGORY) || + kind.equals(FilePlanComponentKind.RECORD_FOLDER)) { // set the vital record definition values to match that of the parent nodeService.setProperty(nodeRef, @@ -144,13 +144,13 @@ public class VitalRecordServiceImpl extends ServiceBaseImpl VitalRecordDefinition result = null; FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); - if (FilePlanComponentKind.RECORD.equals(kind) == true) + if (FilePlanComponentKind.RECORD.equals(kind)) { result = resolveVitalRecordDefinition(nodeRef); } else { - if (nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD_DEFINITION) == true) + if (nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD_DEFINITION)) { result = VitalRecordDefinitionImpl.create(nodeService, nodeRef); } diff --git a/rm-server/source/java/org/alfresco/repo/action/parameter/NodeParameterProcessor.java b/rm-server/source/java/org/alfresco/repo/action/parameter/NodeParameterProcessor.java index 1257edf257..9deda1f1ab 100644 --- a/rm-server/source/java/org/alfresco/repo/action/parameter/NodeParameterProcessor.java +++ b/rm-server/source/java/org/alfresco/repo/action/parameter/NodeParameterProcessor.java @@ -130,7 +130,7 @@ public class NodeParameterProcessor extends ParameterProcessor implements Parame } QName type = propertyDefinition.getDataType().getName(); - if (ArrayUtils.contains(supportedDataTypes, type) == true) + if (ArrayUtils.contains(supportedDataTypes, type)) { Serializable propertyValue = nodeService.getProperty(actionedUponNodeRef, qname); if (propertyValue != null) diff --git a/rm-server/source/java/org/alfresco/repo/policy/annotation/AnnotatedBehaviourPostProcessor.java b/rm-server/source/java/org/alfresco/repo/policy/annotation/AnnotatedBehaviourPostProcessor.java index 02e8d2e6ac..2e2e6fb847 100644 --- a/rm-server/source/java/org/alfresco/repo/policy/annotation/AnnotatedBehaviourPostProcessor.java +++ b/rm-server/source/java/org/alfresco/repo/policy/annotation/AnnotatedBehaviourPostProcessor.java @@ -34,20 +34,20 @@ import org.springframework.beans.factory.config.BeanPostProcessor; * Annotated behaviour bean post processor. *

* Registers the annotated methods on behaviour beans with the policy component. - * + * * @author Roy Wetherall */ public class AnnotatedBehaviourPostProcessor implements BeanPostProcessor { /** logger */ private static Log logger = LogFactory.getLog(AnnotatedBehaviourPostProcessor.class); - + /** policy component */ private PolicyComponent policyComponent; - + /** namespace service */ private NamespaceService namespaceService; - + /** * @param policyComponent policy component */ @@ -55,7 +55,7 @@ public class AnnotatedBehaviourPostProcessor implements BeanPostProcessor { this.policyComponent = policyComponent; } - + /** * @param namespaceService namespace service */ @@ -63,7 +63,7 @@ public class AnnotatedBehaviourPostProcessor implements BeanPostProcessor { this.namespaceService = namespaceService; } - + /** * @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization(java.lang.Object, java.lang.String) */ @@ -72,7 +72,7 @@ public class AnnotatedBehaviourPostProcessor implements BeanPostProcessor { // register annotated behavior methods registerBehaviours(bean, beanName); - + // return the bean return bean; } @@ -86,20 +86,20 @@ public class AnnotatedBehaviourPostProcessor implements BeanPostProcessor // do nothing return bean; } - + /** * Register behaviours. - * + * * @param bean bean * @param beanName bean name */ private void registerBehaviours(Object bean, String beanName) - { - if (bean.getClass().isAnnotationPresent(BehaviourBean.class) == true) + { + if (bean.getClass().isAnnotationPresent(BehaviourBean.class)) { BehaviourBean behaviourBean = bean.getClass().getAnnotation(BehaviourBean.class); - - if (logger.isDebugEnabled() == true) + + if (logger.isDebugEnabled()) { logger.debug("Annotated behaviour post processing for " + beanName); } @@ -107,17 +107,17 @@ public class AnnotatedBehaviourPostProcessor implements BeanPostProcessor Method[] methods = bean.getClass().getMethods(); for (Method method : methods) { - if (method.isAnnotationPresent(Behaviour.class) == true) - { + if (method.isAnnotationPresent(Behaviour.class)) + { registerBehaviour(behaviourBean, bean, beanName, method); } } } } - + /** * Register behaviour. - * + * * @param behaviourBean behaviour bean annotation * @param bean bean * @param beanName bean name @@ -128,45 +128,45 @@ public class AnnotatedBehaviourPostProcessor implements BeanPostProcessor Behaviour behaviour = method.getAnnotation(Behaviour.class); QName policy = resolvePolicy(behaviour.policy(), method); QName type = resolveType(behaviourBean, behaviour); - + // assert that the policy and type have been set!! ParameterCheck.mandatory("policy", policy); if (behaviour.isService() == false) { ParameterCheck.mandatory("type", type); } - - if (logger.isDebugEnabled() == true) + + if (logger.isDebugEnabled()) { if (behaviour.isService() == false) - { - logger.debug(" ... binding " + behaviour.kind() + " behaviour for " + beanName + "." + method.getName() + - " for policy " + policy.toString() + + { + logger.debug(" ... binding " + behaviour.kind() + " behaviour for " + beanName + "." + method.getName() + + " for policy " + policy.toString() + " and type " + type.toString()); } else { - logger.debug(" ... binding " + behaviour.kind() + " service behaviour for " + beanName + "." + method.getName() + + logger.debug(" ... binding " + behaviour.kind() + " service behaviour for " + beanName + "." + method.getName() + " for policy " + policy.toString()); } } - + // create java behaviour object JavaBehaviour javaBehaviour = new JavaBehaviour(bean, method.getName(), behaviour.notificationFrequency()); - + // determine whether we should register the behaviour if (bean instanceof BehaviourRegistry && behaviour.name().isEmpty() == false) { - if (logger.isDebugEnabled() == true) + if (logger.isDebugEnabled()) { logger.debug(" ... adding behaviour to registry with name " + behaviour.name()); } - + ((BehaviourRegistry)bean).registerBehaviour(behaviour.name(), javaBehaviour); } - + // deal with class behaviours - if (BehaviourKind.CLASS.equals(behaviour.kind()) == true) + if (BehaviourKind.CLASS.equals(behaviour.kind())) { if (behaviour.isService() == false) { @@ -180,27 +180,27 @@ public class AnnotatedBehaviourPostProcessor implements BeanPostProcessor } } // deal with association behaviours - else if (BehaviourKind.ASSOCIATION.equals(behaviour.kind()) == true) + else if (BehaviourKind.ASSOCIATION.equals(behaviour.kind())) { if (behaviour.isService() == false) - { + { // bind association behaviour for given type and assoc type - policyComponent.bindAssociationBehaviour(policy, - type, + policyComponent.bindAssociationBehaviour(policy, + type, toQName(behaviour.assocType()), - javaBehaviour); + javaBehaviour); } else - { + { // bind association service behaviour - policyComponent.bindAssociationBehaviour(policy, bean, javaBehaviour); + policyComponent.bindAssociationBehaviour(policy, bean, javaBehaviour); } - } + } } - + /** * Resolve the policy qname, defaulting to the qualified name of the method if none specified. - * + * * @param policyName policy name * @param method method * @return {@link QName} qualified name of the policy @@ -208,7 +208,7 @@ public class AnnotatedBehaviourPostProcessor implements BeanPostProcessor private QName resolvePolicy(String policyName, Method method) { QName policy = null; - if (policyName.isEmpty() == true) + if (policyName.isEmpty()) { policy = QName.createQName(NamespaceService.ALFRESCO_URI, method.getName()); } @@ -216,12 +216,12 @@ public class AnnotatedBehaviourPostProcessor implements BeanPostProcessor { policy = toQName(policyName); } - - return policy; + + return policy; } - + /** - * + * * @param behaviourBean * @param typeName * @return @@ -231,7 +231,7 @@ public class AnnotatedBehaviourPostProcessor implements BeanPostProcessor QName type = null; if (behaviour.isService() == false) { - if (behaviour.type().isEmpty() == true) + if (behaviour.type().isEmpty()) { // get default type = toQName(behaviourBean.defaultType()); @@ -244,9 +244,9 @@ public class AnnotatedBehaviourPostProcessor implements BeanPostProcessor } return type; } - + /** - * + * * @param name * @return */ diff --git a/rm-server/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java b/rm-server/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java index df1f8bf5b8..49d8c7e47a 100644 --- a/rm-server/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java +++ b/rm-server/source/java/org/alfresco/repo/rule/ExtendedRuleServiceImpl.java @@ -44,7 +44,7 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl /** ignore types */ private Set ignoredTypes = new HashSet(); - + /** file plan service */ private FilePlanService filePlanService; @@ -53,7 +53,7 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl /** node service */ protected NodeService nodeService; - + /** * @param runAsRmAdmin true if run rules as rmadmin, false otherwise */ @@ -77,11 +77,11 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl { this.nodeService = nodeService; } - + /** * @param filePlanService file plan service */ - public void setFilePlanService(FilePlanService filePlanService) + public void setFilePlanService(FilePlanService filePlanService) { this.filePlanService = filePlanService; } @@ -107,7 +107,7 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl @Override public void saveRule(final NodeRef nodeRef, final Rule rule) { - if (filePlanService.isFilePlanComponent(nodeRef) == true) + if (filePlanService.isFilePlanComponent(nodeRef)) { AuthenticationUtil.runAsSystem(new RunAsWork() { @@ -132,7 +132,7 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl @Override public void removeRule(final NodeRef nodeRef, final Rule rule) { - if (filePlanService.isFilePlanComponent(nodeRef) == true) + if (filePlanService.isFilePlanComponent(nodeRef)) { AuthenticationUtil.runAsSystem(new RunAsWork() { @@ -157,24 +157,24 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl @Override public void executeRule(final Rule rule, final NodeRef nodeRef, final Set executedRules) { - if (nodeService.exists(nodeRef) == true) + if (nodeService.exists(nodeRef)) { QName typeQName = nodeService.getType(nodeRef); - + // check if this is a rm rule on a rm artifact - if (filePlanService.isFilePlanComponent(nodeRef) == true && - isFilePlanComponentRule(rule) == true) + if (filePlanService.isFilePlanComponent(nodeRef) && + isFilePlanComponentRule(rule)) { // ignore and if (isIgnoredType(typeQName) == false) { - if (runAsRmAdmin == true) + if (runAsRmAdmin) { // run as rmadmin - filePlanAuthenticationService.runAsRmAdmin(new RunAsWork() + filePlanAuthenticationService.runAsRmAdmin(new RunAsWork() { @Override - public Void doWork() throws Exception + public Void doWork() throws Exception { ExtendedRuleServiceImpl.super.executeRule(rule, nodeRef, executedRules); return null; @@ -198,7 +198,7 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl /** * Indicates whether the rule is a file plan component - * + * * @param rule rule * @return boolean true if rule is set on a file plan component, false otherwise */ @@ -209,7 +209,7 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl } /** - * @param typeQName type qname + * @param typeQName type qname * @return boolean true if ignore type, false otherwise */ private boolean isIgnoredType(QName typeQName) diff --git a/rm-server/source/java/org/alfresco/repo/rule/ruletrigger/ExtendedBeforeDeleteChildAssociationRuleTrigger.java b/rm-server/source/java/org/alfresco/repo/rule/ruletrigger/ExtendedBeforeDeleteChildAssociationRuleTrigger.java index 7ebfd70775..7297b36009 100644 --- a/rm-server/source/java/org/alfresco/repo/rule/ruletrigger/ExtendedBeforeDeleteChildAssociationRuleTrigger.java +++ b/rm-server/source/java/org/alfresco/repo/rule/ruletrigger/ExtendedBeforeDeleteChildAssociationRuleTrigger.java @@ -33,7 +33,7 @@ import org.apache.commons.logging.LogFactory; /** * Prevent multiple triggering of outbound rules when moving records. - * + * * @author Roy Wetherall */ public class ExtendedBeforeDeleteChildAssociationRuleTrigger @@ -44,33 +44,33 @@ public class ExtendedBeforeDeleteChildAssociationRuleTrigger * The logger */ private static Log logger = LogFactory.getLog(BeforeDeleteChildAssociationRuleTrigger.class); - + private static final String POLICY = "beforeDeleteChildAssociation"; - + private boolean isClassBehaviour = false; - + public void setIsClassBehaviour(boolean isClassBehaviour) { this.isClassBehaviour = isClassBehaviour; } - + /** * @see org.alfresco.repo.rule.ruletrigger.RuleTrigger#registerRuleTrigger() */ public void registerRuleTrigger() { - if (isClassBehaviour == true) + if (isClassBehaviour) { this.policyComponent.bindClassBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, POLICY), - this, + QName.createQName(NamespaceService.ALFRESCO_URI, POLICY), + this, new JavaBehaviour(this, POLICY, NotificationFrequency.FIRST_EVENT)); } else { this.policyComponent.bindAssociationBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, POLICY), - this, + QName.createQName(NamespaceService.ALFRESCO_URI, POLICY), + this, new JavaBehaviour(this, POLICY, NotificationFrequency.FIRST_EVENT)); } } @@ -91,12 +91,12 @@ public class ExtendedBeforeDeleteChildAssociationRuleTrigger { return; } - - if (logger.isDebugEnabled() == true) + + if (logger.isDebugEnabled()) { logger.debug("Single child assoc trigger (policy = " + POLICY + ") fired for parent node " + childAssocRef.getParentRef() + " and child node " + childAssocRef.getChildRef()); } - + triggerRules(childAssocRef.getParentRef(), childNodeRef); } diff --git a/rm-server/source/java/org/alfresco/repo/security/permissions/impl/RMPermissionServiceImpl.java b/rm-server/source/java/org/alfresco/repo/security/permissions/impl/RMPermissionServiceImpl.java index aba0984bfd..ba52558447 100644 --- a/rm-server/source/java/org/alfresco/repo/security/permissions/impl/RMPermissionServiceImpl.java +++ b/rm-server/source/java/org/alfresco/repo/security/permissions/impl/RMPermissionServiceImpl.java @@ -39,7 +39,7 @@ import org.springframework.context.ApplicationEvent; * permission. *

* This is required for SOLR support. - * + * * @author Roy Wetherall */ public class RMPermissionServiceImpl extends PermissionServiceImpl @@ -47,7 +47,7 @@ public class RMPermissionServiceImpl extends PermissionServiceImpl { /** Writers simple cache */ protected SimpleCache> writersCache; - + /** * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#setAnyDenyDenies(boolean) */ @@ -57,7 +57,7 @@ public class RMPermissionServiceImpl extends PermissionServiceImpl super.setAnyDenyDenies(anyDenyDenies); writersCache.clear(); } - + /** * @param writersCache the writersCache to set */ @@ -65,44 +65,44 @@ public class RMPermissionServiceImpl extends PermissionServiceImpl { this.writersCache = writersCache; } - + /** * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#onBootstrap(org.springframework.context.ApplicationEvent) */ @Override protected void onBootstrap(ApplicationEvent event) { - super.onBootstrap(event); + super.onBootstrap(event); PropertyCheck.mandatory(this, "writersCache", writersCache); } - + /** * Override to deal with the possibility of hard coded permission checks in core code. - * + * * Note: Eventually we need to merge the RM permission model into the core to make this more rebust. - * + * * @see org.alfresco.repo.security.permissions.impl.ExtendedPermissionService#hasPermission(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) */ @Override public AccessStatus hasPermission(NodeRef nodeRef, String perm) { AccessStatus acs = super.hasPermission(nodeRef, perm); - if (AccessStatus.DENIED.equals(acs) == true && - PermissionService.READ.equals(perm) == true && - nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) == true) + if (AccessStatus.DENIED.equals(acs) && + PermissionService.READ.equals(perm) && + nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) { return super.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS); } - else if (AccessStatus.DENIED.equals(acs) == true && - PermissionService.WRITE.equals(perm) == true && - nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) == true) + else if (AccessStatus.DENIED.equals(acs) && + PermissionService.WRITE.equals(perm) && + nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) { return super.hasPermission(nodeRef, RMPermissionModel.FILE_RECORDS); } - + return acs; } - + /** * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#canRead(java.lang.Long) */ @@ -111,8 +111,8 @@ public class RMPermissionServiceImpl extends PermissionServiceImpl { Set authorities = getAuthorisations(); - // test denied - + // test denied + if(anyDenyDenies) { @@ -125,12 +125,12 @@ public class RMPermissionServiceImpl extends PermissionServiceImpl return AccessStatus.DENIED; } } - + } // test acl readers Set aclReaders = getReaders(aclId); - + for(String auth : aclReaders) { if(authorities.contains(auth)) @@ -141,7 +141,7 @@ public class RMPermissionServiceImpl extends PermissionServiceImpl return AccessStatus.DENIED; } - + /** * @see org.alfresco.repo.security.permissions.impl.PermissionServiceImpl#getReaders(java.lang.Long) */ @@ -159,7 +159,7 @@ public class RMPermissionServiceImpl extends PermissionServiceImpl { return aclReaders; } - + HashSet assigned = new HashSet(); HashSet readers = new HashSet(); @@ -185,7 +185,7 @@ public class RMPermissionServiceImpl extends PermissionServiceImpl /** * Override with check for RM read - * + * * @param aclId * @return */ @@ -219,12 +219,12 @@ public class RMPermissionServiceImpl extends PermissionServiceImpl denied.add(authority); } } - + readersDeniedCache.put((Serializable)acl.getProperties(), denied); return denied; } - + /** * @see org.alfresco.repo.security.permissions.impl.ExtendedPermissionService#getWriters(java.lang.Long) */ @@ -241,7 +241,7 @@ public class RMPermissionServiceImpl extends PermissionServiceImpl { return aclWriters; } - + HashSet assigned = new HashSet(); HashSet readers = new HashSet(); diff --git a/rm-server/source/java/org/alfresco/repo/web/scripts/dictionary/RmClassesGet.java b/rm-server/source/java/org/alfresco/repo/web/scripts/dictionary/RmClassesGet.java index 6628221c73..762c4569fe 100644 --- a/rm-server/source/java/org/alfresco/repo/web/scripts/dictionary/RmClassesGet.java +++ b/rm-server/source/java/org/alfresco/repo/web/scripts/dictionary/RmClassesGet.java @@ -185,7 +185,7 @@ public class RmClassesGet extends DictionaryWebServiceBase implements RecordsMan } } - if (classdef.isEmpty() == true) + if (classdef.isEmpty()) { for (QName qnameObj : qnames) { @@ -213,7 +213,7 @@ public class RmClassesGet extends DictionaryWebServiceBase implements RecordsMan */ private Collection getTypes(boolean isRM) { - if (isRM == true) + if (isRM) { return this.dictionaryservice.getTypes(RM_MODEL); } @@ -231,7 +231,7 @@ public class RmClassesGet extends DictionaryWebServiceBase implements RecordsMan */ private Collection getAspects(boolean isRM) { - if (isRM == true) + if (isRM) { return this.dictionaryservice.getAspects(RM_MODEL); } diff --git a/rm-server/source/java/org/alfresco/repo/web/scripts/dictionary/RmDictionaryWebServiceUtils.java b/rm-server/source/java/org/alfresco/repo/web/scripts/dictionary/RmDictionaryWebServiceUtils.java index eea2d809c1..9c1cfb874e 100644 --- a/rm-server/source/java/org/alfresco/repo/web/scripts/dictionary/RmDictionaryWebServiceUtils.java +++ b/rm-server/source/java/org/alfresco/repo/web/scripts/dictionary/RmDictionaryWebServiceUtils.java @@ -43,12 +43,12 @@ public class RmDictionaryWebServiceUtils { boolean isRmSite = false; String siteId = req.getParameter(SITE_ID); - if (StringUtils.isNotBlank(siteId) == true) + if (StringUtils.isNotBlank(siteId)) { SiteInfo site = siteService.getSite(siteId); if (site != null) { - if (site.getSitePreset().equals(SITE_PRESET) == true) + if (site.getSitePreset().equals(SITE_PRESET)) { isRmSite = true; } diff --git a/rm-server/source/java/org/alfresco/repo/web/scripts/dictionary/RmPropertiesGet.java b/rm-server/source/java/org/alfresco/repo/web/scripts/dictionary/RmPropertiesGet.java index 5c2ad7395a..93f45057c4 100644 --- a/rm-server/source/java/org/alfresco/repo/web/scripts/dictionary/RmPropertiesGet.java +++ b/rm-server/source/java/org/alfresco/repo/web/scripts/dictionary/RmPropertiesGet.java @@ -139,7 +139,7 @@ public class RmPropertiesGet extends DictionaryWebServiceBase implements Records for (Map.Entry entry : propMap.entrySet()) { if ((namespaceURI != null && - namespaceURI.equals(entry.getKey().getNamespaceURI()) == true) || + namespaceURI.equals(entry.getKey().getNamespaceURI())) || namespaceURI == null) { props.add(entry.getValue()); @@ -165,7 +165,7 @@ public class RmPropertiesGet extends DictionaryWebServiceBase implements Records */ private Collection getProperties(boolean isRM) { - if (isRM == true) + if (isRM) { return dictionaryservice.getProperties(RM_MODEL); } diff --git a/rm-server/source/java/org/alfresco/repo/web/scripts/rule/RmActionConditionDefinitionsGet.java b/rm-server/source/java/org/alfresco/repo/web/scripts/rule/RmActionConditionDefinitionsGet.java index 22db936be7..3f8ac376ce 100644 --- a/rm-server/source/java/org/alfresco/repo/web/scripts/rule/RmActionConditionDefinitionsGet.java +++ b/rm-server/source/java/org/alfresco/repo/web/scripts/rule/RmActionConditionDefinitionsGet.java @@ -41,33 +41,33 @@ import org.springframework.extensions.webscripts.WebScriptRequest; public class RmActionConditionDefinitionsGet extends DeclarativeWebScript { private ActionService actionService; - + private RecordsManagementActionService recordsManagementActionService; - + public void setActionService(ActionService actionService) { this.actionService = actionService; } - + public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) { this.recordsManagementActionService = recordsManagementActionService; } - + /** * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) */ @Override protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) { - List dmDefs = actionService.getActionConditionDefinitions(); + List dmDefs = actionService.getActionConditionDefinitions(); List conditions = recordsManagementActionService.getRecordsManagementActionConditions(); - + List defs = new ArrayList(dmDefs.size()+conditions.size()); defs.addAll(dmDefs); for (RecordsManagementActionCondition condition: conditions) { - if (condition.isPublicCondition() == true) + if (condition.isPublicCondition()) { defs.add(condition.getRecordsManagementActionConditionDefinition()); } diff --git a/rm-server/source/java/org/alfresco/repo/web/scripts/rule/RmActionDefinitionsGet.java b/rm-server/source/java/org/alfresco/repo/web/scripts/rule/RmActionDefinitionsGet.java index 407f6ef7ae..4aafdbcbad 100644 --- a/rm-server/source/java/org/alfresco/repo/web/scripts/rule/RmActionDefinitionsGet.java +++ b/rm-server/source/java/org/alfresco/repo/web/scripts/rule/RmActionDefinitionsGet.java @@ -41,12 +41,12 @@ import org.springframework.extensions.webscripts.WebScriptRequest; public class RmActionDefinitionsGet extends DeclarativeWebScript { private RecordsManagementActionService recordsManagementActionService; - + public void setRecordsManagementActionService(RecordsManagementActionService recordsManagementActionService) { this.recordsManagementActionService = recordsManagementActionService; } - + /** * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) */ @@ -57,15 +57,15 @@ public class RmActionDefinitionsGet extends DeclarativeWebScript Set defs = new HashSet(actions.size()); for (RecordsManagementAction action : actions) { - if (action.isPublicAction() == true) + if (action.isPublicAction()) { defs.add(action.getRecordsManagementActionDefinition()); } } - + Map model = new HashMap(); model.put("actiondefinitions", defs); - + return model; } } diff --git a/rm-server/source/java/org/alfresco/repo/web/scripts/substitutionsuggestions/RmSubstitutionSuggestionsGet.java b/rm-server/source/java/org/alfresco/repo/web/scripts/substitutionsuggestions/RmSubstitutionSuggestionsGet.java index 0c41818a2f..5f719f51b6 100644 --- a/rm-server/source/java/org/alfresco/repo/web/scripts/substitutionsuggestions/RmSubstitutionSuggestionsGet.java +++ b/rm-server/source/java/org/alfresco/repo/web/scripts/substitutionsuggestions/RmSubstitutionSuggestionsGet.java @@ -243,7 +243,7 @@ public class RmSubstitutionSuggestionsGet extends DeclarativeWebScript { StoreRef storeRef = new StoreRef(storeType, storeId); NodeRef nodeRef = new NodeRef(storeRef, id); - if (filePlanService.isFilePlan(nodeRef) == true) + if (filePlanService.isFilePlan(nodeRef)) { filePlan = nodeRef; } diff --git a/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoUtils.java b/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoUtils.java index 4b2de8a6f8..43e386abd8 100644 --- a/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoUtils.java +++ b/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoUtils.java @@ -113,7 +113,7 @@ public class RequestInfoUtils String userName = null; String ruleCreator = (String) delegateTask.getVariable("rmwf_ruleCreator"); - if (StringUtils.isBlank(ruleCreator) == true) + if (StringUtils.isBlank(ruleCreator)) { ActivitiScriptNode initiator = (ActivitiScriptNode) delegateTask.getVariable("initiator"); if (initiator.exists()) diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/capabilities/DeclarativeCapabilityTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/capabilities/DeclarativeCapabilityTest.java index e9c069733a..1715b067d7 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/capabilities/DeclarativeCapabilityTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/capabilities/DeclarativeCapabilityTest.java @@ -178,7 +178,7 @@ public class DeclarativeCapabilityTest extends BaseRMTestCase AccessStatus accessStatus = capability.hasPermission(filePlanComponent); Set roles = filePlanRoleService.getRolesByUser(filePlan, userName); - if (roles.isEmpty() == true) + if (roles.isEmpty()) { assertEquals("User " + userName + " has no RM role so we expect access to be denied for capability " + capability.getName(), AccessStatus.DENIED, @@ -191,7 +191,7 @@ public class DeclarativeCapabilityTest extends BaseRMTestCase List kinds = capability.getKinds(); if (kinds == null || - kinds.contains(actualKind.toString()) == true) + kinds.contains(actualKind.toString())) { Map conditions = capability.getConditions(); boolean conditionResult = getConditionResult(filePlanComponent, conditions); @@ -201,7 +201,7 @@ public class DeclarativeCapabilityTest extends BaseRMTestCase assertNotNull(role); Set roleCapabilities = role.getCapabilities(); - if (roleCapabilities.contains(capability) == true && conditionResult == true) + if (roleCapabilities.contains(capability) && conditionResult) { assertEquals("User " + userName + " has the role " + role.getDisplayLabel() + " so we expect access to be allowed for capability " + capability.getName() + " on the object " + diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/jscript/JSONConversionComponentTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/jscript/JSONConversionComponentTest.java index 0d2fbcc0b6..e5c6a0ec27 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/jscript/JSONConversionComponentTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/jscript/JSONConversionComponentTest.java @@ -31,77 +31,77 @@ import org.json.JSONObject; * @author Roy Wetherall */ public class JSONConversionComponentTest extends BaseRMTestCase -{ +{ private JSONConversionComponent converter; - - private NodeRef record; - + + private NodeRef record; + @Override protected void initServices() { super.initServices(); converter = (JSONConversionComponent)applicationContext.getBean("jsonConversionComponent"); } - + @Override protected void setupTestDataImpl() { super.setupTestDataImpl(); - + // Create records record = utils.createRecord(rmFolder, "testRecord.txt"); } - + public void testJSON() throws Exception - { + { doTestInTransaction(new JSONTest ( filePlan, new String[]{"isRmNode", "true", "boolean"}, new String[]{"rmNode.kind", "FILE_PLAN"} - ){}); - + ){}); + doTestInTransaction(new JSONTest ( rmContainer, new String[]{"isRmNode", "true", "boolean"}, new String[]{"rmNode.kind", "RECORD_CATEGORY"} ){}); - + doTestInTransaction(new JSONTest ( rmFolder, new String[]{"isRmNode", "true", "boolean"}, new String[]{"rmNode.kind", "RECORD_FOLDER"} - ){}); - + ){}); + doTestInTransaction(new JSONTest ( record, new String[]{"isRmNode", "true", "boolean"}, new String[]{"rmNode.kind", "RECORD"} - ){}); + ){}); } - + class JSONTest extends Test { private NodeRef nodeRef; private String[][] testValues; - + public JSONTest(NodeRef nodeRef, String[] ... testValues) { this.nodeRef = nodeRef; this.testValues = testValues; } - + @Override public JSONObject run() throws Exception - { + { String json = converter.toJSON(nodeRef, true); System.out.println(json); return new JSONObject(json); } - + @Override public void test(JSONObject result) throws Exception { @@ -112,29 +112,29 @@ public class JSONConversionComponentTest extends BaseRMTestCase if (testValue.length == 3) { type = testValue[2]; - } + } Serializable value = convertValue(testValue[1], type); Serializable actualValue = (Serializable)getValue(result, key); - + assertEquals("The key " + key + " did not have the expected value.", value, actualValue); } } - + private Serializable convertValue(String stringValue, String type) { Serializable value = stringValue; - if (type.equals("boolean") == true) + if (type.equals("boolean")) { value = new Boolean(stringValue); - } + } return value; } - + private Object getValue(JSONObject jsonObject, String key) throws JSONException { return getValue(jsonObject, key.split("\\.")); } - + private Object getValue(JSONObject jsonObject, String[] key) throws JSONException { if (key.length == 1) diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/DispositionServiceImplTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/DispositionServiceImplTest.java index 51d18234b4..0b58483d52 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/DispositionServiceImplTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/DispositionServiceImplTest.java @@ -773,7 +773,7 @@ public class DispositionServiceImplTest extends BaseRMTestCase { String origEvent = i.next(); - if (expectedEvents.contains(origEvent) == true) + if (expectedEvents.contains(origEvent)) { i.remove(); copy.remove(origEvent); @@ -804,7 +804,7 @@ public class DispositionServiceImplTest extends BaseRMTestCase fail(buff.toString()); } - if (CommonRMTestUtils.PERIOD_NONE.equals(strPeriod) == true) + if (CommonRMTestUtils.PERIOD_NONE.equals(strPeriod)) { assertNull(da.getAsOfDate()); } @@ -972,7 +972,7 @@ public class DispositionServiceImplTest extends BaseRMTestCase dispositionService.updateDispositionActionDefinition( actionDefinition, - adParams ); + adParams); return actionDefinition; } diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/ExtendedActionServiceTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/ExtendedActionServiceTest.java index cbc8157966..8127c09869 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/ExtendedActionServiceTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/ExtendedActionServiceTest.java @@ -123,7 +123,7 @@ public class ExtendedActionServiceTest extends BaseRMTestCase for (ActionDefinition actionDefinition : list) { - if (actionDefinition.getName().equals(actionName) == true) + if (actionDefinition.getName().equals(actionName)) { result = true; break; diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RMCaveatConfigServiceImplTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RMCaveatConfigServiceImplTest.java index e36de6ef56..318ecefdc7 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RMCaveatConfigServiceImplTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RMCaveatConfigServiceImplTest.java @@ -42,54 +42,54 @@ import org.alfresco.util.PropertyMap; /** * Test of RM Caveat (Admin facing scripts) - * + * * @author Mark Rogers */ public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD5015Model -{ +{ protected static StoreRef SPACES_STORE = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"); - + private NodeRef filePlan; - + private NodeService nodeService; private TransactionService transactionService; private RMCaveatConfigService caveatConfigService; - + private MutableAuthenticationService authenticationService; private PersonService personService; private AuthorityService authorityService; - + // example base test data for supplemental markings list protected final static String NOFORN = "NOFORN"; // Not Releasable to Foreign Nationals/Governments/Non-US Citizens protected final static String NOCONTRACT = "NOCONTRACT"; // Not Releasable to Contractors or Contractor/Consultants - protected final static String FOUO = "FOUO"; // For Official Use Only + protected final static String FOUO = "FOUO"; // For Official Use Only protected final static String FGI = "FGI"; // Foreign Government Information - + protected final static String RM_LIST = "rmc:smList"; // existing pre-defined list protected final static String RM_LIST_ALT = "rmc:anoList"; - + @Override - protected void onSetUpInTransaction() throws Exception + protected void onSetUpInTransaction() throws Exception { super.onSetUpInTransaction(); // Get the service required in the tests - this.nodeService = (NodeService)this.applicationContext.getBean("NodeService"); // use upper 'N'odeService (to test access config interceptor) + this.nodeService = (NodeService)this.applicationContext.getBean("NodeService"); // use upper 'N'odeService (to test access config interceptor) this.authenticationService = (MutableAuthenticationService)this.applicationContext.getBean("AuthenticationService"); this.personService = (PersonService)this.applicationContext.getBean("PersonService"); this.authorityService = (AuthorityService)this.applicationContext.getBean("AuthorityService"); this.caveatConfigService = (RMCaveatConfigServiceImpl)this.applicationContext.getBean("caveatConfigService"); this.transactionService = (TransactionService)this.applicationContext.getBean("TransactionService"); - - + + // Set the current security context as admin AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - + // Get the test data setUpTestData(); } - + private void setUpTestData() { } @@ -110,58 +110,58 @@ public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD //System.out.println("DID NOT DELETE FILE PLAN!"); } } - + @Override protected void onTearDownAfterTransaction() throws Exception { // TODO Auto-generated method stub super.onTearDownAfterTransaction(); } - + public void testSetup() { // NOOP - } - - + } + + /** * Test of Caveat Config - * + * * @throws Exception */ public void testAddRMConstraintList() throws Exception { setComplete(); endTransaction(); - + cleanCaveatConfigData(); - + startNewTransaction(); - + /** * Now remove the entire list (rma:smList); */ logger.debug("test remove entire list rmc:smList"); caveatConfigService.deleteRMConstraint(RM_LIST); - + /** * Now add the list again */ logger.debug("test add back rmc:smList"); caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - + /** * Negative test - add a list that already exists */ logger.debug("try to create duplicate list rmc:smList"); caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - + /** * Negative test - remove a list that does not exist */ logger.debug("test remove entire list rmc:smList"); caveatConfigService.deleteRMConstraint(RM_LIST); - try + try { caveatConfigService.deleteRMConstraint(RM_LIST); fail("unknown constraint should have thrown an exception"); @@ -170,13 +170,13 @@ public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD { // expect to go here } - - + + /** * Negative test - add a constraint to property that does not exist */ logger.debug("test property does not exist"); - try + try { caveatConfigService.addRMConstraint("rma:mer", "", new String[0]); fail("unknown property should have thrown an exception"); @@ -187,25 +187,25 @@ public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD } endTransaction(); cleanCaveatConfigData(); - + } - + /** * Test of addRMConstraintListValue - * + * * @throws Exception */ public void testAddRMConstraintListValue() throws Exception { setComplete(); endTransaction(); - + cleanCaveatConfigData(); setupCaveatConfigData(); - + startNewTransaction(); caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - + /** * Add a user to the list */ @@ -213,17 +213,17 @@ public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD values.add(NOFORN); values.add(NOCONTRACT); caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); - + /** * Add another value to that list */ caveatConfigService.addRMConstraintListValue(RM_LIST, "jrogers", FGI); - + /** * Negative test - attempt to add a duplicate value */ caveatConfigService.addRMConstraintListValue(RM_LIST, "jrogers", FGI); - + /** * Negative test - attempt to add to a list that does not exist */ @@ -231,17 +231,17 @@ public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD { caveatConfigService.addRMConstraintListValue(RM_LIST_ALT, "mhouse", FGI); fail("exception not thrown"); - } + } catch (Exception re) { // should go here - + } - + /** * Negative test - attempt to add to a list that does exist and user that does not exist */ - try + try { caveatConfigService.addRMConstraintListValue(RM_LIST, "mhouse", FGI); fail("exception not thrown"); @@ -250,27 +250,27 @@ public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD { // should go here } - + } - + /** * Test of UpdateRMConstraintListAuthority - * + * * @throws Exception */ public void testUpdateRMConstraintListAuthority() throws Exception { setComplete(); endTransaction(); - + cleanCaveatConfigData(); setupCaveatConfigData(); - + startNewTransaction(); - + caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - + /** * Add a user to the list */ @@ -278,7 +278,7 @@ public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD values.add(NOFORN); values.add(NOCONTRACT); caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); - + /** * Add to a authority that already exists * Should replace existing authority @@ -286,103 +286,103 @@ public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD List updatedValues = new ArrayList(); values.add(FGI); caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", updatedValues); - + /** * Add a group to the list */ caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "Engineering", values); - + /** * Add to a list that does not exist * Should create a new list */ caveatConfigService.deleteRMConstraint(RM_LIST); caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); - - + + /** * Add to a authority that already exists * Should replace existing authority */ - + endTransaction(); cleanCaveatConfigData(); - + } - + /** * Test of RemoveRMConstraintListAuthority - * + * * @throws Exception */ public void testRemoveRMConstraintListAuthority() throws Exception { setComplete(); endTransaction(); - + cleanCaveatConfigData(); setupCaveatConfigData(); - + startNewTransaction(); caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - + List values = new ArrayList(); values.add(FGI); caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); - + /** * Remove a user from a list */ caveatConfigService.removeRMConstraintListAuthority(RM_LIST, "jrogers"); - + /** * Negative test - remove a user that does not exist */ caveatConfigService.removeRMConstraintListAuthority(RM_LIST, "jrogers"); - + /** * Negative test - remove a user from a list that does not exist. * Should create a new list */ - + caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "jrogers", values); - + endTransaction(); cleanCaveatConfigData(); - + } - - - + + + /** * Test of Caveat Config - * + * * @throws Exception */ public void testRMCaveatConfig() throws Exception { setComplete(); endTransaction(); - + cleanCaveatConfigData(); - + startNewTransaction(); - + caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); List values = new ArrayList(); values.add(NOFORN); values.add(FOUO); caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "dfranco", values); - + values.add(FGI); values.add(NOCONTRACT); caveatConfigService.updateRMConstraintListAuthority(RM_LIST, "dmartinz", values); - + // Test list of allowed values for caveats - + List allowedValues = AuthenticationUtil.runAs(new RunAsWork>() { public List doWork() @@ -391,12 +391,12 @@ public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD return caveatConfigService.getRMAllowedValues(RM_LIST); } }, "dfranco"); - + assertEquals(2, allowedValues.size()); assertTrue(allowedValues.contains(NOFORN)); assertTrue(allowedValues.contains(FOUO)); - - + + allowedValues = AuthenticationUtil.runAs(new RunAsWork>() { public List doWork() @@ -405,39 +405,39 @@ public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD return caveatConfigService.getRMAllowedValues(RM_LIST); } }, "dmartinz"); - + assertEquals(4, allowedValues.size()); assertTrue(allowedValues.contains(NOFORN)); assertTrue(allowedValues.contains(NOCONTRACT)); assertTrue(allowedValues.contains(FOUO)); assertTrue(allowedValues.contains(FGI)); - + /** // * Now remove the entire list (rma:smList); */ logger.debug("test remove entire list rmc:smList"); caveatConfigService.deleteRMConstraint(RM_LIST); - - + + /** * Now add the list again */ logger.debug("test add back rmc:smList"); caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - + /** * Negative test - add a list that already exists */ logger.debug("try to create duplicate list rmc:smList"); caveatConfigService.addRMConstraint(RM_LIST, "my title", new String[0]); - + /** * Negative test - remove a list that does not exist */ logger.debug("test remove entire list rmc:smList"); caveatConfigService.deleteRMConstraint(RM_LIST); - try + try { caveatConfigService.deleteRMConstraint(RM_LIST); fail("unknown constraint should have thrown an exception"); @@ -446,13 +446,13 @@ public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD { // expect to go here } - - + + /** * Negative test - add a constraint to property that does not exist */ logger.debug("test property does not exist"); - try + try { caveatConfigService.addRMConstraint("rma:mer", "", new String[0]); fail("unknown property should have thrown an exception"); @@ -464,13 +464,13 @@ public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD endTransaction(); cleanCaveatConfigData(); } - + private void cleanCaveatConfigData() { startNewTransaction(); - + AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - + deleteUser("jrangel"); deleteUser("dmartinz"); deleteUser("jrogers"); @@ -484,26 +484,26 @@ public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD deleteUser("dsandy"); deleteUser("driggs"); deleteUser("test1"); - + deleteGroup("Engineering"); deleteGroup("Finance"); deleteGroup("test1"); - + caveatConfigService.updateOrCreateCaveatConfig("{}"); // empty config ! - + setComplete(); endTransaction(); } - + private void setupCaveatConfigData() { startNewTransaction(); - + // Switch to admin AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - + // Create test users/groups (if they do not already exist) - + createUser("jrangel"); createUser("dmartinz"); createUser("jrogers"); @@ -517,36 +517,36 @@ public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD createUser("dsandy"); createUser("driggs"); createUser("test1"); - + createGroup("Engineering"); createGroup("Finance"); createGroup("test1"); - + addToGroup("jrogers", "Engineering"); addToGroup("dfranco", "Finance"); - + // not in grouo to start with - added later //addToGroup("gsmith", "Engineering"); - - + + //URL url = AbstractContentTransformerTest.class.getClassLoader().getResource("testCaveatConfig2.json"); // from test-resources //assertNotNull(url); //File file = new File(url.getFile()); //assertTrue(file.exists()); - + //caveatConfigService.updateOrCreateCaveatConfig(file); - + setComplete(); endTransaction(); } - + protected void createUser(String userName) { if (! authenticationService.authenticationExists(userName)) { authenticationService.createAuthentication(userName, "PWD".toCharArray()); } - + if (! personService.personExists(userName)) { PropertyMap ppOne = new PropertyMap(4); @@ -555,11 +555,11 @@ public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD ppOne.put(ContentModel.PROP_LASTNAME, "lastName"); ppOne.put(ContentModel.PROP_EMAIL, "email@email.com"); ppOne.put(ContentModel.PROP_JOBTITLE, "jobTitle"); - + personService.createPerson(ppOne); } } - + protected void deleteUser(String userName) { if (personService.personExists(userName)) @@ -567,12 +567,12 @@ public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD personService.deletePerson(userName); } } - + protected void createGroup(String groupShortName) { createGroup(null, groupShortName); } - + protected void createGroup(String parentGroupShortName, String groupShortName) { if (parentGroupShortName != null) @@ -589,24 +589,24 @@ public class RMCaveatConfigServiceImplTest extends BaseSpringTest implements DOD authorityService.createAuthority(AuthorityType.GROUP, groupShortName, groupShortName, null); } } - + protected void deleteGroup(String groupShortName) { String groupFullName = authorityService.getName(AuthorityType.GROUP, groupShortName); - if (authorityService.authorityExists(groupFullName) == true) + if (authorityService.authorityExists(groupFullName)) { authorityService.deleteAuthority(groupFullName); } } - + protected void addToGroup(String authorityName, String groupShortName) { authorityService.addAuthority(authorityService.getName(AuthorityType.GROUP, groupShortName), authorityName); } - + protected void removeFromGroup(String authorityName, String groupShortName) { authorityService.removeAuthority(authorityService.getName(AuthorityType.GROUP, groupShortName), authorityName); } - + } diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RecordsManagementActionServiceImplTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RecordsManagementActionServiceImplTest.java index 65c2a1e148..c2db981591 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RecordsManagementActionServiceImplTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RecordsManagementActionServiceImplTest.java @@ -53,10 +53,10 @@ import org.springframework.context.ApplicationContext; /** * Records management action service implementation test - * + * * @author Roy Wetherall */ -public class RecordsManagementActionServiceImplTest extends TestCase +public class RecordsManagementActionServiceImplTest extends TestCase implements RecordsManagementModel, BeforeRMActionExecution, OnRMActionExecution @@ -64,9 +64,9 @@ public class RecordsManagementActionServiceImplTest extends TestCase private static final String[] CONFIG_LOCATIONS = new String[] { "classpath:alfresco/application-context.xml", "classpath:test-context.xml"}; - + private ApplicationContext ctx; - + private ServiceRegistry serviceRegistry; private TransactionService transactionService; private RetryingTransactionHelper txnHelper; @@ -76,13 +76,13 @@ public class RecordsManagementActionServiceImplTest extends TestCase private NodeRef nodeRef; private List nodeRefs; - + private boolean beforeMarker; private boolean onMarker; private boolean inTest; @Override - protected void setUp() throws Exception + protected void setUp() throws Exception { ctx = ApplicationContextHelper.getApplicationContext(CONFIG_LOCATIONS); @@ -90,13 +90,13 @@ public class RecordsManagementActionServiceImplTest extends TestCase this.transactionService = serviceRegistry.getTransactionService(); this.txnHelper = transactionService.getRetryingTransactionHelper(); this.nodeService = serviceRegistry.getNodeService(); - + this.rmActionService = (RecordsManagementActionService)ctx.getBean("RecordsManagementActionService"); this.policyComponent = (PolicyComponent)ctx.getBean("policyComponent"); // Set the current security context as admin AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); - + RetryingTransactionCallback setUpCallback = new RetryingTransactionCallback() { public Void execute() throws Throwable @@ -104,38 +104,38 @@ public class RecordsManagementActionServiceImplTest extends TestCase // Create a node we can use for the tests NodeRef rootNodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); nodeRef = nodeService.createNode( - rootNodeRef, - ContentModel.ASSOC_CHILDREN, - QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "temp.txt"), + rootNodeRef, + ContentModel.ASSOC_CHILDREN, + QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "temp.txt"), ContentModel.TYPE_CONTENT).getChildRef(); - + // Create nodeRef list nodeRefs = new ArrayList(5); for (int i = 0; i < 5; i++) { nodeRefs.add( nodeService.createNode( - rootNodeRef, - ContentModel.ASSOC_CHILDREN, - QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "temp.txt"), + rootNodeRef, + ContentModel.ASSOC_CHILDREN, + QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "temp.txt"), ContentModel.TYPE_CONTENT).getChildRef()); } return null; } }; txnHelper.doInTransaction(setUpCallback); - + beforeMarker = false; onMarker = false; inTest = false; } - + @Override protected void tearDown() { AuthenticationUtil.clearCurrentSecurityContext(); } - + public void testGetActions() { RetryingTransactionCallback testCallback = new RetryingTransactionCallback() @@ -148,7 +148,7 @@ public class RecordsManagementActionServiceImplTest extends TestCase }; txnHelper.doInTransaction(testCallback); } - + private void getActionsImpl() { List result = this.rmActionService.getRecordsManagementActions(); @@ -158,10 +158,10 @@ public class RecordsManagementActionServiceImplTest extends TestCase { resultMap.put(action.getName(), action); } - + assertTrue(resultMap.containsKey(TestAction.NAME)); assertTrue(resultMap.containsKey(TestAction2.NAME)); - + result = this.rmActionService.getDispositionActions(); resultMap = new HashMap(8); for (RecordsManagementAction action : result) @@ -170,22 +170,22 @@ public class RecordsManagementActionServiceImplTest extends TestCase } assertTrue(resultMap.containsKey(TestAction.NAME)); assertFalse(resultMap.containsKey(TestAction2.NAME)); - + // get some specific actions and check the label RecordsManagementAction cutoff = this.rmActionService.getDispositionAction("cutoff"); assertNotNull(cutoff); assertEquals("Cut off", cutoff.getLabel()); - + RecordsManagementAction freeze = this.rmActionService.getRecordsManagementAction("freeze"); assertNotNull(freeze); assertEquals("Freeze", freeze.getLabel()); assertEquals("Freeze", freeze.getLabel()); - + // test non-existent actions assertNull(this.rmActionService.getDispositionAction("notThere")); assertNull(this.rmActionService.getRecordsManagementAction("notThere")); } - + public void testExecution() { RetryingTransactionCallback testCallback = new RetryingTransactionCallback() @@ -198,10 +198,10 @@ public class RecordsManagementActionServiceImplTest extends TestCase }; txnHelper.doInTransaction(testCallback); } - + public void beforeRMActionExecution(NodeRef nodeRef, String name, Map parameters) { - if (inTest == true) + if (inTest) { assertEquals(this.nodeRef, nodeRef); assertEquals(TestAction.NAME, name); @@ -214,7 +214,7 @@ public class RecordsManagementActionServiceImplTest extends TestCase public void onRMActionExecution(NodeRef nodeRef, String name, Map parameters) { - if (inTest == true) + if (inTest) { assertEquals(this.nodeRef, nodeRef); assertEquals(TestAction.NAME, name); @@ -224,29 +224,29 @@ public class RecordsManagementActionServiceImplTest extends TestCase onMarker = true; } } - + private void executionImpl() { inTest = true; try { policyComponent.bindClassBehaviour( - RecordsManagementPolicies.BEFORE_RM_ACTION_EXECUTION, - this, + RecordsManagementPolicies.BEFORE_RM_ACTION_EXECUTION, + this, new JavaBehaviour(this, "beforeRMActionExecution", NotificationFrequency.EVERY_EVENT)); policyComponent.bindClassBehaviour( - RecordsManagementPolicies.ON_RM_ACTION_EXECUTION, - this, + RecordsManagementPolicies.ON_RM_ACTION_EXECUTION, + this, new JavaBehaviour(this, "onRMActionExecution", NotificationFrequency.EVERY_EVENT)); - + assertFalse(beforeMarker); assertFalse(onMarker); assertFalse(this.nodeService.hasAspect(this.nodeRef, ASPECT_RECORD)); - + Map params = new HashMap(1); params.put(TestAction.PARAM, TestAction.PARAM_VALUE); this.rmActionService.executeRecordsManagementAction(this.nodeRef, TestAction.NAME, params); - + assertTrue(beforeMarker); assertTrue(onMarker); assertTrue(this.nodeService.hasAspect(this.nodeRef, ASPECT_RECORD)); @@ -256,7 +256,7 @@ public class RecordsManagementActionServiceImplTest extends TestCase inTest = false; } } - + public void testBulkExecution() { RetryingTransactionCallback testCallback = new RetryingTransactionCallback() @@ -269,18 +269,18 @@ public class RecordsManagementActionServiceImplTest extends TestCase }; txnHelper.doInTransaction(testCallback); } - + private void bulkExecutionImpl() { for (NodeRef nodeRef : this.nodeRefs) { assertFalse(this.nodeService.hasAspect(nodeRef, ASPECT_RECORD)); } - + Map params = new HashMap(1); params.put(TestAction.PARAM, TestAction.PARAM_VALUE); - this.rmActionService.executeRecordsManagementAction(this.nodeRefs, TestAction.NAME, params); - + this.rmActionService.executeRecordsManagementAction(this.nodeRefs, TestAction.NAME, params); + for (NodeRef nodeRef : this.nodeRefs) { assertTrue(this.nodeService.hasAspect(nodeRef, ASPECT_RECORD)); diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RecordsManagementEventServiceImplTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RecordsManagementEventServiceImplTest.java index d6f2387219..ade1bd05bb 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RecordsManagementEventServiceImplTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/RecordsManagementEventServiceImplTest.java @@ -116,7 +116,7 @@ public class RecordsManagementEventServiceImplTest extends BaseRMTestCase implem boolean result = false; for (RecordsManagementEvent event : events) { - if (eventName.equals(event.getName()) == true) + if (eventName.equals(event.getName())) { result = true; break; diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/VitalRecordServiceImplTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/VitalRecordServiceImplTest.java index a494adc490..191d8432ff 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/VitalRecordServiceImplTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/service/VitalRecordServiceImplTest.java @@ -429,7 +429,7 @@ public class VitalRecordServiceImplTest extends BaseRMTestCase assertEquals(enabled, vitalRecordIndicator.booleanValue()); assertEquals(enabled, def.isEnabled()); - if (enabled == true) + if (enabled) { Period reviewPeriod = (Period)nodeService.getProperty(nodeRef, PROP_REVIEW_PERIOD); assertNotNull(reviewPeriod); @@ -443,7 +443,7 @@ public class VitalRecordServiceImplTest extends BaseRMTestCase private void assertVitalRecord(NodeRef nodeRef, boolean enabled, Period period) { assertEquals(enabled, nodeService.hasAspect(nodeRef, ASPECT_VITAL_RECORD)); - if (enabled == true) + if (enabled) { Date reviewAsOf = (Date)nodeService.getProperty(nodeRef, PROP_REVIEW_AS_OF); assertNotNull(reviewAsOf); diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java index b2ff35e132..207df69f5e 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java @@ -336,19 +336,19 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase setupTestData(); // Create multi hierarchy data - if (isMultiHierarchyTest() == true) + if (isMultiHierarchyTest()) { setupMultiHierarchyTestData(); } // Create collaboration data - if (isCollaborationSiteTest() == true) + if (isCollaborationSiteTest()) { setupCollaborationSiteTestData(); } // Create the users here - if (isUserTest() == true) + if (isUserTest()) { setupTestUsers(filePlan); } @@ -431,7 +431,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase filter.disableBehaviour(); try { - if (filePlan != null && nodeService.exists(filePlan) == true) + if (filePlan != null && nodeService.exists(filePlan)) { List holds = holdService.getHoldsInFilePlan(filePlan); for (NodeRef hold : holds) @@ -440,7 +440,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase } } - if (folder != null && nodeService.exists(folder) == true) + if (folder != null && nodeService.exists(folder)) { // Delete the folder nodeService.deleteNode(folder); @@ -453,7 +453,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase } // delete the collaboration site (if required) - if (isCollaborationSiteTest() == true && siteService.getSite(collabSiteId) != null) + if (isCollaborationSiteTest() && siteService.getSite(collabSiteId) != null) { siteService.deleteSite(collabSiteId); } @@ -484,7 +484,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase { setupTestDataImpl(); - if (isRecordTest() == true && isRMSiteTest() == true) + if (isRecordTest() && isRMSiteTest()) { setupTestRecords(); } @@ -495,9 +495,9 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase @Override public void test(Void result) throws Exception { - if (isRMSiteTest() == true) + if (isRMSiteTest()) { - if (isRecordTest() == true) + if (isRecordTest()) { // declare a record utils.declareRecord(recordDeclaredOne); @@ -542,7 +542,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase permissionService.setPermission(folder, "rmadmin", PermissionService.WRITE, true); permissionService.setPermission(folder, "rmadmin", PermissionService.ADD_CHILDREN, true); - if (isRMSiteTest() == true) + if (isRMSiteTest()) { siteId = GUID.generate(); siteInfo = siteService.createSite( @@ -633,7 +633,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase rmAdminName }; - if (isFillingForAllUsers() == true) + if (isFillingForAllUsers()) { // Give all the users file permission objects for (String user : testUsers) @@ -653,7 +653,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase */ protected NodeRef createPerson(String userName, boolean createAuth) { - if (createAuth == true) + if (createAuth) { authenticationService.createAuthentication(userName, "password".toCharArray()); } diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMWebScriptTestCase.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMWebScriptTestCase.java index d6cf86b172..69d2175502 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMWebScriptTestCase.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMWebScriptTestCase.java @@ -218,7 +218,7 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest siteService.deleteSite(siteId); // Delete the collaboration site (if required) - if (isCollaborationSiteTest() == true) + if (isCollaborationSiteTest()) { siteService.deleteSite(collabSiteId); } @@ -300,7 +300,7 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest assertNotNull("Could not create rm folder 2", recordFolder2); // Create collaboration data - if (isCollaborationSiteTest() == true) + if (isCollaborationSiteTest()) { setupCollaborationSiteTestData(); } @@ -359,7 +359,7 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest protected void deleteUser(String userName) { - if (authenticationService.authenticationExists(userName) == true) + if (authenticationService.authenticationExists(userName)) { personService.deletePerson(userName); } @@ -375,7 +375,7 @@ public class BaseRMWebScriptTestCase extends BaseWebScriptTest protected void deleteGroup(String groupName) { - if (authorityService.authorityExists(groupName) == true) + if (authorityService.authorityExists(groupName)) { authorityService.deleteAuthority(groupName, true); } diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java index 2c5bfea085..7667660d0e 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java @@ -125,7 +125,7 @@ public class CommonRMTestUtils implements RecordsManagementModel dsProps.put(PROP_RECORD_LEVEL_DISPOSITION, isRecordLevel); DispositionSchedule dispositionSchedule = dispositionService.createDispositionSchedule(container, dsProps); - if (defaultDispositionActions == true) + if (defaultDispositionActions) { Map adParams = new HashMap(3); adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); @@ -137,7 +137,7 @@ public class CommonRMTestUtils implements RecordsManagementModel dispositionService.addDispositionActionDefinition(dispositionSchedule, adParams); - if (extendedDispositionSchedule == true) + if (extendedDispositionSchedule) { adParams = new HashMap(4); adParams.put(PROP_DISPOSITION_ACTION_NAME, TransferAction.NAME);