ACS-3376 Simplify method of obtaining rule ids.

This commit is contained in:
Tom Page
2022-10-03 15:28:00 +01:00
parent a93dd27674
commit af7e9f97aa
2 changed files with 3 additions and 3 deletions

View File

@@ -35,7 +35,6 @@ import java.util.List;
import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.rest.api.impl.mapper.rules.RestRuleModelMapper; import org.alfresco.rest.api.impl.mapper.rules.RestRuleModelMapper;
import org.alfresco.rest.api.model.rules.Rule;
import org.alfresco.rest.api.model.rules.RuleSet; import org.alfresco.rest.api.model.rules.RuleSet;
import org.alfresco.service.Experimental; import org.alfresco.service.Experimental;
import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef;
@@ -152,8 +151,8 @@ public class RuleSetLoader
private List<String> loadRuleIds(NodeRef folderNodeRef) private List<String> loadRuleIds(NodeRef folderNodeRef)
{ {
return ruleService.getRules(folderNodeRef, false).stream() return ruleService.getRules(folderNodeRef, false).stream()
.map(restRuleModelMapper::toRestModel) .map(org.alfresco.service.cmr.rule.Rule::getNodeRef)
.map(Rule::getId) .map(NodeRef::getId)
.collect(toList()); .collect(toList());
} }

View File

@@ -90,6 +90,7 @@ public class RuleSetLoaderTest extends TestCase
given(nodeServiceMock.getParentAssocs(RULE_SET_NODE)).willReturn(List.of(ruleSetAssociationMock, linkAssociationMock)); given(nodeServiceMock.getParentAssocs(RULE_SET_NODE)).willReturn(List.of(ruleSetAssociationMock, linkAssociationMock));
given(ruleServiceMock.getFoldersInheritingRuleSet(eq(RULE_SET_NODE), anyInt())).willReturn(List.of(INHERITING_FOLDER)); given(ruleServiceMock.getFoldersInheritingRuleSet(eq(RULE_SET_NODE), anyInt())).willReturn(List.of(INHERITING_FOLDER));
given(ruleServiceMock.getFoldersLinkingToRuleSet(RULE_SET_NODE)).willReturn(List.of(LINKING_FOLDER));
} }
@Test @Test