Examples of BeanComparator


Examples of org.apache.commons.beanutils.BeanComparator

    @SuppressWarnings({ "unchecked", "rawtypes" })
    public List<T> getHandlers() {
        synchronized (LOCK_OBJECT) {
            if (!handlersSorted) {
                if (!handlersSorted) {
                    Comparator fieldCompare = new BeanComparator("priority");
                    Collections.sort(handlers, fieldCompare);
                    handlersSorted = true;
                }
            }
            return handlers;
View Full Code Here

Examples of org.apache.commons.beanutils.BeanComparator

            offerMap.get(potential).add(candidate);
        }
        List<FulfillmentGroupOfferPotential> potentials = new ArrayList<FulfillmentGroupOfferPotential>();
        for (FulfillmentGroupOfferPotential potential : offerMap.keySet()) {
            List<PromotableCandidateFulfillmentGroupOffer> fgOffers = offerMap.get(potential);
            Collections.sort(fgOffers, new ReverseComparator(new BeanComparator("discountedAmount", new NullComparator())));
            Collections.sort(fgOffers, new BeanComparator("priority", new NullComparator()));

            if (potential.getOffer().isLimitedUsePerOrder() && fgOffers.size() > potential.getOffer().getMaxUsesPerOrder()) {
                for (int j = potential.getOffer().getMaxUsesPerOrder(); j < fgOffers.size(); j++) {
                    fgOffers.remove(j);
                }
            }
            for (PromotableCandidateFulfillmentGroupOffer candidate : fgOffers) {
                if (potential.getTotalSavings().getAmount().equals(BankersRounding.zeroAmount())) {
                    BroadleafCurrency currency = order.getOrderCurrency();
                    if (currency != null) {
                        potential.setTotalSavings(new Money(BigDecimal.ZERO, currency.getCurrencyCode()));
                    } else {
                        potential.setTotalSavings(new Money(BigDecimal.ZERO));
                    }
                }

                Money priceBeforeAdjustments = candidate.getFulfillmentGroup().calculatePriceWithoutAdjustments();
                Money discountedPrice = candidate.getDiscountedPrice();
                potential.setTotalSavings(potential.getTotalSavings().add(priceBeforeAdjustments.subtract(discountedPrice)));
                potential.setPriority(candidate.getOffer().getPriority());
            }

            potentials.add(potential);
        }

        // Sort fg potentials by priority and discount
        Collections.sort(potentials, new BeanComparator("totalSavings", Collections.reverseOrder()));
        Collections.sort(potentials, new BeanComparator("priority"));
        potentials = removeTrailingNotCombinableFulfillmentGroupOffers(potentials);

        boolean fgOfferApplied = false;
        for (FulfillmentGroupOfferPotential potential : potentials) {
            Offer offer = potential.getOffer();
View Full Code Here

Examples of org.apache.commons.beanutils.BeanComparator

        else if ( sortField.equals( ContactListFields.COMPANY.name() ) ) {
          fieldName = "company";
        }
        Comparator comparator = null;
        if ( ascending ) {
          comparator = new BeanComparator( fieldName );
        }
        else {
          comparator = new ReverseComparator( new BeanComparator( fieldName ) );
        }
        Collections.sort( contactList, comparator );
      }

      String[][] array = new String[contactList.size()][ContactListFields.values().length];
View Full Code Here

Examples of org.apache.commons.beanutils.BeanComparator

    List<TimeZone> result = new ArrayList<TimeZone>();
    while (ids.hasMoreElements()) {
      result.add( TimeZone.getTimeZone( ids.nextElement() ) );
    }

    Collections.sort( result, new BeanComparator( "rawOffset" ) );

    return result;
  }
View Full Code Here

Examples of org.apache.commons.beanutils.BeanComparator

    List<TimeZone> result = new ArrayList<TimeZone>();
    while (ids.hasMoreElements()) {
      result.add( TimeZone.getTimeZone( ids.nextElement() ) );
    }

    Collections.sort( result, new BeanComparator( "rawOffset" ) );

    return result;
  }
View Full Code Here

Examples of org.apache.commons.beanutils.BeanComparator

        } catch (Throwable t) {
            ApsSystemUtils.logThrowable(t, this, "searchUsers");
            //throw new ApsSystemException("Error searching users", t);
        }
        if (null != users) {
            BeanComparator comparator = new BeanComparator("username");
            Collections.sort(users, comparator);
        }
        return users;
    }
View Full Code Here

Examples of org.apache.commons.beanutils.BeanComparator

        || folderInfos.getMessages().size() != folder.getMessageCount()); //cambiato size
  }
  */
  protected void orderMessages(List<Message> messages) {
    //TODO PER ORA ORDINA PER DATA DISCENDENTE... POI STRUTTURARE OPZIONI
    BeanComparator comparator = new BeanComparator("receivedDate");
    Collections.sort(messages, comparator);
    Collections.reverse(messages);
  }
View Full Code Here

Examples of org.apache.commons.beanutils.BeanComparator

                String code = allowedShowlets.get(i);
                WidgetType type = customizableShowlets.get(code);
                WidgetCheckInfo info = new WidgetCheckInfo(type, false, currentLang);
                checkInfos.add(info);
            }
            BeanComparator comparator = new BeanComparator("title");
            Collections.sort(checkInfos, comparator);
            this.pageContext.setAttribute(this.getVar(), checkInfos);
        } catch (Throwable t) {
            ApsSystemUtils.logThrowable(t, this, "doStartTag");
            throw new JspException("Error on doStartTag", t);
View Full Code Here

Examples of org.apache.commons.beanutils.BeanComparator

  public List<IApsEntity> getContentTypes() {
    List<IApsEntity> entityPrototypes = null;
    try {
      Map<String, IApsEntity> modelMap = this.getContentManager().getEntityPrototypes();
      entityPrototypes = new ArrayList<IApsEntity>(modelMap.values());
      BeanComparator comparator = new BeanComparator("typeDescr");
      Collections.sort(entityPrototypes, comparator);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "getContentTypes");
      throw new RuntimeException("Error extracting content types", t);
    }
View Full Code Here

Examples of org.apache.commons.beanutils.BeanComparator

        long positionInt = Math.round(position);
        String classId = String.valueOf(((int)positionInt+1));
        CloudInfoBean bean = new CloudInfoBean(treeNode, occurrence, classId, currentLang);
        beans.add(bean);
      }
      BeanComparator comparator = new BeanComparator("title");
      Collections.sort(beans, comparator);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "buildCloudsInfoBeans");
      throw new ApsSystemException("Error building Cloud info", t);
    }
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.