Example usage for org.apache.commons.collections.functors ChainedTransformer getInstance

List of usage examples for org.apache.commons.collections.functors ChainedTransformer getInstance

Introduction

In this page you can find the example usage for org.apache.commons.collections.functors ChainedTransformer getInstance.

Prototype

public static Transformer getInstance(Transformer transformer1, Transformer transformer2) 

Source Link

Document

Factory method that performs validation.

Usage

From source file:org.openvpms.web.component.im.util.IMObjectSorter.java

/**
 * Returns a new comparator for a node sort constraint.
 *
 * @param sort        the sort criteria//from  w  w w  . ja v  a2s .  c  o m
 * @param transformer a transformer to apply
 * @return a new comparator
 */
@SuppressWarnings("unchecked")
private static Comparator<Object> getComparator(NodeSortConstraint sort, Transformer transformer) {
    Comparator comparator = getComparator(sort.isAscending());
    Transformer transform = ChainedTransformer.getInstance(transformer, getTransformer(sort));
    return new TransformingComparator(transform, comparator);
}

From source file:org.openvpms.web.component.im.util.IMObjectSorter.java

/**
 * Returns a new comparator for an archetype property.
 *
 * @param sort        the sort criteria/*from  w  w  w  .  ja v  a 2  s .c  o m*/
 * @param transformer a transformer to apply
 * @return a new comparator
 */
@SuppressWarnings("unchecked")
private static Comparator<Object> getComparator(ArchetypeSortConstraint sort, Transformer transformer) {
    Comparator comparator = getComparator(sort.isAscending());
    Transformer transform = ChainedTransformer.getInstance(transformer, new ArchetypeTransformer());
    return new TransformingComparator(transform, comparator);
}

From source file:org.sipfoundry.sipxconfig.common.DaoUtils.java

/**
 * Performs operation on all the bean in the list. List of the bean is passed as list of ids,
 * beans are loaded by hibernate before operation starts.
 *
 * After operation is performed all the beans are saved.
 *//* w  w  w  .  j av a2  s .  co m*/
public static void doForAllBeanIds(HibernateTemplate hibernate, DaoEventPublisher eventPublisher,
        Transformer beanTransformer, Class klass, Collection ids) {
    IdToBean idToBean = new IdToBean(hibernate, klass);
    Transformer transformer = ChainedTransformer.getInstance(idToBean, beanTransformer);
    Collection beans = CollectionUtils.collect(ids, transformer);
    for (Object item : beans) {
        eventPublisher.publishSave(item);
    }
    hibernate.saveOrUpdateAll(beans);
}