Example usage for java.util Collections EMPTY_LIST

List of usage examples for java.util Collections EMPTY_LIST

Introduction

In this page you can find the example usage for java.util Collections EMPTY_LIST.

Prototype

List EMPTY_LIST

To view the source code for java.util Collections EMPTY_LIST.

Click Source Link

Document

The empty list (immutable).

Usage

From source file:com.sshdemo.common.security.manage.web.group.DetailAction.java

public void query() {
    Group group = fac.getGroup(name);

    JsonBaseAction json = new JsonBaseAction();

    if (group == null) {
        logger.warn("Group name is {} but get is null", name);
        json.renderObject(new DataGrid(0, Collections.EMPTY_LIST));
        return;//  ww  w . j av  a2s.  c  om
    }

    List<PropertyGridItem> items = new ArrayList<PropertyGridItem>();
    items.addAll(getItems(group.getAuthorities(), new ConvertToPropertyGridItem() {
        @Override
        public PropertyGridItem convert(Object value) {
            Authority authority = (Authority) value;
            return new PropertyGridItem(authority.getName(), authority.getRemark(), Authority_Group_Title);
        }
    }));
    items.addAll(getItems(group.getUsers(), new ConvertToPropertyGridItem() {
        @Override
        public PropertyGridItem convert(Object value) {
            User user = (User) value;
            return new PropertyGridItem(user.getUsername(), user.getUserInfo().getName(), User_Group_Title);
        }
    }));

    json.renderObject(new DataGrid(items.size(), items));
}

From source file:com.mitre.core.suggestion.DefaultSimpleSuggestionServiceIntegrationTest.java

@Test
public void testReferencesForPurchasedInCategory() {
    final UserModel user = userService.getUserForUID("dejol");
    final CategoryModel category = categoryService.getCategoryForCode("cameras");

    List<ProductModel> result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory(category, user,
            Collections.EMPTY_LIST, false, null);
    Assert.assertEquals(4, result.size());
    result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory(category, user,
            Collections.EMPTY_LIST, false, NumberUtils.INTEGER_ONE);
    Assert.assertEquals(1, result.size());
    result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory(category, user,
            Arrays.asList(ProductReferenceTypeEnum.SIMILAR), false, null);
    Assert.assertEquals(1, result.size());
    result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory(category, user,
            Arrays.asList(ProductReferenceTypeEnum.ACCESSORIES), false, null);
    Assert.assertEquals(2, result.size());
    result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory(category, user,
            Arrays.asList(ProductReferenceTypeEnum.ACCESSORIES), true, null);
    Assert.assertEquals(1, result.size());
    final ProductModel product = result.get(0);
    Assert.assertEquals("adapterDC", product.getCode());
    Assert.assertEquals("adapter", product.getName());
}

From source file:architecture.ee.web.util.ParamUtils.java

public static <T> T getJsonParameter(HttpServletRequest request, String name, String key,
        Class<T> requiredType) {
    try {//from   w  ww .j a va  2  s  .c o m
        Map map = getJsonParameter(request, name);
        return (T) map.get(key);
    } catch (Exception e) {
        log.error(e);
        if (requiredType == List.class)
            return (T) Collections.EMPTY_LIST;
        else if (requiredType == Map.class) {
            return (T) Collections.EMPTY_MAP;
        }
        return null;
    }
}

From source file:flens.filter.RenameFilter.java

public Collection<Record> process(Record in) {
    Map vals = in.getValues();/*from w w w  . j a  va 2s  .c  om*/
    for (Pair ren : this.names) {
        Object val = vals.remove(ren.getKey());
        if (val != null) {
            if (!((String) ren.getRight()).isEmpty())
                vals.put(ren.getRight(), val);
            if (ren.getRight().equals(Constants.TIME)) {

                vals.put(Constants.TIME, in.getTimestamp());
            }
        }
    }

    tag(in);
    return Collections.EMPTY_LIST;
}

From source file:com.gistlabs.mechanize.document.json.node.impl.ArrayNodeImpl.java

@SuppressWarnings("unchecked")
@Override/*w  ww  .  ja  v  a 2  s.co  m*/
public List<JsonNode> getChildren(final String... names) {
    if (names.length > 2)
        return Collections.EMPTY_LIST;
    if (names.length == 1 && !"*".equalsIgnoreCase(names[0]))
        return Collections.EMPTY_LIST;

    try {
        if (children == null) {
            children = new ArrayList<JsonNode>();
            for (int i = 0; i < array.length(); i++) {
                Object obj = array.get(i);
                children.add(factory("array", obj, array, i));
            }
        }
        return children;
    } catch (JSONException e) {
        throw new JsonException(e);
    }
}

From source file:com.feedzai.fos.impl.dummy.DummyScorer.java

