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:net.sf.infrared.web.customtags.ContainsTag.java

public int doStartTag() throws JspException {
    Object formBean = RequestUtils.lookup(pageContext, name, scope);

    // Able to get an value for instance as Struts creates page context variable
    // with the same name as the id in the logic:iterate tag. Thus for each iteration
    // the value of this variable is updated.

    String instance = (String) RequestUtils.lookup(pageContext, selectedName, scope);
    flag = Boolean.valueOf(notContains).booleanValue();

    Set currentInstance = null;/*w ww .j a v  a 2 s  .c o m*/
    try {
        currentInstance = (Set) PropertyUtils.getProperty(formBean, property);
    } catch (Exception e) {
        logger.error("Unable to find the property " + property + " in the bean", e);
    }

    if ((currentInstance.contains(instance) && !flag) || (!currentInstance.contains(instance) && flag))
        return (EVAL_BODY_INCLUDE);
    else
        return (SKIP_BODY);
}

From source file:org.zols.datastore.validator.TV4.java

public Boolean validate(Object data, String schema)
        throws ScriptException, NoSuchMethodException, JsonProcessingException {
    System.out.println("Schema \n--------- \n " + schema);
    Invocable inv = (Invocable) engine;
    Object schemaToJavaScript = inv.invokeMethod(json, "parse", schema);
    Object dataToJavaScript = inv.invokeMethod(json, "parse", mapper.writeValueAsString(data));

    System.out.println("Data \n--------- \n " + mapper.writeValueAsString(data));

    Object validation = inv.invokeFunction("validate", dataToJavaScript, schemaToJavaScript);

    Object result = inv.invokeMethod(json, "stringify", validation);
    return Boolean.valueOf(result.toString());
}

From source file:com.synapticpath.pisecure.modules.LogglyEventLoggerModule.java

@Override
public void configure(Config config) throws Exception {
    postRequestUrl = config.getProperty("loggly.logger.post.url", true);
    searchRequestUrl = config.getProperty("loggly.logger.search.url", true);
    eventsRequestUrl = config.getProperty("loggly.logger.events.url", true);

    disabled = Boolean.valueOf(config.getProperty("loggly.logger.disabled", "true"));

    tag = config.getProperty("loggly.tag", true);
    token = config.getProperty("loggly.token", true);

    String username = config.getProperty("loggly.username", true);
    String password = config.getProperty("loggly.password", true);

    String userpass = username + ":" + password;

    auth = new sun.misc.BASE64Encoder().encode(userpass.getBytes());

}

From source file:org.apache.smscserver.config.spring.CommandFactoryBeanDefinitionParser.java

/**
 * {@inheritDoc}//from   w w w .j av a2 s .  c  om
 */
@SuppressWarnings("unchecked")
@Override
protected void doParse(final Element element, final ParserContext parserContext,
        final BeanDefinitionBuilder builder) {

    BeanDefinitionBuilder factoryBuilder = BeanDefinitionBuilder
            .genericBeanDefinition(CommandFactoryFactory.class);

    ManagedMap commands = new ManagedMap();

    List<Element> childs = SpringUtil.getChildElements(element);

    for (Element commandElm : childs) {
        String name = commandElm.getAttribute("protocol-id");
        Object bean = SpringUtil.parseSpringChildElement(commandElm, parserContext, builder);
        commands.put(name, bean);
    }

    factoryBuilder.addPropertyValue("commandMap", commands);

    if (StringUtils.hasText(element.getAttribute("use-default"))) {
        factoryBuilder.addPropertyValue("useDefaultCommands",
                Boolean.valueOf(element.getAttribute("use-default")));
    }

    BeanDefinition factoryDefinition = factoryBuilder.getBeanDefinition();
    String factoryId = parserContext.getReaderContext().generateBeanName(factoryDefinition);

    BeanDefinitionHolder factoryHolder = new BeanDefinitionHolder(factoryDefinition, factoryId);
    this.registerBeanDefinition(factoryHolder, parserContext.getRegistry());

    // set the factory on the listener bean
    builder.getRawBeanDefinition().setFactoryBeanName(factoryId);
    builder.getRawBeanDefinition().setFactoryMethodName("createCommandFactory");

}

From source file:com.aliyun.odps.ship.upload.BlockUploader.java

public BlockUploader(BlockInfo blockInfo, TunnelUploadSession tus, SessionHistory sh) throws IOException {
    this.blockInfo = blockInfo;
    this.blockId = blockInfo.getBlockId();

    this.uploadSession = tus;
    this.sessionHistory = sh;
    this.isScan = tus.isScan();

    isDiscardBadRecord = Boolean.valueOf(DshipContext.INSTANCE.get(Constants.DISCARD_BAD_RECORDS));
    badRecords = 0;// w  w w. j av a2s . c  om
    if (DshipContext.INSTANCE.get(Constants.MAX_BAD_RECORDS) != null) {
        maxBadRecords = Long.valueOf(DshipContext.INSTANCE.get(Constants.MAX_BAD_RECORDS));
    }
}

From source file:curly.commons.github.GitHubAuthenticationMethodHandler.java

