Example usage for org.apache.commons.lang BooleanUtils toBoolean

List of usage examples for org.apache.commons.lang BooleanUtils toBoolean

Introduction

In this page you can find the example usage for org.apache.commons.lang BooleanUtils toBoolean.

Prototype

public static boolean toBoolean(String str) 

Source Link

Document

Converts a String to a boolean (optimised for performance).

'true', 'on' or 'yes' (case insensitive) will return true.

Usage

From source file:org.apache.jetspeed.portlets.AdminPortletWebPage.java

/**
 * Set visibilities of components in a page based on preferences.
 * The preference name for a component is prepended by the specified preferenceNamePrefix.
 * @param prefix//from  w ww  .jav a 2 s.c  o  m
 * @param defaultVisibility
 */
public void setVisibilitiesOfChildComponentsByPreferences(String prefix, boolean defaultVisibility) {
    PortletRequest request = ((AbstractAdminWebApplication) getApplication()).getPortletRequest();
    PortletPreferences prefs = request.getPreferences();

    for (Enumeration<String> prefNames = prefs.getNames(); prefNames.hasMoreElements();) {
        String prefName = prefNames.nextElement();

        if (prefName.startsWith(prefix)) {
            String componentName = prefName.substring(prefix.length());
            String prefValue = prefs.getValue(prefName, defaultVisibility ? "true" : "false");
            Component component = get(componentName);

            if (component != null) {
                component.setVisibilityAllowed(true).setVisible(BooleanUtils.toBoolean(prefValue));
            }
        }
    }
}

From source file:org.apache.ode.bpel.common.evt.DebugBpelEventListener.java

public void startup(Properties configProperties) {
    if (configProperties != null) {
        _dumpToStdOut = BooleanUtils.toBoolean(configProperties.getProperty(SYSOUT_KEY, "false"));
    }//from  w  ww  . java  2 s  .c om
}

From source file:org.apache.solr.handler.admin.LukeRequestHandler.java

@Override
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception {
    IndexSchema schema = req.getSchema();
    SolrIndexSearcher searcher = req.getSearcher();
    IndexReader reader = searcher.getReader();
    SolrParams params = req.getParams();
    int numTerms = params.getInt(NUMTERMS, DEFAULT_COUNT);

    // Always show the core lucene info

    Map<String, TopTermQueue> topTerms = new TreeMap<String, TopTermQueue>();

    // If no doc is given, show all fields and top terms
    Set<String> fields = null;
    String fl = params.get(CommonParams.FL);
    if (fl != null) {
        fields = new TreeSet<String>(Arrays.asList(fl.split("[,\\s]+")));
    }//from  ww w  . ja  v  a2 s  .co m

    if ("schema".equals(params.get("show"))) {
        numTerms = 0; // Abort any statistics gathering.
    }
    rsp.add("index", getIndexInfo(reader, numTerms, topTerms, fields));

    Integer docId = params.getInt(DOC_ID);
    if (docId == null && params.get(ID) != null) {
        // Look for something with a given solr ID
        SchemaField uniqueKey = schema.getUniqueKeyField();
        String v = uniqueKey.getType().toInternal(params.get(ID));
        Term t = new Term(uniqueKey.getName(), v);
        docId = searcher.getFirstMatch(t);
        if (docId < 0) {
            throw new SolrException(SolrException.ErrorCode.NOT_FOUND,
                    "Can't find document: " + params.get(ID));
        }
    }
    // Read the document from the index
    if (docId != null) {
        Document doc = null;
        try {
            doc = reader.document(docId);
        } catch (Exception ex) {
        }
        if (doc == null) {
            throw new SolrException(SolrException.ErrorCode.NOT_FOUND, "Can't find document: " + docId);
        }

        SimpleOrderedMap<Object> info = getDocumentFieldsInfo(doc, docId, reader, schema);

        SimpleOrderedMap<Object> docinfo = new SimpleOrderedMap<Object>();
        docinfo.add("docId", docId);
        docinfo.add("lucene", info);
        docinfo.add("solr", doc);
        rsp.add("doc", docinfo);
    } else if ("schema".equals(params.get("show"))) {
        rsp.add("schema", getSchemaInfo(req.getSchema()));
    } else {
        boolean reportDocCount = true;
        String reportDoc = params.get(REPORT_DOC_COUNT, "false");
        if ("1".equals(reportDoc))
            reportDocCount = true;
        else if ("0".equals(reportDoc))
            reportDocCount = false;
        else
            reportDocCount = BooleanUtils.toBoolean(reportDoc);
        rsp.add("fields", getIndexedFieldsInfo(searcher, fields, numTerms, topTerms, reportDocCount));
    }

    // Add some generally helpful information
    NamedList<Object> info = new SimpleOrderedMap<Object>();
    info.add("key", getFieldFlagsKey());
    info.add("NOTE",
            "Document Frequency (df) is not updated when a document is marked for deletion.  df values include deleted documents.");
    rsp.add("info", info);
    rsp.setHttpCaching(false);
}

