Example usage for org.apache.commons.collections CollectionUtils transform

List of usage examples for org.apache.commons.collections CollectionUtils transform

Introduction

In this page you can find the example usage for org.apache.commons.collections CollectionUtils transform.

Prototype

public static void transform(Collection collection, Transformer transformer) 

Source Link

Document

Transform the collection by applying a Transformer to each element.

Usage

From source file:org.fosstrak.epcis.repository.query.QueryOperationsModule.java

/**
 * Create an SQL query string from the given query parameters.
 * <p>// w w w .j  av a 2  s . c  om
 * Note: the CXF framework always returns an instance of org.w3c.dom.Element
 * for the query parameter value given in the <code>queryParams</code>
 * argument, because the spec defines this value to be of type
 * <code>anyType</code>. CXF <i>does not</i> resolve the type of the
 * query parameter value from the query name as Axis does! However, if the
 * user specifies the XML type in the request, then CXF returns an instance
 * of the corresponding type.
 * <p>
 * Consider the following example of a query parameter:
 * 
 * <pre>
 * &lt;param&gt;
 *   &lt;name&gt;GE_eventTime&lt;/name&gt;
 *   &lt;value&gt;2007-07-07T07:07:07+02:00&lt;/value&gt;
 * &lt;/param&gt;
 * </pre>
 * 
 * For the query parameter value, CXF will return an instance of
 * org.w3c.dom.Element containing the text value
 * "2007-07-07T07:07:07+02:00". However, if the user provides the following
 * instead, CXF will return an instance of
 * javax.xml.datatype.XMLGregorianCalendar.
 * 
 * <pre>
 * &lt;param&gt;
 *   &lt;name&gt;GE_eventTime&lt;/name&gt;
 *   &lt;value
 *       xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
 *       xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;
 *       xsi:type=&quot;xs:dateTime&quot;&gt;
 *     2007-07-07T07:07:07+02:00
 *   &lt;/value&gt;
 * &lt;/param&gt;
 * </pre>
 * 
 * As a consequence, we always first need to check if the value is an
 * instance of Element, and if so, we need to parse it manually according to
 * the semantics of the parameter name.
 * 
 * @param queryParams
 *            The query parameters.
 * @param eventType
 *            Has to be one of the four basic event types "ObjectEvent",
 *            "AggregationEvent", "QuantityEvent", "TransactionEvent".
 * @return The prepared sql statement.
 * @throws SQLException
 *             Whenever something goes wrong when querying the db.
 * @throws QueryParameterException
 *             If one of the given QueryParam is invalid.
 * @throws ImplementationException
 *             If an error in the implementation occurred.
 */
