Package org.timedex.beans

Examples of org.timedex.beans.Event


    eventDAO = new EventDAOImpl();
    pageDAO = new PageDAOImpl();
  }
 
  public void testFindNotFound() {
    Event found = eventDAO.findById(-1);
   
    assertNull(found);
  }
View Full Code Here


  }
 
  public void testFindCreateUpdateDelete() {
    Page page = pageDAO.findById(8942008);
   
    Event newEvent = new Event(page, "blah blah September 7, 1985 blah", new Date(), new Date(), null, -1);//TODO
   
    eventDAO.create(newEvent);
   
    assertTrue(newEvent.getId() != -1);
   
    List<Event> foundEvents = eventDAO.findByPage(page);
   
    assertTrue(foundEvents.size() != 0);
   
View Full Code Here

      .list();
    return result;
  }
 
  public Event findById(long id) {
    Event result = (Event)getCurrentSession()
      .createCriteria(Event.class)
      .add(Restrictions.eq("id", id))
      .uniqueResult();
    return result;
  }
View Full Code Here

 
  private void writeEvent(DateAndSentenceTuple tuple, Page p,
      Stack<String> headingStack, int rank) {
      Calendar c = tuple.getDate();
    try {
      Event e = new Event(p, tuple.getSentence(), c, getHeadingStringFromStack(headingStack), rank);
      if(EventFilter.isGoodEvent(e)) {
        eventDAO.create(e);
      }
    } catch (IllegalArgumentException e) {
      //throw new RuntimeException("Caught exception attempting to add the event from this sentence:\n" + sentence, e);
View Full Code Here

    Iterator it = hits.iterator();
    try {
      while(it.hasNext() && events.size() < maxResults) {
        Document d = ((Hit)it.next()).getDocument();
        long eventId = Long.parseLong(d.getField("event_id").stringValue());
        Event found = eventDAO.findById(eventId);
        events.add(found);
      }
      return events;
    }catch(IOException e) {
      System.out.println("index being used: " + LUCENE_INDEX);
View Full Code Here

 
  private void displayResults(PrintWriter out, List<Event> eventList, long milliSeconds) {
    out.println("{\"results\": { \"result\": [");
   
    if(eventList.size() > 0) {
      Event first = eventList.get(0);
      out.print(getJSONEventString(first));
    }
   
    for(int i=1;i<eventList.size();i++) {
      out.println(",");
View Full Code Here

TOP

Related Classes of org.timedex.beans.Event

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.