1 4 5 package org.enhydra.shark.partmappersistence.data; 6 7 import java.util.Iterator ; 8 9 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 } 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 } 52 53 public String toString() { 54 StringBuffer retVal = new StringBuffer (); 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 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 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 |