Package org.broadleafcommerce.core.offer.domain

Examples of org.broadleafcommerce.core.offer.domain.OfferImpl$Presentation$Group


        Set<OfferItemCriteria> targetItemCriteria,
        boolean totalitarianOffer,
        OfferType offerType,
        BigDecimal value
    ) {
        Offer offer = new OfferImpl();
        OfferRule customerRule = new OfferRuleImpl();
        customerRule.setMatchRule(appliesToCustomerRules);
        offer.getOfferMatchRules().put(OfferRuleType.CUSTOMER.getType(), customerRule);
        OfferRule fgRule = new OfferRuleImpl();
        fgRule.setMatchRule(appliesToFulfillmentGroupRules);
        offer.getOfferMatchRules().put(OfferRuleType.FULFILLMENT_GROUP.getType(), fgRule);
        OfferRule orderRule = new OfferRuleImpl();
        orderRule.setMatchRule(appliesToRules);
        offer.getOfferMatchRules().put(OfferRuleType.ORDER.getType(), orderRule);
        offer.setApplyDiscountToSalePrice(applyToSalePrice);
        offer.setCombinableWithOtherOffers(combinableWithOtherOffers);
        offer.setDeliveryType(deliveryType);
        offer.setAutomaticallyAdded(OfferDeliveryType.AUTOMATIC==deliveryType);
        offer.setDiscountType(type);
        offer.setEndDate(endDate);
        offer.setMaxUses(maxUses);
        offer.setOfferItemQualifierRuleType(qualifierType);
        offer.setOfferItemTargetRuleType(targetType);
        offer.setPriority(priority);
        offer.setQualifyingItemCriteria(qualifyingItemCriteria);
        offer.setStackable(stackable);
        offer.setStartDate(startDate);
        offer.setTargetItemCriteria(targetItemCriteria);
        offer.setTotalitarianOffer(totalitarianOffer);
        offer.setType(offerType);
        offer.setValue(value);
        offer.setTreatAsNewFormat(true);
        offer.setId(getOfferId());
        return offer;
    }
View Full Code Here


        DiscreteOrderItemImpl orderItem = new DiscreteOrderItemImpl();
        Sku sku = new SkuImpl();
        sku.setRetailPrice(new Money("1"));
        sku.setId(1234L);
        orderItem.setSku(sku);
        OfferImpl offer = new OfferImpl();
        offer.setType(OfferType.ORDER_ITEM);

        //Set up MVEL Context
        ParserContext context = new ParserContext();

        //Import OfferType into the MVEL context since it may be used
View Full Code Here

        OrderImpl order = new OrderImpl();
        order.setSubTotal(new Money(110D));
        FulfillmentGroupImpl group = new FulfillmentGroupImpl();
        group.setPrimary(true);

        OfferImpl offer = new OfferImpl();
        offer.setType(OfferType.FULFILLMENT_GROUP);
        order.getFulfillmentGroups().add(group);

        //Set up MVEL Context
        ParserContext context = new ParserContext();
        //Import OfferType into the MVEL context since it may be used
View Full Code Here

        offerCode = offerService.saveOfferCode(offerCode);
        return offerCode;
    }

    private Offer createOffer(String offerName, OfferType offerType, OfferDiscountType discountType, double value, String customerRule, String orderRule) {
        Offer offer = new OfferImpl();
        offer.setName(offerName);
        offer.setStartDate(SystemTime.asDate());
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, -1);
        offer.setStartDate(calendar.getTime());
        calendar.add(Calendar.DATE, 2);
        offer.setEndDate(calendar.getTime());
        offer.setType(offerType);
        offer.setDiscountType(discountType);
        offer.setValue(BigDecimal.valueOf(value));
        offer.setDeliveryType(OfferDeliveryType.CODE);
        offer.setStackable(true);
        offer.setAppliesToOrderRules(orderRule);
        offer.setAppliesToCustomerRules(customerRule);
        offer.setCombinableWithOtherOffers(true);
        offer = offerService.save(offer);
        offer.setMaxUses(50);
        return offer;
    }
View Full Code Here

public class OfferDataProvider {