private List<SimpleEventQueryDTO> constructSimpleEventQueries(final QueryParams queryParams)
        throws SQLException, QueryParameterExceptionResponse {
    SimpleEventQueryDTO aggrEventQuery = new SimpleEventQueryDTO(EpcisConstants.AGGREGATION_EVENT);
    SimpleEventQueryDTO objEventQuery = new SimpleEventQueryDTO(EpcisConstants.OBJECT_EVENT);
    SimpleEventQueryDTO quantEventQuery = new SimpleEventQueryDTO(EpcisConstants.QUANTITY_EVENT);
    SimpleEventQueryDTO transEventQuery = new SimpleEventQueryDTO(EpcisConstants.TRANSACTION_EVENT);

    boolean includeAggrEvents = true;
    boolean includeObjEvents = true;
    boolean includeQuantEvents = true;
    boolean includeTransEvents = true;

    String orderBy = null;
    OrderDirection orderDirection = null;
    int eventCountLimit = -1;
    int maxEventCount = -1;

    // a sorted List of query parameter names - keeps track of the processed
    // names in order to cope with duplicates
    List<String> sortedParamNames = new ArrayList<String>();

    int nofEventFieldExtensions = 0;
    for (QueryParam param : queryParams.getParam()) {
        String paramName = param.getName();
        Object paramValue = param.getValue();

        // check for null values
        if (paramName == null || "".equals(paramName)) {
            String msg = "Missing name for a query parameter";
            throw queryParameterException(msg, null);
        }
        if (paramValue == null) {
            String msg = "Missing value for query parameter '" + paramName + "'";
            throw queryParameterException(msg, null);
        }
        // check if the current query parameter has already been provided
        int index = Collections.binarySearch(sortedParamNames, paramName);
        if (index < 0) {
            // we have not yet seen this query parameter name - ok
            sortedParamNames.add(-index - 1, paramName);
        } else {
            // we have already handled this query parameter name - not ok
            String msg = "Query parameter '" + paramName + "' provided more than once";
            throw queryParameterException(msg, null);
        }

        if (LOG.isDebugEnabled()) {
            LOG.debug("Handling query parameter: " + paramName);
        }
        try {
            if (paramName.equals("eventType")) {
                // by default all event types will be included
                List<String> eventTypes = parseAsArrayOfString(paramValue).getString();
                if (!eventTypes.isEmpty()) {
                    // check if valid event types are provided
                    checkEventTypes(eventTypes);

                    // check for excluded event types
                    if (!eventTypes.contains(EpcisConstants.AGGREGATION_EVENT)) {
                        includeAggrEvents = false;
                    }
                    if (!eventTypes.contains(EpcisConstants.OBJECT_EVENT)) {
                        includeObjEvents = false;
                    }
                    if (!eventTypes.contains(EpcisConstants.QUANTITY_EVENT)) {
                        includeQuantEvents = false;
                    }
                    if (!eventTypes.contains(EpcisConstants.TRANSACTION_EVENT)) {
                        includeTransEvents = false;
                    }
                }
            } else if (paramName.equals("GE_eventTime") || paramName.equals("LT_eventTime")
                    || paramName.equals("GE_recordTime") || paramName.equals("LT_recordTime")) {
                Calendar cal = parseAsCalendar(paramValue, paramName);
                Operation op = Operation.valueOf(paramName.substring(0, 2));
                String eventField = paramName.substring(3, paramName.length()) + "Ms";
                aggrEventQuery.addEventQueryParam(eventField, op, cal.getTimeInMillis());
                objEventQuery.addEventQueryParam(eventField, op, cal.getTimeInMillis());
                quantEventQuery.addEventQueryParam(eventField, op, cal.getTimeInMillis());
                transEventQuery.addEventQueryParam(eventField, op, cal.getTimeInMillis());

            } else if (paramName.equals("EQ_action")) {
                // QuantityEvents have no "action" field, thus exclude them
                includeQuantEvents = false;
                ArrayOfString aos = parseAsArrayOfString(paramValue);
                if (!aos.getString().isEmpty()) {
                    checkActionValues(aos.getString());
                    aggrEventQuery.addEventQueryParam("action", Operation.EQ, aos.getString());
                    objEventQuery.addEventQueryParam("action", Operation.EQ, aos.getString());
                    transEventQuery.addEventQueryParam("action", Operation.EQ, aos.getString());
                }

            } else if (paramName.equals("EQ_bizStep") || paramName.equals("EQ_disposition")
                    || paramName.equals("EQ_readPoint") || paramName.equals("EQ_bizLocation")) {
                ArrayOfString aos = parseAsArrayOfString(paramValue);
                if (!aos.getString().isEmpty()) {
                    String eventField = paramName.substring(3, paramName.length());
                    aggrEventQuery.addEventQueryParam(eventField, Operation.EQ, aos.getString());
                    objEventQuery.addEventQueryParam(eventField, Operation.EQ, aos.getString());
                    quantEventQuery.addEventQueryParam(eventField, Operation.EQ, aos.getString());
                    transEventQuery.addEventQueryParam(eventField, Operation.EQ, aos.getString());
                }

            } else if (paramName.equals("WD_readPoint") || paramName.equals("WD_bizLocation")) {
                ArrayOfString aos = parseAsArrayOfString(paramValue);
                if (!aos.getString().isEmpty()) {
                    // append a "*" to each of the parameter values - this
                    // should implement the semantics of "With Descendant"
                    // TODO: should???
                    CollectionUtils.transform(aos.getString(), new StringTransformer());
                    String eventField = paramName.substring(3, paramName.length());
                    aggrEventQuery.addEventQueryParam(eventField, Operation.WD, aos.getString());
                    objEventQuery.addEventQueryParam(eventField, Operation.WD, aos.getString());
                    quantEventQuery.addEventQueryParam(eventField, Operation.WD, aos.getString());
                    transEventQuery.addEventQueryParam(eventField, Operation.WD, aos.getString());
                }

            } else if (paramName.startsWith("EQ_bizTransaction_")) {
                // type extracted from parameter name
                String bizTransType = paramName.substring(18);
                ArrayOfString aos = parseAsArrayOfString(paramValue);
                if (!aos.getString().isEmpty()) {
                    aggrEventQuery.addEventQueryParam("bizTransList.type", Operation.EQ, bizTransType);
                    objEventQuery.addEventQueryParam("bizTransList.type", Operation.EQ, bizTransType);
                    quantEventQuery.addEventQueryParam("bizTransList.type", Operation.EQ, bizTransType);
                    transEventQuery.addEventQueryParam("bizTransList.type", Operation.EQ, bizTransType);
                    aggrEventQuery.addEventQueryParam("bizTransList.bizTrans", Operation.EQ, aos.getString());
                    objEventQuery.addEventQueryParam("bizTransList.bizTrans", Operation.EQ, aos.getString());
                    quantEventQuery.addEventQueryParam("bizTransList.bizTrans", Operation.EQ, aos.getString());
                    transEventQuery.addEventQueryParam("bizTransList.bizTrans", Operation.EQ, aos.getString());
                }

            } else if (paramName.equals("MATCH_epc") || paramName.equals("MATCH_anyEPC")) {
                // QuantityEvents have no field for EPCs, thus exclude them
                includeQuantEvents = false;
                ArrayOfString aos = parseAsArrayOfString(paramValue);
                if (!aos.getString().isEmpty()) {
                    aggrEventQuery.addEventQueryParam("childEPCs", Operation.MATCH, aos.getString());
                    objEventQuery.addEventQueryParam("epcList", Operation.MATCH, aos.getString());
                    transEventQuery.addEventQueryParam("epcList", Operation.MATCH, aos.getString());
                    if (paramName.equals("MATCH_anyEPC")) {
                        // AggregationEvent and TransactionEvent need
                        // special treatment ("parentID" field)
                        aggrEventQuery.setIsAnyEpc(true);
                        transEventQuery.setIsAnyEpc(true);
                    }
                }

            } else if (paramName.equals("MATCH_parentID")) {
                includeQuantEvents = false;
                includeObjEvents = false;
                ArrayOfString aos = parseAsArrayOfString(paramValue);
                if (!aos.getString().isEmpty()) {
                    aggrEventQuery.addEventQueryParam("parentID", Operation.MATCH, aos.getString());
                    transEventQuery.addEventQueryParam("parentID", Operation.MATCH, aos.getString());
                }

            } else if (paramName.equals("MATCH_epcClass")) {
                includeAggrEvents = false;
                includeObjEvents = false;
                includeTransEvents = false;
                ArrayOfString aos = parseAsArrayOfString(paramValue);
                if (!aos.getString().isEmpty()) {
                    quantEventQuery.addEventQueryParam("epcClass", Operation.MATCH, aos.getString());
                }

            } else if (paramName.endsWith("_quantity")) {
                includeAggrEvents = false;
                includeObjEvents = false;
                includeTransEvents = false;
                Operation op = Operation.valueOf(paramName.substring(0, paramName.indexOf('_')));
                quantEventQuery.addEventQueryParam("quantity", op, parseAsInteger(paramValue));

            } else if (paramName.startsWith("GT_") || paramName.startsWith("GE_") || paramName.startsWith("EQ_")
                    || paramName.startsWith("LE_") || paramName.startsWith("LT_")) {
                // must be an event field extension
                String fieldname = paramName.substring(3);
                String[] parts = fieldname.split("#");
                if (parts.length != 2) {
                    String msg = "Invalid parameter " + paramName;
                    throw queryParameterException(msg, null);
                }
                nofEventFieldExtensions++;
                String eventFieldExtBase = "extension" + nofEventFieldExtensions;
                EventQueryParam queryParam = parseExtensionField(eventFieldExtBase, paramName, paramValue);
                aggrEventQuery.addEventQueryParam(queryParam);
                objEventQuery.addEventQueryParam(queryParam);
                quantEventQuery.addEventQueryParam(queryParam);
                transEventQuery.addEventQueryParam(queryParam);
                String eventFieldExt = eventFieldExtBase + ".fieldname";
                aggrEventQuery.addEventQueryParam(eventFieldExt, Operation.EQ, fieldname);
                objEventQuery.addEventQueryParam(eventFieldExt, Operation.EQ, fieldname);
                quantEventQuery.addEventQueryParam(eventFieldExt, Operation.EQ, fieldname);
                transEventQuery.addEventQueryParam(eventFieldExt, Operation.EQ, fieldname);

            } else if (paramName.startsWith("EXISTS_")) {
                String fieldname = paramName.substring(7);
                if (fieldname.equals("childEPCs")) {
                    includeObjEvents = false;
                    includeQuantEvents = false;
                    includeTransEvents = false;
                    aggrEventQuery.addEventQueryParam("childEPCs", Operation.EXISTS, null);
                } else if (fieldname.equals("epcList")) {
                    includeAggrEvents = false;
                    includeQuantEvents = false;
                    objEventQuery.addEventQueryParam("epcList", Operation.EXISTS, null);
                    transEventQuery.addEventQueryParam("epcList", Operation.EXISTS, null);
                } else if (fieldname.equals("action")) {
                    includeQuantEvents = false;
                    aggrEventQuery.addEventQueryParam("action", Operation.EXISTS, null);
                    objEventQuery.addEventQueryParam("action", Operation.EXISTS, null);
                    transEventQuery.addEventQueryParam("action", Operation.EXISTS, null);
                } else if (fieldname.equals("parentID")) {
                    includeObjEvents = false;
                    includeQuantEvents = false;
                    aggrEventQuery.addEventQueryParam("parentID", Operation.EXISTS, null);
                    transEventQuery.addEventQueryParam("parentID", Operation.EXISTS, null);
                } else if (fieldname.equals("quantity") || fieldname.equals("epcClass")) {
                    includeAggrEvents = false;
                    includeObjEvents = false;
                    includeTransEvents = false;
                    quantEventQuery.addEventQueryParam(fieldname, Operation.EXISTS, null);
                } else if (fieldname.equals("eventTime") || fieldname.equals("recordTime")
                        || fieldname.equals("eventTimeZoneOffset") || fieldname.equals("bizStep")
                        || fieldname.equals("disposition") || fieldname.equals("readPoint")
                        || fieldname.equals("bizLocation") || fieldname.equals("bizTransList")) {
                    aggrEventQuery.addEventQueryParam(fieldname, Operation.EXISTS, null);
                    objEventQuery.addEventQueryParam(fieldname, Operation.EXISTS, null);
                    quantEventQuery.addEventQueryParam(fieldname, Operation.EXISTS, null);
                    transEventQuery.addEventQueryParam(fieldname, Operation.EXISTS, null);
                } else {
                    // lets see if we have an extension fieldname
                    String[] parts = fieldname.split("#");
                    if (parts.length != 2) {
                        String msg = "Invalid parameter " + paramName;
                        throw queryParameterException(msg, null);
                    }
                    nofEventFieldExtensions++;
                    String eventFieldExt = "extension" + nofEventFieldExtensions + ".fieldname";
                    aggrEventQuery.addEventQueryParam(eventFieldExt, Operation.EQ, fieldname);
                    objEventQuery.addEventQueryParam(eventFieldExt, Operation.EQ, fieldname);
                    quantEventQuery.addEventQueryParam(eventFieldExt, Operation.EQ, fieldname);
                    transEventQuery.addEventQueryParam(eventFieldExt, Operation.EQ, fieldname);
                }

            } else if (paramName.startsWith("HASATTR_")) {
                // restrict by attribute name
                String fieldname = paramName.substring(8);
                ArrayOfString aos = parseAsArrayOfString(paramValue);
                String eventField = fieldname + ".attribute";
                aggrEventQuery.addEventQueryParam(eventField, Operation.EQ, aos.getString());
                objEventQuery.addEventQueryParam(eventField, Operation.EQ, aos.getString());
                quantEventQuery.addEventQueryParam(eventField, Operation.EQ, aos.getString());
                transEventQuery.addEventQueryParam(eventField, Operation.EQ, aos.getString());

            } else if (paramName.startsWith("EQATTR_")) {
                String fieldname = paramName.substring(7);
                String attrname = null;
                String[] parts = fieldname.split("_");
                if (parts.length > 2) {
                    String msg = "Query parameter has invalid format: " + paramName
                            + ". Expected: EQATTR_fieldname_attrname";
                    throw queryParameterException(msg, null);
                } else if (parts.length == 2) {
                    fieldname = parts[0];
                    attrname = parts[1];
                }
                // restrict by attribute name
                String eventField = fieldname + ".attribute";
                aggrEventQuery.addEventQueryParam(eventField, Operation.EQ, attrname);
                objEventQuery.addEventQueryParam(eventField, Operation.EQ, attrname);
                quantEventQuery.addEventQueryParam(eventField, Operation.EQ, attrname);
                transEventQuery.addEventQueryParam(eventField, Operation.EQ, attrname);
                // restrict by attribute value
                ArrayOfString aos = parseAsArrayOfString(paramValue);
                eventField = eventField + ".value";
                aggrEventQuery.addEventQueryParam(eventField, Operation.EQ, aos.getString());
                objEventQuery.addEventQueryParam(eventField, Operation.EQ, aos.getString());
                quantEventQuery.addEventQueryParam(eventField, Operation.EQ, aos.getString());
                transEventQuery.addEventQueryParam(eventField, Operation.EQ, aos.getString());

            } else if (paramName.equals("orderBy")) {
                orderBy = parseAsString(paramValue);
                if (!"eventTime".equals(orderBy) && !"recordTime".equals(orderBy)
                        && !"quantity".equals(orderBy)) {
                    String[] parts = orderBy.split("#");
                    if (parts.length != 2) {
                        String msg = "orderBy must be one of eventTime, recordTime, quantity, or an extension field";
                        throw queryParameterException(msg, null);
                    }
                }

            } else if (paramName.equals("orderDirection")) {
                orderDirection = OrderDirection.valueOf(parseAsString(paramValue));

            } else if (paramName.equals("eventCountLimit")) {
                eventCountLimit = parseAsInteger(paramValue).intValue();

            } else if (paramName.equals("maxEventCount")) {
                maxEventCount = parseAsInteger(paramValue).intValue();

            } else {
                String msg = "Unknown query parameter: " + paramName;
                throw queryParameterException(msg, null);
            }
        } catch (ClassCastException e) {
            String msg = "Type of value invalid for query parameter '" + paramName + "': " + paramValue;
            throw queryParameterException(msg, e);
        } catch (IllegalArgumentException e) {
            String msg = "Unparseable value for query parameter '" + paramName + "'. " + e.getMessage();
            throw queryParameterException(msg, e);
        }
    }

    // some more user input checks
    if (maxEventCount > -1 && eventCountLimit > -1) {
        String msg = "Paramters 'maxEventCount' and 'eventCountLimit' are mutually exclusive";
        throw queryParameterException(msg, null);
    }
    if (orderBy == null && eventCountLimit > -1) {
        String msg = "'eventCountLimit' may only be used when 'orderBy' is specified";
        throw queryParameterException(msg, null);
    }
    if (orderBy == null && orderDirection != null) {
        String msg = "'orderDirection' may only be used when 'orderBy' is specified";
        throw queryParameterException(msg, null);
    }
    if (orderBy != null) {
        aggrEventQuery.setOrderBy(orderBy);
        objEventQuery.setOrderBy(orderBy);
        quantEventQuery.setOrderBy(orderBy);
        transEventQuery.setOrderBy(orderBy);
        if (orderDirection != null) {
            aggrEventQuery.setOrderDirection(orderDirection);
            objEventQuery.setOrderDirection(orderDirection);
            quantEventQuery.setOrderDirection(orderDirection);
            transEventQuery.setOrderDirection(orderDirection);
        }
    }
    if (eventCountLimit > -1) {
        aggrEventQuery.setLimit(eventCountLimit);
        objEventQuery.setLimit(eventCountLimit);
        quantEventQuery.setLimit(eventCountLimit);
        transEventQuery.setLimit(eventCountLimit);
    }
    if (maxEventCount > -1) {
        aggrEventQuery.setMaxEventCount(maxEventCount);
        objEventQuery.setMaxEventCount(maxEventCount);
        quantEventQuery.setMaxEventCount(maxEventCount);
        transEventQuery.setMaxEventCount(maxEventCount);
    }

    List<SimpleEventQueryDTO> eventQueries = new ArrayList<SimpleEventQueryDTO>(4);
    if (includeAggrEvents) {
        eventQueries.add(aggrEventQuery);
    }
    if (includeObjEvents) {
        eventQueries.add(objEventQuery);
    }
    if (includeQuantEvents) {
        eventQueries.add(quantEventQuery);
    }
    if (includeTransEvents) {
        eventQueries.add(transEventQuery);
    }
    return eventQueries;
}

