KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.apache.ojb.broker;
2
3
4 /** represents a product group containing a set of Articles.
5  * @see Article
6  */

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

87     public InterfaceArticle[] getAllArticlesInGroup()
88     {
89         return allArticlesInGroup;
90     }
91
92     /**
93      * Sets the allArticlesInGroup.
94      * @param allArticlesInGroup The allArticlesInGroup to set
95      */

96     public void setAllArticlesInGroup(InterfaceArticle[] allArticlesInGroup)
97     {
98         this.allArticlesInGroup = allArticlesInGroup;
99     }
100
101     /**
102      * Gets the description.
103      * @return Returns a String
104      */

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

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

123     public int getGroupId()
124     {
125         return groupId;
126     }
127
128     /**
129      * Sets the groupId.
130      * @param groupId The groupId to set
131      */

132     public void setGroupId(int groupId)
133     {
134         this.groupId = groupId;
135     }
136
137     /**
138      * Gets the groupName.
139      * @return Returns a String
140      */

141     public String JavaDoc getGroupName()
142     {
143         return groupName;
144     }
145
146     /**
147      * Sets the groupName.
148      * @param groupName The groupName to set
149      */

150     public void setGroupName(String JavaDoc groupName)
151     {
152         this.groupName = groupName;
153     }
154
155 }
156
Popular Tags