Example usage for java.util Set isEmpty

List of usage examples for java.util Set isEmpty

Introduction

In this page you can find the example usage for java.util Set isEmpty.

Prototype

boolean isEmpty();

Source Link

Document

Returns true if this set contains no elements.

Usage

From source file:com.flipkart.foxtrot.core.querystore.actions.spi.AnalyticsLoader.java

@Override
public void start() throws Exception {
    Reflections reflections = new Reflections("com.flipkart.foxtrot", new SubTypesScanner());
    Set<Class<? extends Action>> actions = reflections.getSubTypesOf(Action.class);
    if (actions.isEmpty()) {
        throw new Exception("No analytics actions found!!");
    }/*from   w w w  . java2  s  .  com*/
    List<NamedType> types = new ArrayList<>();
    for (Class<? extends Action> action : actions) {
        AnalyticsProvider analyticsProvider = action.getAnnotation(AnalyticsProvider.class);
        if (null == analyticsProvider.request() || null == analyticsProvider.opcode()
                || analyticsProvider.opcode().isEmpty() || null == analyticsProvider.response()) {
            throw new Exception("Invalid annotation on " + action.getCanonicalName());
        }
        if (analyticsProvider.opcode().equalsIgnoreCase("default")) {
            logger.warn("Action " + action.getCanonicalName() + " does not specify cache token. "
                    + "Using default cache.");
        }
        register(new ActionMetadata(analyticsProvider.request(), action, analyticsProvider.cacheable(),
                analyticsProvider.opcode()));
        types.add(new NamedType(analyticsProvider.request(), analyticsProvider.opcode()));
        types.add(new NamedType(analyticsProvider.response(), analyticsProvider.opcode()));
        logger.info("Registered action: " + action.getCanonicalName());
    }
    objectMapper.getSubtypeResolver().registerSubtypes(types.toArray(new NamedType[types.size()]));
}

From source file:com.anite.antelope.zebra.om.TurbineAntelopeProcessInstanceTest.java

public void testGetTaskInstances() {
    Set taskInstances = processInstance.getTaskInstances();
    assertTrue("No Instances", taskInstances.isEmpty());

}

From source file:com.chadekin.jadys.syntax.from.impl.FromClauseBuilderImpl.java

private void attachRelatedActiveAliases(Set<String> aliases) {
    Set<String> foundAliases = Sets.newHashSet(aliases);
    while (!foundAliases.isEmpty()) {
        Set<String> result = Sets.difference(findRelatedAlias(foundAliases), aliases);
        foundAliases.clear();/* www  .  jav  a 2 s  . c om*/
        foundAliases.addAll(result);
        aliases.addAll(result);
    }
}

From source file:com.espertech.esper.core.StatementEventTypeRefImpl.java

public void addReferences(String statementName, Set<String> eventTypesReferenced) {
    if (eventTypesReferenced.isEmpty()) {
        return;/* ww w.  j a  va 2 s .com*/
    }

    mapLock.acquireWriteLock();
    try {
        for (String ref : eventTypesReferenced) {
            addReference(statementName, ref);
        }
    } finally {
        mapLock.releaseWriteLock();
    }
}

From source file:com.vmware.identity.openidconnect.protocol.LogoutSuccessResponse.java

public LogoutSuccessResponse(URI postLogoutRedirectUri, State state, SessionID sessionId, Set<URI> logoutUris) {
    super(postLogoutRedirectUri, state);

    Validate.notNull(logoutUris); // pass in empty set instead
    if (!logoutUris.isEmpty() && sessionId == null) {
        throw new IllegalArgumentException("sessionId should not be null when logoutUris is non-empty");
    }/* w w  w . j a  v a 2s  . c  om*/

    this.sessionId = sessionId;
    this.logoutUris = logoutUris;
}

From source file:com.anrisoftware.sscontrol.services.ServiceLoad.java

/**
 * Search the file system for the service script file and loads the service.
 * /* w  w w  . j  a  v  a 2s  .c  o m*/
 * @param name
 *            the name of the service.
 * 
 * @param profile
 *            the {@link ProfileService} or {@code null} if no profile is
 *            set.
 * 
 * @param variables
 *            a {@link Map} of variables that should be injected in the
 *            script. The map should contain entries
 *            {@code [<variable name>=<value>, ...]}.
 * 
 * @return {@link ServicesRegistry} registry that will contain the loaded
 *         service.
 * 
 * @throws FileSystemException
 *             if there was error searching the profile in the file system.
 * 
 * @throws ServiceException
 *             if there was error loading the service script.
 */