@Override
public List<double[]> score(List<UUID> modelIds, Object[] scorable) {
    try {//from   w  w w  .  ja  v a 2s .  co m
        logger.trace("modelIds='{}', scorable='{}'", mapper.writeValueAsString(modelIds),
                mapper.writeValueAsString(scorable));
    } catch (IOException e) {
        logger.error(e.getMessage(), e);
    }
    return Collections.EMPTY_LIST;
}

From source file:com.aw.support.beans.BeanUtils.java

public static Object copyProperties(Object source, Object target, String[] propertyNamesToIgnore,
        boolean ignoreProxy, boolean ignoreCollections) {
    List<String> propertyNamesToIgnoreList = propertyNamesToIgnore == null ? Collections.EMPTY_LIST
            : Arrays.asList(propertyNamesToIgnore);
    BeanWrapper sourceWrap = new BeanWrapperImpl(source);
    BeanWrapper targetWrap = new BeanWrapperImpl(target);
    for (PropertyDescriptor propDescriptor : sourceWrap.getPropertyDescriptors()) {
        String propName = propDescriptor.getName();
        //chequear que no esta en la lista a ignorar
        if (propertyNamesToIgnoreList.contains(propName))
            continue;
        //chequear que se puede leer
        if (!sourceWrap.isReadableProperty(propName))
            continue;
        //chequear que se puede escribir
        if (!targetWrap.isWritableProperty(propName))
            continue;

        Object sourceValue = sourceWrap.getPropertyValue(propName);

        //chequear que objeto no es un proxy
        if (ignoreProxy && sourceValue != null && Proxy.isProxyClass(sourceValue.getClass()))
            continue;

        //chequear que objeto no una collection
        if (ignoreCollections && sourceValue instanceof Collection)
            continue;

        targetWrap.setPropertyValue(propName, sourceValue);
    }//  ww  w . j a v a 2s.c  o m
    return target;
}

From source file:com.exxonmobile.ace.hybris.core.suggestion.DefaultSimpleSuggestionServiceIntegrationTest.java

@Test
public void testReferencesForPurchasedInCategory() {
    final UserModel user = userService.getUserForUID("deJol");
    final CategoryModel category = categoryService.getCategoryForCode("cameras");

    List<ProductModel> result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory(category, user,
            Collections.EMPTY_LIST, false, null);
    Assert.assertEquals(4, result.size());
    result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory(category, user,
            Collections.EMPTY_LIST, false, NumberUtils.INTEGER_ONE);
    Assert.assertEquals(1, result.size());
    result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory(category, user,
            Arrays.asList(ProductReferenceTypeEnum.SIMILAR), false, null);
    Assert.assertEquals(1, result.size());
    result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory(category, user,
            Arrays.asList(ProductReferenceTypeEnum.ACCESSORIES), false, null);
    Assert.assertEquals(2, result.size());
    result = b2bSimpleSuggestionService.getReferencesForPurchasedInCategory(category, user,
            Arrays.asList(ProductReferenceTypeEnum.ACCESSORIES), true, null);
    Assert.assertEquals(1, result.size());
    final ProductModel product = result.get(0);
    Assert.assertEquals("adapterDC", product.getCode());
    Assert.assertEquals("adapter", product.getName());
}

From source file:net.ontopia.persistence.query.jdo.JDOQuery.java

public List getParameterNames() {
    if (param_names == null)
        return Collections.EMPTY_LIST;
    else/*from w  w w  . jav a  2 s.  com*/
        return param_names;
}

From source file:com.acc.facades.suggestion.DefaultSimpleSuggestionFacadeIntegrationTest.java

@Test
public void testReferencesForPurchasedInCategory() {
    final UserModel user = userService.getUserForUID("deJol");
    userService.setCurrentUser(user);/*from w w  w .  ja  v a  2 s .com*/
    List<ProductData> result = simpleSuggestionFacade.getReferencesForPurchasedInCategory("cameras",
            Collections.EMPTY_LIST, false, null);
    Assert.assertEquals(4, result.size());
    result = simpleSuggestionFacade.getReferencesForPurchasedInCategory("cameras", Collections.EMPTY_LIST,
            false, NumberUtils.INTEGER_ONE);
    Assert.assertEquals(1, result.size());
    result = simpleSuggestionFacade.getReferencesForPurchasedInCategory("cameras",
            Arrays.asList(ProductReferenceTypeEnum.SIMILAR), false, null);
    Assert.assertEquals(1, result.size());
    result = simpleSuggestionFacade.getReferencesForPurchasedInCategory("cameras",
            Arrays.asList(ProductReferenceTypeEnum.ACCESSORIES), false, null);
    Assert.assertEquals(2, result.size());
    result = simpleSuggestionFacade.getReferencesForPurchasedInCategory("cameras",
            Arrays.asList(ProductReferenceTypeEnum.ACCESSORIES), true, null);
    Assert.assertEquals(1, result.size());
    final ProductData product = result.get(0);
    Assert.assertEquals("adapterDC", product.getCode());
    Assert.assertEquals("adapter", product.getName());
}