Merged DEV to V2.2.1.x

114241: MNT-14900 : Alfresco doesn't work with Records Management
      - Fixed problem with circular references during Spring dependency injection process

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.2.1.x@114437 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alexandru Balmus
2015-10-15 13:18:14 +00:00
parent 2541cc36ab
commit 670ca476a4
4 changed files with 41 additions and 7 deletions

View File

@@ -145,7 +145,8 @@
<!-- Action Service --> <!-- Action Service -->
<bean id="actionService" class="org.alfresco.repo.action.ExtendedActionServiceImpl" init-method="init"> <bean id="actionService" class="org.alfresco.repo.action.ExtendedActionServiceImpl" init-method="init">
<property name="filePlanService" ref="FilePlanService" /> <!-- The following reference injection has been commented out to address MNT-14900; dependency is resolved internally. -->
<!-- <property name="filePlanService" ref="FilePlanService" /> -->
<property name="policyComponent"> <property name="policyComponent">
<ref bean="policyComponent" /> <ref bean="policyComponent" />

View File

@@ -501,7 +501,8 @@
<property name="authorityService" ref="AuthorityService"/> <property name="authorityService" ref="AuthorityService"/>
<property name="permissionService" ref="PermissionService"/> <property name="permissionService" ref="PermissionService"/>
<property name="nodeService" ref="NodeService"/> <property name="nodeService" ref="NodeService"/>
<property name="filePlanService" ref="FilePlanService" /> <!-- The following reference injection has been commented out to address MNT-14900; dependency is resolved internally. -->
<!-- <property name="filePlanService" ref="FilePlanService" /> -->
<!-- init repo for when a tenant is created --> <!-- init repo for when a tenant is created -->
<property name="bootstrapImporterModuleComponent" ref="org_alfresco_module_rm_bootstrapData"/> <property name="bootstrapImporterModuleComponent" ref="org_alfresco_module_rm_bootstrapData"/>

View File

@@ -53,6 +53,9 @@ import org.apache.commons.lang.StringUtils;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.extensions.surf.util.I18NUtil; import org.springframework.extensions.surf.util.I18NUtil;
/** /**
@@ -62,7 +65,8 @@ import org.springframework.extensions.surf.util.I18NUtil;
* @since 2.1 * @since 2.1
*/ */
public class FilePlanRoleServiceImpl implements FilePlanRoleService, public class FilePlanRoleServiceImpl implements FilePlanRoleService,
RecordsManagementModel RecordsManagementModel,
ApplicationContextAware
{ {
/** I18N */ /** I18N */
private static final String MSG_ALL_ROLES = "rm.role.all"; private static final String MSG_ALL_ROLES = "rm.role.all";
@@ -93,6 +97,8 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
private BootstrapImporterModuleComponent bootstrapImporterModule; private BootstrapImporterModuleComponent bootstrapImporterModule;
private ApplicationContext applicationContext;
/** Records management role zone */ /** Records management role zone */
public static final String RM_ROLE_ZONE_PREFIX = "rmRoleZone"; public static final String RM_ROLE_ZONE_PREFIX = "rmRoleZone";
@@ -148,6 +154,16 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
this.bootstrapImporterModule = bootstrapImporterModuleComponent; this.bootstrapImporterModule = bootstrapImporterModuleComponent;
} }
protected FilePlanService getFilePlanService()
{
if (filePlanService == null)
{
filePlanService = (FilePlanService) applicationContext.getBean("FilePlanService");
}
return filePlanService;
}
/** /**
* @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#initialiseFilePlan(org.alfresco.service.cmr.repository.NodeRef) * @see org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService#initialiseFilePlan(org.alfresco.service.cmr.repository.NodeRef)
*/ */
@@ -190,11 +206,11 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
permissionService.setPermission(filePlan, ExtendedWriterDynamicAuthority.EXTENDED_WRITER, RMPermissionModel.FILING, true); permissionService.setPermission(filePlan, ExtendedWriterDynamicAuthority.EXTENDED_WRITER, RMPermissionModel.FILING, true);
// Create the transfer and hold containers // Create the transfer and hold containers
systemContainers.add(filePlanService.createHoldContainer(filePlan)); systemContainers.add(getFilePlanService().createHoldContainer(filePlan));
systemContainers.add(filePlanService.createTransferContainer(filePlan)); systemContainers.add(getFilePlanService().createTransferContainer(filePlan));
// Create the unfiled record container // Create the unfiled record container
systemContainers.add(filePlanService.createUnfiledContainer(filePlan)); systemContainers.add(getFilePlanService().createUnfiledContainer(filePlan));
return systemContainers; return systemContainers;
} }
@@ -877,4 +893,10 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
{ {
return authorityService.getName(AuthorityType.GROUP, getAllRolesGroupShortName(filePlan)); return authorityService.getName(AuthorityType.GROUP, getAllRolesGroupShortName(filePlan));
} }
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
{
this.applicationContext = applicationContext;
}
} }

View File

@@ -46,6 +46,16 @@ public class ExtendedActionServiceImpl extends ActionServiceImpl implements Appl
/** Application context */ /** Application context */
private ApplicationContext extendedApplicationContext; private ApplicationContext extendedApplicationContext;
protected FilePlanService getFilePlanService()
{
if (filePlanService == null)
{
filePlanService = (FilePlanService) extendedApplicationContext.getBean("FilePlanService");
}
return filePlanService;
}
/** /**
* @see org.alfresco.repo.action.ActionServiceImpl#setApplicationContext(org.springframework.context.ApplicationContext) * @see org.alfresco.repo.action.ActionServiceImpl#setApplicationContext(org.springframework.context.ApplicationContext)
*/ */
@@ -98,7 +108,7 @@ public class ExtendedActionServiceImpl extends ActionServiceImpl implements Appl
else else
{ {
// get the file component kind of the node reference // get the file component kind of the node reference
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); FilePlanComponentKind kind = getFilePlanService().getFilePlanComponentKind(nodeRef);
result = new ArrayList<ActionDefinition>(actionDefinitions.size()); result = new ArrayList<ActionDefinition>(actionDefinitions.size());
// check each action definition // check each action definition