Package uk.org.woodcraft.bookings.datamodel

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


    if (setupComplete != "" )
      throw new SecurityException("Cannot recreate users for an already set up instance");
   
    CoreData.createCoreData();
   
    Event event1 = new Event(TestConstants.EVENT1_NAME, TestConstants.EVENT1_START, TestConstants.EVENT1_END, true, RegisteredPricingStrategy.COCAMP);
    event1.setEarlyBookingDeadline(DateUtils.getDate(2011, 0, 1));
    event1.setBookingDeadline(DateUtils.getDate(2011, 5, 2));
    event1.setBookingSystemLocked(TestConstants.EVENT1_START);
    CannedQueries.save(event1);
   
    AppSetting defaultEventSetting = new AppSetting(AppSetting.DEFAULT_EVENT, event1.getWebKey());
    CannedQueries.save(defaultEventSetting);
   
   
    Organisation orgWcf = new Organisation(TestConstants.ORG1_NAME, true);
    CannedQueries.save(orgWcf);
View Full Code Here


  private List<DiscountLine> discountLines = new ArrayList<DiscountLine>();
  private double totalDiscount;
 
  public String generateDiscounts() {
    SecurityModel.checkIsAdminUser(this);
    Event event = getCurrentEvent();
   
    Map<Unit, List<Transaction>> transactionsByUnit = getRelevantTransactions(event);
    Map<Key, List<Booking>> bookingsByUnit = getRelevantBookings(event);
   
    List<Transaction> allDiscounts = new ArrayList<Transaction>();
View Full Code Here

    @Test
    public void testPersistEvent() {
     
      PersistenceManager pm = PMF.get().getPersistenceManager();
    Event e1 = new Event("Test event", DateUtils.getDate(2011, 1, 1), DateUtils.getDate(2011, 1, 10), true, RegisteredPricingStrategy.COCAMP);
    pm.makePersistent(e1);
   
    Event retrieved = (Event) pm.getObjectById(Event.class, e1.getKey() );
    assertEquals(e1, retrieved);
   
    Extent<Event> extent = pm.getExtent(Event.class, false);
    for(Event e : extent)
    {
View Full Code Here

  @Test
  public void testPriceOf() {
   
    VenturerCampPricingStrategy pricer = new VenturerCampPricingStrategy();
   
    Event vcamp = CannedQueries.eventByName(TestConstants.EVENT1_NAME);
    Organisation testOrg = CannedQueries.orgByName(TestConstants.ORG1_NAME);
    Unit testUnit = CannedQueries.unitByName(TestConstants.UNIT1_NAME, testOrg);
   
    TestClock testClock = new TestClock(BasicVCampTestDataFixture.DATE_BEFORE_DEADLINE);
   
View Full Code Here

 
  @Test
  public void testCancellation(){
    VenturerCampPricingStrategy pricer = new VenturerCampPricingStrategy();
   
    Event vcamp = CannedQueries.eventByName(TestConstants.EVENT1_NAME);
    Organisation testOrg = CannedQueries.orgByName(TestConstants.ORG1_NAME);
    Unit testUnit = CannedQueries.unitByName(TestConstants.UNIT1_NAME, testOrg);
   
    TestClock testClock = new TestClock(BasicVCampTestDataFixture.DATE_BEFORE_DEADLINE);
   
View Full Code Here

     
      Clock testClock = new TestClock(TestConstants.DATE_BEFORE_EARLY_DEADLINE);
     
      // Events
      List<Event> events = new ArrayList<Event>();
      Event event1 = getTestEvent();
     
      events.add(event1);
       Event event2 = new Event("Other event", null, null, true, RegisteredPricingStrategy.COCAMP);
      events.add(event2);   
     
      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);
View Full Code Here

      pm.close();
    }
  }

  protected Event getTestEvent() {
    Event event1 = new Event(TestConstants.EVENT1_NAME, TestConstants.EVENT1_START, TestConstants.EVENT1_END, true, RegisteredPricingStrategy.COCAMP);
    event1.setEarlyBookingDeadline(DateUtils.getDate(2011, 0, 1));
    event1.setBookingDeadline(DateUtils.getDate(2011, 4, 2));
    event1.setBookingAmendmentDeadline(DateUtils.getDate(2011, 4, 2)); // For CoCamp, this is the same as the booking deadline.
    event1.setBookingSystemLocked(DateUtils.getDate(2011, 7, 28));
   
    return event1;
  }
View Full Code Here

   
    if (booking.getEventKey() == null) return 0;
    if (booking.getArrivalDate() == null) return 0;
    if (booking.getDepartureDate() == null) return 0;
   
    Event event = CannedQueries.eventByKey(booking.getEventKey());
    if (event == null) return 0;
   
    double price = priceForDuration(booking, event);
   
    if(booking.getDob() != null &&
        DateUtils.ageOnDay(booking.getDob(), event.getPublicEventStart()) <= 5)
    {
      // Those aged 5 and under are free
      price = 0;
    }
   
   
    if (booking.getBookingCreationDate().after(event.getBookingDeadline())
        || (booking.getBookingUnlockDate() != null && booking.getBookingUnlockDate().after(event.getBookingDeadline())))
    {
      // Late booking fee is 25, applies for any booking created or updated after this time
      price += 25;
    }
     
   
    if (booking.getCancellationDate() != null)
    {
      if (booking.getCancellationDate().before(event.getBookingDeadline()))
        // �75 for bookings cancelled after booking deadline, capped at fee
        return Math.min(25d, price);
      else
     
        // �75 for bookings cancelled after booking deadline, capped at fee
View Full Code Here

   
    if (booking.getEventKey() == null) return 0;
    if (booking.getArrivalDate() == null) return 0;
    if (booking.getDepartureDate() == null) return 0;
   
    Event event = CannedQueries.eventByKey(booking.getEventKey());
    if (event == null) return 0;
   
    double price = priceForDuration(booking, event);
   
    if(booking.getDob() != null &&
        DateUtils.ageOnDay(booking.getDob(), event.getPublicEventStart()) <= 5)
    {
      // Those aged 5 and under are free
      price = 0;
    }
 
    if (booking.getBookingCreationDate().after(event.getPublicEventStart()))
    {
      // At-event booking fee is 30, applies for any booking created after it started
      price += 30;
     
    } else if (booking.getBookingCreationDate().after(event.getBookingDeadline()))
    {
      // Late booking fee is 10, applies for any booking created after this time
      price += 10;
    }
 
   
    if (booking.getBookingUnlockDate() != null && booking.getBookingUnlockDate().after(event.getBookingAmendmentDeadline()))
    {
      // Amendment fee is 5, for any booking changed after the deadline
      price += 5;
    }
   
     
   
    if (booking.getCancellationDate() != null)
    {
      if (booking.getCancellationDate().before(event.getBookingDeadline()))
        // �0 for bookings cancelled before booking deadline, capped at fee
        return 0d;
      else
     
        // �50 for bookings cancelled after booking deadline, capped at fee
View Full Code Here

  @Test
  public void testPriceOf() {
   
    CoCampPricingStrategy pricer = new CoCampPricingStrategy();
   
    Event cocamp = CannedQueries.eventByName(TestConstants.EVENT1_NAME);
    Organisation testOrg = CannedQueries.orgByName(TestConstants.ORG1_NAME);
    Unit testUnit = CannedQueries.unitByName(TestConstants.UNIT1_NAME, testOrg);
   
    TestClock testClock = new TestClock(TestConstants.DATE_BEFORE_DEADLINE);
   
View Full Code Here

TOP

Related Classes of uk.org.woodcraft.bookings.datamodel.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.