    @DataProvider(name = "offerDataProvider")
    public static Object[][] provideBasicOffer(){
        List<Offer> allOffers = new ArrayList<Offer>();
        OfferImpl o = new OfferImpl();
        o.setDiscountType(OfferDiscountType.AMOUNT_OFF);
        o.setValue(new BigDecimal("5.00"));
        o.setName("Some test offer");
        o.setPriority(100);
        o.setStackable(true);
        o.setStartDate(SystemTime.asDate());
        o.setEndDate(new Date(SystemTime.asMillis()+100000000));
        o.setApplyDiscountToMarkedItems(false);
        o.setTargetSystem("WEB");
        o.setType(OfferType.ORDER_ITEM);
        o.setAppliesToOrderRules(
                "package org.broadleafcommerce.core.offer.service;"+
                "import org.broadleafcommerce.core.offer.domain.Offer;"+
                "import org.broadleafcommerce.core.order.domain.Order;"+
                "import org.broadleafcommerce.core.order.domain.OrderItem;"+
                "import org.broadleafcommerce.type.OfferType;"+
                "import java.util.List;"+
                "global List orderItems;"+
                "global List offerPackages;"+
                "rule \"Offer 1 Rule\" "+
                "salience 100"+
                "when "+
                "  orderItem : OrderItem(sku == 1) "+
                "  "+
                " then"+
                "   System.err.println(\"applying offer 1\");"+
                "   orderItem.addRulesCandidateOffer"+
        "end");

        allOffers.add(o);
        o = new OfferImpl();
        o.setDiscountType(OfferDiscountType.AMOUNT_OFF);
        o.setValue(new BigDecimal("5.00"));
        o.setName("Second test offer");
        o.setPriority(100);
        o.setStackable(false);
        o.setStartDate(SystemTime.asDate());
        o.setEndDate(new Date(SystemTime.asMillis()+100000000));
        o.setApplyDiscountToMarkedItems(false);
        o.setTargetSystem("WEB");
        o.setType(OfferType.FULFILLMENT_GROUP);
        o.setAppliesToOrderRules(
                "package org.broadleafcommerce.core.offer.service;"+
                "import org.broadleafcommerce.core.offer.domain.Offer;"+
                "import org.broadleafcommerce.core.order.domain.Order;"+
                "import org.broadleafcommerce.core.order.domain.OrderItem;"+
                "import org.broadleafcommerce.type.OfferType;"+
View Full Code Here

    }

    Variable v = ds.findVariable("time_offset");
    v.addAttribute(new Attribute( "units", "seconds since "+dfo.toDateTimeString(start)));

    Group root = ds.getRootGroup();
    root.addAttribute(new Attribute( "Convention", "Suomi-Station-CDM"));   
    ds.finish();
  }
View Full Code Here

  public void testEosMetadata() {
    //NetcdfFile ncfile = TestH5.open("c:/data/hdf5/HIRDLS/HIRDLS2_v0.3.1-aIrix-c3_2003d106.h5");
    NetcdfFile ncfile = TestH5.open(testDir +"HIRDLS2-Aura73p_b029_2000d275.he5");

    Group root = ncfile.getRootGroup();
    Group g = root.findGroup("HDFEOS INFORMATION");
    Variable dset = g.findVariable("StructMetadata.0");
    assert(null != dset );
    assert(dset.getDataType() == DataType.CHAR);

    // read entire array
    Array A;
    try {
      A = dset.read();
    }
    catch (IOException e) {
      System.err.println("ERROR reading file");
      assert(false);
      return;
    }
    assert(A.getRank() == 1);
    assert (A instanceof ArrayChar);

    ArrayChar ca = (ArrayChar) A;
    String sval = ca.getString();
    System.out.println(dset.getFullName());
    System.out.println(" Length = "+sval.length());
    System.out.println(" Value = "+sval);

    ////////////////
    dset = g.findVariable("coremetadata.0");
    assert(null != dset );
    assert(dset.getDataType() == DataType.CHAR);

    // read entire array
    try {
View Full Code Here

    public int doAct(String filename) throws IOException {
      NetcdfFile ncfile = null;

      try {
        ncfile = NetcdfFile.open(filename);
        Group root = ncfile.getRootGroup();
        Group g = root.findGroup("HDFEOS INFORMATION");
        if (g == null) g = ncfile.getRootGroup();

        Variable dset = g.findVariable("StructMetadata.0");
        if (dset != null) {
          System.out.println("EOS file=" + filename);
          return 1;
        }
View Full Code Here

    public void setSearchPath(final String... groupNames) {
        final Group[] groups = new Group[groupNames.length];
        int count = 0;
        for (final String name : groupNames) {
            if (name != null) {
                final Group group = file.findGroup(name);
                if (group == null) {
                    continue; // Group not found - do not increment the counter.
                }
                groups[count] = group;
            }
View Full Code Here

     */
    @Override
    public String[] getSearchPath() {
        final String[] path = new String[groups.length];
        for (int i=0; i<path.length; i++) {
            final Group group = groups[i];
            if (group != null) {
                path[i] = group.getShortName();
            }
        }
        return path;
    }
View Full Code Here

TOP

Related Classes of org.broadleafcommerce.core.offer.domain.OfferImpl$Presentation$Group

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.