mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Fixed major bugs (Visibility Modifier) reported in Sonar
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@73864 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -844,9 +844,7 @@
|
||||
<bean id="freezeService" class="org.alfresco.module.org_alfresco_module_rm.freeze.FreezeServiceImpl">
|
||||
<property name="nodeService" ref="nodeService" />
|
||||
<property name="dictionaryService" ref="DictionaryService" />
|
||||
<property name="recordService" ref="RecordService" />
|
||||
<property name="filePlanService" ref="FilePlanService" />
|
||||
<property name="recordFolderService" ref="RecordFolderService" />
|
||||
<property name="holdService" ref="HoldService" />
|
||||
</bean>
|
||||
|
||||
|
@@ -34,17 +34,41 @@ import org.springframework.context.ApplicationContextAware;
|
||||
public abstract class AuditableActionExecuterAbstractBase extends ActionExecuterAbstractBase implements ApplicationContextAware
|
||||
{
|
||||
/** Indicates whether the action is auditable or not */
|
||||
protected boolean auditable = true;
|
||||
private boolean auditable = true;
|
||||
|
||||
/** Indicates whether the action is audited immediately or not */
|
||||
protected boolean auditedImmediately = false;
|
||||
private boolean auditedImmediately = false;
|
||||
|
||||
/** Application context */
|
||||
protected ApplicationContext applicationContext;
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
/** Records management audit service */
|
||||
private RecordsManagementAuditService auditService;
|
||||
|
||||
/**
|
||||
* @return True if auditable, false otherwise
|
||||
*/
|
||||
protected boolean isAuditable()
|
||||
{
|
||||
return this.auditable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if audited immediately, false otherwise
|
||||
*/
|
||||
protected boolean isAuditedImmediately()
|
||||
{
|
||||
return this.auditedImmediately;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Application context
|
||||
*/
|
||||
protected ApplicationContext getApplicationContext()
|
||||
{
|
||||
return this.applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param auditable true if auditable, false otherwise
|
||||
*/
|
||||
@@ -77,7 +101,7 @@ public abstract class AuditableActionExecuterAbstractBase extends ActionExecuter
|
||||
{
|
||||
if (auditService == null)
|
||||
{
|
||||
auditService = (RecordsManagementAuditService)applicationContext.getBean("recordsManagementAuditService");
|
||||
auditService = (RecordsManagementAuditService) getApplicationContext().getBean("recordsManagementAuditService");
|
||||
}
|
||||
return auditService;
|
||||
}
|
||||
@@ -93,7 +117,7 @@ public abstract class AuditableActionExecuterAbstractBase extends ActionExecuter
|
||||
super.init();
|
||||
}
|
||||
|
||||
if (auditable)
|
||||
if (isAuditable())
|
||||
{
|
||||
// get the details of the action
|
||||
String name = getActionDefinition().getName();
|
||||
@@ -116,9 +140,9 @@ public abstract class AuditableActionExecuterAbstractBase extends ActionExecuter
|
||||
public void execute(Action action, NodeRef actionedUponNodeRef)
|
||||
{
|
||||
// audit the execution of the action
|
||||
if (auditable)
|
||||
if (isAuditable())
|
||||
{
|
||||
if (auditedImmediately)
|
||||
if (isAuditedImmediately())
|
||||
{
|
||||
// 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);
|
||||
|
@@ -32,11 +32,27 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
*/
|
||||
public abstract class PropertySubActionExecuterAbstractBase extends AuditableActionExecuterAbstractBase
|
||||
{
|
||||
/** Parameter processor component */
|
||||
protected ParameterProcessorComponent parameterProcessorComponent;
|
||||
/** Parameter processor component */
|
||||
private ParameterProcessorComponent parameterProcessorComponent;
|
||||
|
||||
/** Indicates whether parameter substitutions are allowed */
|
||||
protected boolean allowParameterSubstitutions = false;
|
||||
private boolean allowParameterSubstitutions = false;
|
||||
|
||||
/**
|
||||
* @return Parameter processor component
|
||||
*/
|
||||
protected ParameterProcessorComponent getParameterProcessorComponent()
|
||||
{
|
||||
return this.parameterProcessorComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if parameter substitutions are allowed, false otherwise
|
||||
*/
|
||||
protected boolean isAllowParameterSubstitutions()
|
||||
{
|
||||
return this.allowParameterSubstitutions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parameterProcessorComponent parameter processor component
|
||||
@@ -61,9 +77,9 @@ public abstract class PropertySubActionExecuterAbstractBase extends AuditableAct
|
||||
public void execute(Action action, NodeRef actionedUponNodeRef)
|
||||
{
|
||||
// do the property subs (if any exist)
|
||||
if (allowParameterSubstitutions)
|
||||
if (isAllowParameterSubstitutions())
|
||||
{
|
||||
parameterProcessorComponent.process(action, getActionDefinition(), actionedUponNodeRef);
|
||||
getParameterProcessorComponent().process(action, getActionDefinition(), actionedUponNodeRef);
|
||||
}
|
||||
|
||||
super.execute(action, actionedUponNodeRef);
|
||||
|
@@ -68,9 +68,9 @@ public class DelegateAction extends RMActionExecuterAbstractBase
|
||||
(!checkFrozen || !freezeService.isFrozen(actionedUponNodeRef)))
|
||||
{
|
||||
// do the property subs (if any exist)
|
||||
if (allowParameterSubstitutions)
|
||||
if (isAllowParameterSubstitutions())
|
||||
{
|
||||
parameterProcessorComponent.process(action, delegateActionExecuter.getActionDefinition(), actionedUponNodeRef);
|
||||
getParameterProcessorComponent().process(action, delegateActionExecuter.getActionDefinition(), actionedUponNodeRef);
|
||||
}
|
||||
|
||||
delegateActionExecuter.execute(action, actionedUponNodeRef);
|
||||
|
@@ -55,8 +55,16 @@ public class FileReportAction extends RMActionExecuterAbstractBase implements Re
|
||||
/** I18N */
|
||||
private static final String MSG_PARAM_NOT_SUPPLIED = "rm.action.parameter-not-supplied";
|
||||
|
||||
/** report service */
|
||||
protected ReportService reportService;
|
||||
/** Report service */
|
||||
private ReportService reportService;
|
||||
|
||||
/**
|
||||
* @return Report service
|
||||
*/
|
||||
protected ReportService getReportService()
|
||||
{
|
||||
return this.reportService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param reportService report service
|
||||
@@ -87,7 +95,7 @@ public class FileReportAction extends RMActionExecuterAbstractBase implements Re
|
||||
final NodeRef destination = getDestination(action);
|
||||
|
||||
// generate the report
|
||||
final Report report = reportService.generateReport(reportType, actionedUponNodeRef, mimetype);
|
||||
final Report report = getReportService().generateReport(reportType, actionedUponNodeRef, mimetype);
|
||||
|
||||
// file the report as system
|
||||
NodeRef filedReport = AuthenticationUtil.runAsSystem(new RunAsWork<NodeRef>()
|
||||
@@ -95,7 +103,7 @@ public class FileReportAction extends RMActionExecuterAbstractBase implements Re
|
||||
@Override
|
||||
public NodeRef doWork()
|
||||
{
|
||||
return reportService.fileReport(destination, report);
|
||||
return getReportService().fileReport(destination, report);
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -37,7 +37,15 @@ public class TransferCompleteAction extends RMActionExecuterAbstractBase
|
||||
private static final String MSG_NODE_NOT_TRANSFER = "rm.action.node-not-transfer";
|
||||
|
||||
/** Transfer service */
|
||||
protected TransferService transferService;
|
||||
private TransferService transferService;
|
||||
|
||||
/**
|
||||
* @return transfer service
|
||||
*/
|
||||
protected TransferService getTransferService()
|
||||
{
|
||||
return this.transferService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param transferService transfer service
|
||||
@@ -55,7 +63,7 @@ public class TransferCompleteAction extends RMActionExecuterAbstractBase
|
||||
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
|
||||
{
|
||||
checkTransferSubClass(actionedUponNodeRef);
|
||||
transferService.completeTransfer(actionedUponNodeRef);
|
||||
getTransferService().completeTransfer(actionedUponNodeRef);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -117,7 +117,7 @@ public class OnReferenceCreateEventType extends SimpleRecordsManagementEventType
|
||||
List<EventCompletionDetails> events = da.getEventCompletionDetails();
|
||||
for (EventCompletionDetails event : events)
|
||||
{
|
||||
RecordsManagementEvent rmEvent = recordsManagementEventService.getEvent(event.getEventName());
|
||||
RecordsManagementEvent rmEvent = getRecordsManagementEventService().getEvent(event.getEventName());
|
||||
if (!event.isEventComplete() &&
|
||||
rmEvent.getType().equals(getName()))
|
||||
{
|
||||
|
@@ -241,7 +241,7 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent
|
||||
List<EventCompletionDetails> events = da.getEventCompletionDetails();
|
||||
for (EventCompletionDetails event : events)
|
||||
{
|
||||
RecordsManagementEvent rmEvent = recordsManagementEventService.getEvent(event.getEventName());
|
||||
RecordsManagementEvent rmEvent = getRecordsManagementEventService().getEvent(event.getEventName());
|
||||
if (!event.isEventComplete() &&
|
||||
rmEvent.getType().equals(getName()))
|
||||
{
|
||||
|
@@ -35,10 +35,18 @@ public class SimpleRecordsManagementEventTypeImpl implements RecordsManagementEv
|
||||
public static final String NAME = "rmEventType.simple";
|
||||
|
||||
/** Records management event service */
|
||||
protected RecordsManagementEventService recordsManagementEventService;
|
||||
private RecordsManagementEventService recordsManagementEventService;
|
||||
|
||||
/** Name */
|
||||
protected String name;
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* @return Records management event service
|
||||
*/
|
||||
protected RecordsManagementEventService getRecordsManagementEventService()
|
||||
{
|
||||
return this.recordsManagementEventService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the records management event service
|
||||
@@ -55,7 +63,7 @@ public class SimpleRecordsManagementEventTypeImpl implements RecordsManagementEv
|
||||
*/
|
||||
public void init()
|
||||
{
|
||||
recordsManagementEventService.registerEventType(this);
|
||||
getRecordsManagementEventService().registerEventType(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -29,16 +29,12 @@ import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.hold.HoldService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
|
||||
/**
|
||||
@@ -52,50 +48,40 @@ public class FreezeServiceImpl extends ServiceBaseImpl
|
||||
implements FreezeService,
|
||||
RecordsManagementModel
|
||||
{
|
||||
/** Logger */
|
||||
@SuppressWarnings("unused")
|
||||
private static Log logger = LogFactory.getLog(FreezeServiceImpl.class);
|
||||
|
||||
/** I18N */
|
||||
//private static final String MSG_FREEZE_ONLY_RECORDS_FOLDERS = "rm.action.freeze-only-records-folders";
|
||||
private static final String MSG_HOLD_NAME = "rm.hold.name";
|
||||
|
||||
/** Record service */
|
||||
protected RecordService recordService;
|
||||
|
||||
/** File Plan Service */
|
||||
protected FilePlanService filePlanService;
|
||||
|
||||
/** Record folder service */
|
||||
protected RecordFolderService recordFolderService;
|
||||
private FilePlanService filePlanService;
|
||||
|
||||
/** Hold service */
|
||||
protected HoldService holdService;
|
||||
private HoldService holdService;
|
||||
|
||||
/**
|
||||
* @param recordService record service
|
||||
* @return File plan service
|
||||
*/
|
||||
public void setRecordService(RecordService recordService)
|
||||
protected FilePlanService getFilePlanService()
|
||||
{
|
||||
this.recordService = recordService;
|
||||
return this.filePlanService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param filePlanService file plan service
|
||||
* @return Hold service
|
||||
*/
|
||||
protected HoldService getHoldService()
|
||||
{
|
||||
return this.holdService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param filePlanService file plan service
|
||||
*/
|
||||
public void setFilePlanService(FilePlanService filePlanService)
|
||||
{
|
||||
this.filePlanService = filePlanService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recordFolderService record folder service
|
||||
*/
|
||||
public void setRecordFolderService(RecordFolderService recordFolderService)
|
||||
{
|
||||
this.recordFolderService = recordFolderService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param holdService hold service
|
||||
*/
|
||||
@@ -134,8 +120,8 @@ public class FreezeServiceImpl extends ServiceBaseImpl
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#getFreezeDate(org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@@ -169,7 +155,7 @@ public class FreezeServiceImpl extends ServiceBaseImpl
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deprecated Method Implementations
|
||||
*/
|
||||
@@ -181,7 +167,7 @@ public class FreezeServiceImpl extends ServiceBaseImpl
|
||||
@Deprecated
|
||||
public Set<NodeRef> getFrozen(NodeRef hold)
|
||||
{
|
||||
return new HashSet<NodeRef>(holdService.getHeld(hold));
|
||||
return new HashSet<NodeRef>(getHoldService().getHeld(hold));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -193,7 +179,7 @@ public class FreezeServiceImpl extends ServiceBaseImpl
|
||||
public NodeRef freeze(String reason, NodeRef nodeRef)
|
||||
{
|
||||
NodeRef hold = createHold(nodeRef, reason);
|
||||
holdService.addToHold(hold, nodeRef);
|
||||
getHoldService().addToHold(hold, nodeRef);
|
||||
return hold;
|
||||
}
|
||||
|
||||
@@ -208,7 +194,7 @@ public class FreezeServiceImpl extends ServiceBaseImpl
|
||||
ParameterCheck.mandatory("hold", hold);
|
||||
ParameterCheck.mandatory("nodeRef", nodeRef);
|
||||
|
||||
holdService.addToHold(hold, nodeRef);
|
||||
getHoldService().addToHold(hold, nodeRef);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -219,12 +205,12 @@ public class FreezeServiceImpl extends ServiceBaseImpl
|
||||
@Deprecated
|
||||
public NodeRef freeze(String reason, Set<NodeRef> nodeRefs)
|
||||
{
|
||||
NodeRef hold = null;
|
||||
NodeRef hold = null;
|
||||
if (!nodeRefs.isEmpty())
|
||||
{
|
||||
List<NodeRef> list = new ArrayList<NodeRef>(nodeRefs);
|
||||
hold = createHold(list.get(0), reason);
|
||||
holdService.addToHold(hold, list);
|
||||
getHoldService().addToHold(hold, list);
|
||||
}
|
||||
return hold;
|
||||
}
|
||||
@@ -253,10 +239,10 @@ public class FreezeServiceImpl extends ServiceBaseImpl
|
||||
@Deprecated
|
||||
public void unFreeze(NodeRef nodeRef)
|
||||
{
|
||||
List<NodeRef> holds = holdService.heldBy(nodeRef, true);
|
||||
List<NodeRef> holds = getHoldService().heldBy(nodeRef, true);
|
||||
for (NodeRef hold : holds)
|
||||
{
|
||||
holdService.removeFromHold(hold, nodeRef);
|
||||
getHoldService().removeFromHold(hold, nodeRef);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,7 +268,7 @@ public class FreezeServiceImpl extends ServiceBaseImpl
|
||||
@Deprecated
|
||||
public void relinquish(NodeRef hold)
|
||||
{
|
||||
holdService.deleteHold(hold);
|
||||
getHoldService().deleteHold(hold);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -292,7 +278,7 @@ public class FreezeServiceImpl extends ServiceBaseImpl
|
||||
@Deprecated
|
||||
public String getReason(NodeRef hold)
|
||||
{
|
||||
return holdService.getHoldReason(hold);
|
||||
return getHoldService().getHoldReason(hold);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -303,7 +289,7 @@ public class FreezeServiceImpl extends ServiceBaseImpl
|
||||
@Deprecated
|
||||
public void updateReason(NodeRef hold, String reason)
|
||||
{
|
||||
holdService.setHoldReason(hold, reason);
|
||||
getHoldService().setHoldReason(hold, reason);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -314,8 +300,8 @@ public class FreezeServiceImpl extends ServiceBaseImpl
|
||||
{
|
||||
ParameterCheck.mandatory("filePlan", filePlan);
|
||||
|
||||
return new HashSet<NodeRef>(holdService.getHolds(filePlan));
|
||||
}
|
||||
return new HashSet<NodeRef>(getHoldService().getHolds(filePlan));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a hold using the given nodeRef and reason
|
||||
@@ -327,14 +313,14 @@ public class FreezeServiceImpl extends ServiceBaseImpl
|
||||
private NodeRef createHold(NodeRef nodeRef, String reason)
|
||||
{
|
||||
// get the hold container
|
||||
final NodeRef filePlan = filePlanService.getFilePlan(nodeRef);
|
||||
NodeRef holdContainer = filePlanService.getHoldContainer(filePlan);
|
||||
final NodeRef filePlan = getFilePlanService().getFilePlan(nodeRef);
|
||||
NodeRef holdContainer = getFilePlanService().getHoldContainer(filePlan);
|
||||
|
||||
// calculate the hold name
|
||||
int nextCount = getNextCount(holdContainer);
|
||||
String holdName = I18NUtil.getMessage(MSG_HOLD_NAME) + " " + StringUtils.leftPad(Integer.toString(nextCount), 10, "0");
|
||||
|
||||
// create hold
|
||||
return holdService.createHold(filePlan, holdName, reason, null);
|
||||
}
|
||||
return getHoldService().createHold(filePlan, holdName, reason, null);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user