|
| 1 | +package com.mcplusa.google.feeder; |
| 2 | + |
| 3 | +import com.mcplusa.google.feeder.enums.ACLCaseSensitivityType; |
| 4 | +import com.mcplusa.google.feeder.enums.ACLInheritanceType; |
| 5 | +import com.mcplusa.google.feeder.enums.ACLPrincipalAccess; |
| 6 | +import com.mcplusa.google.feeder.enums.ACLPrincipalScope; |
| 7 | +import java.util.ArrayList; |
| 8 | +import java.util.List; |
| 9 | + |
| 10 | +public class GSAACLItem { |
| 11 | + private String url; |
| 12 | + private ACLInheritanceType inheritanceType; |
| 13 | + private String inheritFrom; |
| 14 | + private List<GSAACLPrincipal> principals; |
| 15 | + |
| 16 | + public GSAACLItem() { |
| 17 | + this.principals = new ArrayList<GSAACLPrincipal>(); |
| 18 | + } |
| 19 | + |
| 20 | + public String getUrl() { |
| 21 | + return url; |
| 22 | + } |
| 23 | + |
| 24 | + public void setUrl(String url) { |
| 25 | + this.url = url; |
| 26 | + } |
| 27 | + |
| 28 | + public ACLInheritanceType getInheritanceType() { |
| 29 | + return inheritanceType; |
| 30 | + } |
| 31 | + |
| 32 | + public void setInheritanceType(ACLInheritanceType inheritanceType) { |
| 33 | + this.inheritanceType = inheritanceType; |
| 34 | + } |
| 35 | + |
| 36 | + public String getInheritFrom() { |
| 37 | + return inheritFrom; |
| 38 | + } |
| 39 | + |
| 40 | + public void setInheritFrom(String inheritFrom) { |
| 41 | + this.inheritFrom = inheritFrom; |
| 42 | + } |
| 43 | + |
| 44 | + public List<GSAACLPrincipal> getPrincipals() { |
| 45 | + return principals; |
| 46 | + } |
| 47 | + |
| 48 | + public void addUserPrincipal(String username, ACLPrincipalAccess access) { |
| 49 | + this.addUserPrincipal(username, access, |
| 50 | + ACLCaseSensitivityType.ACL_PRINCIPAL_CASE_INSENSITIVE, |
| 51 | + "Default"); |
| 52 | + } |
| 53 | + |
| 54 | + public void addUserPrincipal(String username, ACLPrincipalAccess access, |
| 55 | + ACLCaseSensitivityType caseSensitivity, String namespace) { |
| 56 | + this.addPrincipal(username, access, caseSensitivity, |
| 57 | + namespace, ACLPrincipalScope.ACL_PRINCIPAL_SCOPE_USER); |
| 58 | + } |
| 59 | + |
| 60 | + public void addGroupPrincipal(String groupName, ACLPrincipalAccess access) { |
| 61 | + this.addGroupPrincipal(groupName, access, |
| 62 | + ACLCaseSensitivityType.ACL_PRINCIPAL_CASE_INSENSITIVE, |
| 63 | + "Default"); |
| 64 | + } |
| 65 | + |
| 66 | + public void addGroupPrincipal(String groupName, ACLPrincipalAccess access, |
| 67 | + ACLCaseSensitivityType caseSensitivity, String namespace) { |
| 68 | + this.addPrincipal(groupName, access, caseSensitivity, |
| 69 | + namespace, ACLPrincipalScope.ACL_PRINCIPAL_SCOPE_GROUP); |
| 70 | + } |
| 71 | + |
| 72 | + private void addPrincipal(String name, ACLPrincipalAccess access, |
| 73 | + ACLCaseSensitivityType caseSensitivity, String namespace, |
| 74 | + ACLPrincipalScope scope) { |
| 75 | + GSAACLPrincipal principal = new GSAACLPrincipal(); |
| 76 | + principal.setAccess(access); |
| 77 | + principal.setCaseSensitivityType(caseSensitivity); |
| 78 | + principal.setContent(name); |
| 79 | + principal.setNamespace(namespace); |
| 80 | + principal.setScope(scope); |
| 81 | + this.principals.add(principal); |
| 82 | + } |
| 83 | +} |
0 commit comments