From source file:org.apache.solr.handler.component.RuleManagerComponent.java

/**
 * Prepares a query to the rules index based on the type of request received and the provided params.
 * <p/>/*from www  . j ava 2  s.  c om*/
 * This query is intended to match any rules that apply for the current request.
 * @param requestParams Parameters on the current request being processed (i.e. search, category browsing, rule based pages, etc).
 * @param pageType Type of page to which this request belongs to.
 * @return Query ready to be sent to the rules core, to fetch all rules that apply for the given request.
 * @throws IOException If there are missing required values.
 */
protected SolrQuery getRulesQuery(SolrParams requestParams, PageType pageType) throws IOException {
    String catalogId = requestParams.get(RuleManagerParams.CATALOG_ID);

    if (catalogId == null) {
        logger.debug("No catalog ID provided, bypassing this request.");
        return null;
    }

    SolrQuery ruleParams = new SolrQuery("*:*");

    //Common params
    ruleParams.set(CommonParams.ROWS, PAGE_SIZE);
    ruleParams.set(CommonParams.FL, RuleConstants.FIELD_ID, RuleConstants.FIELD_BOOST_FUNCTION,
            RuleConstants.FIELD_FACET_FIELD, RuleConstants.FIELD_COMBINE_MODE, RuleConstants.FIELD_QUERY,
            RuleConstants.FIELD_CATEGORY);

    //Sorting options
    ruleParams.addSort(RuleConstants.FIELD_SORT_PRIORITY, SolrQuery.ORDER.asc);
    ruleParams.addSort(RuleConstants.FIELD_SCORE, SolrQuery.ORDER.asc);
    ruleParams.addSort(RuleConstants.FIELD_ID, SolrQuery.ORDER.asc);

    //Filter queries
    StringBuilder reusableStringBuilder = new StringBuilder();
    ruleParams.addFilterQuery(
            getTargetFilter(reusableStringBuilder, pageType, requestParams.get(CommonParams.Q)));
    ruleParams.addFilterQuery(
            getCategoryFilter(reusableStringBuilder, requestParams.get(RuleManagerParams.CATEGORY_FILTER)));
    ruleParams.addFilterQuery(
            getSiteFilter(reusableStringBuilder, requestParams.getParams(RuleManagerParams.SITE_IDS)));
    ruleParams.addFilterQuery(
            getBrandFilter(reusableStringBuilder, requestParams.get(RuleManagerParams.BRAND_ID)));
    ruleParams.addFilterQuery(getSubTargetFilter(reusableStringBuilder,
            isOutletRequest(requestParams.getParams(CommonParams.FQ))));

    StringBuilder catalogFilter = reuseStringBuilder(reusableStringBuilder);
    catalogFilter.append(RuleConstants.FIELD_CATALOG_ID).append(":").append(RuleConstants.WILDCARD)
            .append(" OR ").append(RuleConstants.FIELD_CATALOG_ID).append(":").append(catalogId);
    ruleParams.addFilterQuery(catalogFilter.toString());

    if (requestParams.get("redirects") != null) {
        if (!requestParams.getBool("redirects")) {
            ruleParams.addFilterQuery("-ruleType:redirectRule");
        }
    }

    if (!BooleanUtils.toBoolean(requestParams.getBool("facet"))) {
        ruleParams.addFilterQuery("-ruleType:facetRule");
    }

    //Notice how the current datetime (NOW wildcard on Solr) is rounded to days (NOW/DAY). This allows filter caches
    //to be reused and hopefully improve performance. If you don't round to day, NOW is very precise (up to milliseconds); so every query
    //would need a new entry on the filter cache...
    //Also, notice that NOW/DAY is midnight from last night, and NOW/DAY+1DAY is midnight today.
    //The below query is intended to match rules with null start or end dates, or start and end dates in the proper range.
    StringBuilder dateFilter = reuseStringBuilder(reusableStringBuilder);
    dateFilter.append("-(((").append(RuleConstants.FIELD_START_DATE).append(":[* TO *]) AND -(")
            .append(RuleConstants.FIELD_START_DATE).append(":[* TO NOW/DAY+1DAY])) OR (")
            .append(RuleConstants.FIELD_END_DATE).append(":[* TO *] AND -").append(RuleConstants.FIELD_END_DATE)
            .append(":[NOW/DAY+1DAY TO *]))");
    ruleParams.addFilterQuery(dateFilter.toString());
    return ruleParams;
}

