001: package org.apache.ojb.broker;
002:
003: import java.util.List;
004: import java.util.Vector;
005:
006: /** represents a product group containing a set of Articles.
007: * @see Article
008: */
009: public abstract class AbstractProductGroup implements
010: InterfaceProductGroup {
011: /** add article to group*/
012: public synchronized void add(InterfaceArticle article) {
013: if (allArticlesInGroup == null) {
014: allArticlesInGroup = new Vector();
015: }
016: article.setProductGroup(this );
017: allArticlesInGroup.add(article);
018: }
019:
020: /** return group id*/
021: public Integer getId() {
022: return groupId;
023: }
024:
025: /**return string representation*/
026: public String toString() {
027: return "----\n" + "group Id: " + groupId + "\n"
028: + "name: " + groupName + "\n" + "description: "
029: + description + "\n" + "articles in group: "
030: + allArticlesInGroup;
031: }
032:
033: /** return groupname*/
034: public String getName() {
035: return groupName;
036: }
037:
038: /** collection containing all articles of a given product group*/
039: private List allArticlesInGroup;
040: /** a textual description of the group*/
041: private String description;
042: /** the unique id of a product group*/
043: private Integer groupId;
044:
045: public AbstractProductGroup() {
046: }
047:
048: public AbstractProductGroup(Integer pGroupId, String pGroupName,
049: String pDescription) {
050: groupId = pGroupId;
051: groupName = pGroupName;
052: description = pDescription;
053: }
054:
055: public void setName(String groupName) {
056: this .groupName = groupName;
057: }
058:
059: /** the name of a group*/
060: private String groupName;
061:
062: /** return List of all Articles in productgroup*/
063: public List getAllArticles() {
064: return allArticlesInGroup;
065: }
066:
067: /** set group id*/
068: public void setId(Integer newValue) {
069: groupId = newValue;
070: }
071:
072: /**
073: * Gets the groupId.
074: * @return Returns a int
075: */
076: public Integer getGroupId() {
077: return groupId;
078: }
079:
080: /**
081: * Sets the groupId.
082: * @param groupId The groupId to set
083: */
084: public void setGroupId(Integer groupId) {
085: this .groupId = groupId;
086: }
087:
088: /**
089: * Gets the description.
090: * @return Returns a String
091: */
092: public String getDescription() {
093: return description;
094: }
095:
096: /**
097: * Sets the description.
098: * @param description The description to set
099: */
100: public void setDescription(String description) {
101: this .description = description;
102: }
103:
104: /**
105: * Gets the groupName.
106: * @return Returns a String
107: */
108: public String getGroupName() {
109: return groupName;
110: }
111:
112: /**
113: * Sets the groupName.
114: * @param groupName The groupName to set
115: */
116: public void setGroupName(String groupName) {
117: this .groupName = groupName;
118: }
119:
120: /**
121: * Gets the allArticlesInGroup.
122: * @return Returns a List
123: */
124: public List getAllArticlesInGroup() {
125: return allArticlesInGroup;
126: }
127:
128: /**
129: * Sets the allArticlesInGroup.
130: * @param allArticlesInGroup The allArticlesInGroup to set
131: */
132: public void setAllArticlesInGroup(List allArticlesInGroup) {
133: this.allArticlesInGroup = allArticlesInGroup;
134: }
135:
136: }
|