Example usage for java.lang Boolean booleanValue

List of usage examples for java.lang Boolean booleanValue

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public boolean booleanValue() 

Source Link

Document

Returns the value of this Boolean object as a boolean primitive.

Usage

From source file:com.centurylink.mdw.sync.SyncExpressionEvaluator.java

/**
 * Checks whether the synchronization criteria can be considered to be met
 * by evaluating the expression versus the list of completed activities.
 * @param completedActivities logical ids of completed activities
 * @param variableInstances variable instances to use in evaluation
 * @return result of the evaluation/*from  w w  w.j a  va 2  s.c om*/
 */
@SuppressWarnings("unchecked")
public boolean evaluate(List<String> completedActivities, List<VariableInstance> variableInstances)
        throws SynchronizationException {
    if (syncedActivityIds == null || syncedActivityIds.length == 0)
        return true;

    try {
        Expression e = ExpressionFactory.createExpression(syncExpression);
        // create a context
        JexlContext jc = JexlHelper.createContext();
        if (syncedActivityIds != null && completedActivities != null) {
            // set the sync values
            for (String syncedActivityId : syncedActivityIds) {
                Boolean isCompleted = completedActivities.contains(syncedActivityId);
                jc.getVars().put(syncedActivityId, isCompleted);
                // the following is for backward compatibility where escaped activity names are used
                String escapedName = idToEscapedName.get(syncedActivityId);
                if (escapedName != null)
                    jc.getVars().put(escapedName, isCompleted);
            }
        }
        if (variableInstances != null) {
            // set the variables
            for (VariableInstance variableInstance : variableInstances) {
                jc.getVars().put(variableInstance.getName(), variableInstance.getData());
            }
        }

        // evaluate the expression
        Boolean b = (Boolean) e.evaluate(jc);
        return b.booleanValue();
    } catch (Exception ex) {
        logger.severeException(ex.getMessage(), ex);
        throw new SynchronizationException(ex.getMessage(), ex);
    }
}

From source file:com.glaf.activiti.delegate.LeaveNode.java

@Override
public void execute(ActivityExecution execution) throws Exception {
    logger.debug("----------------------------------------------------");
    logger.debug("------------------LeaveNode-------------------------");
    logger.debug("----------------------------------------------------");

    if (conditionExpression != null) {
        Object value = conditionExpression.getValue(execution);
        if (value != null) {
            logger.debug("condition:" + value);
            if (value instanceof Boolean) {
                Boolean b = (Boolean) value;
                if (b.booleanValue()) {
                    this.leave(execution);
                }/*www  . ja  v  a  2 s  . c  o m*/
            }
        }
    }

}

From source file:com.openmeap.thinclient.javascript.JsApiCoreImpl.java

public void doToast(final String mesg, final Boolean isLong) {
    boolean longOne = isLong == null ? true : isLong.booleanValue();
    activity.doToast(mesg, longOne);//  ww  w.  j  a  va 2  s .  c o m
}

From source file:org.eclipse.virgo.ide.runtime.internal.core.ServerStatusPingThread.java

protected void ping() {
    try {/*from  ww  w.j  a v a2  s  . c o  m*/
        Thread.sleep(PING_DELAY);
    } catch (Exception e) {
        // ignore
    }
    while (!stop) {
        try {

            Boolean value = behaviour.getServerDeployer().ping();
            if (!stop && value != null && value.booleanValue()) {
                // ping worked - server is up
                stop = true;
                behaviour.setServerStarted();
            } else {
                sleep();
            }
        } catch (IOException se) {
            sleep();
        } catch (Exception e) {
            SpringCore.log("Server startup ping failed", e);
            // pinging failed
            if (!stop) {
                sleep();
            }
        }
    }
}

From source file:com.google.gdt.eclipse.designer.smart.model.ComponentConfiguratorBeforeAssociation.java

private boolean isRendered() throws Exception {
    String script = JavaInfoUtils.getParameter(m_javaInfo, "objectReadyValidator");
    if (StringUtils.isEmpty(script)) {
        script = "if (object.isCreated()) return object.isDrawn(); else return false;";
    }//w w w . ja v  a 2  s .co m
    Boolean result = (Boolean) JavaInfoUtils.executeScript(m_javaInfo, script);
    return result != null && result.booleanValue();
}

From source file:com.wavemaker.runtime.ws.jaxws.SOAPLoggingHandler.java

