summaryrefslogtreecommitdiff
path: root/src/com/google/wireless/gdata/calendar/data/Who.java
blob: 2d438d6db12308efd6057bf4a038b0c27f338f99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
package com.google.wireless.gdata.calendar.data;

import com.google.wireless.gdata.data.StringUtils;

/**
 * Contains information about a event attendee.
 */
public class Who {

    /**
     * No attendee relationhip set.  Used in {@link #setRelationship}
     * and {@link #getRelationship}.
     */
    public static final byte RELATIONSHIP_NONE = 0;

    /**
     * A general meeting/event attendee.  Used in {@link #setRelationship}
     * and {@link #getRelationship}.
     */
    public static final byte RELATIONSHIP_ATTENDEE = 1;

    /**
     * Event organizer.  An organizer is not necessary an attendee.
     * Used in {@link #setRelationship} and {@link #getRelationship}.
     */
    public static final byte RELATIONSHIP_ORGANIZER = 2;

    /**
     * Performer.  Similar to {@link #RELATIONSHIP_SPEAKER}, but with more emphasis on art than
     * speech delivery.
     * Used in {@link #setRelationship} and {@link #getRelationship}.
     */
    public static final byte RELATIONSHIP_PERFORMER = 3;

    /**
     * Speaker.  Used in {@link #setRelationship} and {@link #getRelationship}.
     */
    public static final byte RELATIONSHIP_SPEAKER = 4;

    /**
     * No attendee type set.  Used in {@link #setType} and {@link #getType}.
     */
    public static final byte TYPE_NONE = 0;

    /**
     * Optional attendee.  Used in {@link #setType} and {@link #getType}.
     */
    public static final byte TYPE_OPTIONAL = 1;

    /**
     * Required attendee.  Used in {@link #setType} and {@link #getType}.
     */
    public static final byte TYPE_REQUIRED = 2;

    /**
     * No attendee status set.  Used in {@link #setStatus} and {@link #getStatus}.
     */
    public static final byte STATUS_NONE = 0;


    /**
     * Attendee has accepted.  Used in {@link #setStatus} and {@link #getStatus}.
     */
    public static final byte STATUS_ACCEPTED = 1;

    /**
     * Attendee has declined.  Used in {@link #setStatus} and {@link #getStatus}.
     */
    public static final byte STATUS_DECLINED = 2;

    /**
     * Invitation has been sent, but the person has not accepted.
     * Used in {@link #setStatus} and {@link #getStatus}.
     */
    public static final byte STATUS_INVITED = 3;

    /**
     * Attendee has accepted tentatively.  Used in {@link #setStatus} and {@link #getStatus}.
     */
    public static final byte STATUS_TENTATIVE = 4;

    private String email;
    private String value;
    private byte relationship = RELATIONSHIP_NONE;
    private byte type = TYPE_NONE;
    private byte status = STATUS_NONE;

    /**
     * Creates a new Who, representing event attendee information.
     */
    public Who() {
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public byte getRelationship() {
        return relationship;
    }

    public void setRelationship(byte relationship) {
        this.relationship = relationship;
    }

    public byte getType() {
        return type;
    }

    public void setType(byte type) {
        this.type = type;
    }

    public byte getStatus() {
        return status;
    }

    public void setStatus(byte status) {
        this.status = status;
    }

    protected void toString(StringBuffer sb) {
        if (!StringUtils.isEmpty(email)) {
            sb.append("EMAIL: " + email + "\n");
        }

        if (!StringUtils.isEmpty(value)) {
            sb.append("VALUE: " + value + "\n");
        }

        sb.append("RELATIONSHIP: " + relationship + "\n");
        sb.append("TYPE: " + type + "\n");
        sb.append("STATUS: " + status + "\n");
    }

    public String toString() {
        StringBuffer sb = new StringBuffer();
        toString(sb);
        return sb.toString();
    }
}