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.testdriven.psiprobe.controllers.apps.AjaxToggleContextController.java

protected ModelAndView handleContext(String contextName, Context context, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    if (!request.getContextPath().equals(contextName) && context != null) {
        try {//from w  w  w  . j  a v a  2 s .c  o  m
            if (context.getAvailable()) {
                logger.info(request.getRemoteAddr() + " requested STOP of " + contextName);
                getContainerWrapper().getTomcatContainer().stop(contextName);
            } else {
                logger.info(request.getRemoteAddr() + " requested START of " + contextName);
                getContainerWrapper().getTomcatContainer().start(contextName);
            }
        } catch (Throwable e) {
            logger.error(e);
            //
            // make sure we always re-throw ThreadDeath
            //
            if (e instanceof ThreadDeath) {
                throw (ThreadDeath) e;
            }
        }
    }
    return new ModelAndView(getViewName(), "available",
            Boolean.valueOf(context != null && context.getAvailable()));
}

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

private URLFilter createFilter(boolean removeAnchor) {
    ObjectNode filterParams = new ObjectNode(JsonNodeFactory.instance);
    filterParams.put("removeAnchorPart", Boolean.valueOf(removeAnchor));
    return createFilter(filterParams);
}

From source file:org.openmrs.module.casereport.CrossOriginResourceSharingFilter.java

/**
 * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
 *//*w  ww. j a va 2s .  c  om*/
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain)
        throws IOException, ServletException {

    if (log.isDebugEnabled()) {
        log.debug("In Cors filter...");
    }
    HttpServletRequest request = (HttpServletRequest) servletRequest;
    String gpValue = Context.getAdministrationService()
            .getGlobalProperty(CaseReportWebConstants.GP_ENABLE_CORS);
    if (Boolean.valueOf(gpValue)) {
        if (log.isDebugEnabled()) {
            log.debug("Cors is enabled");
        }
        HttpServletResponse response = (HttpServletResponse) servletResponse;
        response.addHeader("Access-Control-Allow-Origin", "*");
        response.addHeader("Access-Control-Allow-Methods", "GET, POST");
        response.addHeader("Access-Control-Allow-Headers", "Authorization, Content-Type");
        response.addHeader("Access-Control-Max-Age", "3600");

        //TODO add GP to disable this filter
        if (request.getMethod().equals("OPTIONS")) {

            if (log.isDebugEnabled()) {
                log.debug("Cors filter responding with Ok status");
            }
            response.setStatus(HttpServletResponse.SC_OK);

            return;
        }
    } else {
        if (log.isDebugEnabled()) {
            log.debug("Cors is disabled");
        }
    }

    // pass the request along the filter chain
    chain.doFilter(request, servletResponse);
}

From source file:webim.WebimConfig.java

public WebimConfig() {
    Properties prop = new Properties();
    try {//from  ww  w  .j  a  v  a 2 s.  c o  m
        prop.load(getClass().getResourceAsStream("/webim/Webim.properties"));
    } catch (IOException e) {
        e.printStackTrace();
    }
    Set<Object> keys = prop.keySet();
    for (Iterator<Object> it = keys.iterator(); it.hasNext();) {
        String key = (String) it.next();
        String value = prop.getProperty(key);
        key = key.substring("webim.".length());
        if ("true".equals(value) || "false".equals(value)) {
            data.put(key, Boolean.valueOf(value));
        } else {
            data.put(key, value);
        }
    }
}

From source file:com.fujitsu.dc.engine.rs.TestResource.java

/**
 * .//from www .j ava  2 s  . c o m
 * @param useDebug JavaScript ????????
 * @throws DcEngineException DcEngine
 */
public TestResource(@QueryParam("useScriptDebug") final String useDebug) throws DcEngineException {
    // http://xxx/yy?useScriptDebug=true ?????useScriptDebug????useDebug?
    super();
    this.serviceSubject = "engine"; // "engine"??
    this.useScriptDebug = Boolean.valueOf(useDebug);
    log.info("Create DebugResource. useScriptDebug=" + this.useScriptDebug);
}

From source file:org.ff4j.services.feature.FeatureServicesStepDef.java

@Given("^the feature with \"([^\"]*)\", \"([^\"]*)\", \"([^\"]*)\", \"([^\"]*)\" and \"([^\"]*)\" exists in the feature store$")
public void the_feature_with_and_exists_in_the_feature_store(String uid, String enabled, String description,
        String group, String csvPermissions) throws Throwable {
    Feature feature = new Feature(uid, Boolean.valueOf(enabled), description, group,
            Arrays.asList(csvPermissions.split(",")));
    createFeature(feature);/*from ww w  .  java 2s  . com*/
}

From source file:com.netflix.spinnaker.front50.migrations.LinearToParallelMigration.java

@Override
public void run() {
    log.info("Starting Linear -> Parallel Migration");
    pipelineDAO.all().stream()//from  w w  w  .j av a  2  s.com
            .filter(pipeline -> !(Boolean.valueOf(pipeline.getOrDefault("parallel", false).toString())))
            .forEach(pipeline -> {
                migrate(pipelineDAO, "pipeline", pipeline);
            });

    pipelineStrategyDAO.all().stream()
            .filter(strategy -> !(Boolean.valueOf(strategy.getOrDefault("parallel", false).toString())))
            .forEach(strategy -> {
                migrate(pipelineStrategyDAO, "pipeline strategy", strategy);
            });
}

From source file:com.enonic.cms.core.search.NodeSettingsBuilder.java

private Boolean getAsBoolean(String value, Boolean defaultValue) {
    if (Strings.isNullOrEmpty(value)) {
        return defaultValue;
    }/*from  w  w w .jav  a  2s .c  om*/

    return Boolean.valueOf(StringUtils.trimToNull(value));
}

From source file:blue.soundObject.jmask.Accumulator.java

public static Accumulator loadFromXML(Element data) {
    Accumulator retVal = new Accumulator();

    Elements nodes = data.getElements();

    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        String nodeName = node.getName();

        if (nodeName.equals("table")) {
            Table t = Table.loadFromXML(node);
            String tabInstance = node.getAttributeValue("tableId");

            if (tabInstance == null) {
                continue;
            } else if (tabInstance.equals("highTable")) {
                retVal.highTable = t;/*  w ww.j a  v a2 s . c o m*/
            } else if (tabInstance.equals("lowTable")) {
                retVal.lowTable = t;
            }

        } else if (nodeName.equals("highTableEnabled")) {
            retVal.highTableEnabled = Boolean.valueOf(node.getTextString()).booleanValue();
        } else if (nodeName.equals("lowTableEnabled")) {
            retVal.lowTableEnabled = Boolean.valueOf(node.getTextString()).booleanValue();
        } else if (nodeName.equals("mode")) {
            retVal.mode = Integer.parseInt(node.getTextString());
        } else if (nodeName.equals("low")) {
            retVal.low = Double.parseDouble(node.getTextString());
        } else if (nodeName.equals("high")) {
            retVal.high = Double.parseDouble(node.getTextString());
        } else if (nodeName.equals("initialValue")) {
            retVal.initialValue = Double.parseDouble(node.getTextString());
        } else if (nodeName.equals("enabled")) {
            retVal.enabled = Boolean.valueOf(node.getTextString()).booleanValue();

        }

    }
    return retVal;
}