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:jp.go.aist.six.util.core.persist.castor.ExtendedCastorTemplate.java

/**
 *//*  w ww .ja v a2s .c o m*/
public boolean isPersistent(final Object entity) throws DataAccessException {
    Boolean isPersistent = (Boolean) execute(new CastorCallback() {
        public Object doInCastor(final Database database) throws PersistenceException {
            boolean result = database.isPersistent(entity);
            return Boolean.valueOf(result);
        }
    });

    return isPersistent.booleanValue();
}

From source file:metadata.etl.dataset.hdfs.HdfsMetadataEtl.java

@Override
public void extract() throws Exception {
    logger.info("Begin hdfs metadata extract! - " + prop.getProperty(Constant.WH_EXEC_ID_KEY));
    boolean isRemote = Boolean.valueOf(prop.getProperty(Constant.HDFS_REMOTE, "false"));
    if (isRemote) {
        extractRemote();/* w w  w.j av a2 s  . c  o m*/
    } else {
        extractLocal();
    }

}

From source file:io.fabric8.jolokia.facade.FabricServiceFacadeTest.java

@Test
public void testGetContainer() {

    // this can only be run if you have a fabric running...
    Assume.assumeTrue(Boolean.valueOf(System.getProperty("hasFabric")));

    FabricService service = getFabricService();

    Container[] containers = service.getContainers();

    for (Container container : containers) {
        System.out.println("container: " + container.getId());
        System.out.println("alive: " + container.isAlive());
        System.out.println("type: " + container.getType());
        System.out.println("ensembleServer: " + container.isEnsembleServer());
        System.out.println("JMX domains: " + container.getJmxDomains());
        System.out.println("Provision status: " + container.getProvisionStatus());
        //System.out.println("Provision list: " + container.getProvisionList());
    }/*from www .  j a  v a 2 s.c o m*/
}

From source file:edu.vt.middleware.servlet.filter.SessionAttributeFilter.java

/**
 * Initialize this filter.//w ww. ja  va  2 s  . c o  m
 *
 * @param  config  <code>FilterConfig</code>
 */
public void init(final FilterConfig config) {
    this.context = config.getServletContext();
    this.requireAttribute = Boolean.valueOf(config.getInitParameter(REQUIRE_ATTRIBUTE)).booleanValue();
    if (LOG.isDebugEnabled()) {
        LOG.debug("requireAttribute = " + this.requireAttribute);
    }

    final Enumeration<?> e = config.getInitParameterNames();
    while (e.hasMoreElements()) {
        final String name = (String) e.nextElement();
        if (!name.equals(REQUIRE_ATTRIBUTE)) {
            final String value = config.getInitParameter(name);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Loaded attribute name:value " + name + ":" + value);
            }

            final StringTokenizer st = new StringTokenizer(name);
            final String attrName = st.nextToken();
            final String attrValue = st.nextToken();

            this.attributes.put(attrName, Pattern.compile(attrValue));
            this.redirects.put(attrName, value);
            if (LOG.isDebugEnabled()) {
                LOG.debug("Stored attribute " + attrName + " for pattern " + attrValue + " with redirect of "
                        + value);
            }
        }
    }
}

From source file:gwtupload.server.UploadAction.java

@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);
    ServletContext ctx = config.getServletContext();
    removeSessionFiles = Boolean.valueOf(ctx.getInitParameter("removeSessionFiles"));
    removeData = Boolean.valueOf(ctx.getInitParameter("removeData"));

    logger.info("UPLOAD-ACTION init: removeSessionFiles=" + removeSessionFiles + ", removeData=" + removeData);
}

From source file:com.fluidops.iwb.widget.WidgetConfig.java

@Override
public boolean equals(Object obj) {
    if (obj instanceof WidgetConfig) {
        WidgetConfig other = (WidgetConfig) obj;
        if (input.toString().equals(other.input.toString()) && widget.equals(other.widget)
                && value.equals(other.value)
                && (Boolean.valueOf(applyToInstances).equals(Boolean.valueOf(other.applyToInstances))))
            return true;
    }/*from   w  w  w .j a v  a  2  s.  com*/
    return false;
}

From source file:io.pivotal.spring.cloud.cloudfoundry.HystrixAmqpServiceInfoCreator.java

