Example usage for com.google.common.base Predicates alwaysTrue

List of usage examples for com.google.common.base Predicates alwaysTrue

Introduction

In this page you can find the example usage for com.google.common.base Predicates alwaysTrue.

Prototype

@GwtCompatible(serializable = true)
public static <T> Predicate<T> alwaysTrue() 

Source Link

Document

Returns a predicate that always evaluates to true .

Usage

From source file:org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.Navigatable.java

/**
 * Returns, from the given TreeNode, the previous TreeNode that contains a diff.
 * /*from  w  w  w  . j  a  v  a 2s.c o m*/
 * @param treeNode
 *            the given TreeNode for which we want to find the previous.
 * @return the previous TreeNode that contains a diff.
 */
private Object getPreviousDiff(TreeItem item) {
    return getPreviousData(item, Predicates.alwaysTrue());
}

From source file:com.eucalyptus.tags.TagSupport.java

/**
 * Get the tags for the given resources, grouped by ID and ordered for display.
 * //from  www.j a v  a  2 s.c o  m
 * @param owner The account for the tags
 * @param identifiers The resource identifiers for the tags
 * @return The tag map with an entry for each requested resource
 */
public Map<String, List<Tag>> getResourceTagMap(final OwnerFullName owner, final Iterable<String> identifiers) {
    final Map<String, List<Tag>> tagMap = Maps.newHashMap();
    for (final String id : identifiers) {
        tagMap.put(id, Lists.<Tag>newArrayList());
    }
    if (!tagMap.isEmpty()) {
        final Tag example = example(owner);
        final DetachedCriteria detachedCriteria = DetachedCriteria.forClass(resourceClass)
                .add(Restrictions.in(resourceClassIdField, Lists.newArrayList(identifiers)))
                .setProjection(Projections.id());
        final Criterion idRestriction = Property.forName(tagClassResourceField).in(detachedCriteria);
        try {
            final List<Tag> tags = Tags.list(example, Predicates.alwaysTrue(), idRestriction,
                    Collections.<String, String>emptyMap());
            for (final Tag tag : tags) {
                tagMap.get(tag.getResourceId()).add(tag);
            }
        } catch (NoSuchMetadataException e) {
            log.error(e, e);
        }
        Ordering<Tag> order = Ordering.natural().onResultOf(Tags.key());
        for (final String id : identifiers) {
            Collections.sort(tagMap.get(id), order);
        }
    }
    return tagMap;
}

From source file:de.iteratec.iteraplan.businesslogic.service.ecore.MappedEPackage.java

public MappedEPackage createCopy() {
    Predicate<ENamedElement> filter = Predicates.alwaysTrue();
    return new MappingEPackageCopier().copy(this, filter);
}

From source file:com.eucalyptus.compute.common.internal.tags.TagSupport.java

/**
 * Get the tags for the given resources, grouped by ID and ordered for display.
 * //from w w w.  ja v a2s  . com
 * @param owner The account for the tags
 * @param identifiers The resource identifiers for the tags
 * @return The tag map with an entry for each requested resource
 */
public Map<String, List<Tag>> getResourceTagMap(final OwnerFullName owner, final Iterable<String> identifiers) {
    final int identifiersSize = Iterables.size(identifiers);
    final Map<String, List<Tag>> tagMap = Maps.newHashMapWithExpectedSize(identifiersSize);
    for (final String id : identifiers) {
        tagMap.put(id, Lists.<Tag>newArrayList());
    }
    if (!tagMap.isEmpty()) {
        final Tag example = example(owner);
        final Criterion idRestriction = identifiersSize < 1000 ? Property.forName(tagClassResourceField)
                .in(DetachedCriteria.forClass(resourceClass)
                        .add(Restrictions.in(resourceClassIdField, Lists.newArrayList(identifiers)))
                        .setProjection(Projections.id()))
                : Restrictions.conjunction();
        try {
            final List<Tag> tags = Tags.list(example, Predicates.alwaysTrue(), idRestriction,
                    Collections.<String, String>emptyMap());
            for (final Tag tag : tags) {
                final List<Tag> keyTags = tagMap.get(tag.getResourceId());
                if (keyTags != null) {
                    keyTags.add(tag);
                }
            }
        } catch (Exception e) {
            log.error(e, e);
        }
        Ordering<Tag> order = Ordering.natural().onResultOf(Tags.key());
        for (final String id : identifiers) {
            Collections.sort(tagMap.get(id), order);
        }
    }
    return tagMap;
}

