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:io.gravitee.management.standalone.jetty.JettyEmbeddedContainer.java

@Override
protected void doStart() throws Exception {
    AbstractHandler noContentHandler = new NoContentOutputErrorHandler();
    // This part is needed to avoid WARN while starting container.
    noContentHandler.setServer(server);/*from   w w w .  j  a  v  a2  s. c o  m*/
    server.addBean(noContentHandler);

    // Create the servlet context
    final ServletContextHandler context = new ServletContextHandler(server, "/management/*",
            ServletContextHandler.SESSIONS);

    // REST configuration
    final ServletHolder servletHolder = new ServletHolder(ServletContainer.class);
    servletHolder.setInitParameter("javax.ws.rs.Application", GraviteeApplication.class.getName());
    servletHolder.setInitOrder(0);
    context.addServlet(servletHolder, "/*");

    // Spring configuration
    System.setProperty(AbstractEnvironment.ACTIVE_PROFILES_PROPERTY_NAME, securityImplementation);

    AnnotationConfigWebApplicationContext webApplicationContext = new AnnotationConfigWebApplicationContext();
    webApplicationContext.register(SecurityConfiguration.class);
    webApplicationContext.setEnvironment((ConfigurableEnvironment) applicationContext.getEnvironment());
    webApplicationContext.setParent(applicationContext);

    context.addEventListener(new ContextLoaderListener(webApplicationContext));

    // Spring Security filter
    context.addFilter(new FilterHolder(new DelegatingFilterProxy("springSecurityFilterChain")), "/*",
            EnumSet.allOf(DispatcherType.class));

    // start the server
    server.start();
}

From source file:com.smartsheet.api.internal.SheetResourcesImplTest.java

@Test
public void testGetSheet() throws SmartsheetException, IOException {

    server.setResponseBody(new File("src/test/resources/getSheet.json"));
    Sheet sheet = sheetResource.getSheet(123123L, null, null, null, null, null, null, null);
    assertEquals(9, sheet.getColumns().size());
    assertEquals(0, sheet.getRows().size());

    Source source = sheet.getSource();
    assertNotNull(source.getId());// w w w .  ja  va 2  s. co m
    assertNotNull(source.getType());

    Set<Long> rowIds = new HashSet<Long>();
    rowIds.add(123456789L);
    rowIds.add(987654321L);

    sheet = sheetResource.getSheet(123123L, EnumSet.allOf(SheetInclusion.class),
            EnumSet.allOf(ObjectExclusion.class), rowIds, null, null, 1, 1);
    assertEquals(9, sheet.getColumns().size());
    assertEquals(0, sheet.getRows().size());
}

From source file:com.mysample.springbootsample.config.SecurityConfig.java

@Bean
public FilterRegistrationBean getSpringSecurityFilterChainBindedToError(
        @Qualifier("springSecurityFilterChain") Filter springSecurityFilterChain) {

    FilterRegistrationBean registration = new FilterRegistrationBean();
    registration.setFilter(springSecurityFilterChain);
    registration.setDispatcherTypes(EnumSet.allOf(DispatcherType.class));
    return registration;
}

From source file:org.ngrinder.user.controller.UserController.java

/**
 * Get user list on the given role.//from w  w w  .  ja v a2s .c o m
 *
 * @param model    model
 * @param role     role
 * @param pageable page info
 * @param keywords search keyword.
 * @return user/userList
 */
@PreAuthorize("hasAnyRole('A')")
@RequestMapping({ "", "/" })
public String getAll(ModelMap model, @RequestParam(required = false) Role role,
        @PageableDefaults Pageable pageable, @RequestParam(required = false) String keywords) {

    pageable = new PageRequest(pageable.getPageNumber(), pageable.getPageSize(),
            defaultIfNull(pageable.getSort(), new Sort(Direction.ASC, "userName")));
    Page<User> pagedUser;
    if (StringUtils.isEmpty(keywords)) {
        pagedUser = userService.getPagedAll(role, pageable);
    } else {
        pagedUser = userService.getPagedAll(keywords, pageable);
        model.put("keywords", keywords);
    }
    model.addAttribute("users", pagedUser);
    EnumSet<Role> roleSet = EnumSet.allOf(Role.class);
    model.addAttribute("roleSet", roleSet);
    model.addAttribute("role", role);
    putPageIntoModelMap(model, pageable);
    return "user/list";
}

