Example usage for java.lang Boolean valueOf

List of usage examples for java.lang Boolean valueOf

Introduction

In this page you can find the example usage for java.lang Boolean valueOf.

Prototype

public static Boolean valueOf(String s) 

Source Link

Document

Returns a Boolean with a value represented by the specified string.

Usage

From source file:com.digitalpebble.storm.crawler.filtering.HostURLFilterTest.java

private HostURLFilter createFilter(boolean ignoreOutsideHost, boolean ignoreOutsideDomain) {
    HostURLFilter filter = new HostURLFilter();
    ObjectNode filterParams = new ObjectNode(JsonNodeFactory.instance);
    filterParams.put("ignoreOutsideHost", Boolean.valueOf(ignoreOutsideHost));
    filterParams.put("ignoreOutsideDomain", Boolean.valueOf(ignoreOutsideDomain));
    Map<String, Object> conf = new HashMap<String, Object>();
    filter.configure(conf, filterParams);
    return filter;
}

From source file:com.netflix.discovery.converters.jackson.serializer.PortWrapperXmlDeserializer.java

@Override
public InstanceInfo.PortWrapper deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
    boolean enabled = false;
    int port = 0;
    while (jp.nextToken() == JsonToken.FIELD_NAME) {
        String fieldName = jp.getCurrentName();
        jp.nextToken(); // to point to value
        if ("enabled".equals(fieldName)) {
            enabled = Boolean.valueOf(jp.getValueAsString());
        } else if (fieldName == null || "".equals(fieldName)) {
            String value = jp.getValueAsString();
            port = value == null ? 0 : Integer.parseInt(value);
        } else {/*  w w  w  .ja  v  a 2  s.c o m*/
            throw new JsonMappingException("Unexpected field " + fieldName, jp.getCurrentLocation());
        }
    }
    return new InstanceInfo.PortWrapper(enabled, port);
}

From source file:ru.trett.cis.validators.DeviceTypeValidator.java

public void validateType(DeviceType deviceType, ValidationContext context) {
    RequestContext requestContext = RequestContextHolder.getRequestContext();
    Boolean exists = Boolean
            .valueOf(requestContext.getExternalContext().getRequestParameterMap().get("exists"));

    if (inventoryService.getDeviceTypeByName(deviceType.getType()) != null && !exists)
        context.getMessageContext().addMessage(new MessageBuilder().error().source("type").code("not.unique")
                .defaultText("Already present").build());
}

From source file:ru.trett.cis.validators.DeviceBrandValidator.java

public void validateBrand(DeviceBrand deviceBrand, ValidationContext context) {
    RequestContext requestContext = RequestContextHolder.getRequestContext();
    Boolean exists = Boolean
            .valueOf(requestContext.getExternalContext().getRequestParameterMap().get("exists"));

    if (inventoryService.getDeviceBrandByName(deviceBrand.getBrand()) != null && !exists)
        context.getMessageContext().addMessage(new MessageBuilder().error().source("brand").code("not.unique")
                .defaultText("Already present").build());
}

From source file:fr.aliasource.webmail.disposition.DispositionNotificationAction.java

@Override
public void execute(IProxy p, IParameterSource req, IResponder responder) {
    DispositionStorage dispositionStorage = new DispositionStorageCache(p.getAccount());
    MessageId messageId = getMessageId(req);
    boolean accept = Boolean.valueOf(req.getParameter("accept"));
    if (accept) {
        IFolder folder = getFolder(p, req);
        MailMessage message = p.getAccount().getLoadMessages().load(folder, messageId);
        logger.info("send notification for mid : " + messageId.getImapId());
        dispositionStorage.notificationSent(message);
    } else {/*from w w  w. j  a  va  2  s. co m*/
        logger.info("decline notification for mid : " + messageId.getImapId());
        dispositionStorage.notificationDenied(messageId);
    }
}

From source file:org.lightadmin.logging.configurer.LoggingConfigurerSettings.java

public LoggingConfigurerSettings(ServletContext servletContext) {
    this.applicationBaseUrl = servletContext.getInitParameter(LIGHT_CONFIGURER_BASE_URL);
    this.demoMode = Boolean.valueOf(servletContext.getInitParameter(LIGHT_CONFIGURER_DEMO_MODE));
    setBackToSiteUrl(servletContext.getInitParameter(LIGHT_CONFIGURER_BACK_TO_SITE_URL));
}

From source file:org.sakuli.loader.BeanLoader.java

public static Environment loadEnvironment(String resumeOnException) {
    logger.debug("Get an new environment object over BeanFactory.");
    return new Environment(Boolean.valueOf(resumeOnException));
}

From source file:com.microsoft.tfs.core.clients.workitem.internal.rules.cache.RulePersonScopeCache.java

