Package uk.org.woodcraft.bookings.datamodel

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


   
   
    Organisation orgWcf = new Organisation(TestConstants.ORG1_NAME, true);
    CannedQueries.save(orgWcf);
   
    Unit unit1 = new Unit(TestConstants.UNIT1_NAME, orgWcf, true);
    CannedQueries.save(unit1);
   
    User rootUser = new User("globaladmin@example.com", "Global Admin 1", "password", Accesslevel.GLOBAL_ADMIN);
    rootUser.setOrganisationKey(orgWcf.getKeyCheckNotNull());
    rootUser.setUnitKey(unit1.getKeyCheckNotNull());
    CannedQueries.save(rootUser);

    User orgUser = new User("orgbooking@example.com", "Org Booking Secretary 1", "password", Accesslevel.ORG_ADMIN);
    orgUser.setOrganisationKey(orgWcf.getKeyCheckNotNull());
    orgUser.setUnitKey(unit1.getKeyCheckNotNull());
    CannedQueries.save(orgUser);

    User unitUser = new User("unitbooking@example.com", "Unit Booking Secretary 1", "password", Accesslevel.UNIT_ADMIN);
    unitUser.setOrganisationKey(orgWcf.getKeyCheckNotNull());
    unitUser.setUnitKey(unit1.getKeyCheckNotNull());
    CannedQueries.save(unitUser);
   
   
    // And don't let this be repeated!
    AppSetting setupCompleteSetting = new AppSetting(AppSetting.SETUP_COMPLETE, "true");
View Full Code Here


      if (!DateUtils.cleanupTime(transaction.getTimestamp()).after(eventEarlyBookingDeadline) || transaction.getType() == TransactionType.Discount)
      {
        // Ignore any additional bills
        if ( !transaction.getType().getIsCost())
        {
          Unit unit = transaction.getUnit();
          List<Transaction> transactionsForUnit = relevantTransactions.get(unit);
         
          if (transactionsForUnit == null )
          {
            transactionsForUnit = new ArrayList<Transaction>();
View Full Code Here

    {
      setModel(CannedQueries.unitByKey(key));
    } else {
      Organisation currentOrg = SessionUtils.getCurrentOrg();
      if (currentOrg != null)
        setModel(new Unit(currentOrg));
      else
      {
        Organisation userAddedOrg = (Organisation)getSessionObject(SessionConstants.SIGNUP_ADDED_ORG);
        if (userAddedOrg != null) {
          setModel(new Unit(userAddedOrg));
        } else
          setModel(new Unit());
      }
    }
  }
View Full Code Here

   
    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);
   
    Booking regularBooking = Booking.create(testUnit, vcamp, testClock);
    regularBooking.setArrivalDate(DateUtils.getDate(2013, 7, 3));
View Full Code Here

  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);
   
    Booking regularBooking = Booking.create(testUnit, vcamp, testClock);
    regularBooking.setArrivalDate(DateUtils.getDate(2013, 7, 3));
