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.openthinks.webscheduler.model.security.User.java

public Set<Role> getRoles() {
    if ((this.roles == null || this.roles.isEmpty()) && this.roleKeys != null) {
        try {/* ww w  .j a  v  a2  s  .c  om*/
            this.roles = this.roleKeys.getRoles().stream().map((roleKey) -> {
                Role role = null;
                Roles roles = WebContexts.get().lookup(WebSecurityService.class).getRoles();
                if (roleKey.getId() != null) {
                    role = roles.findById(roleKey.getId());
                }
                if (role == null && roleKey.getName() != null) {
                    role = roles.findByName(roleKey.getName());
                }
                Checker.require(role).notNull();
                return role;
            }).collect(Collectors.toSet());
        } catch (Exception e) {
            ProcessLogger.error(e);
            this.roles = Collections.emptySet();
        }
    }
    return roles;
}

From source file:ch.cyberduck.core.AbstractProtocol.java

@Override
public Set<Location.Name> getRegions() {
    return Collections.emptySet();
}

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

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

    configuration = getBasicConf();/* w w  w. j  a  v a  2 s .  com*/
    configuration.getEventTypeIns().get(0).setType(null);
    checkValidationError(configuration);
    configuration.getEventTypeIns().get(0).setType("");
    checkValidationError(configuration);

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

From source file:nu.yona.server.analysis.service.AnalysisEngineService_determineRelevantGoalsTest.java

@Before
public void setUp() {
    initMocks(this);

    setUpRepositoryMocks();/*from   w w  w .  ja  va  2s.  c om*/

    LocalDateTime yesterday = TimeUtil.utcNow().minusDays(1);
    LocalDateTime dayBeforeYesterday = yesterday.minusDays(1);
    gamblingGoal = BudgetGoal.createNoGoInstance(dayBeforeYesterday,
            ActivityCategory.createInstance(UUID.randomUUID(), usString("gambling"), false,
                    new HashSet<>(Arrays.asList("poker", "lotto")),
                    new HashSet<>(Arrays.asList("Poker App", "Lotto App")), usString("Descr")));
    newsGoal = BudgetGoal.createNoGoInstance(dayBeforeYesterday,
            ActivityCategory.createInstance(UUID.randomUUID(), usString("news"), false,
                    new HashSet<>(Arrays.asList("refdag", "bbc")), Collections.emptySet(), usString("Descr")));
    gamingGoal = BudgetGoal.createNoGoInstance(dayBeforeYesterday,
            ActivityCategory.createInstance(UUID.randomUUID(), usString("gaming"), false,
                    new HashSet<>(Arrays.asList("games")), Collections.emptySet(), usString("Descr")));
    socialGoal = TimeZoneGoal.createInstance(dayBeforeYesterday,
            ActivityCategory.createInstance(UUID.randomUUID(), usString("social"), false,
                    new HashSet<>(Arrays.asList("social")), Collections.emptySet(), usString("Descr")),
            Collections.emptyList());
    shoppingGoal = BudgetGoal
            .createInstance(dayBeforeYesterday,
                    ActivityCategory.createInstance(UUID.randomUUID(), usString("shopping"), false,
                            new HashSet<>(Arrays.asList("webshop")), Collections.emptySet(), usString("Descr")),
                    1);
    shoppingGoalHistoryItem = shoppingGoal.cloneAsHistoryItem(yesterday);

    // Set up UserAnonymized instance.
    MessageDestination anonMessageDestinationEntity = MessageDestination
            .createInstance(PublicKeyUtil.generateKeyPair().getPublic());
    Set<Goal> goals = new HashSet<>(
            Arrays.asList(gamblingGoal, gamingGoal, socialGoal, shoppingGoal, shoppingGoalHistoryItem));
    deviceAnonEntity = DeviceAnonymized.createInstance(0, operatingSystem, "Unknown", 0, Optional.empty());
    userAnonEntity = UserAnonymized.createInstance(anonMessageDestinationEntity, goals);
    userAnonEntity.addDeviceAnonymized(deviceAnonEntity);
    userAnonDto = UserAnonymizedDto.createInstance(userAnonEntity);
    deviceAnonDto = DeviceAnonymizedDto.createInstance(deviceAnonEntity);
    userAnonZoneId = userAnonDto.getTimeZone();
}