From source file:org.apache.solr.handler.component.RuleManagerComponent.java

/**
 * Set filter queries params, used for faceting and filtering of results.
 * @param requestParams Original request params
 * @param ruleParams The new query parameters added by the rules component.
 *///ww w.  ja  v  a 2  s  .c  o  m
private void setFilterQueries(Map<String, NamedList> facets, SolrParams requestParams,
        MergedSolrParams ruleParams) {

    String isRulePage = requestParams.get(RuleManagerParams.RULE_PAGE);
    String catalogId = requestParams.get(RuleManagerParams.CATALOG_ID);
    ruleParams.setFacetPrefix(RuleConstants.FIELD_CATEGORY, "1." + catalogId + ".");
    ruleParams.addFilterQuery(RuleConstants.FIELD_CATEGORY + ":0." + catalogId);

    String categoryFilter = requestParams.get(RuleManagerParams.CATEGORY_FILTER);
    //if we don't have a category filter, or we are in a rule page, skip adding the facet prefix
    //to the category facet. This is cause we don't index the rule path in the category facet
    if (StringUtils.isNotBlank(categoryFilter) && !BooleanUtils.toBoolean(isRulePage)) {
        int index = categoryFilter.indexOf(SearchConstants.CATEGORY_SEPARATOR);
        if (index != -1) {
            int level = Integer.parseInt(categoryFilter.substring(0, index));

            categoryFilter = ++level + FilterQuery.unescapeQueryChars(categoryFilter.substring(index)) + ".";
            ruleParams.setFacetPrefix(RuleConstants.FIELD_CATEGORY, categoryFilter);
        }
    }

    if (BooleanUtils.toBoolean(isRulePage)) {
        //if we are in a rule page, we need to replace the FQ from the original request for possible
        //appearances of the $YEAR & $SEASON variables, to set the corresponding value
        Calendar calendar = Calendar.getInstance();
        ruleParams.replaceVariable(CommonParams.FQ, "$YEAR", Integer.toString(calendar.get(Calendar.YEAR)));
        ruleParams.replaceVariable(CommonParams.FQ, "$SEASON", seasonMapper[calendar.get(Calendar.MONTH)]);
    }

    String[] filterQueries = requestParams.getParams("rule.fq");
    if (filterQueries == null) {
        return;
    }

    Map<String, Set<String>> multiExpressionFilters = new HashMap<String, Set<String>>();
    for (String filterQuery : filterQueries) {

        String[] parts = StringUtils.split(filterQuery, ":", 2);
        if (parts.length != 2) {
            logger.error("Invalid filter query: " + filterQuery);
            continue;
        } else {
            String fieldName = parts[0];
            String fieldExpression = parts[1];

            if (fieldName.equals("category")) {
                int index = fieldExpression.indexOf(SearchConstants.CATEGORY_SEPARATOR);
                if (index != -1) {
                    int level = Integer.parseInt(fieldExpression.substring(0, index));

                    fieldExpression = ++level + FilterQuery.unescapeQueryChars(fieldExpression.substring(index))
                            + ".";
                    ruleParams.setFacetPrefix("category", fieldExpression);
                }
            }
            NamedList facetItem = facets.get(fieldName);
            if (facetItem != null) {
                String multiSelect = (String) facetItem.get("isMultiSelect");
                if (facetItem != null && StringUtils.isNotBlank(multiSelect)) {
                    if (FacetHandler.getBooleanFromField(multiSelect)) {
                        Set<String> expressions = multiExpressionFilters.get(fieldName);
                        if (expressions == null) {
                            expressions = new HashSet<String>();
                            multiExpressionFilters.put(fieldName, expressions);
                        }
                        expressions.add(fieldExpression);
                        continue;
                    }
                }
            }

        }

        ruleParams.addFilterQuery(filterQuery);
    }

    StringBuilder b = new StringBuilder();
    for (Entry<String, Set<String>> entry : multiExpressionFilters.entrySet()) {
        String operator = " OR ";
        String fieldName = entry.getKey();
        b.append("{!tag=").append(fieldName).append("}");
        for (String expression : entry.getValue()) {
            b.append(fieldName).append(FilterQuery.SEPARATOR).append(expression).append(operator);
        }
        b.setLength(b.length() - operator.length());
        ruleParams.addFilterQuery(b.toString());
        b.setLength(0);
    }

}

