Example usage for java.lang Boolean toString

List of usage examples for java.lang Boolean toString

Introduction

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

Prototype

public static String toString(boolean b) 

Source Link

Document

Returns a String object representing the specified boolean.

Usage

From source file:net.sourceforge.ajaxtags.tags.AjaxToggleTag.java

public String getOnOff() {
    return Boolean.toString(onOff);
}

From source file:it.polimi.modaclouds.monitoring.appleveldc.Config.java

private Config() throws ConfigurationException {
    validator = new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS);
    ddaIP = getOptionalEnvVar(Env.MODACLOUDS_MONITORING_DDA_ENDPOINT_IP, ddaIP);
    ddaPort = getOptionalEnvVar(Env.MODACLOUDS_MONITORING_DDA_ENDPOINT_PORT, ddaPort);
    kbIP = getOptionalEnvVar(Env.MODACLOUDS_KNOWLEDGEBASE_ENDPOINT_IP, kbIP);
    kbPort = getOptionalEnvVar(Env.MODACLOUDS_KNOWLEDGEBASE_ENDPOINT_PORT, kbPort);
    kbPath = getOptionalEnvVar(Env.MODACLOUDS_KNOWLEDGEBASE_DATASET_PATH, kbPath);
    String kbSyncPeriodString = getOptionalEnvVar(Env.MODACLOUDS_KNOWLEDGEBASE_SYNC_PERIOD,
            Integer.toString(kbSyncPeriod));
    String startSyncingWithKBString = getOptionalEnvVar(Env.MODACLOUDS_START_SYNC_WITH_KB,
            Boolean.toString(startSyncingWithKB));
    appId = getMandatoryEnvVar(Env.MODACLOUDS_MONITORED_APP_ID);

    ddaUrl = "http://" + ddaIP + ":" + ddaPort;
    kbUrl = "http://" + kbIP + ":" + kbPort + kbPath;

    if (!validator.isValid(ddaUrl))
        throw new ConfigurationException(ddaUrl + " is not a valid URL");
    if (!validator.isValid(kbUrl))
        throw new ConfigurationException(kbUrl + " is not a valid URL");

    try {/*w  w w  . j  a  v  a 2  s.  c  o m*/
        kbSyncPeriod = Integer.parseInt(kbSyncPeriodString);
        startSyncingWithKB = Boolean.parseBoolean(startSyncingWithKBString);
    } catch (NumberFormatException e) {
        throw new ConfigurationException(
                kbSyncPeriodString + " is not a valid value for " + Env.MODACLOUDS_KNOWLEDGEBASE_SYNC_PERIOD);
    }
}

From source file:mitm.djigzo.web.mixins.DisableOnCheck.java

@AfterRender
public void afterRender() {
    renderSupport.addScript(String.format("new DisableOnCheck('%s', '%s', '%s');",
            StringEscapeUtils.escapeJavaScript(element.getClientId()),
            StringEscapeUtils.escapeJavaScript(idsToDisable), Boolean.toString(invert)));
}

From source file:org.sakaiproject.contentreview.urkund.util.UrkundAPIUtil.java

public static String postDocument(String baseUrl, String receiverAddress, String externalId,
        UrkundSubmission submission, String urkundUsername, String urkundPassword, int timeout) {
    String ret = null;/*from   w  ww .  j a v  a2s  .  c om*/

    RequestConfig.Builder requestBuilder = RequestConfig.custom();
    requestBuilder = requestBuilder.setConnectTimeout(timeout);
    requestBuilder = requestBuilder.setConnectionRequestTimeout(timeout);

    HttpClientBuilder builder = HttpClientBuilder.create();
    builder.setDefaultRequestConfig(requestBuilder.build());
    try (CloseableHttpClient httpClient = builder.build()) {

        HttpPost httppost = new HttpPost(baseUrl + "submissions/" + receiverAddress + "/" + externalId);
        //------------------------------------------------------------
        EntityBuilder eBuilder = EntityBuilder.create();
        eBuilder.setBinary(submission.getContent());

        httppost.setEntity(eBuilder.build());
        //------------------------------------------------------------
        if (StringUtils.isNotBlank(urkundUsername) && StringUtils.isNotBlank(urkundPassword)) {
            addAuthorization(httppost, urkundUsername, urkundPassword);
        }
        //------------------------------------------------------------
        httppost.addHeader("Accept", "application/json");
        httppost.addHeader("Content-Type", submission.getMimeType());
        httppost.addHeader("Accept-Language", submission.getLanguage());
        httppost.addHeader("x-urkund-filename", submission.getFilenameEncoded());
        httppost.addHeader("x-urkund-submitter", submission.getSubmitterEmail());
        httppost.addHeader("x-urkund-anonymous", Boolean.toString(submission.isAnon()));
        httppost.addHeader("x-urkund-subject", submission.getSubject());
        httppost.addHeader("x-urkund-message", submission.getMessage());
        //------------------------------------------------------------

        HttpResponse response = httpClient.execute(httppost);
        HttpEntity resEntity = response.getEntity();

        if (resEntity != null) {
            ret = EntityUtils.toString(resEntity);
            EntityUtils.consume(resEntity);
        }

    } catch (IOException e) {
        log.error("ERROR uploading File : ", e);
    }

    return ret;
}

