Example usage for java.util EnumSet allOf

List of usage examples for java.util EnumSet allOf

Introduction

In this page you can find the example usage for java.util EnumSet allOf.

Prototype

public static <E extends Enum<E>> EnumSet<E> allOf(Class<E> elementType) 

Source Link

Document

Creates an enum set containing all of the elements in the specified element type.

Usage

From source file:com.devnexus.ting.web.controller.admin.ReviewCfpController.java

private void prepareReferenceData(ModelMap model) {

    final Event currentEvent = businessService.getCurrentEvent();
    model.addAttribute("currentEvent", currentEvent);

    final Set<CfpSubmissionStatusType> cfpSubmissionStatusTypes = EnumSet.allOf(CfpSubmissionStatusType.class);
    model.addAttribute("cfpSubmissionStatusTypes", cfpSubmissionStatusTypes);

}

From source file:io.swagger.inflector.config.DirectionDeserializerTest.java

@DataProvider(name = BOOLEAN)
private Object[][] listFilesWithBoolean() {
    return new Object[][] { { "validation-as-false.yaml", EnumSet.noneOf(Configuration.Direction.class) },
            { "validation-as-true.yaml", EnumSet.allOf(Configuration.Direction.class) } };
}

From source file:guru.nidi.raml.doc.OptionParser.java

@SuppressWarnings("static-access")
protected Options createOptions() {
    final String features = StringUtils.join(EnumSet.allOf(Feature.class).toArray(), ", ").toLowerCase();
    return new Options()
            .addOption(withDescription("Target directory to write the output.\nDefault: raml-doc")
                    .isRequired(false).withArgName("Directory").hasArg(true).create('t'))
            .addOption(withDescription("Features to enable.\nComma separated list of these features: "
                    + features + "\nDefault: " + features).isRequired(false).withArgName("Features")
                            .hasArg(true).create('f'))
            .addOption(withDescription("The base URI to use.\nDefault: As defined in RAML").isRequired(false)
                    .withArgName("URI").hasArg(true).create('b'))
            .addOption(withDescription("Base URI parameters.\nFormat: parameter=value,...").isRequired(false)
                    .withArgName("Parameters").hasArg(true).create('p'))
            .addOption(withDescription(/*w  ww  .ja  v  a 2s.  c o  m*/
                    "Customization location.\nfavicon.ico, custom-variables.less, custom-style.less are taken from there, if existing\nDefault: Location of RAML-1")
                            .isRequired(false).withArgName("Directory").hasArg(true).create('c'));
}

From source file:org.elasticsearch.ingest.attachment.AttachmentProcessorTests.java

@Before
public void createStandardProcessor() throws IOException {
    processor = new AttachmentProcessor(randomAlphaOfLength(10), "source_field", "target_field",
            EnumSet.allOf(AttachmentProcessor.Property.class), 10000, false);
}

From source file:org.apache.nifi.web.security.anonymous.NiFiAnonymousUserFilter.java

@Override
protected Authentication createAuthentication(HttpServletRequest request) {
    Authentication authentication = null;

    try {// w w  w  .  j  a va2 s  .  com
        // load the anonymous user from the database
        NiFiUser user = userService.getUserByDn(NiFiUser.ANONYMOUS_USER_IDENTITY);

        // if this is an unsecure request allow full access
        if (!request.isSecure()) {
            user.getAuthorities().addAll(EnumSet.allOf(Authority.class));
        }

        // only create an authentication token if the anonymous user has some authorities
        if (!user.getAuthorities().isEmpty()) {
            NiFiUserDetails userDetails = new NiFiUserDetails(user);

            // get the granted authorities
            authentication = new NiFiAuthorizationToken(userDetails);
        }
    } catch (AdministrationException ase) {
        // record the issue
        anonymousUserFilterLogger
                .warn("Unable to load anonymous user from accounts database: " + ase.getMessage());
        if (anonymousUserFilterLogger.isDebugEnabled()) {
            anonymousUserFilterLogger.warn(StringUtils.EMPTY, ase);
        }
    }
    return authentication;
}

From source file:com.github.fge.jsonschema.core.keyword.syntax.checkers.draftv3.DraftV3TypeKeywordSyntaxChecker.java

