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:com.legstar.cob2xsd.Cob2XsdIOTest.java

/**
 * Go through all the samples and check with backward compatibility.
 * /*from   w w  w  .ja  v  a  2  s  .  com*/
 * @throws Exception if test fails
 */
@Test
public void testAllSamples() throws Exception {
    File cobolDir = new File(COBOL_SAMPLES_DIR);
    for (File cobolFile : cobolDir.listFiles()) {
        if (cobolFile.isFile()) {
            _log.debug("Translating " + cobolFile);
            String name = cobolFile.getName().toLowerCase();
            configProps.put(Cob2XsdConfig.ADD_LEGSTAR_ANNOTATIONS, Boolean.toString(true));

            /* Backward compatibility */
            configProps.put(Cob2XsdConfig.ELEMENT_NAMES_START_WITH_UPPERCASE, Boolean.toString(true));
            configProps.put(Cob2XsdConfig.QUOTE_IS_QUOTE, Boolean.toString(false));

            Cob2XsdIO translator = new Cob2XsdIO(new Cob2XsdConfig(configProps));
            File custmXslt = new File(XSLT_SAMPLES_DIR, name + ".xsl");
            File xsdFile = translator.translate(cobolFile, "ISO-8859-1", tempDir,
                    "http://legstar.com/test/coxb", custmXslt.exists() ? custmXslt.getPath() : null);
            if (_log.isDebugEnabled()) {
                _log.debug("Result:\n" + FileUtils.readFileToString(xsdFile));
            }
            File xsdRefFile = new File(XSD_REFERENCES_DIR, name.toLowerCase() + ".xsd");

            if (CREATE_REFERENCES) {
                FileUtils.copyFile(xsdFile, xsdRefFile);
            } else {
                Document result = getXMLSchemaAsDoc(xsdFile);
                Document expected = getXMLSchemaAsDoc(xsdRefFile);
                compare(xsdFile.getName(), expected, result);
            }
            xsdFile.deleteOnExit();
        }
    }
}

From source file:nz.net.orcon.kanban.controllers.SystemController.java

@RequestMapping(value = "", method = RequestMethod.GET)
public @ResponseBody Map<String, String> getSystemState() throws Exception {
    Map<String, String> result = new HashMap<String, String>();
    result.put("server", clusterManager.getServerId());
    result.put("leader", Boolean.toString(clusterManager.isLeader()));
    result.put("couptime", Long.toString(clusterManager.getStartTime()));
    return result;
}

From source file:coral.model.ExpData.java

public void setNewpage(boolean newpage) {
    this.put("newpage", Boolean.toString(newpage));
}

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

public RemoveNodeSourceCommand(String nodeSource) {
    this(nodeSource, Boolean.toString(false));
}

From source file:com.autentia.intra.manager.admin.SettingManager.java

/**
 * Save a property for current user//from  ww w .  j av a2 s .c  o  m
 *
 * @param propertyPath property path
 * @param value        property value
 */
public static void setValue(Setting val, boolean value) {
    val.setType(SettingType.BOOLEAN);
    val.setValue(Boolean.toString(value));
}

From source file:com.msopentech.odatajclient.engine.data.json.DOMTreeUtils.java

/**
 * Recursively builds DOM content out of JSON subtree rooted at given node.
 *
 * @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
 *//*from  ww  w. j av a 2s.  c om*/
