Example usage for java.util Collections emptySet

List of usage examples for java.util Collections emptySet

Introduction

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

Prototype

@SuppressWarnings("unchecked")
public static final <T> Set<T> emptySet() 

Source Link

Document

Returns an empty set (immutable).

Usage

From source file:com.wms.studio.cache.lock.SyncLockMapCache.java

@Override
public Collection<V> values() {
    try {/*from   ww w .j a va  2  s.c  om*/
        HashMap<K, V> attributes = memcachedClient.get(name);
        if (attributes != null) {
            Collection<V> values = attributes.values();
            if (!CollectionUtils.isEmpty(values))
                return Collections.unmodifiableCollection(values);
        }
    } catch (Exception e) {
        log.fatal("?MemCache,.", e);
    }
    return Collections.emptySet();
}

From source file:com.orange.cepheus.cep.controller.AdminControllerValidationTest.java

@Test
public void configurationValidationTypeOut() throws Exception {
    Configuration configuration = getBasicConf();
    configuration.getEventTypeOuts().get(0).setId(null);
    checkValidationError(configuration);
    configuration.getEventTypeOuts().get(0).setId("");
    checkValidationError(configuration);

    configuration = getBasicConf();/*from   ww w.  j  ava2s .c o m*/
    configuration.getEventTypeOuts().get(0).setType(null);
    checkValidationError(configuration);
    configuration.getEventTypeOuts().get(0).setType("");
    checkValidationError(configuration);

    configuration = getBasicConf();
    configuration.getEventTypeOuts().get(0).setAttributes(null);
    checkValidationError(configuration);
    configuration.getEventTypeOuts().get(0).setAttributes(Collections.emptySet());
    checkValidationError(configuration);
}

From source file:ca.sqlpower.object.annotation.SPAnnotationProcessor.java

@Override
public Set<String> getSupportedOptions() {
    return Collections.emptySet();
}

From source file:ddf.catalog.impl.operations.ResourceOperations.java

public Map<String, Set<String>> getEnterpriseResourceOptions(String metacardId, boolean fanoutEnabled)
        throws ResourceNotFoundException {
    LOGGER.trace("ENTERING: getEnterpriseResourceOptions");
    Set<String> supportedOptions = Collections.emptySet();

    try {/*from   w ww  . j  ava  2s .  c o m*/
        QueryRequest queryRequest = new QueryRequestImpl(createMetacardIdQuery(metacardId), true, null, null);
        QueryResponse queryResponse = queryOperations.query(queryRequest, null, false, fanoutEnabled);
        List<Result> results = queryResponse.getResults();

        if (!results.isEmpty()) {
            Metacard metacard = results.get(0).getMetacard();
            String sourceIdOfResult = metacard.getSourceId();

            if (sourceIdOfResult != null && sourceIdOfResult.equals(getId())) {
                // found entry on local source
                supportedOptions = getOptionsFromLocalProvider(metacard);
            } else if (sourceIdOfResult != null && !sourceIdOfResult.equals(getId())) {
                // found entry on federated source
                supportedOptions = getOptionsFromFederatedSource(metacard, sourceIdOfResult);
            }
        } else {
            String message = "Unable to find metacard " + metacardId + " on enterprise.";
            LOGGER.debug(message);
            LOGGER.trace("EXITING: getEnterpriseResourceOptions");
            throw new ResourceNotFoundException(message);
        }

    } catch (UnsupportedQueryException e) {
        LOGGER.debug("Error finding metacard {}", metacardId, e);
        LOGGER.trace("EXITING: getEnterpriseResourceOptions");
        throw new ResourceNotFoundException("Error finding metacard due to Unsuppported Query", e);
    } catch (FederationException e) {
        LOGGER.debug("Error federating query for metacard {}", metacardId, e);
        LOGGER.trace("EXITING: getEnterpriseResourceOptions");
        throw new ResourceNotFoundException("Error finding metacard due to Federation issue", e);
    } catch (IllegalArgumentException e) {
        LOGGER.debug("Metacard couldn't be found {}", metacardId, e);
        LOGGER.trace("EXITING: getEnterpriseResourceOptions");
        throw new ResourceNotFoundException("Query returned null metacard", e);
    }

    LOGGER.trace("EXITING: getEnterpriseResourceOptions");
    return Collections.singletonMap(ResourceRequest.OPTION_ARGUMENT, supportedOptions);
}

From source file:eu.europa.ec.fisheries.uvms.reporting.service.mapper.ReportMapper.java

private Set<ExecutionLog> executionLogDTOToExecutionLogSet(ExecutionLogDTO executionLogDto, Report report) {
    if (executionLogDto != null) {
        ExecutionLog executionLog = new ExecutionLog(report, executionLogDto.getExecutedBy());
        return Sets.newHashSet(executionLog);
    }//from w  ww.  j a va  2  s  .  c om
    return Collections.emptySet();
}

From source file:com.ge.predix.acs.service.policy.matcher.PolicyMatcherImplTest.java

/**
 * Tests matching a blanket policy to a request.
 *
 * @throws IOException//  w ww .  jav  a  2 s .  co m
 *             on failure to load policy required for test.
 */