From source file:blue.soundObject.pattern.Pattern.java

public Element saveAsXML() {
    Element retVal = new Element("pattern");

    retVal.addElement("patternName").setText(patternName);
    retVal.addElement("patternScore").setText(patternScore);
    retVal.addElement("muted").setText(Boolean.toString(muted));
    retVal.addElement("solo").setText(Boolean.toString(solo));

    StringBuilder buffer = new StringBuilder();

    for (int i = 0; i < values.length; i++) {
        if (values[i]) {
            buffer.append("1");
        } else {//from  ww  w.  j a v  a 2 s .  c  o  m
            buffer.append("0");
        }
    }

    retVal.addElement("values").setText(buffer.toString());

    return retVal;
}

From source file:com.remobile.cordova.PluginResult.java

public PluginResult(Status status, boolean b) {
    this.status = status.ordinal();
    this.messageType = MESSAGE_TYPE_BOOLEAN;
    this.strMessage = Boolean.toString(b);
}

From source file:com.msopentech.odatajclient.engine.data.impl.JSONDOMTreeUtils.java

/**
 * Recursively builds DOM content out of JSON subtree rooted at given node.
 *
 * @param client OData client.// w  w w .ja va  2s.  c om
 * @param document root of the DOM document being built
 * @param parent parent of the nodes being generated during this step
 * @param node JSON node to be used as source for DOM elements
 */
public static void buildSubtree(final ODataClient client, final Element parent, final JsonNode node) {
    final Iterator<String> fieldNameItor = node.fieldNames();
    final Iterator<JsonNode> nodeItor = node.elements();
    while (nodeItor.hasNext()) {
        final JsonNode child = nodeItor.next();
        final String name = fieldNameItor.hasNext() ? fieldNameItor.next() : "";

        // no name? array item
        if (name.isEmpty()) {
            final Element element = parent.getOwnerDocument().createElementNS(
                    client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_DATASERVICES),
                    ODataConstants.PREFIX_DATASERVICES + ODataConstants.ELEM_ELEMENT);
            parent.appendChild(element);

            if (child.isValueNode()) {
                if (child.isNull()) {
                    element.setAttributeNS(
                            client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
                            ODataConstants.ATTR_NULL, Boolean.toString(true));
                } else {
                    element.appendChild(parent.getOwnerDocument().createTextNode(child.asText()));
                }
            }

            if (child.isContainerNode()) {
                buildSubtree(client, element, child);
            }
        } else if (!name.contains("@") && !ODataConstants.JSON_TYPE.equals(name)) {
            final Element property = parent.getOwnerDocument().createElementNS(
                    client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_DATASERVICES),
                    ODataConstants.PREFIX_DATASERVICES + name);
            parent.appendChild(property);

            boolean typeSet = false;
            if (node.hasNonNull(name + "@" + ODataConstants.JSON_TYPE)) {
                property.setAttributeNS(
                        client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
                        ODataConstants.ATTR_M_TYPE,
                        node.get(name + "@" + ODataConstants.JSON_TYPE).textValue());
                typeSet = true;
            }

            if (child.isNull()) {
                property.setAttributeNS(
                        client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
                        ODataConstants.ATTR_NULL, Boolean.toString(true));
            } else if (child.isValueNode()) {
                if (!typeSet) {
                    if (child.isInt()) {
                        property.setAttributeNS(
                                client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
                                ODataConstants.ATTR_M_TYPE, EdmSimpleType.Int32.toString());
                    }
                    if (child.isLong()) {
                        property.setAttributeNS(
                                client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
                                ODataConstants.ATTR_M_TYPE, EdmSimpleType.Int64.toString());
                    }
                    if (child.isBigDecimal()) {
                        property.setAttributeNS(
                                client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
                                ODataConstants.ATTR_M_TYPE, EdmSimpleType.Decimal.toString());
                    }
                    if (child.isDouble()) {
                        property.setAttributeNS(
                                client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
                                ODataConstants.ATTR_M_TYPE, EdmSimpleType.Double.toString());
                    }
                    if (child.isBoolean()) {
                        property.setAttributeNS(
                                client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
                                ODataConstants.ATTR_M_TYPE, EdmSimpleType.Boolean.toString());
                    }
                    if (child.isTextual()) {
                        property.setAttributeNS(
                                client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
                                ODataConstants.ATTR_M_TYPE, EdmSimpleType.String.toString());
                    }
                }

                property.appendChild(parent.getOwnerDocument().createTextNode(child.asText()));
            } else if (child.isContainerNode()) {
                if (!typeSet && child.hasNonNull(ODataConstants.JSON_TYPE)) {
                    property.setAttributeNS(
                            client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
                            ODataConstants.ATTR_M_TYPE, child.get(ODataConstants.JSON_TYPE).textValue());
                }

                final String type = property.getAttribute(ODataConstants.ATTR_M_TYPE);
                if (StringUtils.isNotBlank(type) && EdmSimpleType.isGeospatial(type)) {
                    if (EdmSimpleType.Geography.toString().equals(type)
                            || EdmSimpleType.Geometry.toString().equals(type)) {

                        final String geoType = child.get(ODataConstants.ATTR_TYPE).textValue();
                        property.setAttributeNS(
                                client.getWorkingVersion().getNamespaceMap().get(ODataVersion.NS_METADATA),
                                ODataConstants.ATTR_M_TYPE,
                                geoType.startsWith("Geo") ? EdmSimpleType.namespace() + "." + geoType
                                        : type + geoType);
                    }

                    if (child.has(ODataConstants.JSON_COORDINATES)
                            || child.has(ODataConstants.JSON_GEOMETRIES)) {
                        GeospatialJSONHandler.deserialize(child, property,
                                property.getAttribute(ODataConstants.ATTR_M_TYPE));
                    }
                } else {
                    buildSubtree(client, property, child);
                }
            }
        }
    }
}

