Grundaufbau der App
[DHBWCampusApp.git] / app / src / main / java / de / dhbwloe / campusapp / vorlesungen / CourseEvent.java
1 package de.dhbwloe.campusapp.vorlesungen;
2
3 import de.dhbwloe.campusapp.database.DatabaseManager;
4
5 /**
6  * Created by pk910 on 20.01.2016.
7  */
8 public class CourseEvent {
9     private int iEventId;
10     private String sCourseName;
11     private String sUniqueId;
12     private int iSequenceId;
13     private long iEventFrom, iEventTo;
14     private String sEventTitle, sEventLocation, sEventStatus;
15     private String sRecurRule, sExcludeDates;
16     private CourseGroup oCourseGroup;
17
18     private boolean bMustUpdate = false;
19     private boolean bIsNew = false;
20
21     public CourseEvent(int id, String coursename, String uniqueid, int sequenceid, long eventfrom, long eventto, String title, String location, String status, String rrule, String exdates, CourseGroup group) {
22         iEventId = id;
23         sCourseName = coursename;
24         sUniqueId = uniqueid;
25         iSequenceId = sequenceid;
26         iEventFrom = eventfrom;
27         iEventTo = eventto;
28         sEventTitle = title;
29         sEventLocation = location;
30         sEventStatus = status;
31         sRecurRule = rrule;
32         sExcludeDates = exdates;
33
34         oCourseGroup = group;
35         if(group != null)
36             group.addCourseEvent(this);
37     }
38
39     public CourseEvent(String coursename, String uniqueid, int sequenceid, boolean isNew) {
40         sCourseName = coursename;
41         sUniqueId = uniqueid;
42         iSequenceId = sequenceid;
43         bIsNew = isNew;
44         bMustUpdate = isNew;
45     }
46
47     public void setEventId(int id) {
48         iEventId = id;
49     }
50
51     public int getEventId() {
52         return iEventId;
53     }
54
55     private void resetUpdateFlag() {
56         bIsNew = false;
57         bMustUpdate = false;
58     }
59
60     public void update(DatabaseManager dbm) {
61         if(!bMustUpdate)
62             return;
63
64         dbm.updateCourseCalendar(this);
65         resetUpdateFlag();
66     }
67
68     public CourseGroup getCourseGroup() {
69         return oCourseGroup;
70     }
71
72     public void setCourseGroup(CourseGroup group) {
73         group.addCourseEvent(this);
74         oCourseGroup = group;
75     }
76
77     public String getUniqueId() {
78         return sUniqueId;
79     }
80
81     public boolean IsPendingUpdate() {
82         return bMustUpdate;
83     }
84
85     public boolean IsNewEvent() {
86         return bIsNew;
87     }
88
89     public String getEventStatus() {
90         return sEventStatus;
91     }
92
93     public void setEventStatus(String sEventStatus) {
94         this.sEventStatus = sEventStatus;
95         bMustUpdate = true;
96     }
97
98     public String getEventLocation() {
99         return sEventLocation;
100     }
101
102     public void setEventLocation(String sEventLocation) {
103         this.sEventLocation = sEventLocation;
104         bMustUpdate = true;
105     }
106
107     public String getEventTitle() {
108         return sEventTitle;
109     }
110     public String getGroupTitle() {
111         return sEventTitle; // maybe cut prof name?
112     }
113
114     public void setEventTitle(String sEventTitle) {
115         this.sEventTitle = sEventTitle;
116         bMustUpdate = true;
117     }
118
119     public long getEventTo() {
120         return iEventTo;
121     }
122
123     public void setEventTo(long iEventTo) {
124         this.iEventTo = iEventTo;
125         bMustUpdate = true;
126     }
127
128     public long getEventFrom() {
129         return iEventFrom;
130     }
131
132     public void setEventFrom(long iEventFrom) {
133         this.iEventFrom = iEventFrom;
134         bMustUpdate = true;
135     }
136
137     public String getCourseName() {
138         return sCourseName;
139     }
140
141     public int getSequenceId() {
142         return iSequenceId;
143     }
144
145     public void setSequenceId(int iSequenceId) {
146         this.iSequenceId = iSequenceId;
147         bMustUpdate = true;
148     }
149
150     public String getRecurRule() {
151         return sRecurRule;
152     }
153
154     public void setRecurRule(String rrule) {
155         this.sRecurRule = rrule;
156         bMustUpdate = true;
157     }
158
159     public String getExcludeDates() {
160         return sExcludeDates;
161     }
162
163     public void setExcludeDates(String exrules) {
164         this.sExcludeDates = exrules;
165         bMustUpdate = true;
166     }
167 }