public void testMatchPolicyWithNoTargetAction() throws IOException {
    File file = getPolicyFileForTest(getMethodName());
    PolicySet policySet = PolicySets.loadFromFile(file);
    List<Policy> policies = policySet.getPolicies();

    PolicyMatchCandidate candidate = new PolicyMatchCandidate();
    candidate.setAction("GET");
    candidate.setResourceURI("/this/does/not/exist");
    candidate.setSubjectIdentifier("Edward R. Murrow");
    candidate.setSupplementalResourceAttributes(Collections.emptySet());
    candidate.setSupplementalSubjectAttributes(Collections.emptySet());
    List<MatchedPolicy> matchedPolicies = this.policyMatcher.match(candidate, policies);
    Assert.assertEquals(matchedPolicies.size(), 1);
    Assert.assertEquals(matchedPolicies.get(0).getPolicy(), policies.get(policies.size() - 1));
    Assert.assertNull(matchedPolicies.get(0).getPolicy().getTarget());
}

From source file:com.mingo.convert.ConverterService.java

private Set<Class<? extends Converter>> getConvertersClasses(String converterPackage) {
    Set<Class<? extends Converter>> classes = Collections.emptySet();
    for (ClassLoader classLoader : classLoaders) {
        classes = getConvertersClasses(converterPackage, classLoader);
        if (CollectionUtils.isNotEmpty(classes)) {
            break;
        }//w  ww . j a  v a  2s .c  o  m
    }
    return classes;
}

From source file:com.haulmont.cuba.web.widgets.CubaGroupTable.java

@Override
public void changeVariables(Object source, Map<String, Object> variables) {
    Object[] newGroupProperties = null;

    if (variables.containsKey("columnorder") && !variables.containsKey("groupedcolumns")) {
        newGroupProperties = new Object[0];
    } else if (variables.containsKey("groupedcolumns")) {
        focus();//from www .  j  av a 2 s. com

        Object[] ids = (Object[]) variables.get("groupedcolumns");
        Object[] groupProperties = new Object[ids.length];
        for (int i = 0; i < ids.length; i++) {
            groupProperties[i] = _columnIdMap().get(ids[i].toString());
        }
        newGroupProperties = groupProperties;
        // Deny group by generated columns
        if (!_columnGenerators().isEmpty()) {
            List<Object> notGeneratedProperties = new ArrayList<>();
            for (Object id : newGroupProperties) {
                // todo support grouping by generated columns with Printable
                if (!_columnGenerators().containsKey(id) || isNonGeneratedProperty(id)) {
                    notGeneratedProperties.add(id);
                }
            }
            newGroupProperties = notGeneratedProperties.toArray();
        }
    }

    if (variables.containsKey("collapsedcolumns")) {
        Object[] ids = (Object[]) variables.get("collapsedcolumns");

        Set<Object> idSet = ids.length > 0 ? new HashSet<>() : Collections.emptySet();

        for (Object id : ids) {
            idSet.add(_columnIdMap().get(id.toString()));
        }

        boolean needToRegroup = false;
        List<Object> groupProperties = new ArrayList<>(getGroupProperties());
        for (int index = 0; index < groupProperties.size(); index++) {
            final Object propertyId = groupProperties.get(index);
            if (idSet.contains(propertyId)) {
                groupProperties.subList(index, groupProperties.size()).clear();
                needToRegroup = true;
                break;
            }
        }
        if (needToRegroup) {
            newGroupProperties = groupProperties.toArray();
        }
    }

    if ((hasGroupDisallowedProperties(newGroupProperties) || fixedGrouping)
            && isGroupsChanged(newGroupProperties)) {
        requestColumnReorderingAllowed = false;
        markAsDirty();
    }

    super.changeVariables(source, variables);

    if (!(hasGroupDisallowedProperties(newGroupProperties) || fixedGrouping) && newGroupProperties != null
            && isGroupsChanged(newGroupProperties)) {
        groupBy(newGroupProperties, true);
    }

    requestColumnReorderingAllowed = true;
}

From source file:com.siemens.sw360.portal.portlets.projects.ProjectPortlet.java

@Override
protected Set<Attachment> getAttachments(String documentId, String documentType, User user) {

    try {/*from   ww  w  .j a v a  2  s. c o m*/
        ProjectService.Iface client = thriftClients.makeProjectClient();
        Project projectById = client.getProjectById(documentId, user);
        return CommonUtils.nullToEmptySet(projectById.getAttachments());
    } catch (TException e) {
        log.error("Could not get project", e);
    }
    return Collections.emptySet();
}

From source file:com.nflabs.shiro.cache.zookeeper.ZookeeperCache.java

@Override
public Set<K> keys() {
    if (!isBaseDirectoryExist()) {
        LOG.debug("The Zookeeper base dir doesnt exist, abort.");
        return Collections.emptySet();
    }/*from w w  w. jav a 2 s. c o  m*/

    try {
        @SuppressWarnings("unchecked")
        List<K> childrens = (List<K>) zookeeperClient.getChildren(zookeeperBasePath, null);
        if (!CollectionUtils.isEmpty(childrens)) {
            return Collections.unmodifiableSet(new LinkedHashSet<K>(childrens));
        } else {
            return Collections.emptySet();
        }
    } catch (InterruptedException | KeeperException e) {
        //throw new CacheException(e);
        LOG.error("Error: {}", e.getMessage());
        return Collections.emptySet();
    }
}