mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
ACS-9429 Fix AGS Roles API (#3365)
This commit is contained in:
@@ -81,6 +81,7 @@
|
|||||||
<bean class="org.alfresco.rm.rest.api.fileplans.FilePlanRolesRelation">
|
<bean class="org.alfresco.rm.rest.api.fileplans.FilePlanRolesRelation">
|
||||||
<property name="apiUtils" ref="apiUtils" />
|
<property name="apiUtils" ref="apiUtils" />
|
||||||
<property name="rmRoles" ref="rm.roles" />
|
<property name="rmRoles" ref="rm.roles" />
|
||||||
|
<property name="filePlanService" ref="FilePlanService" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean class="org.alfresco.rm.rest.api.holds.HoldsEntityResource" >
|
<bean class="org.alfresco.rm.rest.api.holds.HoldsEntityResource" >
|
||||||
|
@@ -30,7 +30,9 @@ import static org.alfresco.util.ParameterCheck.mandatory;
|
|||||||
|
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
|
||||||
|
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.rest.framework.core.exceptions.EntityNotFoundException;
|
||||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
import org.alfresco.rest.framework.resource.RelationshipResource;
|
||||||
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
||||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||||
@@ -44,6 +46,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
public class FilePlanRolesRelation implements RelationshipResourceAction.Read<RoleModel>, InitializingBean
|
public class FilePlanRolesRelation implements RelationshipResourceAction.Read<RoleModel>, InitializingBean
|
||||||
{
|
{
|
||||||
private RMRoles rmRoles;
|
private RMRoles rmRoles;
|
||||||
|
private FilePlanService filePlanService;
|
||||||
private FilePlanComponentsApiUtils apiUtils;
|
private FilePlanComponentsApiUtils apiUtils;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -51,15 +54,31 @@ public class FilePlanRolesRelation implements RelationshipResourceAction.Read<Ro
|
|||||||
{
|
{
|
||||||
mandatory("rmRoles", this.rmRoles);
|
mandatory("rmRoles", this.rmRoles);
|
||||||
mandatory("apiUtils", this.apiUtils);
|
mandatory("apiUtils", this.apiUtils);
|
||||||
|
mandatory("filePlanService", this.filePlanService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CollectionWithPagingInfo<RoleModel> readAll(String filePlanId, Parameters params)
|
public CollectionWithPagingInfo<RoleModel> readAll(String filePlanId, Parameters params)
|
||||||
{
|
{
|
||||||
NodeRef filePlanNodeRef = apiUtils.lookupAndValidateNodeType(filePlanId, RecordsManagementModel.TYPE_FILE_PLAN);
|
NodeRef filePlanNodeRef = getFilePlan(filePlanId);
|
||||||
|
if (filePlanNodeRef == null)
|
||||||
|
{
|
||||||
|
throw new EntityNotFoundException(filePlanId);
|
||||||
|
}
|
||||||
|
|
||||||
return rmRoles.getRoles(filePlanNodeRef, params);
|
return rmRoles.getRoles(filePlanNodeRef, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private NodeRef getFilePlan(String filePlanId)
|
||||||
|
{
|
||||||
|
NodeRef filePlanNodeRef = apiUtils.lookupAndValidateNodeType(filePlanId, RecordsManagementModel.TYPE_FILE_PLAN);
|
||||||
|
if (!FilePlanComponentsApiUtils.FILE_PLAN_ALIAS.equals(filePlanId))
|
||||||
|
{
|
||||||
|
filePlanNodeRef = filePlanService.getFilePlan(filePlanNodeRef);
|
||||||
|
}
|
||||||
|
return filePlanNodeRef;
|
||||||
|
}
|
||||||
|
|
||||||
public void setRmRoles(RMRoles rmRoles)
|
public void setRmRoles(RMRoles rmRoles)
|
||||||
{
|
{
|
||||||
this.rmRoles = rmRoles;
|
this.rmRoles = rmRoles;
|
||||||
@@ -69,4 +88,9 @@ public class FilePlanRolesRelation implements RelationshipResourceAction.Read<Ro
|
|||||||
{
|
{
|
||||||
this.apiUtils = apiUtils;
|
this.apiUtils = apiUtils;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFilePlanService(FilePlanService filePlanService)
|
||||||
|
{
|
||||||
|
this.filePlanService = filePlanService;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user