From source file:org.jannocessor.collection.impl.PowerArrayList.java

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override//w ww. jav a2 s  . c  o  m
public <T> PowerList<T> getTransformed(final Transformation<? super E, T> transformation) {
    PowerList copy = copy();
    CollectionUtils.transform(copy, new Transformer() {
        public Object transform(Object input) {
            return transformation.transform((E) input);
        }
    });
    return copy;
}

From source file:org.jannocessor.collection.impl.PowerLinkedHashSet.java

@SuppressWarnings({ "rawtypes", "unchecked" })
public <T> PowerSet<T> getTransformed(final Transformation<? super E, T> transformation) {
    PowerSet copy = copy();/*from ww w .  j a  va  2  s  .  c  o  m*/
    CollectionUtils.transform(copy, new Transformer() {
        public Object transform(Object input) {
            return transformation.transform((E) input);
        }
    });
    return copy;
}

From source file:org.openmrs.api.db.hibernate.HibernateConceptDAO.java

private LuceneQuery<Drug> newDrugQuery(String drugName, boolean searchKeywords, boolean searchDrugConceptNames,
        Locale locale, boolean exactLocale, Concept concept, boolean includeRetired) {
    if (StringUtils.isBlank(drugName) && concept == null) {
        return null;
    }//from www  . j a v  a  2 s .  c  o m
    if (locale == null) {
        locale = Context.getLocale();
    }

    StringBuilder query = new StringBuilder();
    if (!StringUtils.isBlank(drugName)) {
        List<String> tokenizedName = Arrays.asList(drugName.trim().split("\\+"));
        String escapedName = LuceneQuery.escapeQuery(drugName);
        query.append("(");
        query.append(newNameQuery(tokenizedName, escapedName, searchKeywords));
        query.append(")^0.3 OR drugReferenceMaps.conceptReferenceTerm.code:(\"").append(escapedName)
                .append("\")^0.6");
    }

    if (concept != null) {
        query.append(" OR concept.conceptId:(").append(concept.getConceptId()).append(")^0.1");
    } else if (searchDrugConceptNames) {
        LuceneQuery<ConceptName> conceptNameQuery = newConceptNameLuceneQuery(drugName, searchKeywords,
                Arrays.asList(locale), exactLocale, includeRetired, null, null, null, null, null);
        List<Object> conceptIds = conceptNameQuery.listProjection("concept.conceptId");
        if (!conceptIds.isEmpty()) {
            CollectionUtils.transform(conceptIds, new Transformer() {

                @Override
                public Object transform(Object input) {
                    return ((Object[]) input)[0].toString();
                }
            });
            //The default Lucene clauses limit is 1024. We arbitrarily chose to use 512 here as it does not make sense to return more hits by concept name anyway.
            int maxSize = (conceptIds.size() < 512) ? conceptIds.size() : 512;
            query.append(" OR concept.conceptId:(")
                    .append(StringUtils.join(conceptIds.subList(0, maxSize), " OR ")).append(")^0.1");
        }
    }

    LuceneQuery<Drug> drugsQuery = LuceneQuery.newQuery(Drug.class, sessionFactory.getCurrentSession(),
            query.toString());
    if (!includeRetired) {
        drugsQuery.include("retired", false);
    }
    return drugsQuery;
}