From source file:fr.mby.portal.coreimpl.configuration.PropertiesConfigurationManager.java

@Override
public Collection<String> getConfigurationKeys(final String tag) throws IllegalArgumentException {
    Set<String> keys = this.keysByTag.get(tag);

    if (keys == null) {
        keys = Collections.emptySet();
    }/*from w ww.ja v a 2 s .  c  o m*/

    return keys;
}

From source file:de.javadesign.cdi.extension.spring.SpringBean.java

@Override
public Set<InjectionPoint> getInjectionPoints() {

    return Collections.emptySet();
}

From source file:nu.yona.server.goals.service.ActivityCategoryService.java

@CacheEvict(value = "activityCategorySet", key = "'instance'")
@Transactional//from  ww  w. jav a  2 s.co  m
public ActivityCategoryDto addActivityCategory(ActivityCategoryDto activityCategoryDto) {
    logger.info("Adding activity category '{}' with ID '{}'",
            activityCategoryDto.getName(Translator.EN_US_LOCALE), activityCategoryDto.getId());
    assertNoDuplicateNames(Collections.emptySet(), activityCategoryDto.getLocalizableNameByLocale());
    return ActivityCategoryDto
            .createInstance(repository.save(activityCategoryDto.createActivityCategoryEntity()));
}

From source file:org.jasig.irclog.ChannelLogger.java

/**
 * Set {@link IrcEvent} classes that should not be logged. By default {@link JoinEvent}, {@link KickEvent}
 * {@link PartEvent}, and {@link ModeEvent} are ignored. Providing any Set here overrides these defaults.
 *//*from  w  w w.  ja v a  2 s  .  co m*/
public void setIgnoredEvents(Set<Class<? extends IrcEvent>> ignoredEvents) {
    if (ignoredEvents == null) {
        this.ignoredEvents = Collections.emptySet();
    } else {
        this.ignoredEvents = ignoredEvents;
    }
}

From source file:com.netflix.nicobar.core.archive.JarScriptArchiveTest.java

@Test
public void testLoadWithModuleSpec() throws Exception {
    URL rootPathUrl = getClass().getClassLoader().getResource(TEST_MODULE_SPEC_JAR.getResourcePath());
    Path rootPath = Paths.get(rootPathUrl.toURI()).toAbsolutePath();

    // if the module spec isn't provided, it should be discovered in the jar
    JarScriptArchive scriptArchive = new JarScriptArchive.Builder(rootPath).build();
    ScriptModuleSpec moduleSpec = scriptArchive.getModuleSpec();
    assertEquals(moduleSpec.getModuleId(), TEST_MODULE_SPEC_JAR.getModuleId());
    assertEquals(moduleSpec.getModuleDependencies(), Collections.emptySet());
    Map<String, String> expectedMetadata = new HashMap<String, String>();
    expectedMetadata.put("metadataName1", "metadataValue1");
    expectedMetadata.put("metadataName2", "metadataValue2");
}

From source file:com.xpn.xwiki.plugin.skinx.CssSkinFileExtensionPlugin.java

/**
 * {@inheritDoc}//from  ww  w .  j a  va 2  s  .  co m
 * <p>
 * There is no support for always used skinfile-based extensions.
 * </p>
 * 
 * @see AbstractSkinExtensionPlugin#getAlwaysUsedExtensions(XWikiContext)
 */
@Override
public Set<String> getAlwaysUsedExtensions(XWikiContext context) {
    return Collections.emptySet();
}