From source file:org.betaconceptframework.astroboa.model.jaxb.writer.JSONXmlStreamWriter.java

@Override
public void writeAttribute(String localName, String value) throws XMLStreamException {
    try {//from w  w w . ja v a2s .  com

        if (!objectQueue.isEmpty()) {
            if (StringUtils.equals(CmsConstants.EXPORT_AS_AN_ARRAY_INSTRUCTION, localName)) {
                objectQueue.peek().exportAsAnArray = BooleanUtils.isTrue(BooleanUtils.toBoolean(value));
            } else {
                objectQueue.peek().addAttribute(localName, value);
            }

        }

    } catch (Exception e) {
        throw new XMLStreamException(e);
    }

}

From source file:org.broadleafcommerce.core.web.processor.OnePageCheckoutProcessor.java

/**
 * This method is responsible of populating the variables necessary to draw the checkout page.
 * This logic is highly dependent on your layout. If your layout does not follow the same flow
 * as the HeatClinic demo, you will need to override with your own custom layout implementation
 *
 * @param localVars/*w ww.  j  a  v  a2 s. c  o m*/
 */
protected void populateSectionViewStates(Map<String, Object> localVars) {
    boolean orderInfoPopulated = hasPopulatedOrderInfo(CartState.getCart());
    boolean billingPopulated = hasPopulatedBillingAddress(CartState.getCart());
    boolean shippingPopulated = hasPopulatedShippingAddress(CartState.getCart());

    localVars.put("orderInfoPopulated", orderInfoPopulated);
    localVars.put("billingPopulated", billingPopulated);
    localVars.put("shippingPopulated", shippingPopulated);

    //Logic to show/hide sections based on state of the order
    // show all sections including header unless specifically hidden
    // (e.g. hide shipping if no shippable items in order or hide billing section if the order payment doesn't need
    // an address i.e. PayPal Express)
    boolean showBillingInfoSection = true;
    boolean showShippingInfoSection = true;
    boolean showAllPaymentMethods = true;

    int numShippableFulfillmentGroups = calculateNumShippableFulfillmentGroups();
    if (numShippableFulfillmentGroups == 0) {
        showShippingInfoSection = false;
    }

    boolean orderContainsThirdPartyPayment = false;
    boolean orderContainsUnconfirmedCreditCard = false;
    OrderPayment unconfirmedCC = null;
    if (CartState.getCart().getPayments() != null) {
        for (OrderPayment payment : CartState.getCart().getPayments()) {
            if (payment.isActive() && PaymentType.THIRD_PARTY_ACCOUNT.equals(payment.getType())) {
                orderContainsThirdPartyPayment = true;
            }
            if (payment.isActive() && (PaymentType.CREDIT_CARD.equals(payment.getType())
                    && !PaymentGatewayType.TEMPORARY.equals(payment.getGatewayType()))) {
                orderContainsUnconfirmedCreditCard = true;
                unconfirmedCC = payment;
            }
        }
    }

    //Toggle the Payment Info Section based on what payments were applied to the order
    //(e.g. Third Party Account (i.e. PayPal Express) or Gift Cards/Customer Credit)
    Money orderTotalAfterAppliedPayments = CartState.getCart().getTotalAfterAppliedPayments();
    if (orderContainsThirdPartyPayment || orderContainsUnconfirmedCreditCard) {
        showBillingInfoSection = false;
        showAllPaymentMethods = false;
    } else if (orderTotalAfterAppliedPayments != null && orderTotalAfterAppliedPayments.isZero()) {
        //If all the applied payments (e.g. gift cards) cover the entire amount
        //we don't need to show all payment method options.
        showAllPaymentMethods = false;
    }

    localVars.put("showBillingInfoSection", showBillingInfoSection);
    localVars.put("showAllPaymentMethods", showAllPaymentMethods);
    localVars.put("orderContainsThirdPartyPayment", orderContainsThirdPartyPayment);
    localVars.put("orderContainsUnconfirmedCreditCard", orderContainsUnconfirmedCreditCard);
    localVars.put("unconfirmedCC", unconfirmedCC);

    //The Sections are all initialized to INACTIVE view
    List<CheckoutSectionDTO> drawnSections = new LinkedList<CheckoutSectionDTO>();
    CheckoutSectionDTO orderInfoSection = new CheckoutSectionDTO(CheckoutSectionViewType.ORDER_INFO,
            orderInfoPopulated);
    CheckoutSectionDTO billingInfoSection = new CheckoutSectionDTO(CheckoutSectionViewType.BILLING_INFO,
            billingPopulated);
    CheckoutSectionDTO shippingInfoSection = new CheckoutSectionDTO(CheckoutSectionViewType.SHIPPING_INFO,
            shippingPopulated);
    CheckoutSectionDTO paymentInfoSection = new CheckoutSectionDTO(CheckoutSectionViewType.PAYMENT_INFO, false);

    String orderInfoHelpMessage = (String) localVars.get("orderInfoHelpMessage");
    String billingInfoHelpMessage = (String) localVars.get("billingInfoHelpMessage");
    String shippingInfoHelpMessage = (String) localVars.get("shippingInfoHelpMessage");

    //Add the Order Info Section
    drawnSections.add(orderInfoSection);

    //Add the Billing Section
    if (showBillingInfoSection) {
        billingInfoSection.setHelpMessage(orderInfoHelpMessage);
        drawnSections.add(billingInfoSection);
    }

    //Add the Shipping Section
    if (showShippingInfoSection) {

        if (showBillingInfoSection) {
            shippingInfoSection.setHelpMessage(billingInfoHelpMessage);
        } else {
            shippingInfoSection.setHelpMessage(orderInfoHelpMessage);
        }

        drawnSections.add(shippingInfoSection);
    }

    //Add the Payment Section
    if (showShippingInfoSection) {
        paymentInfoSection.setHelpMessage(shippingInfoHelpMessage);
    } else if (showBillingInfoSection) {
        paymentInfoSection.setHelpMessage(billingInfoHelpMessage);
    } else {
        paymentInfoSection.setHelpMessage(orderInfoHelpMessage);
    }

    drawnSections.add(paymentInfoSection);

    //Logic to toggle state between form view, saved view, and inactive view
    //This is dependent on the layout of your checkout form. Override this if layout is different.

    //initialize first view to always be a FORM view
    CheckoutSectionDTO firstSection = drawnSections.get(0);
    firstSection.setState(CheckoutSectionStateType.FORM);
    //iterate through all the drawn sections and set their state based on the state of the other sections.

    for (ListIterator<CheckoutSectionDTO> itr = drawnSections.listIterator(); itr.hasNext();) {
        CheckoutSectionDTO previousSection = null;
        if (itr.hasPrevious()) {
            previousSection = drawnSections.get(itr.previousIndex());
        }
        CheckoutSectionDTO section = itr.next();

        //if the previous section is populated, set this section to a Form View
        if (previousSection != null && previousSection.isPopulated()) {
            section.setState(CheckoutSectionStateType.FORM);
        }
        //If this sections is populated then set this section to the Saved View
        if (section.isPopulated()) {
            section.setState(CheckoutSectionStateType.SAVED);
        }

        //Custom Logic to handle a state where there may have been an error on the Payment Gateway
        //and the customer is booted back to the checkout page and will have to re-enter their billing address
        //and payment information as there may have been an error on either. Since, to handle all gateways with the same layout
        //we are breaking the Billing Address Form from the Payment Info Form, to serve a better UX, we will have hide the payment info as
        //the customer will need to re-enter their billing address to try again.
        //{@see DefaultPaymentGatewayCheckoutService where payments are invalidated on an unsuccessful transaction}
        if (CheckoutSectionViewType.PAYMENT_INFO.equals(section.getView())) {
            if (showBillingInfoSection && !billingPopulated) {
                section.setState(CheckoutSectionStateType.INACTIVE);
                section.setHelpMessage(billingInfoHelpMessage);
            }
        }

        //Finally, if the edit button is explicitly clicked, set the section to Form View
        BroadleafRequestContext blcContext = BroadleafRequestContext.getBroadleafRequestContext();
        HttpServletRequest request = blcContext.getRequest();
        boolean editOrderInfo = BooleanUtils.toBoolean(request.getParameter("edit-order-info"));
        boolean editBillingInfo = BooleanUtils.toBoolean(request.getParameter("edit-billing"));
        boolean editShippingInfo = BooleanUtils.toBoolean(request.getParameter("edit-shipping"));

        if (CheckoutSectionViewType.ORDER_INFO.equals(section.getView()) && editOrderInfo) {
            section.setState(CheckoutSectionStateType.FORM);
        } else if (CheckoutSectionViewType.BILLING_INFO.equals(section.getView()) && editBillingInfo) {
            section.setState(CheckoutSectionStateType.FORM);
        } else if (CheckoutSectionViewType.SHIPPING_INFO.equals(section.getView()) && editShippingInfo) {
            section.setState(CheckoutSectionStateType.FORM);
        }
    }

    localVars.put("checkoutSectionDTOs", drawnSections);

}