View Full Code Here

      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); 
      units.add(unit1);
     
      Unit unit2 = new Unit(TestConstants.UNIT2_NAME, organisations.get(0), true);
     
      // FIXME: Note, all units are in all events for now...
      //unit2.addEventRegistration(event1);
      units.add(unit2);
     
      Unit unapprovedWcfUnit = new Unit("Unapproved unit for wcf", organisations.get(0), false);
      units.add(unapprovedWcfUnit);
      Unit otherOrgUnit = new Unit("Unapproved unit", organisations.get(1), false);
      units.add(otherOrgUnit);
      Unit otherOrgUnit2 = new Unit("Approved unit in other org", organisations.get(1), true);
      units.add(otherOrgUnit2);
      pm.makePersistentAll(units);
     
      // Bookings
      List<Booking> bookings = getBookings(event1, event2, unit1, unit2, unapprovedWcfUnit, otherOrgUnit2);
      pm.makePersistentAll(bookings);
     
     
      // Transactions
      List<Transaction> transactions = new ArrayList<Transaction>();
      transactions.add(new Transaction(unit1.getKeyCheckNotNull(), event1.getKeyCheckNotNull(), testClock.getTime(), TransactionType.Payment, "Payment 1", "Comment 1", 23.32d));
      transactions.add(new Transaction(unit1.getKeyCheckNotNull(), event1.getKeyCheckNotNull(), testClock.getTime(), TransactionType.Payment, "Payment 2", "", 12.00d));
      transactions.add(new Transaction(unit1.getKeyCheckNotNull(), event1.getKeyCheckNotNull(), testClock.getTime(), TransactionType.Payment, "Payment 3", "", 130.00d));
     
      transactions.add(new Transaction(unit1.getKeyCheckNotNull(), event1.getKeyCheckNotNull(), testClock.getTime(), TransactionType.Adjustment, "Refund 1", "Refund test", -23.32d));
     
      transactions.add(new Transaction(unit2.getKeyCheckNotNull(), event1.getKeyCheckNotNull(), testClock.getTime(), TransactionType.Payment, "Unit 2 payment", "", 70.00d));
     
      // after earlybird deadline
      transactions.add(new Transaction(unit1.getKeyCheckNotNull(), event1.getKeyCheckNotNull(), afterEarlyBird.getTime(), TransactionType.Payment, "Payment after earlybird", "", 10.00d));
      transactions.add(new Transaction(unit1.getKeyCheckNotNull(), event1.getKeyCheckNotNull(), afterEarlyBird.getTime(), TransactionType.Discount, "Discount for early payment", "", 5.00d));
      pm.makePersistentAll(transactions);
     
      // Users
      User user1 = new User(TestConstants.USER_ADMIN_EMAIL, "Global Admin 1", "password", Accesslevel.GLOBAL_ADMIN);
      user1.setOrganisationKey(orgWcf.getKeyCheckNotNull());
      user1.setUnitKey(unit1.getKeyCheckNotNull());
     
     
      User user2 = new User("orgadmin@example.com", "Org Admin 1", "password", Accesslevel.ORG_ADMIN);
      user2.setOrganisationKey(orgWcf.getKeyCheckNotNull());
      user2.setUnitKey(unit1.getKeyCheckNotNull());
     
      User user3 = new User("unitadmin@example.com", "Unit Admin 1", "password", Accesslevel.UNIT_ADMIN);
      user3.setOrganisationKey(orgWcf.getKeyCheckNotNull());
      user3.setUnitKey(unit1.getKeyCheckNotNull());
     
      User user4 = new User("unassigned@example.com", "Unassigned 1", "password", Accesslevel.UNIT_ADMIN);
      user4.setOrganisationKey(orgWcf.getKeyCheckNotNull());
      user4.setUnitKey(unit2.getKeyCheckNotNull());
      user4.setApproved(false);
     
      User user5 = new User("otherorg@example.com", "Other Org 1", "password", Accesslevel.ORG_ADMIN);
      user5.setOrganisationKey(otherOrg.getKeyCheckNotNull());
      user5.setUnitKey(otherOrgUnit2.getKeyCheckNotNull());
     
      pm.makePersistentAll(user1, user2, user3, user4, user5);
   
     
      // Application settings
View Full Code Here

  private String confirmUnlockBooking = "";
  private String cancelUnlockBooking = "";
 
  @SkipValidation
  public String listForUnit() {   
    Unit unit = getCurrentUnit();   
    SecurityModel.checkAllowed(Operation.READ, unit);
    setModelList(CannedQueries.bookingsForUnit(unit, getCurrentEvent()));
    return SUCCESS;
  }
View Full Code Here

   
    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);
   
    Booking regularBooking = Booking.create(testUnit, cocamp, testClock);
    regularBooking.setArrivalDate(DateUtils.getDate(2011, 6, 30));
View Full Code Here

  public void testCancellation(){
    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);
   
    Booking regularBooking = Booking.create(testUnit, cocamp, testClock);
    regularBooking.setArrivalDate(DateUtils.getDate(2011, 6, 30));
View Full Code Here

  }
  public static class OrgTransformer implements BookingTransformer
  {
    @Override
    public Object[] transform(Booking b) {
      Unit unit = b.getUnit();
      if (unit == null) return new Object[]{null};
      return new Object[]{unit.getOrganisation()};
    }
View Full Code Here

TOP

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

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.