-
Notifications
You must be signed in to change notification settings - Fork 422
OAK-11744 : removed usage of Guava's ImmutableList #2320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,6 @@ | |
| import javax.jcr.security.AccessControlPolicyIterator; | ||
| import javax.jcr.security.Privilege; | ||
|
|
||
| import org.apache.jackrabbit.guava.common.collect.ImmutableList; | ||
| import org.apache.jackrabbit.api.security.JackrabbitAccessControlManager; | ||
| import org.apache.jackrabbit.api.security.JackrabbitAccessControlPolicy; | ||
| import org.apache.jackrabbit.commons.iterator.AccessControlPolicyIteratorAdapter; | ||
|
|
@@ -81,24 +80,23 @@ public Privilege[] getSupportedPrivileges(String absPath) throws RepositoryExcep | |
|
|
||
| @Override | ||
| public AccessControlPolicy[] getPolicies(String absPath) throws RepositoryException { | ||
| ImmutableList.Builder<AccessControlPolicy> policies = ImmutableList.builder(); | ||
| List<AccessControlPolicy> policies = new ArrayList<>(); | ||
| for (AccessControlManager acMgr : acMgrs) { | ||
| policies.add(acMgr.getPolicies(absPath)); | ||
| policies.addAll(Arrays.asList(acMgr.getPolicies(absPath))); | ||
| } | ||
| List<AccessControlPolicy> l = policies.build(); | ||
| return l.toArray(new AccessControlPolicy[0]); | ||
| return policies.toArray(new AccessControlPolicy[0]); | ||
| } | ||
|
|
||
| @Override | ||
| public AccessControlPolicy[] getEffectivePolicies(String absPath) throws RepositoryException { | ||
| ImmutableList.Builder<AccessControlPolicy> policies = ImmutableList.builder(); | ||
| List<AccessControlPolicy> policies = new ArrayList<>(); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
| for (AccessControlManager acMgr : acMgrs) { | ||
| policies.add(acMgr.getEffectivePolicies(absPath)); | ||
| policies.addAll(Arrays.asList(acMgr.getEffectivePolicies(absPath))); | ||
| if (aggregationFilter.stop(acMgr, absPath)) { | ||
| break; | ||
| } | ||
| } | ||
| return policies.build().stream().distinct().toArray(AccessControlPolicy[]::new); | ||
| return policies.stream().distinct().toArray(AccessControlPolicy[]::new); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -138,49 +136,46 @@ public void removePolicy(String absPath, AccessControlPolicy policy) throws Repo | |
| @NotNull | ||
| @Override | ||
| public JackrabbitAccessControlPolicy[] getApplicablePolicies(@NotNull Principal principal) throws RepositoryException { | ||
| ImmutableList.Builder<JackrabbitAccessControlPolicy> policies = ImmutableList.builder(); | ||
| List<JackrabbitAccessControlPolicy> policies = new ArrayList<>(); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above. |
||
| for (AccessControlManager acMgr : acMgrs) { | ||
| if (acMgr instanceof JackrabbitAccessControlManager && acMgr instanceof PolicyOwner) { | ||
| policies.add(((JackrabbitAccessControlManager) acMgr).getApplicablePolicies(principal)); | ||
| policies.addAll(Arrays.asList(((JackrabbitAccessControlManager) acMgr).getApplicablePolicies(principal))); | ||
| } | ||
| } | ||
| List<JackrabbitAccessControlPolicy> l = policies.build(); | ||
| return l.toArray(new JackrabbitAccessControlPolicy[0]); | ||
| return policies.toArray(new JackrabbitAccessControlPolicy[0]); | ||
| } | ||
|
|
||
| @NotNull | ||
| @Override | ||
| public JackrabbitAccessControlPolicy[] getPolicies(@NotNull Principal principal) throws RepositoryException { | ||
| ImmutableList.Builder<JackrabbitAccessControlPolicy> policies = ImmutableList.builder(); | ||
| List<JackrabbitAccessControlPolicy> policies = new ArrayList<>(); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
| for (AccessControlManager acMgr : acMgrs) { | ||
| if (acMgr instanceof JackrabbitAccessControlManager) { | ||
| policies.add(((JackrabbitAccessControlManager) acMgr).getPolicies(principal)); | ||
| policies.addAll(Arrays.asList(((JackrabbitAccessControlManager) acMgr).getPolicies(principal))); | ||
| } | ||
| } | ||
| List<JackrabbitAccessControlPolicy> l = policies.build(); | ||
| return l.toArray(new JackrabbitAccessControlPolicy[0]); | ||
| return policies.toArray(new JackrabbitAccessControlPolicy[0]); | ||
| } | ||
|
|
||
| @NotNull | ||
| @Override | ||
| public AccessControlPolicy[] getEffectivePolicies(@NotNull Set<Principal> principals) throws RepositoryException { | ||
| ImmutableList.Builder<AccessControlPolicy> policies = ImmutableList.builder(); | ||
| List<AccessControlPolicy> policies = new ArrayList<>(); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above. |
||
| for (AccessControlManager acMgr : acMgrs) { | ||
| if (acMgr instanceof JackrabbitAccessControlManager) { | ||
| JackrabbitAccessControlManager jAcMgr = (JackrabbitAccessControlManager) acMgr; | ||
| policies.add(jAcMgr.getEffectivePolicies(principals)); | ||
| policies.addAll(Arrays.asList(jAcMgr.getEffectivePolicies(principals))); | ||
| if (aggregationFilter.stop(jAcMgr, principals)) { | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| List<AccessControlPolicy> l = policies.build(); | ||
| return l.toArray(new AccessControlPolicy[0]); | ||
| return policies.toArray(new AccessControlPolicy[0]); | ||
| } | ||
|
|
||
| @Override | ||
| public @NotNull Iterator<AccessControlPolicy> getEffectivePolicies(@NotNull Set<Principal> principals, @Nullable String... absPaths) throws AccessDeniedException, AccessControlException, UnsupportedRepositoryOperationException, RepositoryException { | ||
| ImmutableList.Builder<Iterator<AccessControlPolicy>> iterators = ImmutableList.builder(); | ||
| List<Iterator<AccessControlPolicy>> iterators = new ArrayList<>(); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above. |
||
| for (AccessControlManager acMgr : acMgrs) { | ||
| if (acMgr instanceof JackrabbitAccessControlManager) { | ||
| JackrabbitAccessControlManager jAcMgr = (JackrabbitAccessControlManager) acMgr; | ||
|
|
@@ -190,6 +185,6 @@ public AccessControlPolicy[] getEffectivePolicies(@NotNull Set<Principal> princi | |
| } | ||
| } | ||
| } | ||
| return IteratorUtils.chainedIterator(iterators.build().toArray(new Iterator[0])); | ||
| return IteratorUtils.chainedIterator(iterators.toArray(new Iterator[0])); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for Immutability here, since the List is never exposed outside the method.