public static void buildSubtree(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(ODataConstants.NS_DATASERVICES,
                    ODataConstants.PREFIX_DATASERVICES + ODataConstants.ELEM_ELEMENT);
            parent.appendChild(element);

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

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

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

            if (child.isNull()) {
                property.setAttributeNS(ODataConstants.NS_METADATA, ODataConstants.ATTR_NULL,
                        Boolean.toString(true));
            } else if (child.isValueNode()) {
                if (!typeSet) {
                    if (child.isInt()) {
                        property.setAttributeNS(ODataConstants.NS_METADATA, ODataConstants.ATTR_M_TYPE,
                                EdmSimpleType.Int32.toString());
                    }
                    if (child.isLong()) {
                        property.setAttributeNS(ODataConstants.NS_METADATA, ODataConstants.ATTR_M_TYPE,
                                EdmSimpleType.Int64.toString());
                    }
                    if (child.isBigDecimal()) {
                        property.setAttributeNS(ODataConstants.NS_METADATA, ODataConstants.ATTR_M_TYPE,
                                EdmSimpleType.Decimal.toString());
                    }
                    if (child.isDouble()) {
                        property.setAttributeNS(ODataConstants.NS_METADATA, ODataConstants.ATTR_M_TYPE,
                                EdmSimpleType.Double.toString());
                    }
                    if (child.isBoolean()) {
                        property.setAttributeNS(ODataConstants.NS_METADATA, ODataConstants.ATTR_M_TYPE,
                                EdmSimpleType.Boolean.toString());
                    }
                    if (child.isTextual()) {
                        property.setAttributeNS(ODataConstants.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(ODataConstants.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(ODataConstants.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(property, child);
                }
            }
        }
    }
}

From source file:com.cloudera.oryx.app.batch.mllib.rdf.RandomCategoricalRDFDataGenerator.java

@Override
public Pair<String, String> generate(int id, RandomGenerator random) {
    List<String> elements = new ArrayList<>(n + 2);
    elements.add(Integer.toString(id));
    boolean positive = true;
    for (int i = 0; i < n; i++) {
        double d = random.nextDouble();
        if (d < 0.5) {
            positive = false;/*from   w  w  w . j  a  v a2  s  . com*/
        }
        elements.add(Double.toString(d));
    }
    elements.add(Boolean.toString(positive));
    return new Pair<>(Integer.toString(id), TextUtils.joinDelimited(elements, ','));
}

From source file:com.netdimensions.client.Commands.java

public static Command<List<EnrollmentRequest>> getEnrollmentRequests(final boolean inbox, final Date since,
        final String filter, final String onBehalfOf) {
    return new Command<List<EnrollmentRequest>>("enrollment-requests", false,
            com.netdimensions.util.Collections.concatenatedList(
                    inbox ? Collections.singletonList(new BasicNameValuePair("inbox", Boolean.toString(true)))
                            : Collections.<NameValuePair>emptyList(),
                    Arrays.asList(new BasicNameValuePair("since", Dates.html5String(since)),
                            new BasicNameValuePair("filter", nullToEmpty(filter)),
                            new BasicNameValuePair("on-behalf-of", nullToEmpty(onBehalfOf)),
                            new BasicNameValuePair("format", "xml"))),
            EnrollmentRequest.PARSER);//  ww w  . j  a va 2  s  .  c  o  m
}

From source file:com.jaeksoft.searchlib.facet.Range.java

public void writeXml(XmlWriter writer) throws SAXException {
    writer.startElement("range", "fromInclusive", Boolean.toString(fromInclusive), "fromValue", fromValue,
            "toInclusive", Boolean.toString(toInclusive), "toValue", toValue);
    writer.endElement();//from  w  ww.j a  v  a 2 s.com
}

From source file:info.magnolia.cms.util.MetaDataUtil.java

/**
 * <p/>//w  w  w .  j a v a  2 s .c o  m
 * Returns the representation of the value as a String:
 * </p>
 *
 * @return String
 */
public String getPropertyValueString(String propertyName, String dateFormat) {
    try {
        if (propertyName.equals(MetaData.CREATION_DATE) || propertyName.equals(MetaData.LAST_MODIFIED)
                || propertyName.equals(MetaData.LAST_ACTION)) {
            Date date = this.getContent().getMetaData().getDateProperty(propertyName).getTime();
            return new DateUtil().getFormattedDate(date, dateFormat);
        } else if (propertyName.equals(MetaData.ACTIVATED)) {
            return Boolean.toString(this.getContent().getMetaData().getBooleanProperty(propertyName));
        } else {
            return this.getContent().getMetaData().getStringProperty(propertyName);
        }
    } catch (Exception e) {
        if (log.isDebugEnabled())
            log.debug("Exception caught: " + e.getMessage(), e); //$NON-NLS-1$
    }
    return StringUtils.EMPTY;
}