KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > calendar > model > Component


1 // The contents of this file are subject to the Mozilla Public License Version
2
// 1.1
3
//(the "License"); you may not use this file except in compliance with the
4
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
5
//
6
//Software distributed under the License is distributed on an "AS IS" basis,
7
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8
//for the specific language governing rights and
9
//limitations under the License.
10
//
11
//The Original Code is "The Columba Project"
12
//
13
//The Initial Developers of the Original Code are Frederik Dietz and Timo
14
// Stich.
15
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
16
//
17
//All Rights Reserved.
18
package org.columba.calendar.model;
19
20 import java.util.Calendar JavaDoc;
21
22 import org.columba.calendar.base.VCalendarUIDGenerator;
23 import org.columba.calendar.model.api.IComponent;
24
25 public class Component implements IComponent {
26
27     private String JavaDoc id;
28
29     private TYPE type;
30
31     private Calendar JavaDoc dtStamp;
32
33     private String JavaDoc calendarId;
34     
35     public Component(String JavaDoc id, TYPE type) {
36         if (id == null)
37             throw new IllegalArgumentException JavaDoc("id == null");
38         if (type == null)
39             throw new IllegalArgumentException JavaDoc("type == null");
40         
41         this.id = id;
42         this.type = type;
43         
44         dtStamp = Calendar.getInstance();
45     }
46
47     public Component(TYPE type) {
48         if (type == null)
49             throw new IllegalArgumentException JavaDoc("type == null");
50         
51         // generate default unique id
52
this.id = new VCalendarUIDGenerator().newUID();
53         
54         this.type = type;
55         
56         dtStamp = Calendar.getInstance();
57
58     }
59
60     public TYPE getType() {
61         return type;
62     }
63
64     public String JavaDoc getId() {
65         return id;
66     }
67
68     public Calendar JavaDoc getDtStamp() {
69         return dtStamp;
70     }
71
72     public void setDtStamp(Calendar JavaDoc calendar) {
73         this.dtStamp = calendar;
74     }
75
76     public String JavaDoc getCalendar() {
77         return calendarId;
78     }
79
80     public void setCalendar(String JavaDoc calendar) {
81         this.calendarId = calendar;
82     }
83
84 }
85
Popular Tags