@Override
@SuppressWarnings("unchecked")
public HystrixAmqpServiceInfo createServiceInfo(Map<String, Object> serviceData) {
    String id = (String) serviceData.get(CREDENTIALS_ID_KEY);
    Map<String, Object> credentials = getCredentials(serviceData);
    Map<String, Object> amqpCredentials = (Map<String, Object>) credentials.get(AMQP_CREDENTIALS_KEY);
    String uri = getUriFromCredentials(amqpCredentials);
    List<String> uris = (List<String>) amqpCredentials.get(URIS_ID_KEY);
    boolean sslEnabled = Boolean.valueOf(amqpCredentials.get(SSL_ID_KEY).toString());
    return new HystrixAmqpServiceInfo(id, uri, uris, sslEnabled);
}

From source file:hudson.model.BooleanParameterDefinition.java

public ParameterValue createValue(String value) {
    return new BooleanParameterValue(getName(), Boolean.valueOf(value), getDescription());
}

From source file:com.eazytec.webapp.filter.CustomAuthenticationProvider.java

License:asdf

public Authentication authenticate(Authentication authentication) throws AuthenticationException {
    String username = String.valueOf(authentication.getPrincipal()).toLowerCase();
    String password = String.valueOf(authentication.getCredentials());
    logger.debug("Checking authentication for user {}" + username);
    logger.debug("userResponse: {}" + captchaCaptureFilter.getCaptcha_response());
    if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) {
        throw new BadCredentialsException("No Username and/or Password Provided.");
    }//from  ww  w  .ja  v  a 2s . c o  m

    licensePreCheck();

    Boolean isCaptchaNeeded = Boolean
            .valueOf(PropertyReader.getInstance().getPropertyFromFile("Boolean", "system.captcha.needed"));

    Boolean adEnabled = Boolean
            .valueOf(PropertyReader.getInstance().getPropertyFromFile("Boolean", "system.ad.enabled"));

    // if(!adEnabled){

    if (isCaptchaNeeded && StringUtils.isBlank(captchaCaptureFilter.getCaptcha_response())) {
        throw new BadCredentialsException("Captcha Response is Empty");
    }

    if (isCaptchaNeeded) {
        // else {
        // Send HTTP request to validate user's Captcha
        boolean captchaPassed = SimpleImageCaptchaServlet.validateCaptcha(
                captchaCaptureFilter.getCaptcha_challenge(), captchaCaptureFilter.getCaptcha_response());

        // Check if valid
        if (captchaPassed) {
            logger.debug("Captcha is valid!");
            resetCaptchaFields();
        } else {
            logger.debug("Captcha is invalid!");
            resetCaptchaFields();

            throw new BPMAccountStatusException(I18nUtil.getMessageProperty("errors.captcha.mismatch"));
        }
    }
    User user = null;
    if (!adEnabled) {
        user = userService.getUserById(username);
    }
    if (user == null && adEnabled) {
        throw new BadCredentialsException(I18nUtil.getMessageProperty("errors.password.mismatch"));
    }
    if (user == null || !user.isEnabled() && !adEnabled) {
        throw new BPMAccountStatusException(I18nUtil.getMessageProperty("errors.password.mismatch"));
    }
    if (passwordEncoder.isPasswordValid(user.getPassword(), password, saltSource.getSalt(user))) {
        Set<GrantedAuthority> authorityList = (Set<GrantedAuthority>) user.getAuthorities();
        return new UsernamePasswordAuthenticationToken(user, password, authorityList);
    } else {
        if (adEnabled) {
            throw new BadCredentialsException(I18nUtil.getMessageProperty("errors.password.mismatch"));
        } else {
            throw new BPMAccountStatusException(I18nUtil.getMessageProperty("errors.password.mismatch"));
        }
    }
}

From source file:com.ponysdk.generator.PropertiesDictionnaryGenerator.java

public void generate(final String[] args) throws Exception {

    if (args.length > 0) {
        for (final String arg : args) {
            final String[] keyValue = arg.split("=");
            if (keyValue.length != 2)
                log.error("Invalid argument: " + arg);
            else {
                final String key = keyValue[0];
                final String value = keyValue[1];
                if ("verbose".equals(key)) {
                    if (Boolean.valueOf(value))
                        verbose = true;/*from w  ww  .  j av a2 s .c  o m*/
                } else {
                    log.error("Unsupported argument: " + arg);
                }
            }
        }
    }

    generateXml();
    generateDictionnary();
}