PageRenderTime 26ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/src/main/java/org/jvnet/hudson/crowd/AbstractRemoteDirectory.java

https://gitlab.com/admin-github-cloud/backend-crowd-javanet-directory
Java | 156 lines | 117 code | 34 blank | 5 comment | 0 complexity | 310a0b67666725ae1d65027e9f773770 MD5 | raw file
  1. package org.jvnet.hudson.crowd;
  2. import com.atlassian.crowd.integration.authentication.PasswordCredential;
  3. import com.atlassian.crowd.integration.directory.RemoteDirectory;
  4. import com.atlassian.crowd.integration.exception.DirectoryAccessException;
  5. import com.atlassian.crowd.integration.exception.InvalidCredentialException;
  6. import com.atlassian.crowd.integration.exception.InvalidGroupException;
  7. import com.atlassian.crowd.integration.exception.InvalidMembershipException;
  8. import com.atlassian.crowd.integration.exception.InvalidUserException;
  9. import com.atlassian.crowd.integration.exception.MembershipNotFoundException;
  10. import com.atlassian.crowd.integration.exception.ObjectNotFoundException;
  11. import com.atlassian.crowd.integration.model.group.Group;
  12. import com.atlassian.crowd.integration.model.group.GroupTemplate;
  13. import com.atlassian.crowd.integration.model.user.User;
  14. import com.atlassian.crowd.integration.model.user.UserTemplate;
  15. import com.atlassian.crowd.search.query.entity.EntityQuery;
  16. import com.atlassian.crowd.search.query.membership.MembershipQuery;
  17. import java.util.Collections;
  18. import java.util.List;
  19. import java.util.Map;
  20. import java.util.Set;
  21. /**
  22. * Base minimal implementation.
  23. *
  24. * @author Kohsuke Kawaguchi
  25. */
  26. public abstract class AbstractRemoteDirectory implements RemoteDirectory {
  27. private long id;
  28. private Map<String,String> attributes = Collections.emptyMap();
  29. public long getDirectoryId() {
  30. return id;
  31. }
  32. public void setDirectoryId(long id) {
  33. this.id = id;
  34. }
  35. public void setAttributes(Map<String, String> atts) {
  36. this.attributes = atts;
  37. }
  38. public User addUser(UserTemplate userTemplate, PasswordCredential passwordCredential) throws InvalidUserException, ObjectNotFoundException, InvalidCredentialException {
  39. throw new UnsupportedOperationException("Adding user is not supported");
  40. }
  41. public User updateUser(UserTemplate userTemplate) throws InvalidUserException, ObjectNotFoundException {
  42. throw new UnsupportedOperationException("Updating user is not supported");
  43. }
  44. public void updateUserCredential(String s, PasswordCredential passwordCredential) throws ObjectNotFoundException, InvalidCredentialException {
  45. throw new UnsupportedOperationException("Changing the password is not supported");
  46. }
  47. public User renameUser(String s, String s1) throws ObjectNotFoundException, InvalidUserException {
  48. throw new UnsupportedOperationException("Renaming user is not supported");
  49. }
  50. public void storeUserAttributes(String s, Map<String, List<String>> stringListMap) throws ObjectNotFoundException {
  51. throw new UnsupportedOperationException();
  52. }
  53. public void removeUserAttributes(String s, String s1) throws ObjectNotFoundException {
  54. throw new UnsupportedOperationException();
  55. }
  56. public void removeUser(String s) throws ObjectNotFoundException {
  57. throw new UnsupportedOperationException();
  58. }
  59. public List searchUsers(EntityQuery entityQuery) {
  60. return Collections.emptyList();
  61. }
  62. public Group addGroup(GroupTemplate groupTemplate) throws InvalidGroupException, ObjectNotFoundException {
  63. throw new UnsupportedOperationException();
  64. }
  65. public Group updateGroup(GroupTemplate groupTemplate) throws InvalidGroupException, ObjectNotFoundException {
  66. throw new UnsupportedOperationException();
  67. }
  68. public Group renameGroup(String s, String s1) throws ObjectNotFoundException, InvalidGroupException {
  69. throw new UnsupportedOperationException();
  70. }
  71. public void storeGroupAttributes(String s, Map<String, List<String>> stringListMap) throws ObjectNotFoundException {
  72. throw new UnsupportedOperationException();
  73. }
  74. public void removeGroupAttributes(String s, String s1) throws ObjectNotFoundException {
  75. throw new UnsupportedOperationException();
  76. }
  77. public void removeGroup(String s) throws ObjectNotFoundException {
  78. throw new UnsupportedOperationException();
  79. }
  80. public List searchGroups(EntityQuery entityQuery) {
  81. return Collections.emptyList();
  82. }
  83. public boolean isUserDirectGroupMember(String s, String s1) {
  84. return false;
  85. }
  86. public boolean isGroupDirectGroupMember(String s, String s1) {
  87. return false;
  88. }
  89. public void addUserToGroup(String s, String s1) throws ObjectNotFoundException {
  90. throw new UnsupportedOperationException();
  91. }
  92. public void addGroupToGroup(String s, String s1) throws ObjectNotFoundException, InvalidMembershipException {
  93. throw new UnsupportedOperationException();
  94. }
  95. public void removeUserFromGroup(String s, String s1) throws ObjectNotFoundException, MembershipNotFoundException {
  96. throw new UnsupportedOperationException();
  97. }
  98. public void removeGroupFromGroup(String s, String s1) throws ObjectNotFoundException, InvalidMembershipException, MembershipNotFoundException {
  99. throw new UnsupportedOperationException();
  100. }
  101. public List searchGroupRelationships(MembershipQuery membershipQuery) {
  102. return Collections.emptyList();
  103. }
  104. public void testConnection() throws DirectoryAccessException {
  105. }
  106. public boolean supportsNestedGroups() {
  107. return false;
  108. }
  109. public List<String> getAttributes(String name) {
  110. String v = attributes.get(name);
  111. return v!=null ? Collections.singletonList(v) : Collections.<String>emptyList();
  112. }
  113. public String getAttribute(String name) {
  114. return attributes.get(name);
  115. }
  116. public Set<String> getAttributeNames() {
  117. return attributes.keySet();
  118. }
  119. public boolean hasAttribute(String name) {
  120. return attributes.containsKey(name);
  121. }
  122. }