@Override
protected void checkValue(final Collection<JsonPointer> pointers, final MessageBundle bundle,
        final ProcessingReport report, final SchemaTree tree) throws ProcessingException {
    final JsonNode node = tree.getNode().get(keyword);

    if (node.isTextual()) {
        final String found = node.textValue();
        if (!typeIsValid(found))
            report.error(newMsg(tree, bundle, "common.typeDisallow.primitiveType.unknown")
                    .putArgument("found", found).putArgument("valid", EnumSet.allOf(NodeType.class)));
        return;//from w  ww.  ja va  2s  .c o  m
    }

    final int size = node.size();
    final Set<Equivalence.Wrapper<JsonNode>> set = Sets.newHashSet();

    JsonNode element;
    NodeType type;
    boolean uniqueItems = true;

    for (int index = 0; index < size; index++) {
        element = node.get(index);
        type = NodeType.getNodeType(element);
        uniqueItems = set.add(EQUIVALENCE.wrap(element));
        if (type == OBJECT) {
            pointers.add(JsonPointer.of(keyword, index));
            continue;
        }
        if (type != STRING) {
            report.error(newMsg(tree, bundle, "common.array.element.incorrectType").putArgument("index", index)
                    .putArgument("expected", EnumSet.of(OBJECT, STRING)).putArgument("found", type));
            continue;
        }
        if (!typeIsValid(element.textValue()))
            report.error(newMsg(tree, bundle, "common.typeDisallow.primitiveType.unknown").put("index", index)
                    .putArgument("found", element.textValue())
                    .putArgument("valid", EnumSet.allOf(NodeType.class)));
    }

    if (!uniqueItems)
        report.error(newMsg(tree, bundle, "common.array.duplicateElements"));
}

From source file:ru.asmsoft.p2p.fsm.NodeStateMachine.java

@Override
public void configure(StateMachineStateConfigurer<NodeStates, NodeEvents> states) throws Exception {
    states.withStates().initial(NodeStates.CONNECTED).states(EnumSet.allOf(NodeStates.class));
}

From source file:org.apache.sentry.policy.indexer.TestIndexerAuthorizationProviderSpecialCases.java

@Test
public void testDuplicateEntries() throws Exception {
    Subject user1 = new Subject("user1");
    Indexer indexer1 = new Indexer("indexer1");
    Set<? extends Action> actions = EnumSet.allOf(IndexerModelAction.class);
    policyFile.addGroupsToUser(user1.getName(), true, "group1", "group1")
            .addRolesToGroup("group1", true, "role1", "role1").addPermissionsToRole("role1", true,
                    "indexer=" + indexer1.getName(), "indexer=" + indexer1.getName());
    policyFile.write(iniFile);// w  w w  .  jav  a  2  s . c  o m
    IndexerPolicyFileBackend policy = new IndexerPolicyFileBackend(initResource);
    authzProvider = new LocalGroupResourceAuthorizationProvider(initResource, policy);
    List<? extends Authorizable> authorizableHierarchy = ImmutableList.of(indexer1);
    Assert.assertTrue(authorizableHierarchy.toString(),
            authzProvider.hasAccess(user1, authorizableHierarchy, actions, ActiveRoleSet.ALL));
}

From source file:org.apache.sentry.policy.search.TestSearchAuthorizationProviderSpecialCases.java

@Test
public void testDuplicateEntries() throws Exception {
    Subject user1 = new Subject("user1");
    Collection collection1 = new Collection("collection1");
    Set<? extends Action> actions = EnumSet.allOf(SearchModelAction.class);
    policyFile.addGroupsToUser(user1.getName(), true, "group1", "group1")
            .addRolesToGroup("group1", true, "role1", "role1").addPermissionsToRole("role1", true,
                    "collection=" + collection1.getName(), "collection=" + collection1.getName());
    policyFile.write(iniFile);//from   w  w  w.j  a va 2  s. c  o m
    SearchPolicyFileBackend policy = new SearchPolicyFileBackend(initResource);
    authzProvider = new LocalGroupResourceAuthorizationProvider(initResource, policy);
    List<? extends Authorizable> authorizableHierarchy = ImmutableList.of(collection1);
    Assert.assertTrue(authorizableHierarchy.toString(),
            authzProvider.hasAccess(user1, authorizableHierarchy, actions, ActiveRoleSet.ALL));
}

From source file:com.devnexus.ting.web.controller.admin.AdminCallForPapersController.java

private void prepareReferenceData(ModelMap model) {

    final Event currentEvent = businessService.getCurrentEvent();
    model.addAttribute("currentEvent", currentEvent);

    final Set<PresentationType> presentationTypes = EnumSet.allOf(PresentationType.class);
    model.addAttribute("presentationTypes", presentationTypes);

    final Set<SkillLevel> skillLevels = EnumSet.allOf(SkillLevel.class);
    model.addAttribute("skillLevels", skillLevels);

    final Set<CfpSubmissionStatusType> cfpSubmissionStatusTypes = EnumSet.allOf(CfpSubmissionStatusType.class);
    model.addAttribute("cfpSubmissionStatusTypes", cfpSubmissionStatusTypes);

    final List<Speaker> allSpeakers = businessService.getAllSpeakersOrderedByName();
    model.addAttribute("allSpeakers", allSpeakers);
}