From source file:org.eclipse.wb.internal.core.model.util.PropertyUtils.java

/**
 * @return the {@link Predicate} for {@link Property} that does not accept properties with titles
 *         listed in parameter value./*from   w w  w .j a  v a2 s. c o m*/
 */
public static Predicate<Property> getExcludeByTitlePredicate(ObjectInfo objectInfo, String parameterName) {
    Predicate<Property> predicate = Predicates.alwaysTrue();
    String propertiesExcludeString = GlobalState.getParametersProvider().getParameter(objectInfo,
            parameterName);
    if (propertiesExcludeString != null) {
        String[] propertiesExclude = StringUtils.split(propertiesExcludeString);
        predicate = getExcludeByTitlePredicate(propertiesExclude);
    }
    return predicate;
}

From source file:com.isotrol.impe3.pms.core.obj.RoutingDomainsObject.java

public List<RoutingDomainSelDTO> map2sel(boolean includeDefault) {
    final Predicate<RoutingDomainObject> p;
    if (includeDefault) {
        p = Predicates.alwaysTrue();
    } else {//from  w  w  w.  ja v  a 2s.  c o  m
        p = Predicates.not(OBJ_DEFAULT);
    }
    return newArrayList(transform(Iterables.filter(byName.values(), p), RD2SEL));
}

From source file:brooklyn.rest.resources.EntityConfigResource.java

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override//from  w w w  .  ja va2s .  c o  m
public void set(String application, String entityToken, String configName, Boolean recurse, Object newValue) {
    final EntityLocal entity = brooklyn().getEntity(application, entityToken);
    if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.MODIFY_ENTITY, entity)) {
        throw WebResourceUtils.unauthorized("User '%s' is not authorized to modify entity '%s'",
                Entitlements.getEntitlementContext().user(), entity);
    }

    ConfigKey ck = findConfig(entity, configName);
    LOG.debug("REST setting config " + configName + " on " + entity + " to " + newValue);
    ((EntityInternal) entity).setConfig(ck, TypeCoercions.coerce(newValue, ck.getTypeToken()));
    if (Boolean.TRUE.equals(recurse)) {
        for (Entity e2 : Entities.descendants(entity, Predicates.alwaysTrue(), false)) {
            ((EntityInternal) e2).setConfig(ck, newValue);
        }
    }
}

From source file:de.cosmocode.palava.ipc.memcache.MemcacheService.java

@Override
public void invalidate(Class<? extends IpcCommand> command) {
    invalidate(command, Predicates.alwaysTrue());
}

From source file:com.google.enterprise.quality.sxse.storage.textstorage.TextUserStorage.java

public List<JudgmentDetails> getJudgments(String userName) throws SxseStorageException {
    Predicate<JudgmentDetails> alwaysTrue = Predicates.alwaysTrue();
    return getJudgments(userName, alwaysTrue);
}

From source file:org.opencms.ade.containerpage.client.ui.CmsToolbarGalleryMenu.java

/**
 * @see org.opencms.gwt.client.ui.I_CmsToolbarButton#onToolbarActivate()
 *///from   ww  w.ja va  2s . co m
@SuppressWarnings("unused")
public void onToolbarActivate() {

    Document.get().getBody().addClassName(I_CmsButton.ButtonData.WAND_BUTTON.getIconClass());
    if (m_dialog == null) {
        int dialogHeight = CmsToolbarPopup.getAvailableHeight();
        int dialogWidth = CmsToolbarPopup.getAvailableWidth();
        Predicate<CmsResultItemBean> resultDndFilter = Predicates.alwaysTrue();
        if (CmsContainerpageController.get().getData().getTemplateContextInfo().getCurrentContext() != null) {
            resultDndFilter = new CmsTemplateContextResultDndFilter();
        }
        final Predicate<CmsResultItemBean> finalDndFilter = resultDndFilter;
        CmsGalleryDialog galleryDialog = new CmsGalleryDialog(new GalleryHandler(finalDndFilter));
        new CmsGalleryController(new CmsGalleryControllerHandler(galleryDialog), m_galleryData, m_search);
        m_dialog = galleryDialog;
        m_dialog.setDialogSize(dialogWidth, dialogHeight);
        getPopup().setWidth(dialogWidth);
        m_tabsContainer.add(m_dialog);
    } else {
        int dialogWidth = CmsToolbarPopup.getAvailableWidth();
        getPopup().setWidth(dialogWidth);
        m_dialog.truncate("GALLERY_DIALOG_TM", dialogWidth);
        m_dialog.updateSizes();
    }
}