@SuppressWarnings("unchecked")
private OctoUser from(OAuth2Authentication auth) {
    Authentication userAuthentication = auth.getUserAuthentication();
    if (userAuthentication != null) {
        try {//ww w  .  java2s . com
            LinkedHashMap<String, Object> map = (LinkedHashMap<String, Object>) userAuthentication.getDetails();
            return new OctoUser(String.valueOf(map.get("email")),
                    Boolean.valueOf(String.valueOf(map.get("hireable"))),
                    Long.valueOf(String.valueOf(map.get("id"))),
                    Integer.valueOf(String.valueOf(map.get("followers"))),
                    Integer.valueOf(String.valueOf(map.get("following"))),
                    Integer.valueOf(String.valueOf(map.get("public_repos"))),
                    String.valueOf(map.get("avatar_url")), String.valueOf(map.get("blog")),
                    String.valueOf(map.get("company")), null, String.valueOf(map.get("html_url")), null,
                    String.valueOf(map.get("login")), String.valueOf(map.get("name")),
                    String.valueOf(map.get("type")), String.valueOf(map.get("url")));

        } catch (ClassCastException e) {
            log.error("Cannot build OctoUser due to a ClassCastException {}", e);
        }
    }
    log.debug("Returning no user due to previous errors or no UserAuthentication detected");
    return null;
}

From source file:cd.go.contrib.elasticagents.dockerswarm.elasticagent.model.reports.DockerNode.java

private String getManagerStatus(ManagerStatus managerStatus) {
    if (managerStatus == null) {
        return null;
    }/*from  w  w w. j av  a2s .  c o m*/

    if ("manager".equalsIgnoreCase(role)) {
        if (managerStatus.leader() != null && Boolean.valueOf(managerStatus.leader())) {
            return "Leader";
        } else {
            return capitalize(managerStatus.reachability());
        }
    }
    return null;
}

From source file:com.enonic.cms.web.main.UpgradeController.java

/**
 * Handle upgrade page mechanism./*from   w w  w  .j a va2  s . co  m*/
 */
@RequestMapping(value = "/upgrade_db", method = RequestMethod.POST)
public ModelAndView handleUpgrade(HttpServletRequest req, HttpServletResponse res) throws Exception {
    boolean authenticated = doAuthenticate(req);

    if (authenticated) {
        if (Boolean.valueOf(req.getParameter("upgrade_all"))) {
            this.upgradeProcessTask.startUpgrade(true);
            redirectToSelf(req, res);
            return null;
        } else {
            this.upgradeProcessTask.startUpgrade(false);
            redirectToSelf(req, res);
            return null;
        }
    }

    Map<String, Object> model = populateViewModel(req, true, authenticated);
    return new ModelAndView("upgradePage", model);
}

From source file:net.projectmonkey.spring.acl.hbase.repository.AccessControlEntryValue.java

public AccessControlEntryValue(final byte[] key, final PermissionFactory permissionFactory) {
    Assert.notNull(key, "key must not be null");
    Assert.notNull(permissionFactory, "permissionFactory must not be null");
    String keyString = new String(key);
    String[] values = keyString.split(SEPARATOR);
    String authority = values[1];
    boolean principal = Boolean.valueOf(values[2]);
    int permissionMask = Integer.parseInt(values[3]);

    Assert.isTrue(values.length == 5, "Key must consist of 5 values separated by :");

    this.id = UUID.fromString(values[0]);
    this.sid = SidUtil.createSid(authority, principal);
    this.permission = permissionFactory.buildFromMask(permissionMask);
    this.granting = Boolean.valueOf(values[4]);
    this.authority = authority;
    this.key = key;
}

From source file:se.kodapan.io.http.wayback.Wayback.java

public void open() throws IOException {

    log.info("Opening BDB...");

    cacheMB = Integer.valueOf(System.getProperty(Wayback.class.getName() + ".cacheMB", "5"));
    readOnly = Boolean.valueOf(System.getProperty(Wayback.class.getName() + ".readOnly", "false"));

    if (!path.exists()) {
        log.info("Creating directory " + path.getAbsolutePath());
        if (!path.mkdirs()) {
            throw new IOException("Could not create directory " + path.getAbsolutePath());
        }/*from  w w w .  j  a  va 2  s. c  om*/

        EnvironmentConfig envConfig = new EnvironmentConfig();
        envConfig.setAllowCreate(true);
        envConfig.setTransactional(false);
        envConfig.setLocking(true);
        envConfig.setReadOnly(false);

        log.info("Creating environment " + envConfig.toString());

        environment = new Environment(path, envConfig);

        StoreConfig storeConfig = new StoreConfig();
        storeConfig.setAllowCreate(true);
        storeConfig.setTransactional(false);
        storeConfig.setReadOnly(false);

        log.info("Creating store '" + storeName + "' " + storeConfig.toString());

        entityStore = new EntityStore(environment, storeName, storeConfig);

        entityStore.close();
        environment.close();

        log.info("BDB has been created");

    }

    // open

    EnvironmentConfig envConfig = new EnvironmentConfig();
    envConfig.setAllowCreate(true);
    envConfig.setTransactional(false);
    envConfig.setLocking(false);
    envConfig.setReadOnly(readOnly);
    envConfig.setCacheSize(cacheMB * 1024 * 1024); //

    log.info("Opening environment " + envConfig.toString());

    environment = new Environment(path, envConfig);

    StoreConfig storeConfig = new StoreConfig();
    storeConfig.setAllowCreate(true);
    storeConfig.setTransactional(false);
    storeConfig.setReadOnly(readOnly);

    log.info("Opening store '" + storeName + "' " + storeConfig.toString());

    entityStore = new EntityStore(environment, storeName, storeConfig);

    waybackResponses = entityStore.getPrimaryIndex(Long.class, WaybackResponse.class);
    waybackContents = entityStore.getPrimaryIndex(Long.class, WaybackContent.class);
    waybackResponsesByRequest = entityStore.getSecondaryIndex(waybackResponses, WaybackRequest.class,
            "request");

    log.info("BDB has been opened.");

}