Package uk.org.woodcraft.bookings.datamodel

Examples of uk.org.woodcraft.bookings.datamodel.Village


  @Test
  public void testVillageByName() {
   
    Event event1 = CannedQueries.eventByName(TestConstants.EVENT1_NAME);   
    Village village = CannedQueries.villageByName("Village 1", event1);
    assertEquals("Village 1", village.getName());
    assertDetached(village);
  }
View Full Code Here


 
 
  @Test
  public void testUnitsForVillage() {
    Event event1 = CannedQueries.eventByName(TestConstants.EVENT1_NAME);   
    Village village = CannedQueries.villageByName("Village 1", event1);
   
    Collection<Unit> units = CannedQueries.unitsForVillage(village);
    TestUtils.assertNames(units, "Unit 1");
    assertDetached(units);
  }
View Full Code Here

  }

  @Test
  public void testBookingsForVillage() {
    Event event1 = CannedQueries.eventByName(TestConstants.EVENT1_NAME);   
    Village village = CannedQueries.villageByName("Village 1", event1);
   
    Collection<Booking> bookings = CannedQueries.bookingsForVillage(village);
   
    // FIXME: The last name shouldn't need to be there, but is due to unit bookings not existing, and so events not partitioning the bookings
    TestUtils.assertNames(bookings, "Test person", "Test person 2", "Person booked after earlybird", "Test person in other event");
    //TestUtils.assertNames(bookings, "Test person", "Test person 2", "Person booked after earlybird");
    assertDetached(bookings);
   
    Village village2 = CannedQueries.villageByName("Village 2", event1);
   
    Collection<Booking> bookings2 = CannedQueries.bookingsForVillage(village2);
    assertEquals(0, bookings2.size());
    assertDetached(bookings2);
View Full Code Here

      events.add(new Event("Closed event", null, null, false, RegisteredPricingStrategy.COCAMP))
      pm.makePersistentAll(events);
     
      // Villages
      List<Village> villages = new ArrayList<Village>();
      Village village1 = new Village(TestConstants.VILLAGE1_NAME, event1);
      villages.add(village1);
      villages.add(new Village("Village 2", event1));
      villages.add(new Village("Empty village", event1));
      villages.add(new Village("Village on other event", events.get(1)));
      pm.makePersistentAll(villages);
     
      // Organisations
      List<Organisation> organisations = new ArrayList<Organisation>();
      Organisation orgWcf = new Organisation(TestConstants.ORG1_NAME, true);
      organisations.add(orgWcf);
     
      Organisation otherOrg = new Organisation("Unapproved organisation", false);
      organisations.add(otherOrg);
      pm.makePersistentAll(organisations);
     
      // Units
      List<Unit> units = new ArrayList<Unit>();
      Unit unit1 = new Unit(TestConstants.UNIT1_NAME, organisations.get(0), true);
      unit1.setVillageKey(village1.getKeyCheckNotNull());
     
      // FIXME: Note, all units are in all events for now...
     
      //unit1.addEventRegistration(event1);
      //unit1.addEventRegistration(event2); 
View Full Code Here

  protected List<Object> renderRow(List<Method> reportedMethods, Object data) {
    List<Object> cells = new ArrayList<Object>();
   
    Booking b = (Booking) data;
    Village v = b.getVillage();
    if (v != null)
      cells.add(v.getName());
    else
      cells.add(null);
   
    cells.add(b.getUnit().getName());
    cells.add(b.getName());
View Full Code Here

    for(Booking booking : bookings)
    {
      if (booking.getMyvillageAuthKey().equals(userKey))
      {
        // We have a match   
        Village village = CannedQueries.villageByKey(booking.getVillageKey());
        if (village == null)
          return new MyVillageResponse("Booking for user located, but no village mapping found. A booking must be assigned to a village before you can use My Village.");
       
        booking.setMyVillageUsername(externalUsername);
        CannedQueries.save(booking);
       
        return new MyVillageResponse(booking.getName(), village.getName(),
            KeyFactory.keyToString(village.getKeyCheckNotNull()))
      }
    } 
   
    return new MyVillageResponse("No matching bookings found. Please check email and key and try again");
  }
View Full Code Here

    Event duplicateEvent = CannedQueries.eventByName(TestConstants.EVENT1_NAME, event1.getKeyCheckNotNull());
    CannedQueries.eventByKey(event1.getKeyCheckNotNull());
   
    // Village queries
    CannedQueries.villagesForEvent(event1);
    Village village1 = CannedQueries.villageByName(TestConstants.VILLAGE1_NAME, event1);
    @SuppressWarnings("unused")
    Village duplicateVillage = CannedQueries.villageByName(TestConstants.VILLAGE1_NAME, event1.getKeyCheckNotNull(), village1.getKeyCheckNotNull());
    CannedQueries.villageByKey(village1.getKeyCheckNotNull());
   
    // Org queries
    CannedQueries.allOrgs(false, false);
View Full Code Here

    Key key = getWebKeyAsKey();
    if (key != null)
    {
      setModel(CannedQueries.villageByKey(key));
    } else {
      setModel(new Village(getCurrentEvent()));
    }
  }
View Full Code Here

    return problemBookings;
  }

  public Collection<Village> getVillages() {
    Collection<Village> villages = new ArrayList<Village>();
    Village noVillage = new Village("No village assigned", getCurrentEvent());
    villages.add(noVillage);
    villages.addAll(CannedQueries.villagesForEvent(getCurrentEvent()));
    return villages;
  }
View Full Code Here

TOP

Related Classes of uk.org.woodcraft.bookings.datamodel.Village

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.