| 1 package sellwin.domain; 2 3 import java.util.*; 4 import java.io.*; 5 import java.text.*; 6 import javax.swing.text.*; 7 8 12 18 public class Campaign implements Serializable { 19 private long pk; 20 private String name; 21 private String type; 22 private String productGroup; 23 private String productLine; 24 private Integer leadCount; private ArrayList leads = new ArrayList(); 26 private String modifiedBy; 27 private Date modifiedDate; 28 29 public Campaign() { 30 modifiedDate = new Date(); 31 } 32 33 public final void setPK(long pk) { this.pk = pk; } 34 public final void setName(String n) { name = n;} 35 public final void setType(String t) { type = t; } 36 public final void setProductGroup(String d) { productGroup=d; } 37 public final void setProductLine(String d) { productLine=d; } 38 public final void setLeadCount(Integer d) { leadCount = d; } 39 public final void addLead(Lead s) { leads.add(s); } 40 public final void setModifiedBy(String d) { modifiedBy=d; } 41 public final void setModifiedDate(Date d) { modifiedDate=d; } 42 43 public final long getPK() { return pk; } 44 public final String getName() { return name; } 45 public final String getType() { return type; } 46 public final String getProductGroup() { return productGroup; } 47 public final String getProductLine() { return productLine; } 48 public final Integer getLeadCount() { return leadCount; } 49 public final ArrayList getLeads() { return leads; } 50 public final String getModifiedBy() { return modifiedBy; } 51 public final Date getModifiedDate() { return modifiedDate; } 52 53 public final Campaign copy() { 54 Campaign copy = new Campaign(); 55 copy.setPK(getPK()); 56 if (name != null) 57 copy.name = new String (name); 58 if (type != null) 59 copy.type = new String (type); 60 if (productGroup != null) 61 copy.productGroup = new String (productGroup); 62 if (productLine != null) 63 copy.productLine = new String (productLine); 64 if (leadCount != null) 65 copy.leadCount = new Integer (leadCount.intValue()); 66 67 Lead leadCopy, lead; 68 for (int i=0;i<leads.size();i++) { 69 lead = (Lead)leads.get(i); 70 leadCopy = lead.copy(); 71 copy.leads.add(leadCopy); 72 } 73 if (modifiedBy != null) 74 copy.modifiedBy = new String (modifiedBy); 75 copy.modifiedDate = new Date(modifiedDate.getTime()); 76 77 return copy; 78 } 79 80 public final void print() { 81 System.out.println("<<Campaign>>"); 82 System.out.println("pk=["+getPK()+"]"); 83 System.out.println("Name=["+getName()+"]"); 84 System.out.println("Type="+getType()); 85 System.out.println("Group="+getProductGroup()); 86 System.out.println("Line="+getProductLine()); 87 System.out.println("Lead Count="+getLeadCount()); 88 System.out.println("ModifiedBy/Date="+getModifiedBy()+getModifiedDate()); 89 } 90 } 91 | Popular Tags |