KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sellwin > domain > Campaign


1 package sellwin.domain;
2
3 import java.util.*;
4 import java.io.*;
5 import java.text.*;
6 import javax.swing.text.*;
7
8 // SellWin http://sourceforge.net/projects/sellwincrm
9
//Contact support@open-app.com for commercial help with SellWin
10
//This software is provided "AS IS", without a warranty of any kind.
11

12 /**
13  * This class represents a marketing campaign and contains a list
14  * of "leads". Leads can eventually be converted into opportunities.
15  * This class holds column values found in the 'campaign' database
16  * table.
17  */

18 public class Campaign implements Serializable {
19     private long pk;
20     private String JavaDoc name;
21     private String JavaDoc type;
22     private String JavaDoc productGroup;
23     private String JavaDoc productLine;
24     private Integer JavaDoc leadCount; //conviently holds the count
25
private ArrayList leads = new ArrayList();
26     private String JavaDoc 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 JavaDoc n) { name = n;}
35     public final void setType(String JavaDoc t) { type = t; }
36     public final void setProductGroup(String JavaDoc d) { productGroup=d; }
37     public final void setProductLine(String JavaDoc d) { productLine=d; }
38     public final void setLeadCount(Integer JavaDoc d) { leadCount = d; }
39     public final void addLead(Lead s) { leads.add(s); }
40     public final void setModifiedBy(String JavaDoc d) { modifiedBy=d; }
41     public final void setModifiedDate(Date d) { modifiedDate=d; }
42
43     public final long getPK() { return pk; }
44     public final String JavaDoc getName() { return name; }
45     public final String JavaDoc getType() { return type; }
46     public final String JavaDoc getProductGroup() { return productGroup; }
47     public final String JavaDoc getProductLine() { return productLine; }
48     public final Integer JavaDoc getLeadCount() { return leadCount; }
49     public final ArrayList getLeads() { return leads; }
50     public final String JavaDoc 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 JavaDoc(name);
58         if (type != null)
59             copy.type = new String JavaDoc(type);
60         if (productGroup != null)
61             copy.productGroup = new String JavaDoc(productGroup);
62         if (productLine != null)
63             copy.productLine = new String JavaDoc(productLine);
64         if (leadCount != null)
65             copy.leadCount = new Integer JavaDoc(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 JavaDoc(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