]> iEval git - unical.git/blob - src/ro/ieval/unical/Attendee.java
6afeaf43e12d558484c11230aacfb63a8af88851
[unical.git] / src / ro / ieval / unical / Attendee.java
1 package ro.ieval.unical;
2
3 import android.content.ContentResolver;
4 import android.content.Context;
5 import android.database.Cursor;
6 import android.provider.CalendarContract;
7 import android.provider.CalendarContract.Attendees;
8 import android.provider.CalendarContract.Events;
9
10 final class Attendee {
11 private static final String[] PROJECTION = {
12 Attendees._ID,
13 Attendees.EVENT_ID,
14 Attendees.ATTENDEE_NAME,
15 Attendees.ATTENDEE_EMAIL,
16 Attendees.ATTENDEE_RELATIONSHIP,
17 Attendees.ATTENDEE_TYPE,
18 Attendees.ATTENDEE_STATUS,
19 };
20
21 /** Attendee ID */
22 public final long _id;
23 /** Event ID */
24 public final long eventID;
25 /** Attendee name */
26 public final String name;
27 /** Attendee email address **/
28 public final String email;
29 /**
30 * Attendee relationship.
31 *
32 * One of {@link CalendarContract.AttendeesColumns#RELATIONSHIP_ATTENDEE RELATIONSHIP_ATENDEE},
33 * {@link CalendarContract.AttendeesColumns#RELATIONSHIP_NONE RELATIONSHIP_NONE},
34 * {@link CalendarContract.AttendeesColumns#RELATIONSHIP_ORGANIZER RELATIONSHIP_ORGANIZER},
35 * {@link CalendarContract.AttendeesColumns#RELATIONSHIP_PERFORMER RELATIONSHIP_PERFORMER},
36 * {@link CalendarContract.AttendeesColumns#RELATIONSHIP_SPEAKER RELATIONSHIP_SPEAKER}
37 */
38 public final int relationship;
39 /**
40 * Attendee type.
41 *
42 * One of {@link CalendarContract.AttendeesColumns#TYPE_NONE TYPE_NONE},
43 * {@link CalendarContract.AttendeesColumns#TYPE_OPTIONAL TYPE_OPTIONAL},
44 * {@link CalendarContract.AttendeesColumns#TYPE_REQUIRED TYPE_REQUIRED},
45 * {@link CalendarContract.AttendeesColumns#TYPE_RESOURCE TYPE_RESOURCE}
46 */
47 public final int type;
48 /**
49 * Attendee status.
50 *
51 * One of {@link CalendarContract.AttendeesColumns#ATTENDEE_STATUS_ACCEPTED ATTENDEE_STATUS_ACCEPTED},
52 * {@link CalendarContract.AttendeesColumns#ATTENDEE_STATUS_DECLINED ATTENDEE_STATUS_DECLINED},
53 * {@link CalendarContract.AttendeesColumns#ATTENDEE_STATUS_INVITED ATTENDEE_STATUS_INVITED},
54 * {@link CalendarContract.AttendeesColumns#ATTENDEE_STATUS_NONE ATTENDEE_STATUS_NONE},
55 * {@link CalendarContract.AttendeesColumns#ATTENDEE_STATUS_TENTATIVE ATTENDEE_STATUS_TENTATIVE}
56 */
57 public final int status;
58
59 private Attendee(final long _id, final long eventID, final String name, final String email, final int relationship, final int type, final int status){
60 this._id=_id;
61 this.eventID=eventID;
62 this.name=name;
63 this.email=email;
64 this.relationship=relationship;
65 this.type=type;
66 this.status=status;
67 }
68
69 public static Attendee[] getAttendeesByEvent(final Context context, final int eventID){
70 final ContentResolver cr=context.getContentResolver();
71 final Cursor cursor = Attendees.query(cr, eventID, PROJECTION);
72 cursor.moveToFirst();
73 final Attendee[] attendees = new Attendee[cursor.getCount()];
74 for(int i=0;i<attendees.length;i++)
75 attendees[i]=new Attendee(cursor.getLong(0), cursor.getLong(1), cursor.getString(2), cursor.getString(3), cursor.getInt(4), cursor.getInt(5), cursor.getInt(6));
76 return attendees;
77 }
78 }
This page took 0.045587 seconds and 4 git commands to generate.