Fixed minor issues reported by sonar (Unread public/protected field)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@63814 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2014-03-09 22:45:08 +00:00
parent 36f8250826
commit d58cfe667b
8 changed files with 54 additions and 141 deletions

View File

@@ -586,7 +586,6 @@
class="org.alfresco.module.org_alfresco_module_rm.vital.BroadcastVitalRecordDefinitionAction" class="org.alfresco.module.org_alfresco_module_rm.vital.BroadcastVitalRecordDefinitionAction"
parent="rmAction"> parent="rmAction">
<property name="filePlanService" ref="FilePlanService"/> <property name="filePlanService" ref="FilePlanService"/>
<property name="filePlanAuthenticationService" ref="FilePlanAuthenticationService"/>
<property name="auditable" value="false"/> <property name="auditable" value="false"/>
</bean> </bean>

View File

@@ -101,7 +101,6 @@
<bean id="rma.record" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.RecordAspect" parent="rm.baseBehaviour"> <bean id="rma.record" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.RecordAspect" parent="rm.baseBehaviour">
<property name="scriptService" ref="ScriptService" /> <property name="scriptService" ref="ScriptService" />
<property name="extendedSecurityService" ref="ExtendedSecurityService" /> <property name="extendedSecurityService" ref="ExtendedSecurityService" />
<property name="recordService" ref="RecordService" />
</bean> </bean>
<bean id="rma.recordComponentIdentifier" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.RecordComponentIdentifierAspect" parent="rm.baseBehaviour"> <bean id="rma.recordComponentIdentifier" class="org.alfresco.module.org_alfresco_module_rm.model.rma.aspect.RecordComponentIdentifierAspect" parent="rm.baseBehaviour">

View File

@@ -31,9 +31,6 @@
<!-- Report Service --> <!-- Report Service -->
<bean id="reportService" parent="baseService" class="org.alfresco.module.org_alfresco_module_rm.report.ReportServiceImpl"> <bean id="reportService" parent="baseService" class="org.alfresco.module.org_alfresco_module_rm.report.ReportServiceImpl">
<property name="fileFolderService" ref="FileFolderService" />
<property name="filePlanService" ref="FilePlanService" />
<property name="contentService" ref="ContentService" />
<property name="recordService" ref="RecordService" /> <property name="recordService" ref="RecordService" />
</bean> </bean>
@@ -77,7 +74,6 @@
<property name="mimetypeService" ref="MimetypeService"/> <property name="mimetypeService" ref="MimetypeService"/>
<property name="fileFolderService" ref="FileFolderService"/> <property name="fileFolderService" ref="FileFolderService"/>
<property name="templateService" ref="TemplateService"/> <property name="templateService" ref="TemplateService"/>
<property name="nodeService" ref="NodeService" />
<property name="parameterProcessorComponent" ref="parameterProcessorComponent"/> <property name="parameterProcessorComponent" ref="parameterProcessorComponent"/>
<property name="repository" ref="repositoryHelper" /> <property name="repository" ref="repositoryHelper" />
<property name="sysAdminParams" ref="sysAdminParams" /> <property name="sysAdminParams" ref="sysAdminParams" />

View File

