Package org.broadleafcommerce.core.offer.domain

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


            "The default is 0.").withShortName("err").create();

    Option helpOpt = obuilder.withLongName("help").withDescription("Print out help").withShortName("h")
        .create();

    Group group = gbuilder.withName("Options").withOption(inputOpt).withOption(idFieldOpt).withOption(
        outputOpt).withOption(delimiterOpt).withOption(helpOpt).withOption(fieldOpt).withOption(maxOpt)
        .withOption(dictOutOpt).withOption(powerOpt).withOption(maxDFPercentOpt)
        .withOption(weightOpt).withOption(minDFOpt).withOption(maxPercentErrorDocsOpt).create();

    try {
View Full Code Here


   
    Option confusionMatrixOpt = obuilder.withLongName("confusionMatrix").withRequired(false).withArgument(
        abuilder.withName("confusionMatrix").withMinimum(1).withMaximum(1).create()).withDescription(
        "Export ConfusionMatrix as SequenceFile").withShortName("cm").create();
     
    Group group = gbuilder.withName("Options").withOption(defaultCatOpt).withOption(dirOpt).withOption(
      encodingOpt).withOption(gramSizeOpt).withOption(pathOpt).withOption(typeOpt).withOption(dataSourceOpt)
        .withOption(helpOpt).withOption(methodOpt).withOption(verboseOutputOpt).withOption(alphaOpt)
        .withOption(confusionMatrixOpt).create();
   
    try {
View Full Code Here

      "Location of model: hdfs. Default Value: hdfs").withShortName("source").create();
   
    Option skipCleanupOpt = obuilder.withLongName("skipCleanup").withRequired(false).withDescription(
        "Skip cleanup of feature extraction output").withShortName("sc").create();
   
    Group group = gbuilder.withName("Options").withOption(gramSizeOpt).withOption(helpOpt).withOption(
      inputDirOpt).withOption(outputOpt).withOption(typeOpt).withOption(dataSourceOpt).withOption(alphaOpt)
        .withOption(minDfOpt).withOption(minSupportOpt).withOption(skipCleanupOpt).create();
    try {
      Parser parser = new Parser();
     
View Full Code Here

   
    Option dataSourceOpt = obuilder.withLongName("dataSource").withRequired(true).withArgument(
      abuilder.withName("dataSource").withMinimum(1).withMaximum(1).create()).withDescription(
      "Location of model: hdfs").withShortName("source").create();
   
    Group options = gbuilder.withName("Options").withOption(pathOpt).withOption(classifyOpt).withOption(
      encodingOpt).withOption(analyzerOpt).withOption(defaultCatOpt).withOption(gramSizeOpt).withOption(
      typeOpt).withOption(dataSourceOpt).create();
   
    Parser parser = new Parser();
    parser.setGroup(options);
View Full Code Here

   
    Option inputOpt = DefaultOptionCreator.inputOption().create();
    Option outputOpt = DefaultOptionCreator.outputOption().create();
    Option helpOpt = DefaultOptionCreator.helpOption();
   
    Group group = gbuilder.withName("Options").withOption(inputOpt).withOption(outputOpt).withOption(helpOpt)
        .create();
   
    try {
      Parser parser = new Parser();
      parser.setGroup(group);
View Full Code Here

    Option collapseOpt = obuilder.withLongName("collapse").withRequired(true).withArgument(
      abuilder.withName("collapse").withMinimum(1).withMaximum(1).create()).withDescription(
      "Collapse a whole directory to a single file, one doc per line").withShortName("p").create();
   
    Option helpOpt = DefaultOptionCreator.helpOption();
    Group group = gbuilder.withName("Options").withOption(inputOpt).withOption(outputOpt).withOption(labelOpt)
        .withOption(analyzerOpt).withOption(charsetOpt).withOption(collapseOpt).withOption(helpOpt).create();
    try {
      Parser parser = new Parser();
      parser.setGroup(group);
      CommandLine cmdLine = parser.parse(args);
View Full Code Here

    GroupBuilder gbuilder = new GroupBuilder();

    Option inputOpt = DefaultOptionCreator.inputOption().withRequired(false).create();
    Option outputOpt = DefaultOptionCreator.outputOption().withRequired(false).create();
    Option helpOpt = DefaultOptionCreator.helpOption();
    Group group = gbuilder.withName("Options").withOption(inputOpt).withOption(outputOpt).withOption(helpOpt).create();

    try {
      Parser parser = new Parser();
      parser.setGroup(group);
      CommandLine cmdLine = parser.parse(args);
View Full Code Here

       
        quantity = priceDetail1.getQuantityAvailableToBeUsedAsQualifier(candidateOffer);
        //items that have already received this promotion cannot get it again
        assertTrue(quantity==1);
       
        Offer testOffer = new OfferImpl();
        testOffer.setOfferItemQualifierRuleType(OfferItemRestrictionRuleType.NONE);
        testOffer.setOfferItemTargetRuleType(OfferItemRestrictionRuleType.NONE);
       
        discount.setPromotion(testOffer);
       
        quantity = priceDetail1.getQuantityAvailableToBeUsedAsQualifier(candidateOffer);
        //this item received a different promotion, but the restriction rule is NONE, so this item cannot be a qualifier for this promotion
        assertTrue(quantity==1);
       
        testOffer.setOfferItemTargetRuleType(OfferItemRestrictionRuleType.QUALIFIER);
        candidateOffer.getOffer().setOfferItemQualifierRuleType(OfferItemRestrictionRuleType.TARGET);

        quantity = priceDetail1.getQuantityAvailableToBeUsedAsQualifier(candidateOffer);
        //this item received a different promotion, but the restriction rule is QUALIFIER, so this item can be a qualifier
        // for this promotion
        assertTrue(quantity==2);
       
        priceDetail1.getPromotionDiscounts().clear();
       
        PromotionQualifier qualifier = new PromotionQualifier();
        qualifier.setPromotion(offer);
        qualifier.setQuantity(1);
        priceDetail1.getPromotionQualifiers().add(qualifier);
       
        quantity = priceDetail1.getQuantityAvailableToBeUsedAsQualifier(candidateOffer);
        //items that have already qualified for this promotion cannot qualify again
        assertTrue(quantity==1);
       
        qualifier.setPromotion(testOffer);
       
        quantity = priceDetail1.getQuantityAvailableToBeUsedAsQualifier(candidateOffer);
        //this item qualified for a different promotion, but the restriction rule is NONE, so this item cannot be a qualifier for this promotion
        assertTrue(quantity==1);
       
        testOffer.setOfferItemQualifierRuleType(OfferItemRestrictionRuleType.QUALIFIER);
        candidateOffer.getOffer().setOfferItemQualifierRuleType(OfferItemRestrictionRuleType.QUALIFIER);
       
        quantity = priceDetail1.getQuantityAvailableToBeUsedAsQualifier(candidateOffer);
        // this item qualified for a different promotion, but the restriction rule is QUALIFIER,
        // so this item can be a qualifier for this promotion
View Full Code Here

       
        quantity = priceDetail1.getQuantityAvailableToBeUsedAsTarget(candidateOffer);
        //items that have already received this promotion cannot get it again
        assertTrue(quantity==1);
       
        Offer tempOffer = new OfferImpl();
        tempOffer.setCombinableWithOtherOffers(true);
        tempOffer.setOfferItemQualifierRuleType(OfferItemRestrictionRuleType.NONE);
        tempOffer.setOfferItemTargetRuleType(OfferItemRestrictionRuleType.NONE);
       
        discount.setPromotion(tempOffer);
       
        quantity = priceDetail1.getQuantityAvailableToBeUsedAsTarget(candidateOffer);
        //this item received a different promotion, but the restriction rule is NONE, so this item cannot be a qualifier
        //for this promotion
        assertTrue(quantity==1);
       
        tempOffer.setOfferItemTargetRuleType(OfferItemRestrictionRuleType.TARGET);
        quantity = priceDetail1.getQuantityAvailableToBeUsedAsTarget(candidateOffer);
        // this item received a different promotion, but the restriction rule is TARGET,
        // so this item can be a target of this promotion but since the "candidateOffer"
        // is set to NONE, the quantity can only be 1
        assertTrue(quantity == 1);
       
        // Now set the candidateOffer to be "TARGET" and we can use the quantity
        // for both promotions.
        candidateOffer.getOffer().setOfferItemTargetRuleType(OfferItemRestrictionRuleType.TARGET);
        quantity = priceDetail1.getQuantityAvailableToBeUsedAsTarget(candidateOffer);
        // this item received a different promotion, but the restriction rule is TARGET,
        // so this item can be a target of this promotion but since the "candidateOffer"
        // is set to NONE, the quantity can only be 1
        assertTrue(quantity == 2);

        priceDetail1.getPromotionDiscounts().clear();
        // rest candidate offer
        candidateOffer.getOffer().setOfferItemTargetRuleType(OfferItemRestrictionRuleType.NONE);
       
        PromotionQualifier qualifier = new PromotionQualifier();
        qualifier.setPromotion(offer);
        qualifier.setQuantity(1);
        priceDetail1.getPromotionQualifiers().add(qualifier);
       
        quantity = priceDetail1.getQuantityAvailableToBeUsedAsTarget(candidateOffer);
        //items that have already qualified for this promotion cannot qualify again
        assertTrue(quantity==1);
       
        qualifier.setPromotion(tempOffer);
       
        quantity = priceDetail1.getQuantityAvailableToBeUsedAsTarget(candidateOffer);
        //this item qualified for a different promotion, but the restriction rule is NONE,
        // so this item cannot be a qualifier for this promotion
        assertTrue(quantity==1);

        tempOffer.setOfferItemQualifierRuleType(OfferItemRestrictionRuleType.TARGET);
        candidateOffer.getOffer().setOfferItemTargetRuleType(OfferItemRestrictionRuleType.QUALIFIER);
        quantity = priceDetail1.getQuantityAvailableToBeUsedAsTarget(candidateOffer);
        //this item qualified for a different promotion, but the restriction rule is QUALIFIER,
        // so this item can be a qualifier for this promotion
        assertTrue(quantity==2);
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);

        OfferItemCriteria oic = new OfferItemCriteriaImpl();
        oic.setQuantity(1);
        oic.setMatchRule(orderRule);
        offer.setTargetItemCriteria(Collections.singleton(oic));

        offer.setAppliesToCustomerRules(customerRule);
        offer.setCombinableWithOtherOffers(true);
        offer = offerService.save(offer);
        offer.setMaxUses(50);
        return offer;
    }
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.