KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sellwin > domain > Activity


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

10 /**
11  * This class represents an Activity in the system. Activities
12  * are 'owned' by an Opportunity. An activity can act as an alarm
13  * to the user. This class holds column values found in the 'activity'
14  * database table.
15  */

16 public class Activity implements Serializable {
17     private long pk;
18     private long oppPK;
19     private String JavaDoc subject;
20     private String JavaDoc type;
21     private String JavaDoc place;
22     private String JavaDoc message;
23     private Date startDate;
24     private Integer JavaDoc duration; //units are in minutes
25
private boolean groupAlarm=false; //group alarm requested
26
private boolean groupAlarmAck=false; //group alarm delivered
27
private Boolean JavaDoc alarm=new Boolean JavaDoc(false); //owner alarm requested
28
private boolean alarmAck=false; //owner alarm delivered
29
private ArrayList attendees = new ArrayList(); //String objects
30
private String JavaDoc modifiedBy;
31     private Date modifiedDate;
32     private boolean updatedLocally=false;
33     private boolean addedLocally=false;
34
35     public final static String JavaDoc[] TYPES = {
36         "Meeting", "Callback", "Conf Call", "Birthday", "Appt", "Delivery"
37     };
38
39     public Activity() {
40     }
41
42     public Activity(String JavaDoc n) {
43         pk = 0L;
44         oppPK = 0L;
45         subject = n;
46         type = TYPES[0];
47         duration = new Integer JavaDoc(15);
48         startDate = new Date();
49         modifiedDate = new Date();
50     }
51
52     public final long getPK() { return pk; }
53     public final void setPK(long pk) { this.pk = pk; }
54
55     public final long getOppPK() { return oppPK; }
56     public final void setOppPK(long pk) { oppPK = pk; }
57
58     public final void setSubject(String JavaDoc n) { subject = n; }
59     public final String JavaDoc getSubject() { return subject; }
60
61     public final void setType(String JavaDoc t) { type = t; }
62     public final String JavaDoc getType() { return type; }
63
64     public final String JavaDoc getPlace() { return place; }
65     public final void setPlace(String JavaDoc s) { place = s; }
66
67     public final String JavaDoc getMessage() { return message; }
68     public final void setMessage(String JavaDoc s) { message = s; }
69
70     public final void setStartDate(Date d) { startDate=d; }
71     public final Date getStartDate() { return startDate; }
72
73     public final void setDuration(Integer JavaDoc d) { duration=d; }
74     public final Integer JavaDoc getDuration() { return duration; }
75
76     public final boolean getGroupAlarm() { return groupAlarm; }
77     public final void setGroupAlarm(boolean t) { groupAlarm = t; }
78
79     public final boolean getGroupAlarmAck() { return groupAlarmAck; }
80     public final void setGroupAlarmAck(boolean b) { groupAlarmAck = b; }
81
82     public final Boolean JavaDoc getAlarm() { return alarm; }
83     public final void setAlarm(Boolean JavaDoc t) { alarm= t; }
84
85     public final boolean getAlarmAck() { return alarmAck; }
86     public final void setAlarmAck(boolean t) { alarmAck = t; }
87
88     public final ArrayList getAttendees() { return attendees; }
89
90     public final void addAttendee(String JavaDoc attendee) {
91         attendees.add(attendee);
92     }
93
94     public final String JavaDoc getModifiedBy() { return modifiedBy; }
95     public final void setModifiedBy(String JavaDoc s) { modifiedBy = s; }
96     public final Date getModifiedDate() { return modifiedDate; }
97     public final void setModifiedDate(Date d) { modifiedDate=d; }
98
99     public final void setUpdatedLocally(boolean b) { updatedLocally=b; }
100     public final void setAddedLocally(boolean b) { addedLocally=b; }
101
102     public final boolean getUpdatedLocally() { return updatedLocally; }
103     public final boolean getAddedLocally() { return addedLocally; }
104
105     public final void print() {
106         System.out.println("Activity");
107         System.out.println("pk="+getPK());
108         System.out.println("subject="+getSubject());
109         System.out.println("place="+getPlace());
110         System.out.println("message="+getMessage());
111         System.out.println("type="+getType());
112         System.out.println("start date="+getStartDate());
113         System.out.println("alarm ="+getAlarm());
114         System.out.println("alarm ack="+getAlarmAck());
115         System.out.println("group alarm="+getGroupAlarm());
116         System.out.println("group alarm ack="+getGroupAlarmAck());
117         System.out.println("created by ="+getModifiedBy());
118         System.out.println("created date ="+getModifiedDate());
119     }
120
121     public final Activity copy() {
122         String JavaDoc copySubject = new String JavaDoc(subject);
123         Activity copy = new Activity(copySubject);
124         copy.pk = pk;
125         if (type != null)
126             copy.type = new String JavaDoc(type);
127         if (place != null)
128             copy.place = new String JavaDoc(place);
129         if (message != null)
130             copy.message = new String JavaDoc(message);
131         if (startDate != null)
132             copy.startDate = new Date(startDate.getTime());
133         copy.duration = duration;
134         if (modifiedBy != null)
135             copy.modifiedBy = new String JavaDoc(modifiedBy);
136         if (modifiedDate != null)
137             copy.modifiedDate = new Date(modifiedDate.getTime());
138
139         copy.alarmAck = alarmAck;
140         copy.alarm= alarm;
141         copy.groupAlarm = groupAlarm;
142         copy.groupAlarmAck = groupAlarmAck;
143     
144         String JavaDoc attendee, attendeeCopy;
145         for (int i=0;i<attendees.size();i++) {
146             attendee = (String JavaDoc)attendees.get(i);
147             attendeeCopy = new String JavaDoc(attendee);
148             copy.addAttendee(attendeeCopy);
149         }
150         return copy;
151     }
152 }
153
Popular Tags