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

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

Introduction

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

Prototype

public static void addAll(Collection collection, Object[] elements) 

Source Link

Document

Adds all elements in the array to the given collection.

Usage

From source file:com.epam.cme.core.services.impl.DefaultCompatibilityService.java

@Override
public List<ProductModel> getFeatureCompatibleProducts(final String code,
        final ClassAttributeAssignmentModel classificationAttributeAssignment,
        final ComposedTypeModel targetItemType) {
    final ProductModel product = getProductService().getProductForCode(code);
    final Set<ProductModel> relatedProducts = new HashSet<ProductModel>();

    final Feature modelFeature = getClassificationService().getFeature(product,
            classificationAttributeAssignment);

    final List<ProductModel> selectedProducts = new ArrayList<ProductModel>();
    if (modelFeature != null) {
        relatedProducts.addAll(getProductsWithFeature(modelFeature, targetItemType));
    }/*from  w w w.  j  a  v  a  2 s .  c o m*/
    CollectionUtils.addAll(selectedProducts, relatedProducts.iterator());
    return selectedProducts;
}

From source file:de.inren.service.car.CarLogEntryServiceImpl.java

@Override
public List<Car> loadAllCars() {
    List<Car> res = new ArrayList<Car>();
    CollectionUtils.addAll(res, carRepository.findAll().iterator());
    return res;//from ww w  .  j  a  v a2s .c o m
}

From source file:com.silverpeas.util.i18n.I18NHelperTest.java

/**
 * Test of getLanguages method, of class I18NHelper.
 *//*  www .j  a va 2 s  . co  m*/
@Test
public void testGetLanguages() {
    Iterator<String> result = I18NHelper.getLanguages();
    List<String> languages = new ArrayList<String>(3);
    CollectionUtils.addAll(languages, result);
    assertThat(languages, containsInAnyOrder("en", "fr", "de"));
}

From source file:com.cyclopsgroup.waterview.core.taglib.GetPortletsTag.java

/**
 * Override method processTag in class GetPanelComponentsTag
 *
 * @see com.cyclopsgroup.waterview.utils.TagSupportBase#processTag(org.apache.commons.jelly.XMLOutput)
 *///from  w w  w  . j av  a 2  s.  c o m
protected void processTag(XMLOutput output) throws Exception {
    requireAttribute("var");
    requireAttribute("panel");
    Page page = (Page) getContext().getVariable(Page.NAME);
    if (page == null) {
        throw new JellyTagException("Page is not found");
    }
    PanelContent content = page.getPanelContent(getPanel());

    List portlets;
    if (content == null) {
        invokeBody(XMLOutput.createDummyXMLOutput());
        portlets = new ArrayList(defaultPortlets);
    } else if (content.isAppend()) {
        invokeBody(XMLOutput.createDummyXMLOutput());
        portlets = new ArrayList(defaultPortlets);
        CollectionUtils.addAll(portlets, content.getPortlets());
    } else {
        portlets = new ArrayList();
        CollectionUtils.addAll(portlets, content.getPortlets());
    }
    getContext().setVariable(getVar(), portlets);
}

From source file:com.cyclopsgroup.waterview.servlet.ServletRequestParameters.java

/**
 * Override or implement method of parent class or interface
 *
 * @see com.cyclopsgroup.waterview.Parameters#doGetValues(java.lang.String)
 *//* ww  w  .  jav  a 2 s  . c  o m*/
protected String[] doGetValues(String name) throws Exception {
    String[] ret = httpServletRequest.getParameterValues(name);
    if (extra.containsKey(name)) {
        List list = new ArrayList((Collection) extra.get(name));
        CollectionUtils.addAll(list, ret);
        ret = (String[]) list.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
    }
    return ret;
}

From source file:de.inren.service.car.CarLogEntryServiceImpl.java

@Override
public List<CarLogEntry> loadAllLogEntries() {
    List<CarLogEntry> res = new ArrayList<CarLogEntry>();
    CollectionUtils.addAll(res, carLogEntryRepository.findAll().iterator());
    return res;/*from w  w w.  ja  v a 2 s .  co  m*/
}

From source file:com.cyclopsgroup.waterview.impl.servlet.ServletRequestParameters.java

/**
 * Override or implement method of parent class or interface
 *
 * @see com.cyclopsgroup.waterview.Parameters#doGetValues(java.lang.String)
 *//*from   w  ww. j ava 2s . c  o m*/
@Override
protected List<String> doGetValues(String name) throws Exception {
    List<String> list = new ArrayList<String>();
    CollectionUtils.addAll(list, httpServletRequest.getParameterValues(name));
    if (extra.containsKey(name)) {
        list.addAll(extra.get(name));
    }
    return list;
}

From source file:de.inren.service.car.CarLogEntryServiceImpl.java

@Override
public List<Car> loadCarsForUser(Long userId) {
    List<Car> res = new ArrayList<Car>();
    CollectionUtils.addAll(res, carRepository.findByUid(userId).iterator());
    return res;//from  w w  w .  j av a 2  s  .  c  o m
}

From source file:edu.isi.misd.scanner.network.registry.web.controller.ScannerUserController.java

@RequestMapping(value = BASE_PATH, method = { RequestMethod.GET,
        RequestMethod.HEAD }, produces = HEADER_JSON_MEDIA_TYPE)
public @ResponseBody List<ScannerUser> getScannerUsers(@RequestHeader(HEADER_LOGIN_NAME) String loginName,
        @RequestParam Map<String, String> paramMap) {
    Map<String, String> params = validateParameterMap(paramMap, REQUEST_PARAM_USER_NAME);

    String userName = params.get(REQUEST_PARAM_USER_NAME);
    List<ScannerUser> users = new ArrayList<ScannerUser>();
    if (userName != null) {
        ScannerUser user = scannerUserRepository.findByUserName(userName);
        if (user == null) {
            throw new ResourceNotFoundException(userName);
        }/* w  ww. j  a v a  2 s  .  c  om*/
        users.add(user);
    } else {
        Iterator iter = scannerUserRepository.findAll().iterator();
        CollectionUtils.addAll(users, iter);
    }
    return users;
}

From source file:com.google.gdt.eclipse.designer.hosted.classloader.GWTSharedClassLoader.java

@Override
public URL[] getURLs() {
    List<URL> urls = Lists.newArrayList();
    CollectionUtils.addAll(urls, super.getURLs());
    try {//from  w w  w  . j  a va 2 s .com
        URL[] moduleURLs = stateTL.get().activeModule.getURLs();
        CollectionUtils.addAll(urls, moduleURLs);
    } catch (Throwable e) {
    }
    return urls.toArray(new URL[urls.size()]);
}