From source file:org.sipfoundry.sipxconfig.acd.stats.AcdStatistics.java

List getStats(Object[] rawStats, Transformer transformer, Predicate filter) {
    List stats = new ArrayList(Arrays.asList(rawStats));
    CollectionUtils.transform(stats, transformer);
    CollectionUtils.filter(stats, filter);
    return stats;
}

From source file:tds.itempreview.ConfigLoader.java

private void setFilePaths(final String configBasePath, Config config) {
    for (Page configPage : config.getPages()) {
        if (configPage.getPassage() != null)
            setFilePath(configBasePath, configPage.getPassage());
        if (configPage.getItems() != null)
            CollectionUtils.transform(configPage.getItems(), new Transformer() {
                @Override/* ww w  . j  av  a2  s . c o  m*/
                public Object transform(Object ic) {
                    setFilePath(configBasePath, (Item) ic);
                    return ic;
                }
            });
    }
}

From source file:tds.itempreview.ConfigLoader.java

private void setHttpPaths(final String rootPath, Config config) {
    for (Page configPage : config.getPages()) {
        if (configPage.getPassage() != null)
            setHttpPath(rootPath, configPage.getPassage());
        if (configPage.getItems() != null)
            CollectionUtils.transform(configPage.getItems(), new Transformer() {

                @Override// ww w .  ja  va2s  .  c o m
                public Object transform(Object ic) {
                    setHttpPath(rootPath, (Item) ic);
                    return ic;
                }
            });
    }
}

From source file:tds.itempreview.ConfigLoader.java

private void encryptPaths(Config config) {
    for (Page configPage : config.getPages()) {
        configPage.setEncrypted(true);/*from w w w  . j ava 2  s.c o m*/
        if (configPage.getPassage() != null)
            encryptPath(configPage.getPassage());
        if (configPage.getItems() != null)
            CollectionUtils.transform(configPage.getItems(), new Transformer() {

                @Override
                public Object transform(Object configContent) {
                    encryptPath((Content) configContent);
                    return configContent;
                }
            });
    }
}