mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -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.RecordsManagementCustomModel;
|
||||
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.repo.copy.CopyBehaviourCallback;
|
||||
import org.alfresco.repo.copy.CopyDetails;
|
||||
@@ -47,7 +46,7 @@ import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* rma:record behaviour bean
|
||||
*
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.2
|
||||
*/
|
||||
@@ -64,16 +63,13 @@ public class RecordAspect extends BaseBehaviourBean
|
||||
/** Well-known location of the scripts folder. */
|
||||
// TODO make configurable
|
||||
private NodeRef scriptsFolderNodeRef = new NodeRef("workspace", "SpacesStore", "rm_behavior_scripts");
|
||||
|
||||
|
||||
/** extended security service */
|
||||
protected ExtendedSecurityService extendedSecurityService;
|
||||
|
||||
|
||||
/** script service */
|
||||
protected ScriptService scriptService;
|
||||
|
||||
/** record service */
|
||||
protected RecordService recordService;
|
||||
|
||||
|
||||
/**
|
||||
* @param extendedSecurityService extended security service
|
||||
*/
|
||||
@@ -89,18 +85,10 @@ public class RecordAspect extends BaseBehaviourBean
|
||||
{
|
||||
this.scriptService = scriptService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recordService record service
|
||||
*/
|
||||
public void setRecordService(RecordService recordService)
|
||||
{
|
||||
this.recordService = recordService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Behaviour to ensure renditions have the appropriate extended security.
|
||||
*
|
||||
*
|
||||
* @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean)
|
||||
*/
|
||||
@Override
|
||||
@@ -158,7 +146,7 @@ public class RecordAspect extends BaseBehaviourBean
|
||||
}
|
||||
|
||||
// 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
|
||||
executeReferenceScript("onRemove", reference, fromNodeRef, toNodeRef);
|
||||
executeReferenceScript("onRemove", reference, fromNodeRef, toNodeRef);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Record copy callback
|
||||
*/
|
||||
@@ -217,7 +205,7 @@ public class RecordAspect extends BaseBehaviourBean
|
||||
|
||||
/**
|
||||
* Record move behaviour
|
||||
*
|
||||
*
|
||||
* @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef)
|
||||
*/
|
||||
@Override
|
||||
@@ -247,7 +235,7 @@ public class RecordAspect extends BaseBehaviourBean
|
||||
}, AuthenticationUtil.getAdminUserName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Executes a reference script if present
|
||||
*
|
||||
|
@@ -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.repo.node.NodeServicePolicies;
|
||||
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.BehaviourBean;
|
||||
import org.alfresco.repo.policy.annotation.BehaviourKind;
|
||||
@@ -48,7 +47,7 @@ import org.alfresco.util.PropertyMap;
|
||||
|
||||
/**
|
||||
* Behaviour associated with the RM Site type
|
||||
*
|
||||
*
|
||||
* @author Roy Wetherall
|
||||
* @since 2.2
|
||||
*/
|
||||
@@ -65,40 +64,28 @@ public class RmSiteType extends BaseBehaviourBean
|
||||
public static final String COMPONENT_DOCUMENT_LIBRARY = "documentLibrary";
|
||||
public static final String DEFAULT_SITE_NAME = "rm";
|
||||
public static final QName DEFAULT_FILE_PLAN_TYPE = TYPE_FILE_PLAN;
|
||||
|
||||
/** Policy component */
|
||||
protected PolicyComponent policyComponent;
|
||||
|
||||
|
||||
/** Site service */
|
||||
protected SiteService siteService;
|
||||
|
||||
|
||||
/** Record Management Search Service */
|
||||
protected RecordsManagementSearchService recordsManagementSearchService;
|
||||
|
||||
|
||||
/** Capability service */
|
||||
protected CapabilityService capabilityService;
|
||||
|
||||
|
||||
/** Map of file plan type's key'ed by corresponding site types */
|
||||
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
|
||||
* @param siteService site service
|
||||
*/
|
||||
public void setSiteService(SiteService siteService)
|
||||
public void setSiteService(SiteService siteService)
|
||||
{
|
||||
this.siteService = siteService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param recordsManagementSearchService records management search service
|
||||
*/
|
||||
@@ -106,7 +93,7 @@ public class RmSiteType extends BaseBehaviourBean
|
||||
{
|
||||
this.recordsManagementSearchService = recordsManagementSearchService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param capabilityService capability service
|
||||
*/
|
||||
@@ -114,10 +101,10 @@ public class RmSiteType extends BaseBehaviourBean
|
||||
{
|
||||
this.capabilityService = capabilityService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Registers a file plan type for a specific site type.
|
||||
*
|
||||
*
|
||||
* @param siteType siteType sub-type of rma:rmsite
|
||||
* @param filePlanType filePlanType sub-type of rma:filePlan
|
||||
* @since 2.2
|
||||
@@ -126,21 +113,21 @@ public class RmSiteType extends BaseBehaviourBean
|
||||
{
|
||||
ParameterCheck.mandatory("siteType", siteType);
|
||||
ParameterCheck.mandatory("filePlanType", filePlanType);
|
||||
|
||||
|
||||
// check that the registered site type is a subtype of rma:rmsite
|
||||
if (dictionaryService.isSubClass(siteType, TYPE_RM_SITE) == false)
|
||||
{
|
||||
throw new AlfrescoRuntimeException(
|
||||
"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
|
||||
if (dictionaryService.isSubClass(filePlanType, TYPE_FILE_PLAN) == false)
|
||||
{
|
||||
throw new AlfrescoRuntimeException(
|
||||
"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
|
||||
mapFilePlanType.put(siteType, filePlanType);
|
||||
}
|
||||
@@ -154,17 +141,17 @@ public class RmSiteType extends BaseBehaviourBean
|
||||
kind = BehaviourKind.CLASS,
|
||||
notificationFrequency = NotificationFrequency.FIRST_EVENT
|
||||
)
|
||||
public void onCreateNode(ChildAssociationRef childAssocRef)
|
||||
{
|
||||
public void onCreateNode(ChildAssociationRef childAssocRef)
|
||||
{
|
||||
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)
|
||||
{
|
||||
// This is not the spaces store - probably the archive store
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (nodeService.exists(rmSite) == true)
|
||||
{
|
||||
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
|
||||
@@ -173,10 +160,10 @@ public class RmSiteType extends BaseBehaviourBean
|
||||
{
|
||||
SiteInfo siteInfo = siteService.getSite(rmSite);
|
||||
if (siteInfo != null)
|
||||
{
|
||||
{
|
||||
// Create the file plan component
|
||||
siteService.createContainer(siteInfo.getShortName(), COMPONENT_DOCUMENT_LIBRARY, getFilePlanType(siteInfo), null);
|
||||
|
||||
|
||||
// Add the reports
|
||||
recordsManagementSearchService.addReports(siteInfo.getShortName());
|
||||
}
|
||||
@@ -185,10 +172,10 @@ public class RmSiteType extends BaseBehaviourBean
|
||||
}, AuthenticationUtil.getAdminUserName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the file plan type for the given site.
|
||||
*
|
||||
*
|
||||
* @param siteInfo site info
|
||||
* @return QName file plan type to create as a container
|
||||
* @since 2.2
|
||||
@@ -196,25 +183,25 @@ public class RmSiteType extends BaseBehaviourBean
|
||||
private QName getFilePlanType(SiteInfo siteInfo)
|
||||
{
|
||||
ParameterCheck.mandatory("siteInfo", siteInfo);
|
||||
|
||||
|
||||
// set default file plan
|
||||
QName result = DEFAULT_FILE_PLAN_TYPE;
|
||||
|
||||
|
||||
// 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)
|
||||
{
|
||||
result = mapFilePlanType.get(siteType);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the visibility of a RM site can not be changed to anything but public.
|
||||
*
|
||||
*
|
||||
* 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)
|
||||
*/
|
||||
@Behaviour
|
||||
@@ -226,10 +213,10 @@ public class RmSiteType extends BaseBehaviourBean
|
||||
{
|
||||
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 &&
|
||||
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
|
||||
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)
|
||||
{
|
||||
// grab the file plan for the RM site
|
||||
NodeRef filePlan = AuthenticationUtil.runAsSystem(new RunAsWork<NodeRef>()
|
||||
NodeRef filePlan = AuthenticationUtil.runAsSystem(new RunAsWork<NodeRef>()
|
||||
{
|
||||
@Override
|
||||
public NodeRef doWork() throws Exception
|
||||
{
|
||||
return siteService.getContainer(siteInfo.getShortName(), COMPONENT_DOCUMENT_LIBRARY);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
if (filePlan != null)
|
||||
{
|
||||
// determine whether the current user has delete capability on the file plan node
|
||||
|
@@ -24,12 +24,9 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
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.util.ServiceBaseImpl;
|
||||
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.namespace.QName;
|
||||
import org.springframework.extensions.surf.util.ParameterCheck;
|
||||
@@ -43,45 +40,12 @@ import org.springframework.extensions.surf.util.ParameterCheck;
|
||||
public class ReportServiceImpl extends ServiceBaseImpl
|
||||
implements ReportService
|
||||
{
|
||||
/** file folder service */
|
||||
protected FileFolderService fileFolderService;
|
||||
|
||||
/** file plan service */
|
||||
protected FilePlanService filePlanService;
|
||||
|
||||
/** content service */
|
||||
protected ContentService contentService;
|
||||
|
||||
/** record service */
|
||||
protected RecordService recordService;
|
||||
|
||||
/** report generator registry */
|
||||
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
|
||||
*/
|
||||
|
@@ -32,7 +32,6 @@ import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.MimetypeService;
|
||||
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.TemplateService;
|
||||
import org.alfresco.util.UrlUtil;
|
||||
@@ -65,9 +64,6 @@ public class DeclarativeReportGenerator extends BaseReportGenerator
|
||||
/** template service */
|
||||
protected TemplateService templateService;
|
||||
|
||||
/** node service */
|
||||
protected NodeService nodeService;
|
||||
|
||||
/** repository helper */
|
||||
protected Repository repository;
|
||||
|
||||
@@ -109,14 +105,6 @@ public class DeclarativeReportGenerator extends BaseReportGenerator
|
||||
this.contentService = contentService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nodeService node service
|
||||
*/
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parameterProcessorComponent parameter processor component
|
||||
*/
|
||||
|
@@ -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.fileplan.FilePlanService;
|
||||
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.RunAsWork;
|
||||
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
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* @author Neil McErlean
|
||||
*/
|
||||
public class BroadcastVitalRecordDefinitionAction extends RMActionExecuterAbstractBase
|
||||
{
|
||||
protected FilePlanService filePlanService;
|
||||
|
||||
protected FilePlanAuthenticationService filePlanAuthenticationService;
|
||||
|
||||
public void setFilePlanService(FilePlanService filePlanService)
|
||||
|
||||
public void setFilePlanService(FilePlanService filePlanService)
|
||||
{
|
||||
this.filePlanService = filePlanService;
|
||||
}
|
||||
|
||||
public void setFilePlanAuthenticationService(FilePlanAuthenticationService filePlanAuthenticationService)
|
||||
{
|
||||
this.filePlanAuthenticationService = filePlanAuthenticationService;
|
||||
this.filePlanService = filePlanService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action,
|
||||
* org.alfresco.service.cmr.repository.NodeRef)
|
||||
@@ -76,18 +68,18 @@ public class BroadcastVitalRecordDefinitionAction extends RMActionExecuterAbstra
|
||||
propagateChangeToChildrenOf(actionedUponNodeRef);
|
||||
return null;
|
||||
}
|
||||
}, AuthenticationUtil.getAdminUserName());
|
||||
}, AuthenticationUtil.getAdminUserName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Propagates the changes to the children of the node specified.
|
||||
*
|
||||
*
|
||||
* @param actionedUponNodeRef actioned upon node reference
|
||||
*/
|
||||
private void propagateChangeToChildrenOf(NodeRef actionedUponNodeRef)
|
||||
{
|
||||
Map<QName, Serializable> parentProps = nodeService.getProperties(actionedUponNodeRef);
|
||||
|
||||
|
||||
// parent vital record indicator, default to null if not set
|
||||
boolean parentVri = false;
|
||||
Boolean parentVriValue = (Boolean) parentProps.get(PROP_VITAL_RECORD_INDICATOR);
|
||||
@@ -95,7 +87,7 @@ public class BroadcastVitalRecordDefinitionAction extends RMActionExecuterAbstra
|
||||
{
|
||||
parentVri = parentVriValue.booleanValue();
|
||||
}
|
||||
|
||||
|
||||
Period parentReviewPeriod = (Period) parentProps.get(PROP_REVIEW_PERIOD);
|
||||
|
||||
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);
|
||||
Map<QName, Serializable> aspectProps = new HashMap<QName, Serializable>();
|
||||
aspectProps.put(PROP_REVIEW_AS_OF, vrDefn.getNextReviewDate());
|
||||
|
||||
|
||||
nodeService.addAspect(nextChild, RecordsManagementModel.ASPECT_VITAL_RECORD, aspectProps);
|
||||
}
|
||||
else
|
||||
@@ -130,7 +122,7 @@ public class BroadcastVitalRecordDefinitionAction extends RMActionExecuterAbstra
|
||||
childProps.put(PROP_VITAL_RECORD_INDICATOR, parentVri);
|
||||
nodeService.setProperties(nextChild, childProps);
|
||||
}
|
||||
|
||||
|
||||
// Recurse down the containment hierarchy to all containers
|
||||
if (recordService.isRecord(nextChild) == false)
|
||||
{
|
||||
|
Reference in New Issue
Block a user