/** * Creates the event. * * @param event the event * @param category_ids the category_ids * @return the long */ public long createEvent(Event event, long[] category_ids) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(KEY_EVENT_TITLE, event.getTitle()); values.put(KEY_EVENT_STARTDATE, event.getStartDate()); values.put(KEY_EVENT_ENDDATE, event.getEndDate()); values.put(KEY_EVENT_STARTTIME, event.getStartTime()); values.put(KEY_EVENT_ENDTIME, event.getEndTime()); values.put(KEY_EVENT_DESCRIPTION, event.getDescription()); values.put(KEY_EVENT_REPEAT, event.getRepeat()); // insert row long event_id = db.insert(TABLE_EVENT, null, values); // assigning categories to events for (long category_id : category_ids) { createEventCategory(event_id, category_id); } // for logging // Log.e("createEvent", event.toString()); // db.close(); return event_id; }
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = mInflater.inflate(R.layout.post, parent, false); mViewHolder = new ViewHolder(); mViewHolder.thumbnail = (ImageView) convertView.findViewById(R.id.post_thumbnail); mViewHolder.author = (TextView) convertView.findViewById(R.id.post_author); mViewHolder.title = (TextView) convertView.findViewById(R.id.post_title); mViewHolder.date = (TextView) convertView.findViewById(R.id.post_date); convertView.setTag(mViewHolder); } else { mViewHolder = (ViewHolder) convertView.getTag(); } mPost = mPosts.get(position); /*if (mPost.getThumbnail() != null) { */ /*new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { try { URL url = new URL(mPost.getThumbnail()); mBitmap = BitmapFactory.decodeStream(url.openConnection().getInputStream()); } catch (MalformedURLException e) { } catch (IOException e) { } return null; } }.execute();*/ /* mViewHolder.thumbnail.setImageBitmap(mBitmap); } Picasso.with(mActivity) .load(mPost.getThumbnail()) .into(mViewHolder.thumbnail); */ mViewHolder.date.setText(mPost.getStartDate() + " to " + mPost.getEndDate()); mViewHolder.title.setText(mPost.getNameTitle() + ""); mViewHolder.author.setText(mPost.getDescription()); // mViewHolder.date.setText(mPost.getStartDateString()); return convertView; }
public EventEntity(Event event) { mVersionCode = 1; zzasD = event.getEventId(); mName = event.getName(); zzaoB = event.getDescription(); zzaqW = event.getIconImageUri(); zzarh = event.getIconImageUrl(); zzarZ = (PlayerEntity)event.getPlayer().freeze(); zzasE = event.getValue(); zzasF = event.getFormattedValue(); zzasG = event.isVisible(); }
public boolean createEvent(Event e) { if (eventList.contains(e)) return true; String query = "INSERT INTO tb_events (evn_id, evn_titile, evn_description, evn_location, evn_start_time, evn_end_time, evn_created_time, evn_created_by, evn_contact_info, evn_cat_id, evn_url, evn_count_like, evn_count_dislike, evn_status, evn_tag, evn_tag_id)"; query = query + " VALUES (NULL, '" + e.getTitle() + "', '" + e.getDescription() + "', '" + e.getLocation() + "', '" + e.getStartDayTime() + "', '" + e.getEndDayTime() + "', '" + e.getCreatedDayTime() + "', " + e.getCreatedBy() + ", '" + e.getContact() + "', " + e.getCategory() + ", '" + e.getUrl() + "', " + e.getLike() + ", " + e.getDislike() + ", " + e.getStatus() + ", '" + e.getTags() + "', NULL)"; Log.i(LOG_TAG, query); List<HashMap<String, String>> result = DBComunicationLayer.executeHttpPost(DBComunicationLayer.PHP_INSERT, query); e.setId(result.get(0).get("evn_id")); eventList.add(e); // add all Tags into Tag Table /* for (int i =0; i< e.getTagList().size();i++) { String query2 = "INSERT INTO tb_tags (tag_id, tag_name)"+ " VALUES (NULL, '"+e.getTagList().get(i)+"')"; List<HashMap<String, String>> result2 = DBComunicationLayer.executeHttpPost( DBComunicationLayer.PHP_INSERT, query2); } */ // return result.get( 0 ).get( "result" ).equals( "1" ); return true; }
public List<Event> getEvents(String filter) { if ("".equals(filter)) { return new ArrayList<Event>(events); } List<Event> filteredEvents = new ArrayList<Event>(); for (Event event : events) { if (event.getDescription().toLowerCase().contains(filter.toLowerCase()) || event.getLocation().toLowerCase().contains(filter.toLowerCase()) || event.getSummary().toLowerCase().contains(filter.toLowerCase())) { filteredEvents.add(event); } } return filteredEvents; }
/** * Update event. * * @param event the event * @return the int */ public int updateEvent(Event event) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(KEY_EVENT_TITLE, event.getTitle()); values.put(KEY_EVENT_STARTDATE, event.getStartDate()); values.put(KEY_EVENT_ENDDATE, event.getEndDate()); values.put(KEY_EVENT_STARTTIME, event.getStartTime()); values.put(KEY_EVENT_ENDTIME, event.getEndTime()); values.put(KEY_EVENT_DESCRIPTION, event.getDescription()); values.put(KEY_EVENT_REPEAT, event.getRepeat()); // updating row return db.update( TABLE_EVENT, values, KEY_ID + " = ?", new String[] {String.valueOf(event.getId())}); }
public static EventSoap toSoapModel(Event model) { EventSoap soapModel = new EventSoap(); soapModel.setEventId(model.getEventId()); soapModel.setName(model.getName()); soapModel.setDescription(model.getDescription()); soapModel.setDate(model.getDate()); soapModel.setCompanyId(model.getCompanyId()); soapModel.setGroupId(model.getGroupId()); soapModel.setUserId(model.getUserId()); soapModel.setCreateDate(model.getCreateDate()); soapModel.setModifiedDate(model.getModifiedDate()); soapModel.setLocationId(model.getLocationId()); return soapModel; }
private void showEvent(String eventId) { Event e = MainModel.getEvent(eventId); LatLng pos = new LatLng( e.getLat() + Math.random() / MARKER_FUDGE_DENOM, e.getLng() + Math.random() / MARKER_FUDGE_DENOM); String description = e.getDescription(); float event_color = (description_hues.containsKey(description)) ? description_hues.get(description) : DEFAULT_MARKER_COLOR; mMap.addMarker( new MarkerOptions() .position(pos) .snippet(eventId) .icon(BitmapDescriptorFactory.defaultMarker(event_color))); }
/** * Check conflictin update events. * * @param newEvent the new event * @return true, if successful * @throws ParseException the parse exception */ @SuppressLint("LongLogTag") public boolean checkConflictinUpdateEvents(Event newEvent) throws ParseException { SimpleDateFormat timeFormat = new SimpleDateFormat("hh:mm"); String sTime = newEvent.getStartTime(); String sDate = newEvent.getStartDate(); String eTime = newEvent.getEndTime(); String eDate = newEvent.getEndDate(); Date parsedStartTime = timeFormat.parse(sTime); Timestamp newStartTime = new Timestamp(parsedStartTime.getTime()); Date parsedEndTime = timeFormat.parse(eTime); Timestamp newEndTime = new Timestamp(parsedEndTime.getTime()); if (sDate.equalsIgnoreCase(eDate)) { if (newStartTime.after(newEndTime)) { Log.e("Illogiacl Update", "StartTime is greater then EndTime"); return false; } } List<Event> allEvents = getEvent(sDate, eDate); for (Event prevEvent : allEvents) { Log.d( "Event: " + prevEvent.getTitle(), "" + prevEvent.getId() + " " + prevEvent.getDescription()); Date parsedPreviousStartTime = timeFormat.parse(prevEvent.getStartTime()); Timestamp previousStartTime = new Timestamp(parsedPreviousStartTime.getTime()); Date parsedPreviousEndTime = timeFormat.parse(prevEvent.getEndTime()); Timestamp previousEndTime = new Timestamp(parsedPreviousEndTime.getTime()); if (newStartTime.after(previousStartTime) && newStartTime.before(previousEndTime) || newEndTime.after(previousStartTime) && newEndTime.before(previousEndTime) || previousStartTime.after(newStartTime) && previousStartTime.before(newEndTime) || previousEndTime.after(newStartTime) && previousEndTime.before(newEndTime)) { if (newEvent.getId() != prevEvent.getId()) { Log.e("Conflict with existent event", "Can't update this event"); return false; } } } return true; }
@MediumTest public void testGetEvent_withLocationAndDescription() { mockServer .expect(requestTo("https://graph.facebook.com/193482154020832")) .andExpect(method(GET)) .andExpect(header("Authorization", "OAuth someAccessToken")) .andRespond(withResponse(jsonResource("testdata/full-event"), responseHeaders)); Event event = facebook.eventOperations().getEvent("193482154020832"); assertEquals("193482154020832", event.getId()); assertEquals("100001387295207", event.getOwner().getId()); assertEquals("Art Names", event.getOwner().getName()); assertEquals("Breakdancing Class", event.getName()); assertEquals(Event.Privacy.SECRET, event.getPrivacy()); assertEquals(toDate("2011-03-30T14:30:00+0000"), event.getStartTime()); assertEquals(toDate("2011-03-30T17:30:00+0000"), event.getEndTime()); assertEquals(toDate("2011-03-30T14:38:40+0000"), event.getUpdatedTime()); assertEquals("Bring your best parachute pants!", event.getDescription()); assertEquals("2400 Dunlavy Dr, Denton, TX", event.getLocation()); }
public EventListByDateAdapter(Context c, String startDate, String endDate) { eContext = c; this.startDate = startDate; this.endDate = endDate; // this.ctg = ctg; // db = new MySQLiteHelper(eContext); // Getting all Events Log.d("Get Events", "Getting All Events"); dayEvents = new ArrayList<Event>(); try { stDate = dateFormat.parse(startDate); eDate = dateFormat.parse(endDate); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } // Getting all Events Log.d("Get Events", "Getting All Events"); allEvents = SimpleCalendarView.db.getAllEvents(); for (Event event : allEvents) { Date eventStartDate = new Date(); // Date eventEndDate = new Date(); try { eventStartDate = dateFormat.parse(event.getStartDate()); // eventEndDate = dateFormat.parse(event.getEndDate()); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (((eventStartDate.compareTo(stDate) >= 0) && (eventStartDate.compareTo(eDate) <= 0))) { dayEvents.add(event); Log.d( "Event:" + event.getTitle(), "ID:" + event.getId() + "Description:" + event.getDescription()); } } }
private void populateItems() { // create the form form = new Form("form"); // create elements and add them to the form form.add(new Label("eventName", event.getName())); form.add(new Label("location", event.getLocation())); form.add(new Label("description", event.getDescription())); form.add(new Label("positions", event.getNumPositions())); form.add(new Label("positionsLeft", event.getNumPositionsRemaining())); form.add( new Button("apply") { @Override public void onSubmit() { EventDao ed = new EventDao(); ed.insertUserSignsUpForEvent(CustomSession.get().getUser(), event); if (returnTo.equals("partnerHomeView")) setResponsePage(PartnerHomeView.class); else if (returnTo.equals("partnerEventView")) setResponsePage(PartnerEventView.class); else if (returnTo.equals("volunteerHomeView")) setResponsePage(VolunteerHomeView.class); else if (returnTo.equals("volunteerSearchPage")) setResponsePage(VolunteerSearchView.class); } }); form.add( new Button("save") { @Override public void onSubmit() { if (returnTo.equals("partnerHomeView")) setResponsePage(PartnerHomeView.class); else if (returnTo.equals("partnerEventView")) setResponsePage(PartnerEventView.class); else if (returnTo.equals("volunteerHomeView")) setResponsePage(VolunteerHomeView.class); else if (returnTo.equals("volunteerSearchPage")) setResponsePage(VolunteerSearchView.class); } }); // add the form to the page add(form); }
static int zza(Event event) { return zzw.hashCode(new Object[] { event.getEventId(), event.getName(), event.getDescription(), event.getIconImageUri(), event.getIconImageUrl(), event.getPlayer(), Long.valueOf(event.getValue()), event.getFormattedValue(), Boolean.valueOf(event.isVisible()) }); }
@Override protected Builder buildEntry(Builder builder, Resource resource) { Event event = (Event) resource; builder = builder .withValue(Events.CALENDAR_ID, id) .withValue(entryColumnRemoteName(), event.getName()) .withValue(entryColumnETag(), event.getETag()) .withValue(entryColumnUID(), event.getUid()) .withValue(Events.ALL_DAY, event.isAllDay() ? 1 : 0) .withValue(Events.DTSTART, event.getDtStartInMillis()) .withValue(Events.EVENT_TIMEZONE, event.getDtStartTzID()) .withValue(Events.HAS_ATTENDEE_DATA, event.getAttendees().isEmpty() ? 0 : 1) .withValue(Events.GUESTS_CAN_INVITE_OTHERS, 1) .withValue(Events.GUESTS_CAN_MODIFY, 1) .withValue(Events.GUESTS_CAN_SEE_GUESTS, 1); boolean recurring = false; if (event.getRrule() != null) { recurring = true; builder = builder.withValue(Events.RRULE, event.getRrule().getValue()); } if (event.getRdate() != null) { recurring = true; builder = builder.withValue(Events.RDATE, event.getRdate().getValue()); } if (event.getExrule() != null) builder = builder.withValue(Events.EXRULE, event.getExrule().getValue()); if (event.getExdate() != null) builder = builder.withValue(Events.EXDATE, event.getExdate().getValue()); // set either DTEND for single-time events or DURATION for recurring events // because that's the way Android likes it (see docs) if (recurring) { // calculate DURATION from start and end date Duration duration = new Duration(event.getDtStart().getDate(), event.getDtEnd().getDate()); builder = builder.withValue(Events.DURATION, duration.getValue()); } else { builder = builder .withValue(Events.DTEND, event.getDtEndInMillis()) .withValue(Events.EVENT_END_TIMEZONE, event.getDtEndTzID()); } if (event.getSummary() != null) builder = builder.withValue(Events.TITLE, event.getSummary()); if (event.getLocation() != null) builder = builder.withValue(Events.EVENT_LOCATION, event.getLocation()); if (event.getDescription() != null) builder = builder.withValue(Events.DESCRIPTION, event.getDescription()); if (event.getOrganizer() != null && event.getOrganizer().getCalAddress() != null) { URI organizer = event.getOrganizer().getCalAddress(); if (organizer.getScheme() != null && organizer.getScheme().equalsIgnoreCase("mailto")) builder = builder.withValue(Events.ORGANIZER, organizer.getSchemeSpecificPart()); } Status status = event.getStatus(); if (status != null) { int statusCode = Events.STATUS_TENTATIVE; if (status == Status.VEVENT_CONFIRMED) statusCode = Events.STATUS_CONFIRMED; else if (status == Status.VEVENT_CANCELLED) statusCode = Events.STATUS_CANCELED; builder = builder.withValue(Events.STATUS, statusCode); } builder = builder.withValue( Events.AVAILABILITY, event.isOpaque() ? Events.AVAILABILITY_BUSY : Events.AVAILABILITY_FREE); if (event.getForPublic() != null) builder = builder.withValue( Events.ACCESS_LEVEL, event.getForPublic() ? Events.ACCESS_PUBLIC : Events.ACCESS_PRIVATE); return builder; }
public synchronized void addEvent(Event event) { System.err.println(event.getDescription() + ": " + event.getAuthor()); /* events.add(event); */ }
public static void compareRecords(Event event, Event readRecord) { assertNotSame(event.getDateCreated(), readRecord.getDateCreated()); assertEquals(event.getDescription(), readRecord.getDescription()); assertEquals(event.getCategory(), readRecord.getCategory()); }