1. /*
  2. * Copyright 2002-2004 The Apache Software Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17. package org.apache.tools.ant.taskdefs.cvslib;
  18. import org.apache.tools.ant.BuildException;
  19. /**
  20. * Represents a CVS user with a userID and a full name.
  21. *
  22. * @version $Revision: 1.5.2.4 $ $Date: 2004/03/09 17:01:40 $
  23. */
  24. public class CvsUser {
  25. /** The user's Id */
  26. private String m_userID;
  27. /** The user's full name */
  28. private String m_displayName;
  29. /**
  30. * Set the user's fullname
  31. *
  32. * @param displayName the user's full name
  33. */
  34. public void setDisplayname(final String displayName) {
  35. m_displayName = displayName;
  36. }
  37. /**
  38. * Set the user's id
  39. *
  40. * @param userID the user's new id value.
  41. */
  42. public void setUserid(final String userID) {
  43. m_userID = userID;
  44. }
  45. /**
  46. * Get the user's id.
  47. *
  48. * @return The userID value
  49. */
  50. String getUserID() {
  51. return m_userID;
  52. }
  53. /**
  54. * Get the user's full name
  55. *
  56. * @return the user's full name
  57. */
  58. String getDisplayname() {
  59. return m_displayName;
  60. }
  61. /**
  62. * validate that this object is configured.
  63. *
  64. * @exception BuildException if the instance has not be correctly
  65. * configured.
  66. */
  67. void validate() throws BuildException {
  68. if (null == m_userID) {
  69. final String message = "Username attribute must be set.";
  70. throw new BuildException(message);
  71. }
  72. if (null == m_displayName) {
  73. final String message =
  74. "Displayname attribute must be set for userID " + m_userID;
  75. throw new BuildException(message);
  76. }
  77. }
  78. }