private void log(SOAPMessageContext context) {
    Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
    String messageText;//from ww w.j  av  a2  s.co m
    if (outboundProperty.booleanValue()) {
        messageText = "Outbound SOAP message:\n";
    } else {
        messageText = "Inbound SOAP message:\n";
    }

    SOAPMessage message = context.getMessage();
    try {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        message.writeTo(baos);
        log.debug(messageText + baos.toString());
        baos.close();
    } catch (Exception e) {
        log.error(e);
    }
}

From source file:com.bstek.dorado.data.variant.DefaultVariantConvertor.java

public boolean toBoolean(Object object) {
    Boolean b = (Boolean) booleanDateType.convertFromObject(object);
    return b.booleanValue();
}

From source file:com.tonbeller.wcf.convert.BooleanConverter.java

/**
 * sets the selected attribute of the checkbox from the bean
 *///from ww w. j a  v a 2  s  .  c o  m
public void convert(Formatter fmt, Object bean, Element elem)
        throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {

    String modelReference = Item.getModelReference(elem);
    if (bean == null || modelReference.length() == 0)
        return;

    Boolean value = (Boolean) PropertyUtils.getProperty(bean, Item.getModelReference(elem));
    boolean b = (value == null) ? false : value.booleanValue();
    Item.setSelected(elem, b);
}

From source file:net.sbbi.upnp.jmx.JMXManager.java

private MBeanServer initMBeanServer(MBeanServerConfig conf) throws Exception {
    mx4j.log.Log.redirectTo(new CommonsLogger());
    //  make sure that MX4j Server builder is used
    String oldSysProp = System.getProperty("javax.management.builder.initial");
    System.setProperty("javax.management.builder.initial", "mx4j.server.MX4JMBeanServerBuilder");
    MBeanServer server = MBeanServerFactory.createMBeanServer("UPNPLib");
    if (oldSysProp != null) {
        System.setProperty("javax.management.builder.initial", oldSysProp);
    }/*from w  w  w. j a va 2  s  . c  om*/
    ObjectName serverName = new ObjectName("Http:name=HttpAdaptor");
    server.createMBean("mx4j.tools.adaptor.http.HttpAdaptor", serverName, null);
    // set attributes
    server.setAttribute(serverName, new Attribute("Port", new Integer(conf.adapterAdapterPort)));

    Boolean allowWanBool = new Boolean(conf.allowWan);
    if (allowWanBool.booleanValue()) {
        server.setAttribute(serverName, new Attribute("Host", "0.0.0.0"));
    } else {
        server.setAttribute(serverName, new Attribute("Host", "localhost"));
    }

    ObjectName processorName = new ObjectName("Http:name=XSLTProcessor");
    server.createMBean("mx4j.tools.adaptor.http.XSLTProcessor", processorName, null);
    server.setAttribute(processorName, new Attribute("LocaleString", conf.locale));

    server.setAttribute(processorName, new Attribute("UseCache", Boolean.FALSE));

    server.setAttribute(processorName, new Attribute("PathInJar", "net/sbbi/jmx/xsl"));

    server.setAttribute(serverName, new Attribute("ProcessorName", processorName));
    // add user names
    server.invoke(serverName, "addAuthorization", new Object[] { conf.adapterUserName, conf.adapterPassword },
            new String[] { "java.lang.String", "java.lang.String" });
    // use basic authentication
    server.setAttribute(serverName, new Attribute("AuthenticationMethod", "basic"));
    // starts the server
    server.invoke(serverName, "start", null, null);

    return server;
}

From source file:com.examination.afinal.http.RetryHandler.java

@Override
public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
    boolean retry = true;

    Boolean b = (Boolean) context.getAttribute(ExecutionContext.HTTP_REQ_SENT);
    boolean sent = (b != null && b.booleanValue());

    if (executionCount > maxRetries) {
        // ????????5            retry = false;
    } else if (exceptionBlacklist.contains(exception.getClass())) {
        // ????????
        retry = false;/*  w w w. j  a  v a  2  s .  co  m*/
    } else if (exceptionWhitelist.contains(exception.getClass())) {
        retry = true;
    } else if (!sent) {
        retry = true;
    }

    if (retry) {
        HttpUriRequest currentReq = (HttpUriRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
        retry = currentReq != null && !"POST".equals(currentReq.getMethod());
    }

    if (retry) {
        //?????            SystemClock.sleep(RETRY_SLEEP_TIME_MILLIS);
    } else {
        exception.printStackTrace();
    }

    return retry;
}