KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > partmappersistence > data > HibernatePackageLevelParticipant


1 /*
2  * Shark Hibernate PartMapPersistence - Copyright Open Wide
3  */

4
5 package org.enhydra.shark.partmappersistence.data;
6
7 import java.util.Iterator JavaDoc;
8
9 /**
10  * Simple POJO class, part of the participant mapping model
11  *
12  * @author Vladislav Pernin
13  */

14 public class HibernatePackageLevelParticipant extends HibernateParticipant {
15
16     private HibernatePackage pck;
17
18
19     public HibernatePackageLevelParticipant() {
20         super();
21     }
22
23     public HibernatePackage getPackage() {
24         return pck;
25     }
26
27     public void setPackage(HibernatePackage pack) {
28         this.pck = pack;
29     }
30     
31     public void addNormalUser (HibernateNormalUser user){
32         if(!normalUsers.contains(user)){
33             normalUsers.add(user);
34         }
35     }
36     
37     public void removeNormalUser(HibernateNormalUser user){
38         normalUsers.remove(user);
39         //user.removePackLevelParts(this);
40
}
41     
42     public void addGrouplUser (HibernateGroupUser user){
43         if(!groupUsers.contains(user)){
44             groupUsers.add(user);
45         }
46     }
47     
48     public void removeGroupUser(HibernateGroupUser user){
49         groupUsers.remove(user);
50         //user.removePackLevelParts(this);
51
}
52     
53     public String JavaDoc toString() {
54         StringBuffer JavaDoc retVal = new StringBuffer JavaDoc();
55         retVal.append("\nparticipantId = "+this.participantId);
56         retVal.append("\nid="+this.id);
57         retVal.append("\tpackage=" + this.pck);
58         retVal.append("\t**************normal user************* \n");
59         if (normalUsers.size() != 0) {
60             for (Iterator JavaDoc it = normalUsers.iterator(); it.hasNext();) {
61                 HibernateNormalUser user = (HibernateNormalUser) it.next();
62                 if (user != null) {
63                     retVal.append("\tuser = " + user.getUserName() + "\n");
64                 } else {
65                     retVal.append("\tuser NULL!\n");
66                 }
67             }
68         } else {
69             retVal.append("\tno user \n");
70         }
71         retVal.append("\t**************end normal user************* \n");
72         retVal.append("\t**************group user************* \n");
73         if (groupUsers.size() != 0) {
74             for (Iterator JavaDoc it = groupUsers.iterator(); it.hasNext();) {
75                 HibernateGroupUser user = (HibernateGroupUser) it.next();
76                 if (user != null) {
77                     retVal.append("\tuser = " + user.getUserName() + "\n");
78                 } else {
79                     retVal.append("\tuser NULL!\n");
80                 }
81             }
82         } else {
83             retVal.append("\tno user \n");
84         }
85         retVal.append("\t**************end group user************* \n");
86         return retVal.toString();
87     }
88
89 }
Popular Tags