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