KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > broker > AbstractProductGroup


1 package org.apache.ojb.broker;
2
3 import java.util.List JavaDoc;
4 import java.util.Vector JavaDoc;
5
6 /** represents a product group containing a set of Articles.
7  * @see Article
8  */

9 public abstract class AbstractProductGroup implements InterfaceProductGroup
10 {
11     /** add article to group*/
12     public synchronized void add(InterfaceArticle article)
13     {
14         if (allArticlesInGroup == null)
15         {
16             allArticlesInGroup = new Vector JavaDoc();
17         }
18         article.setProductGroup(this);
19         allArticlesInGroup.add(article);
20     }
21
22     /** return group id*/
23     public Integer JavaDoc getId()
24     {
25         return groupId;
26     }
27
28     /**return string representation*/
29     public String JavaDoc toString()
30     {
31         return
32                 "----\n" +
33                 "group Id: " + groupId + "\n" +
34                 "name: " + groupName + "\n" +
35                 "description: " + description + "\n" +
36                 "articles in group: " + allArticlesInGroup;
37     }
38
39     /** return groupname*/
40     public String JavaDoc getName()
41     {
42         return groupName;
43     }
44
45     /** collection containing all articles of a given product group*/
46     private List JavaDoc allArticlesInGroup;
47     /** a textual description of the group*/
48     private String JavaDoc description;
49     /** the unique id of a product group*/
50     private Integer JavaDoc groupId;
51
52     public AbstractProductGroup()
53     {
54     }
55
56     public AbstractProductGroup(Integer JavaDoc pGroupId, String JavaDoc pGroupName, String JavaDoc pDescription)
57     {
58         groupId = pGroupId;
59         groupName = pGroupName;
60         description = pDescription;
61     }
62
63     public void setName(String JavaDoc groupName)
64     {
65         this.groupName = groupName;
66     }
67
68     /** the name of a group*/
69     private String JavaDoc groupName;
70
71     /** return List of all Articles in productgroup*/
72     public List JavaDoc getAllArticles()
73     {
74         return allArticlesInGroup;
75     }
76
77     /** set group id*/
78     public void setId(Integer JavaDoc newValue)
79     {
80         groupId = newValue;
81     }
82     /**
83      * Gets the groupId.
84      * @return Returns a int
85      */

86     public Integer JavaDoc getGroupId()
87     {
88         return groupId;
89     }
90
91     /**
92      * Sets the groupId.
93      * @param groupId The groupId to set
94      */

95     public void setGroupId(Integer JavaDoc groupId)
96     {
97         this.groupId = groupId;
98     }
99
100     /**
101      * Gets the description.
102      * @return Returns a String
103      */

104     public String JavaDoc getDescription()
105     {
106         return description;
107     }
108
109     /**
110      * Sets the description.
111      * @param description The description to set
112      */

113     public void setDescription(String JavaDoc description)
114     {
115         this.description = description;
116     }
117
118     /**
119      * Gets the groupName.
120      * @return Returns a String
121      */

122     public String JavaDoc getGroupName()
123     {
124         return groupName;
125     }
126
127     /**
128      * Sets the groupName.
129      * @param groupName The groupName to set
130      */

131     public void setGroupName(String JavaDoc groupName)
132     {
133         this.groupName = groupName;
134     }
135
136     /**
137      * Gets the allArticlesInGroup.
138      * @return Returns a List
139      */

140     public List JavaDoc getAllArticlesInGroup()
141     {
142         return allArticlesInGroup;
143     }
144
145     /**
146      * Sets the allArticlesInGroup.
147      * @param allArticlesInGroup The allArticlesInGroup to set
148      */

149     public void setAllArticlesInGroup(List JavaDoc allArticlesInGroup)
150     {
151         this.allArticlesInGroup = allArticlesInGroup;
152     }
153
154 }
155
Popular Tags