public ServicesRegistry loadService(String name, ProfileService profile, Map<String, Object> variables)
        throws FileSystemException, ServiceException {
    Pattern pattern = filePattern == null ? filePattern(name) : filePattern;
    Set<URL> files = fileSystem.findFiles(pattern);
    if (files.isEmpty()) {
        throw log.noServiceFilesFound(name, pattern);
    }
    for (URL url : files) {
        ServicePreScript prescript = loadPreScript(name, profile);
        ServiceLoader loader = serviceFactory.create(registry, variables);
        loader.setParent(injector);
        loader.setThreads(threads);
        loader.loadService(url, profile, prescript);
    }
    if (!registry.getServiceNames().contains(name)) {
        throw log.serviceFileNotContainService(name, pattern);
    }
    return registry;
}

From source file:com.ny.apps.dao.BaseDaoImpl.java

public <T> void RemoveAll(Class<T> entityType, Set<Serializable> ids) {
    if (ids.isEmpty()) {
        return;/*from  ww  w . j  av  a  2  s .c  o m*/
    }
    String whereClause = buildOrIdWhereClause(ids.size(), "e.id");
    update(concatenateString("delete from ", entityType.getSimpleName(), "e where ", whereClause),
            ids.toArray());
}

From source file:com.adeptj.modules.commons.validator.service.internal.HibernateValidatorService.java

/**
 * {@inheritDoc}/*from  w ww.j ava  2 s  .  c  o  m*/
 */
@Override
public <T> void validate(T instance) {
    Validate.notNull(instance, "Object to be validated can't be null!!");
    Set<ConstraintViolation<T>> violations = this.validatorFactory.getValidator().validate(instance);
    if (!violations.isEmpty()) {
        throw new ConstraintViolationException(violations);
    }
}

From source file:com.dell.asm.asmcore.asmmanager.app.rest.DeviceInventoryService.java

/**
 * Check if the currently logged in user is allowed to access this device.
 *
 * @param entity The device entity/*w ww  .  j  a v a 2  s  .co  m*/
 * @return True if the user is allowed access to the device.
 */
public static boolean checkUserPermissions(DeviceInventoryEntity entity, User thisUser) {
    if (thisUser.getRole().equals(AsmConstants.USERROLE_READONLY)) {
        return true;
    }
    if (thisUser.getRole().equals(AsmConstants.USERROLE_ADMINISTRATOR)) {
        return true;
    }

    if (entity.getDeviceGroupList() != null && entity.getDeviceGroupList().size() > 0) {
        for (DeviceGroupEntity dg : entity.getDeviceGroupList()) {
            if (dg.getGroupsUsers() != null) {
                for (Long ref : dg.getGroupsUsers()) {
                    if (thisUser.getUserSeqId() == ref) {
                        return true;
                    }
                }
            }
        }
    } else {
        // no server pool
        return true;
    }

    // allow user and/or user group to see device details if the access is granted to the service
    List<DeploymentEntity> deployments = entity.getDeployments();
    if (deployments != null && !deployments.isEmpty()) {
        for (DeploymentEntity deployment : deployments) {
            if (deployment.isAllUsersAllowed()) {
                return true;
            }
            Set<DeploymentUserRefEntity> assignedUsers = deployment.getAssignedUserList();
            if (assignedUsers != null && !assignedUsers.isEmpty()) {
                for (DeploymentUserRefEntity user : assignedUsers) {
                    if (user.getUserId() == thisUser.getUserSeqId()) {
                        return true;
                    }
                }
            }
        }
    }

    return false;
}

From source file:com.jdom.get.stuff.done.presenter.BasePresenter.java

protected void enableSync() {
    ContextFactory contextFactory = view.getApplicationContextFactory();
    Set<String> availableSyncAccounts = contextFactory.getAvailableSyncAccounts();

    if (availableSyncAccounts.isEmpty()) {
        contextFactory.displayAlert(NO_VALID_SYNC_ACCOUNTS);
        return;//from  w  w w  .j  a  va 2s  .  c  o  m
    }

    String initialSelection = availableSyncAccounts.iterator().next();
    contextFactory.displayCollectionOfItemsAsRadioButtonGroup(PLEASE_SELECT_SYNC_ACCOUNT, availableSyncAccounts,
            initialSelection, selectedSyncAccountRunnable);
}