@@ -28,7 +28,6 @@ import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies;
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel;
import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour; import org.alfresco.module.org_alfresco_module_rm.model.behaviour.RecordsManagementSearchBehaviour;
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService;
import org.alfresco.repo.copy.CopyBehaviourCallback; import org.alfresco.repo.copy.CopyBehaviourCallback;
import org.alfresco.repo.copy.CopyDetails; import org.alfresco.repo.copy.CopyDetails;
@@ -47,7 +46,7 @@ import org.alfresco.service.namespace.QName;
/** /**
* rma:record behaviour bean * rma:record behaviour bean
* *
* @author Roy Wetherall * @author Roy Wetherall
* @since 2.2 * @since 2.2
*/ */
@@ -64,16 +63,13 @@ public class RecordAspect extends BaseBehaviourBean
/** Well-known location of the scripts folder. */ /** Well-known location of the scripts folder. */
// TODO make configurable // TODO make configurable
private NodeRef scriptsFolderNodeRef = new NodeRef("workspace", "SpacesStore", "rm_behavior_scripts"); private NodeRef scriptsFolderNodeRef = new NodeRef("workspace", "SpacesStore", "rm_behavior_scripts");
/** extended security service */ /** extended security service */
protected ExtendedSecurityService extendedSecurityService; protected ExtendedSecurityService extendedSecurityService;
/** script service */ /** script service */
protected ScriptService scriptService; protected ScriptService scriptService;
/** record service */
protected RecordService recordService;
/** /**
* @param extendedSecurityService extended security service * @param extendedSecurityService extended security service
*/ */
@@ -89,18 +85,10 @@ public class RecordAspect extends BaseBehaviourBean
{ {
this.scriptService = scriptService; this.scriptService = scriptService;
} }
/**
* @param recordService record service
*/
public void setRecordService(RecordService recordService)
{
this.recordService = recordService;
}
/** /**
* Behaviour to ensure renditions have the appropriate extended security. * Behaviour to ensure renditions have the appropriate extended security.
* *
* @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean)
*/ */
@Override @Override
@@ -158,7 +146,7 @@ public class RecordAspect extends BaseBehaviourBean
} }
// Execute script if for the reference event // Execute script if for the reference event
executeReferenceScript("onCreate", reference, fromNodeRef, toNodeRef); executeReferenceScript("onCreate", reference, fromNodeRef, toNodeRef);
} }
/** /**
@@ -180,9 +168,9 @@ public class RecordAspect extends BaseBehaviourBean
} }
// Execute script if for the reference event // Execute script if for the reference event
executeReferenceScript("onRemove", reference, fromNodeRef, toNodeRef); executeReferenceScript("onRemove", reference, fromNodeRef, toNodeRef);
} }
/** /**
* Record copy callback * Record copy callback
*/ */
@@ -217,7 +205,7 @@ public class RecordAspect extends BaseBehaviourBean
/** /**
* Record move behaviour * Record move behaviour
* *
* @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef) * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef)
*/ */
@Override @Override
@@ -247,7 +235,7 @@ public class RecordAspect extends BaseBehaviourBean
}, AuthenticationUtil.getAdminUserName()); }, AuthenticationUtil.getAdminUserName());
} }
} }
/** /**
* Executes a reference script if present * Executes a reference script if present
* *

View File

@@ -28,7 +28,6 @@ import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService;
import org.alfresco.repo.node.NodeServicePolicies; import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.Behaviour.NotificationFrequency; import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.policy.annotation.Behaviour; import org.alfresco.repo.policy.annotation.Behaviour;
import org.alfresco.repo.policy.annotation.BehaviourBean; import org.alfresco.repo.policy.annotation.BehaviourBean;
import org.alfresco.repo.policy.annotation.BehaviourKind; import org.alfresco.repo.policy.annotation.BehaviourKind;
@@ -48,7 +47,7 @@ import org.alfresco.util.PropertyMap;
/** /**
* Behaviour associated with the RM Site type * Behaviour associated with the RM Site type
* *
* @author Roy Wetherall * @author Roy Wetherall
* @since 2.2 * @since 2.2
*/ */
@@ -65,40 +64,28 @@ public class RmSiteType extends BaseBehaviourBean
public static final String COMPONENT_DOCUMENT_LIBRARY = "documentLibrary"; public static final String COMPONENT_DOCUMENT_LIBRARY = "documentLibrary";
public static final String DEFAULT_SITE_NAME = "rm"; public static final String DEFAULT_SITE_NAME = "rm";
public static final QName DEFAULT_FILE_PLAN_TYPE = TYPE_FILE_PLAN; public static final QName DEFAULT_FILE_PLAN_TYPE = TYPE_FILE_PLAN;
/** Policy component */
protected PolicyComponent policyComponent;
/** Site service */ /** Site service */
protected SiteService siteService; protected SiteService siteService;
/** Record Management Search Service */ /** Record Management Search Service */
protected RecordsManagementSearchService recordsManagementSearchService; protected RecordsManagementSearchService recordsManagementSearchService;
/** Capability service */ /** Capability service */
protected CapabilityService capabilityService; protected CapabilityService capabilityService;
/** Map of file plan type's key'ed by corresponding site types */ /** Map of file plan type's key'ed by corresponding site types */
protected Map<QName, QName> mapFilePlanType = new HashMap<QName, QName>(3); protected Map<QName, QName> mapFilePlanType = new HashMap<QName, QName>(3);
/**
* Set the policy component
* @param policyComponent policy component
*/
public void setPolicyComponent(PolicyComponent policyComponent)
{
this.policyComponent = policyComponent;
}
/** /**
* Set the site service * Set the site service
* @param siteService site service * @param siteService site service
*/ */
public void setSiteService(SiteService siteService) public void setSiteService(SiteService siteService)
{ {
this.siteService = siteService; this.siteService = siteService;
} }
/** /**
* @param recordsManagementSearchService records management search service * @param recordsManagementSearchService records management search service
*/ */
@@ -106,7 +93,7 @@ public class RmSiteType extends BaseBehaviourBean
{ {
this.recordsManagementSearchService = recordsManagementSearchService; this.recordsManagementSearchService = recordsManagementSearchService;
} }
/** /**
* @param capabilityService capability service * @param capabilityService capability service
*/ */
@@ -114,10 +101,10 @@ public class RmSiteType extends BaseBehaviourBean
{ {
this.capabilityService = capabilityService; this.capabilityService = capabilityService;
} }
/** /**
* Registers a file plan type for a specific site type. * Registers a file plan type for a specific site type.
* *
* @param siteType siteType sub-type of rma:rmsite * @param siteType siteType sub-type of rma:rmsite
* @param filePlanType filePlanType sub-type of rma:filePlan * @param filePlanType filePlanType sub-type of rma:filePlan
* @since 2.2 * @since 2.2
@@ -126,21 +113,21 @@ public class RmSiteType extends BaseBehaviourBean
{ {
ParameterCheck.mandatory("siteType", siteType); ParameterCheck.mandatory("siteType", siteType);
ParameterCheck.mandatory("filePlanType", filePlanType); ParameterCheck.mandatory("filePlanType", filePlanType);
// check that the registered site type is a subtype of rma:rmsite // check that the registered site type is a subtype of rma:rmsite
if (dictionaryService.isSubClass(siteType, TYPE_RM_SITE) == false) if (dictionaryService.isSubClass(siteType, TYPE_RM_SITE) == false)
{ {
throw new AlfrescoRuntimeException( throw new AlfrescoRuntimeException(
"Can't register site type, because site type is not a sub type of rma:rmsite (siteType=" + siteType.toString() + ")"); "Can't register site type, because site type is not a sub type of rma:rmsite (siteType=" + siteType.toString() + ")");
} }
// check that the registered file plan type is a sub type of rma:filePlan // check that the registered file plan type is a sub type of rma:filePlan
if (dictionaryService.isSubClass(filePlanType, TYPE_FILE_PLAN) == false) if (dictionaryService.isSubClass(filePlanType, TYPE_FILE_PLAN) == false)
{ {
throw new AlfrescoRuntimeException( throw new AlfrescoRuntimeException(
"Can't register file plan type, because site type is not a sub type of rma:filePlan (filePlanType=" + filePlanType.toString() + ")"); "Can't register file plan type, because site type is not a sub type of rma:filePlan (filePlanType=" + filePlanType.toString() + ")");
} }
// add site and file plan types to map // add site and file plan types to map
mapFilePlanType.put(siteType, filePlanType); mapFilePlanType.put(siteType, filePlanType);
} }
@@ -154,17 +141,17 @@ public class RmSiteType extends BaseBehaviourBean
kind = BehaviourKind.CLASS, kind = BehaviourKind.CLASS,
notificationFrequency = NotificationFrequency.FIRST_EVENT notificationFrequency = NotificationFrequency.FIRST_EVENT
) )
public void onCreateNode(ChildAssociationRef childAssocRef) public void onCreateNode(ChildAssociationRef childAssocRef)
{ {
final NodeRef rmSite = childAssocRef.getChildRef(); final NodeRef rmSite = childAssocRef.getChildRef();
// Do not execute behaviour if this has been created in the archive store // 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) == true)
{ {
// This is not the spaces store - probably the archive store // This is not the spaces store - probably the archive store
return; return;
} }
if (nodeService.exists(rmSite) == true) if (nodeService.exists(rmSite) == true)
{ {
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>() AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
@@ -173,10 +160,10 @@ public class RmSiteType extends BaseBehaviourBean
{ {
SiteInfo siteInfo = siteService.getSite(rmSite); SiteInfo siteInfo = siteService.getSite(rmSite);
if (siteInfo != null) if (siteInfo != null)
{ {
// Create the file plan component // Create the file plan component
siteService.createContainer(siteInfo.getShortName(), COMPONENT_DOCUMENT_LIBRARY, getFilePlanType(siteInfo), null); siteService.createContainer(siteInfo.getShortName(), COMPONENT_DOCUMENT_LIBRARY, getFilePlanType(siteInfo), null);
// Add the reports // Add the reports
recordsManagementSearchService.addReports(siteInfo.getShortName()); recordsManagementSearchService.addReports(siteInfo.getShortName());
} }
@@ -185,10 +172,10 @@ public class RmSiteType extends BaseBehaviourBean
}, AuthenticationUtil.getAdminUserName()); }, AuthenticationUtil.getAdminUserName());
} }
} }
/** /**
* Get the file plan type for the given site. * Get the file plan type for the given site.
* *
* @param siteInfo site info * @param siteInfo site info
* @return QName file plan type to create as a container * @return QName file plan type to create as a container
* @since 2.2 * @since 2.2
@@ -196,25 +183,25 @@ public class RmSiteType extends BaseBehaviourBean
private QName getFilePlanType(SiteInfo siteInfo) private QName getFilePlanType(SiteInfo siteInfo)
{ {
ParameterCheck.mandatory("siteInfo", siteInfo); ParameterCheck.mandatory("siteInfo", siteInfo);
// set default file plan // set default file plan
QName result = DEFAULT_FILE_PLAN_TYPE; QName result = DEFAULT_FILE_PLAN_TYPE;
// check to see if there is an 'override' for the file plan type given the site type // check to see if there is an 'override' for the file plan type given the site type
QName siteType = nodeService.getType(siteInfo.getNodeRef()); QName siteType = nodeService.getType(siteInfo.getNodeRef());
if (mapFilePlanType.containsKey(siteType) == true) if (mapFilePlanType.containsKey(siteType) == true)
{ {
result = mapFilePlanType.get(siteType); result = mapFilePlanType.get(siteType);
} }
return result; return result;
} }
/** /**
* Ensure that the visibility of a RM site can not be changed to anything but public. * Ensure that the visibility of a RM site can not be changed to anything but public.
* *
* TODO support other site visibilities * TODO support other site visibilities
* *
* @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map)
*/ */
@Behaviour @Behaviour
@@ -226,10 +213,10 @@ public class RmSiteType extends BaseBehaviourBean
{ {
if (nodeService.exists(nodeRef) == true) if (nodeService.exists(nodeRef) == true)
{ {
Map<QName, Serializable> changed = PropertyMap.getChangedProperties(before, after); Map<QName, Serializable> changed = PropertyMap.getChangedProperties(before, after);
if (changed.containsKey(SiteModel.PROP_SITE_VISIBILITY) == true && if (changed.containsKey(SiteModel.PROP_SITE_VISIBILITY) == true &&
changed.get(SiteModel.PROP_SITE_VISIBILITY) != null && changed.get(SiteModel.PROP_SITE_VISIBILITY) != null &&
SiteVisibility.PUBLIC.equals(changed.get(SiteModel.PROP_SITE_VISIBILITY)) == false) SiteVisibility.PUBLIC.equals(changed.get(SiteModel.PROP_SITE_VISIBILITY)) == false)
{ {
// we do not current support non-public RM sites // we do not current support non-public RM sites
throw new AlfrescoRuntimeException("The records management site must have public visibility. It can't be changed to " + changed.get(SiteModel.PROP_SITE_VISIBILITY)); throw new AlfrescoRuntimeException("The records management site must have public visibility. It can't be changed to " + changed.get(SiteModel.PROP_SITE_VISIBILITY));
@@ -251,16 +238,16 @@ public class RmSiteType extends BaseBehaviourBean
if (siteInfo != null) if (siteInfo != null)
{ {
// grab the file plan for the RM site // grab the file plan for the RM site
NodeRef filePlan = AuthenticationUtil.runAsSystem(new RunAsWork<NodeRef>() NodeRef filePlan = AuthenticationUtil.runAsSystem(new RunAsWork<NodeRef>()
{ {
@Override @Override
public NodeRef doWork() throws Exception public NodeRef doWork() throws Exception
{ {
return siteService.getContainer(siteInfo.getShortName(), COMPONENT_DOCUMENT_LIBRARY); return siteService.getContainer(siteInfo.getShortName(), COMPONENT_DOCUMENT_LIBRARY);
} }
}); });
if (filePlan != null) if (filePlan != null)
{ {
// determine whether the current user has delete capability on the file plan node // determine whether the current user has delete capability on the file plan node

View File

@@ -24,12 +24,9 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.record.RecordService; import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl;
import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.springframework.extensions.surf.util.ParameterCheck; import org.springframework.extensions.surf.util.ParameterCheck;
@@ -43,45 +40,12 @@ import org.springframework.extensions.surf.util.ParameterCheck;
public class ReportServiceImpl extends ServiceBaseImpl public class ReportServiceImpl extends ServiceBaseImpl
implements ReportService implements ReportService
{ {
/** file folder service */
protected FileFolderService fileFolderService;
/** file plan service */
protected FilePlanService filePlanService;
/** content service */
protected ContentService contentService;
/** record service */ /** record service */
protected RecordService recordService; protected RecordService recordService;
/** report generator registry */ /** report generator registry */
private Map<QName, ReportGenerator> registry = new HashMap<QName, ReportGenerator>(); private Map<QName, ReportGenerator> registry = new HashMap<QName, ReportGenerator>();
/**
* @param fileFolderService file folder service
*/
public void setFileFolderService(FileFolderService fileFolderService)
{
this.fileFolderService = fileFolderService;
}
/**
* @param filePlanService file plan service
*/
public void setFilePlanService(FilePlanService filePlanService)
{
this.filePlanService = filePlanService;
}
/**
* @param contentService content service
*/
public void setContentService(ContentService contentService)
{
this.contentService = contentService;
}
/** /**
* @param recordService record service * @param recordService record service
*/ */

View File

@@ -32,7 +32,6 @@ import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.MimetypeService; import org.alfresco.service.cmr.repository.MimetypeService;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.repository.TemplateService; import org.alfresco.service.cmr.repository.TemplateService;
import org.alfresco.util.UrlUtil; import org.alfresco.util.UrlUtil;
@@ -65,9 +64,6 @@ public class DeclarativeReportGenerator extends BaseReportGenerator
/** template service */ /** template service */
protected TemplateService templateService; protected TemplateService templateService;
/** node service */
protected NodeService nodeService;
/** repository helper */ /** repository helper */
protected Repository repository; protected Repository repository;
@@ -109,14 +105,6 @@ public class DeclarativeReportGenerator extends BaseReportGenerator
this.contentService = contentService; this.contentService = contentService;
} }
/**
* @param nodeService node service
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/** /**
* @param parameterProcessorComponent parameter processor component * @param parameterProcessorComponent parameter processor component
*/ */

View File

@@ -27,7 +27,6 @@ import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase;
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.action.Action;
@@ -42,25 +41,18 @@ import org.alfresco.service.namespace.RegexQNamePattern;
* VitalRecordIndicator or the reviewPeriod properties are changed on a record container, then any descendant folders or * VitalRecordIndicator or the reviewPeriod properties are changed on a record container, then any descendant folders or
* records must be updated as a consequence. Descendant folders should have their reviewPeriods and/or * records must be updated as a consequence. Descendant folders should have their reviewPeriods and/or
* vitalRecordIndicators updated to match the new value. Descendant records should have their reviewAsOf date updated. * vitalRecordIndicators updated to match the new value. Descendant records should have their reviewAsOf date updated.
* *
* @author Neil McErlean * @author Neil McErlean
*/ */
public class BroadcastVitalRecordDefinitionAction extends RMActionExecuterAbstractBase public class BroadcastVitalRecordDefinitionAction extends RMActionExecuterAbstractBase
{ {
protected FilePlanService filePlanService; protected FilePlanService filePlanService;
protected FilePlanAuthenticationService filePlanAuthenticationService; public void setFilePlanService(FilePlanService filePlanService)
public void setFilePlanService(FilePlanService filePlanService)
{ {
this.filePlanService = filePlanService; this.filePlanService = filePlanService;
}
public void setFilePlanAuthenticationService(FilePlanAuthenticationService filePlanAuthenticationService)
{
this.filePlanAuthenticationService = filePlanAuthenticationService;
} }
/** /**
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action,
* org.alfresco.service.cmr.repository.NodeRef) * org.alfresco.service.cmr.repository.NodeRef)
@@ -76,18 +68,18 @@ public class BroadcastVitalRecordDefinitionAction extends RMActionExecuterAbstra
propagateChangeToChildrenOf(actionedUponNodeRef); propagateChangeToChildrenOf(actionedUponNodeRef);
return null; return null;
} }
}, AuthenticationUtil.getAdminUserName()); }, AuthenticationUtil.getAdminUserName());
} }
/** /**
* Propagates the changes to the children of the node specified. * Propagates the changes to the children of the node specified.
* *
* @param actionedUponNodeRef actioned upon node reference * @param actionedUponNodeRef actioned upon node reference
*/ */
private void propagateChangeToChildrenOf(NodeRef actionedUponNodeRef) private void propagateChangeToChildrenOf(NodeRef actionedUponNodeRef)
{ {
Map<QName, Serializable> parentProps = nodeService.getProperties(actionedUponNodeRef); Map<QName, Serializable> parentProps = nodeService.getProperties(actionedUponNodeRef);
// parent vital record indicator, default to null if not set // parent vital record indicator, default to null if not set
boolean parentVri = false; boolean parentVri = false;
Boolean parentVriValue = (Boolean) parentProps.get(PROP_VITAL_RECORD_INDICATOR); Boolean parentVriValue = (Boolean) parentProps.get(PROP_VITAL_RECORD_INDICATOR);
@@ -95,7 +87,7 @@ public class BroadcastVitalRecordDefinitionAction extends RMActionExecuterAbstra
{ {
parentVri = parentVriValue.booleanValue(); parentVri = parentVriValue.booleanValue();
} }
Period parentReviewPeriod = (Period) parentProps.get(PROP_REVIEW_PERIOD); Period parentReviewPeriod = (Period) parentProps.get(PROP_REVIEW_PERIOD);
List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(actionedUponNodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); List<ChildAssociationRef> assocs = this.nodeService.getChildAssocs(actionedUponNodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
@@ -114,7 +106,7 @@ public class BroadcastVitalRecordDefinitionAction extends RMActionExecuterAbstra
VitalRecordDefinition vrDefn = vitalRecordService.getVitalRecordDefinition(nextChild); VitalRecordDefinition vrDefn = vitalRecordService.getVitalRecordDefinition(nextChild);
Map<QName, Serializable> aspectProps = new HashMap<QName, Serializable>(); Map<QName, Serializable> aspectProps = new HashMap<QName, Serializable>();
aspectProps.put(PROP_REVIEW_AS_OF, vrDefn.getNextReviewDate()); aspectProps.put(PROP_REVIEW_AS_OF, vrDefn.getNextReviewDate());
nodeService.addAspect(nextChild, RecordsManagementModel.ASPECT_VITAL_RECORD, aspectProps); nodeService.addAspect(nextChild, RecordsManagementModel.ASPECT_VITAL_RECORD, aspectProps);
} }
else else
@@ -130,7 +122,7 @@ public class BroadcastVitalRecordDefinitionAction extends RMActionExecuterAbstra
childProps.put(PROP_VITAL_RECORD_INDICATOR, parentVri); childProps.put(PROP_VITAL_RECORD_INDICATOR, parentVri);
nodeService.setProperties(nextChild, childProps); nodeService.setProperties(nextChild, childProps);
} }
// Recurse down the containment hierarchy to all containers // Recurse down the containment hierarchy to all containers
if (recordService.isRecord(nextChild) == false) if (recordService.isRecord(nextChild) == false)
{ {