KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > samples > photos > Photo


1 /*
2   Copyright (C) AOPSYS (http://www.aopsys.com)
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU General Public License as published by
6   the Free Software Foundation; either version 2 of the License, or
7   (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12   GNU General Public License for more details.
13
14   You should have received a copy of the GNU General Public License
15   along with this program; if not, write to the Free Software
16   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

17
18 package org.objectweb.jac.samples.photos;
19
20 import org.objectweb.jac.lib.Attachment;
21 import java.util.Date JavaDoc;
22 import java.util.List JavaDoc;
23 import java.util.Vector JavaDoc;
24
25 public class Photo {
26    
27    public Photo() {
28       title = "untitled";
29       image = null;
30    }
31
32    public Photo (String JavaDoc title, Attachment image) {
33       this.title = title;
34       this.image = image;
35    }
36
37    /**
38     * the author of the photo
39     */

40    Person author;
41    public Person getAuthor() {
42       return author;
43    }
44    public void setAuthor(Person author) {
45       this.author = author;
46    }
47
48    /**
49     * image of the photo
50     */

51    Attachment image;
52    public void setImage(Attachment image) {
53       this.image = image;
54    }
55    public Attachment getImage() {
56       return image;
57    }
58
59    /**
60     * the title of the photo
61     */

62    String JavaDoc title = "";
63    public String JavaDoc getTitle() {
64       return title;
65    }
66    public void setTitle( String JavaDoc title ) {
67       this.title = title;
68    }
69
70    /**
71     * the date the photo was added
72     */

73    Date JavaDoc date = new Date JavaDoc();
74    public Date JavaDoc getDate() {
75       return date;
76    }
77    public void setDate(Date JavaDoc v) {
78       this.date = v;
79    }
80
81    /**
82     * the rate of the photo
83     */

84    int rate = 5;
85    public int getRate() {
86       return rate;
87    }
88    public void setRate(int rate) {
89       this.rate = rate;
90    }
91
92    /**
93     * comments on the photo
94     */

95    List JavaDoc comments = new Vector JavaDoc();
96    public List JavaDoc getComments() {
97       return comments;
98    }
99    public void addComment(Comment comment) {
100       comments.add(comment);
101    }
102 }
103
Popular Tags