From source file:org.caleydo.datadomain.pathway.manager.EPathwayDatabaseType.java

/**
 * @return
 */
public boolean doRenderBackground() {
    return BooleanUtils.toBoolean(getRenderer().getAttribute("renderBackground"));
}

From source file:org.candlepin.common.config.PropertyConverter.java

public static Boolean toBoolean(Object value) throws ConversionException {
    if (value instanceof Boolean) {
        return (Boolean) value;
    } else if (value instanceof String) {
        if ("1".equalsIgnoreCase((String) value) || "y".equalsIgnoreCase((String) value)) {
            return true;
        }/* w  w w .j  a va 2s.  c o  m*/

        return BooleanUtils.toBoolean((String) value);
    } else {
        String msg = formatErrorMessage(value, Boolean.class);
        log.warn(msg);
        throw new ConversionException(msg);
    }
}

From source file:org.candlepin.policy.js.pool.PoolRules.java

public List<PoolUpdate> updatePools(Pool masterPool, List<Pool> existingPools, Long originalQuantity,
        Set<Product> changedProducts) {
    //local.setCertificate(subscription.getCertificate());

    log.debug("Refreshing pools for existing master pool: {}", masterPool);
    log.debug("  existing pools: {}", existingPools.size());

    List<PoolUpdate> poolsUpdated = new LinkedList<PoolUpdate>();
    Map<String, String> attributes = PoolHelper.getFlattenedAttributes(masterPool.getProduct());

    for (Pool existingPool : existingPools) {
        log.debug("Checking pool: {}", existingPool);

        // Ensure subscription details are maintained on the master pool
        if ("master".equalsIgnoreCase(existingPool.getSubscriptionSubKey())) {
            existingPool.setUpstreamPoolId(masterPool.getUpstreamPoolId());
            existingPool.setUpstreamEntitlementId(masterPool.getUpstreamEntitlementId());
            existingPool.setUpstreamConsumerId(masterPool.getUpstreamConsumerId());

            existingPool.setCdn(masterPool.getCdn());
            existingPool.setCertificate(masterPool.getCertificate());
        }/*from w  ww  . j a v  a 2 s  .  co  m*/

        // Used to track if anything has changed:
        PoolUpdate update = new PoolUpdate(existingPool);

        update.setDatesChanged(
                checkForDateChange(masterPool.getStartDate(), masterPool.getEndDate(), existingPool));

        update.setQuantityChanged(
                checkForQuantityChange(masterPool, existingPool, originalQuantity, existingPools, attributes));

        if (!existingPool.isMarkedForDelete()) {
            boolean useDerived = masterPool.getDerivedProduct() != null
                    && BooleanUtils.toBoolean(existingPool.getAttributeValue(Pool.Attributes.DERIVED_POOL));

            update.setProductsChanged(checkForChangedProducts(
                    useDerived ? masterPool.getDerivedProduct() : masterPool.getProduct(),
                    getExpectedProvidedProducts(masterPool, useDerived), existingPool, changedProducts));

            if (!useDerived) {
                update.setDerivedProductsChanged(
                        checkForChangedDerivedProducts(masterPool, existingPool, changedProducts));
            }

            update.setOrderChanged(checkForOrderDataChanges(masterPool, existingPool));

            update.setBrandingChanged(checkForBrandingChanges(masterPool, existingPool));
        }

        // All done, see if we found any changes and return an update object if so:
        if (update.changed()) {
            poolsUpdated.add(update);
        } else {
            log.debug("   No updates required.");
        }
    }

    return poolsUpdated;
}