From source file:com.esri.geoportal.harvester.migration.MigrationBrokerDefinitionAdaptor.java

public void setPreserveUuids(boolean preserveUuids) {
    this.preserveUuids = preserveUuids;
    set(P_PRESERVE_UUIDS, Boolean.toString(preserveUuids));
}

From source file:org.ow2.proactive_grid_cloud_portal.cli.cmd.rm.RemoveNodeSourceCommand.java

public void execute(ApplicationContext currentContext) throws CLIException {
    if (currentContext.isForced()) {
        preempt = true;//  w w  w  .  j  a  v a2  s. c o  m
    }
    HttpPost request = new HttpPost(currentContext.getResourceUrl("nodesource/remove"));
    QueryStringBuilder queryStringBuilder = new QueryStringBuilder();
    queryStringBuilder.add("name", nodeSource).add("preempt", Boolean.toString(preempt));
    request.setEntity(queryStringBuilder.buildEntity(APPLICATION_FORM_URLENCODED));
    HttpResponseWrapper response = execute(request, currentContext);
    if (statusCode(response) == statusCode(OK)) {
        boolean success = readValue(response, Boolean.TYPE, currentContext);
        resultStack(currentContext).push(success);
        if (success) {
            writeLine(currentContext, "Node source '%s' deleted successfully.", nodeSource);
        } else {
            writeLine(currentContext, "Cannot delete node source: %s.", nodeSource);

        }
    } else {
        handleError(String.format("An error occurred while deleting node source: %s", nodeSource), response,
                currentContext);
    }

}

From source file:com.controlj.green.bulktrend.trendserver.CSVTrendFormatter.java

public void writeTrendData(String id, Collection<? extends TrendSample> samples) throws IOException {
    confirmOutputSet();//from  w  w  w  . ja v a2  s  .c o m

    out.write(escapeString(id));
    Iterator<? extends TrendSample> it = samples.iterator();
    while (it.hasNext()) {
        TrendSample sample = it.next();
        if (sample.getType() == TrendType.DATA) {
            out.write(',');
            out.write(Long.toString(formatDate(sample.getTime())));
            out.write(',');

            if (sample instanceof TrendAnalogSample) {
                out.write(formatAnalog(((TrendAnalogSample) sample).doubleValue()));
            } else if (sample instanceof TrendDigitalSample) {
                out.write(Boolean.toString(((TrendDigitalSample) sample).getState()));
            }
        }
    }
    out.write('\n');
}