From source file:com.devnexus.ting.web.controller.CallForPapersController.java

private void prepareReferenceData(ModelMap model, boolean isSecure) {
    final String reCaptchaEnabled = environment.getProperty("recaptcha.enabled");
    final String recaptchaPublicKey = environment.getProperty("recaptcha.publicKey");
    final String recaptchaPrivateKey = environment.getProperty("recaptcha.privateKey");

    if (Boolean.valueOf(reCaptchaEnabled)) {
        final ReCaptcha reCaptcha;
        reCaptcha = ReCaptchaFactory.newSecureReCaptcha(recaptchaPublicKey, recaptchaPrivateKey, true);

        if (isSecure) {
            ((ReCaptchaImpl) reCaptcha).setRecaptchaServer("https://www.google.com/recaptcha/api");
        } else {/*from   w  ww . ja  va 2  s .  co m*/
            ((ReCaptchaImpl) reCaptcha).setRecaptchaServer("http://www.google.com/recaptcha/api");
        }
        model.addAttribute("reCaptchaHtml", reCaptcha.createRecaptchaHtml(null, null));
    }

    model.addAttribute("reCaptchaEnabled", reCaptchaEnabled);

    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);

}

From source file:org.hawkular.inventory.impl.tinkerpop.provider.TitanProvider.java

@Override
public TitanGraph instantiateGraph(Configuration configuration) {
    return TitanFactory.open(new MapConfiguration(configuration.prefixedWith(ALLOWED_PREFIXES)
            .getImplementationConfiguration(EnumSet.allOf(PropertyKeys.class))));
}

From source file:com.tcloud.bee.key.server.jetty.config.WebAppInitializer.java

/**
 * Register Spring Security/*  www  .j a va  2  s  .  c o  m*/
 * 
 * @param servletContext
 */
private void configureSpringSecurityFilter(ServletContext servletContext) {

    DelegatingFilterProxy delegatingFilterProxy = new DelegatingFilterProxy("springSecurityFilterChain");

    FilterRegistration.Dynamic securityFilterDynamic = servletContext.addFilter("securityFilter",
            delegatingFilterProxy);
    securityFilterDynamic.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");
}

From source file:au.org.ala.biocache.util.MimeType.java

/**
 * Retrieve a list of image mime types supported.
 *
 * @return/*  w w  w. j  av a 2s.co  m*/
 */
public static List<String> getImageMimeTypes() {
    List<String> allMimeTypes = new ArrayList<String>();
    for (MimeType mt : EnumSet.allOf(MimeType.class)) {
        //FIXME this is a bit of hack. Some sources are serving images
        //with application/octlet mime type
        if (mt.getMimeType().startsWith("image")) {
            allMimeTypes.add(mt.getMimeType());
        }
    }
    return allMimeTypes;
}

From source file:com.vmware.upgrade.progress.DefaultExecutionStateAggregatorTest.java

private Set<ExecutionState> computeStateTransitions(final ExecutionState state) {
    EnumSet<ExecutionState> states = EnumSet.allOf(ExecutionState.class);
    CollectionUtils.filter(states, new Predicate() {
        @Override// www. j a  v a2s  .  com
        public boolean evaluate(Object object) {
            return state.canTransitionTo((ExecutionState) object);
        }
    });
    return states;
}

From source file:net.iaeste.iws.core.services.ExchangeCSVFetchService.java

private String findDomesticOffers(final Authentication authentication, final FetchOffersRequest request) {
    final List<String> offerIds = request.getIdentifiers();
    final Page page = request.getPage();
    final Integer exchangeYear = request.getExchangeYear();

    final List<OfferView> found;
    if (offerIds.isEmpty()) {
        //paging could make a problem here if it returns only some offers
        final Set<OfferState> states = EnumSet.allOf(OfferState.class);
        states.remove(OfferState.DELETED);
        found = viewsDao.findDomesticOffers(authentication, exchangeYear, states, false, page);
    } else {/*from  w w w.j a  v  a2s  . c  om*/
        found = viewsDao.findDomesticOffersByOfferIds(authentication, exchangeYear, offerIds);
    }

    return convertOffersToCsv(found, OfferFields.Type.DOMESTIC);
}