public synchronized boolean isRuleInScope(final int personID, final boolean inversePerson) {
    final Integer key = new Integer(personID);
    Boolean matches = personIds.get(key);
    if (matches == null) {
        matches = Boolean.valueOf(currentUserMatches(personID));
        personIds.put(key, matches);/*  ww  w .jav a  2s.  c om*/
    }

    return inversePerson != matches.booleanValue();
}

From source file:functionaltests.RestSchedulerKillTest.java

@Test
public void testKillScheduler() throws Exception {
    String schedulerUrl = getResourceUrl("kill");
    HttpPut httpPut = new HttpPut(schedulerUrl);
    setSessionHeader(httpPut);//from  ww  w .j av a  2s .co  m
    HttpResponse response = executeUriRequest(httpPut);
    assertHttpStatusOK(response);
    assertTrue(Boolean.valueOf(getContent(response)));
    assertTrue(KILLED.equals(getScheduler().getStatus()));
}

From source file:com.xwiki.authentication.guanxi.GuanxiShibConfigurator.java

/**
 *   /*from  w ww.j a  v  a 2 s . c o  m*/
 *   Load the config from file 
 */
public static GuanxiShibConfig getGuanxiShibConfig() {

    if (log.isDebugEnabled()) {
        log.debug("Loading GuanxiShibConfig using " + GuanxiShibConstants.PROPERTIES_FILE
                + " for GX-Auth values");
    }

    GuanxiShibConfig config = new GuanxiShibConfig();

    try {
        // load the config from file
        InputStream propertiesIn = null;
        propertiesIn = GuanxiShibAuthenticator.class.getResourceAsStream(GuanxiShibConstants.PROPERTIES_FILE);

        Properties configProperties = new Properties();
        configProperties.load(propertiesIn);

        // set properties file
        config.setPropertiesFile(configProperties.getProperty(GuanxiShibConstants.PROPERTIES_FILE));

        if (log.isDebugEnabled()) {
            log.debug("GuanxiAuthenticator Properties file set to: " + config.getPropertiesFile());
        }

        // set create users
        config.setCreateUsers(
                Boolean.valueOf(configProperties.getProperty(GuanxiShibConstants.CREATE_USERS)).booleanValue());

        if (log.isDebugEnabled()) {
            log.debug("GuanxiAuthenticator set to create users: " + config.isCreateUsers());
        }

        // set update info 
        config.setUpdateInfo(
                Boolean.valueOf(configProperties.getProperty(GuanxiShibConstants.UPDATE_INFO)).booleanValue());

        if (log.isDebugEnabled()) {
            log.debug("GuanxiAuthenticator set to update info: " + config.isUpdateInfo());
        }

        // set default groups 
        List defaultGroups = new ArrayList();

        String groups = configProperties.getProperty(GuanxiShibConstants.DEFAULT_XWIKI_GROUPS);

        if (groups != null) {
            defaultGroups.addAll(StringUtils.toListDelimitedByComma(groups));

            if (log.isDebugEnabled()) {
                for (Iterator i = defaultGroups.iterator(); i.hasNext();) {
                    log.debug("Adding group " + i.next().toString() + " to list of groups");
                }
            }
        }

        config.setDefaultGroups(defaultGroups);

        // set default user space 
        config.setDefaultUserSpace(configProperties.getProperty(GuanxiShibConstants.DEFAULT_XWIKI_USER_SPACE));

        if (log.isDebugEnabled()) {
            log.debug("GuanxiAuthenticator using " + config.getDefaultUserSpace() + " as user space");
        }

        // set userid header 
        config.setHeaderUserid(configProperties.getProperty(GuanxiShibConstants.HEADER_USERID));

        if (log.isDebugEnabled()) {
            log.debug("GuanxiAuthenticator userid header set to " + config.getHeaderUserid());
        }

        // set header mail
        config.setHeaderMail(configProperties.getProperty(GuanxiShibConstants.HEADER_MAIL));

        if (log.isDebugEnabled()) {
            log.debug("GuanxiAuthenticator mail header set to " + config.getHeaderMail());
        }

        // set header fullname
        config.setHeaderFullname(configProperties.getProperty(GuanxiShibConstants.HEADER_FULLNAME));

        if (log.isDebugEnabled()) {
            log.debug("GuanxiAuthenticator fullname header set to " + config.getHeaderFullname());
        }

        // set 
        config.setReplacementChar(configProperties.getProperty(GuanxiShibConstants.REPLACEMENT_CHAR));

        if (log.isDebugEnabled()) {
            log.debug("GuanxiAuthenticator replacement character set to " + config.getReplacementChar());
        }

    } catch (IOException e) {
        log.warn("Unable to read properties from file, defaulting", e);
    }

    return config;

}