Examples of Discount


Examples of beans.discount.entity.Discount

        DiscountCardType type = findEntity(DiscountCardType.class, discountCardTypeID);
        Collection<Discount> discounts = findEntityList(Discount.class, "cardType", type);
        List<DiscountDetails> list = new ArrayList<DiscountDetails>();
        Iterator<Discount> i = discounts.iterator();
        while(i.hasNext()) {
            Discount j = (Discount) i.next();
            list.add(j.getDetails((RightChecker) this));
        }
        return list;
    }
View Full Code Here

Examples of beans.discount.entity.Discount

          new Field("level", level)};
                   
            @SuppressWarnings("unchecked")
            Iterator<Discount> discounts = findEntityList(Discount.class, field).iterator();
            if(discounts.hasNext()) {
                Discount discount = discounts.next();
                discount.setValue(d.value);
                manager.merge(discount);
                // remove extra lines
                while(discounts.hasNext()) {
                    discount = discounts.next();
                    manager.remove(discount);
                }
            } else {
                Discount discount = new Discount();
                discount.setDiscountCardType(type);
                discount.setServiceClass(cls);
                discount.setLevel(level);
                discount.setValue(d.value);
                manager.persist(discount);
            }
        }
    }
View Full Code Here

Examples of beans.discount.entity.Discount

    protected void onRemove(DiscountLevel entity) throws ClipsServerException {
        super.onRemove(entity);
       
        Iterator list  = findEntityList(Discount.class, "level", entity).iterator();
        while(list.hasNext()) {
            Discount d = (Discount) list.next();
            manager.remove(d);
        }       
    }
View Full Code Here

Examples of beans.discount.entity.Discount

            discountCard.setType((DiscountCardType) entityWith);
            manager.merge(discountCard);
        }
        List entityList1 = findEntityList(Discount.class, "cardType", entityWhat);
        for (int i = 0; i < entityList1.size(); i++) {
            Discount discount = (Discount) entityList1.get(i);
            discount.setDiscountCardType((DiscountCardType) entityWith);
            manager.merge(discount);
        }
        removeEntity(entityWhat);
        manager.flush();
    }
View Full Code Here

Examples of beans.discount.entity.Discount

    private void replaceServiceClass(DirectoryEntity entityWhat, DirectoryEntity entityWith) {
        //Discount, Service
        List entityList = findEntityList(Discount.class, "serviceClass", entityWhat);
        for (int i = 0; i < entityList.size(); i++) {
            Discount d = (Discount)entityList.get(i);
            d.setServiceClass((ServiceClass) entityWith);
            manager.merge(d);
        }
        List entityList1 = findEntityList(Service.class, "serviceClass", entityWhat);
        for (int i = 0; i < entityList1.size(); i++) {
            Service s = (Service) entityList1.get(i);
View Full Code Here

Examples of org.fenixedu.academic.domain.accounting.Discount

    }

    public ActionForward deleteDiscount(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
            HttpServletResponse response) {

        final Discount discount = getDomainObject(request, "discountOid");
        request.setAttribute("eventId", discount.getEvent().getExternalId());

        try {
            discount.delete();
        } catch (final DomainException e) {
            addActionMessage(request, e.getMessage(), e.getArgs());
        }

        return showPaymentsForEvent(mapping, actionForm, request, response);
View Full Code Here

Examples of org.hibernate.test.annotations.Discount

  public void testSimpleOneToManyCollection() throws Exception {
    Session s;
    Transaction tx;
    s = openSession();
    tx = s.beginTransaction();
    Discount d = new Discount();
    d.setDiscount( 10 );
    Customer c = new Customer();
    List discounts = new ArrayList();
    discounts.add( d );
    d.setOwner( c );
    c.setDiscountTickets( discounts );
    s.persist( c );
    tx.commit();
    s.close();
View Full Code Here

Examples of org.hibernate.test.annotations.Discount

  public void testCascade() throws Exception {
    Session s;
    Transaction tx;
    s = openSession();
    tx = s.beginTransaction();
    Discount discount = new Discount();
    discount.setDiscount( 20.12 );
    Customer customer = new Customer();
    Collection discounts = new ArrayList();
    discounts.add( discount );
    customer.setName( "Quentin Tarantino" );
    discount.setOwner( customer );
    customer.setDiscountTickets( discounts );
    s.persist( discount );
    tx.commit();
    s.close();

    s = openSession();
    tx = s.beginTransaction();
    discount = (Discount) s.get( Discount.class, discount.getId() );
    assertNotNull( discount );
    assertEquals( 20.12, discount.getDiscount() );
    assertNotNull( discount.getOwner() );
    customer = new Customer();
    customer.setName( "Clooney" );
    discount.setOwner( customer );
    discounts = new ArrayList();
    discounts.add( discount );
    customer.setDiscountTickets( discounts );
    tx.commit();
    s.close();

    s = openSession();
    tx = s.beginTransaction();
    discount = (Discount) s.get( Discount.class, discount.getId() );
    assertNotNull( discount );
    assertNotNull( discount.getOwner() );
    assertEquals( "Clooney", discount.getOwner().getName() );
    tx.commit();
    s.close();

    s = openSession();
    tx = s.beginTransaction();
View Full Code Here

Examples of org.hibernate.test.annotations.Discount

  public void testFetch() throws Exception {
    Session s;
    Transaction tx;
    s = openSession();
    tx = s.beginTransaction();
    Discount discount = new Discount();
    discount.setDiscount( 20 );
    Customer customer = new Customer();
    Collection discounts = new ArrayList();
    discounts.add( discount );
    customer.setName( "Quentin Tarantino" );
    discount.setOwner( customer );
    customer.setDiscountTickets( discounts );
    s.persist( discount );
    tx.commit();
    s.close();

    s = openSession();
    tx = s.beginTransaction();
    discount = (Discount) s.get( Discount.class, discount.getId() );
    assertNotNull( discount );
    assertFalse( Hibernate.isInitialized( discount.getOwner() ) );
    tx.commit();

    s = openSession();
    tx = s.beginTransaction();
    discount = (Discount) s.load( Discount.class, discount.getId() );
    assertNotNull( discount );
    assertFalse( Hibernate.isInitialized( discount.getOwner() ) );
    tx.commit();

    s = openSession();
    tx = s.beginTransaction();
    s.delete( s.get( Discount.class, discount.getId() ) );
    tx.commit();
    s.close();
  }
View Full Code Here

Examples of org.hibernate.test.annotations.Discount

  public void testSimpleOneToManyCollection() throws Exception {
    Session s;
    Transaction tx;
    s = openSession();
    tx = s.beginTransaction();
    Discount d = new Discount();
    d.setDiscount( 10 );
    Customer c = new Customer();
    List discounts = new ArrayList();
    discounts.add( d );
    d.setOwner( c );
    c.setDiscountTickets( discounts );
    s.persist( c );
    tx.commit();
    s.close();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.