summaryrefslogtreecommitdiff
path: root/src/com/google/wireless/gdata/calendar/data/CalendarEntry.java
blob: 0d9e8d851a0cea12c94d24a0dd04e27900d9c8ee (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
154
155
156
157
158
159
160
161
162
163
164
165
166
// Copyright 2007 The Android Open Source Project

package com.google.wireless.gdata.calendar.data;

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

/**
 * Entry containing information about a calendar.
 */
public class CalendarEntry extends Entry {
    
    /**
     * Access level constant indicating the user has no access to a calendar.
     */
    public static final byte ACCESS_NONE = 0;
    
    /**
     * Access level constant indicating the user can read (but not write) to
     * a calendar. 
     */
    public static final byte ACCESS_READ = 1;
    
    /**
     * Access level constant indicating the user can only view free-busy 
     * information for a calendar.
     */
    public static final byte ACCESS_FREEBUSY = 2;
    
    /**
     * Access level constant indicating the user can edit this calendar.
     */
    public static final byte ACCESS_EDITOR = 3;
    
    /**
     * Access level constant indicating the user owns this calendar.
     */
    public static final byte ACCESS_OWNER = 4;

    /**
     * Access level constant indicating the user is a domain admin.
     */
    public static final byte ACCESS_ROOT = 5;
    
    private byte accessLevel = ACCESS_READ;
    // TODO: rename to feed Url?
    private String alternateLink = null;
    private String color = null;
    private boolean hidden = false;
    private boolean selected = true;
    private String timezone = null;
    
    /**
     * Creates a new, empty calendar entry.
     */
    public CalendarEntry() {
    }

    public void clear() {
        super.clear();
        accessLevel = ACCESS_READ;
        alternateLink = null;
        color = null;
        hidden = false;
        selected = true;
        timezone = null;
    }

    /**
     * @return the accessLevel
     */
    public byte getAccessLevel() {
        return accessLevel;
    }

    /**
     * @param accessLevel the accessLevel to set
     */
    public void setAccessLevel(byte accessLevel) {
        this.accessLevel = accessLevel;
    }

    /**
     * @return the alternateLink
     */
    public String getAlternateLink() {
        return alternateLink;
    }

    /**
     * @param alternateLink the alternateLink to set
     */
    public void setAlternateLink(String alternateLink) {
        this.alternateLink = alternateLink;
    }
    
    /**
     * @return the color
     */
    public String getColor() {
        return color;
    }

    /**
     * @param color the color to set
     */
    public void setColor(String color) {
        this.color = color;
    }

    /**
     * @return the hidden
     */
    public boolean isHidden() {
        return hidden;
    }

    /**
     * @param hidden the hidden to set
     */
    public void setHidden(boolean hidden) {
        this.hidden = hidden;
    }

    /**
     * @return the selected
     */
    public boolean isSelected() {
        return selected;
    }

    /**
     * @param selected the selected to set
     */
    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    /**
     * @return the timezone
     */
    public String getTimezone() {
        return timezone;
    }

    /**
     * @param timezone the timezone to set
     */
    public void setTimezone(String timezone) {
        this.timezone = timezone;
    }
    
    public void toString(StringBuffer sb) {
        sb.append("ACCESS LEVEL: ");
        sb.append(accessLevel);
        sb.append('\n');
        appendIfNotNull(sb, "ALTERNATE LINK", alternateLink);
        appendIfNotNull(sb, "COLOR", color);
        sb.append("HIDDEN: ");
        sb.append(hidden);
        sb.append('\n');
        sb.append("SELECTED: ");
        sb.append(selected);
        sb.append('\n');
        appendIfNotNull(sb, "TIMEZONE", timezone);
    }
}