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.samknows.measurement.schedule.condition.ConditionResult.java

public void generateOut(String id, String... data) {
    DCSStringBuilder b = new DCSStringBuilder();
    b.append(id);//from  w ww .  ja  v a  2s.co m
    long time = System.currentTimeMillis();
    b.append(time);
    if (isSuccess) {
        b.append(Constants.RESULT_OK);
    } else {
        b.append(Constants.RESULT_FAIL);
    }

    for (String s : data) {
        if (s != null) {
            b.append(s);
        }
    }

    outString = b.build();

    outJSON = new JSONObject();
    try {

        outJSON.put(JSON_TYPE, id);
        outJSON.put(JSON_TIMESTAMP, time / 1000 + "");
        outJSON.put(JSON_DATETIME, new java.util.Date(time).toString());
        outJSON.put(JSON_SUCCESS, Boolean.toString(isSuccess));
        if (json_fields != null && json_fields.length == data.length) {
            for (int i = 0; i < json_fields.length; i++) {
                outJSON.put(json_fields[i], data[i]);
            }
        }
    } catch (JSONException je) {
        Logger.e(this, "error in updating JSONObject: " + je.getMessage());
    }

}

From source file:com.spectralogic.ds3contractcomparator.print.utils.SimplePrinterUtils.java

/**
 * Prints a line denoting that the specified value exists in the
 * newer contract but not in the older contract. The value "N/A" is
 * used to denote the absence of the value in the older contract column.
 * @param label The label denoting what category is being printed
 * @param newVal The added value//w w  w.j a v  a 2s  . c  om
 */
public static void printAddedLine(final String label, final boolean newVal, final int indent,
        final WriterHelper writer) {
    printAddedLine(label, Boolean.toString(newVal), indent, writer);
}

From source file:com.granita.contacticloudsync.syncadapter.AccountSettings.java

public static Bundle createBundle(ServerInfo serverInfo) {
    Bundle bundle = new Bundle();
    bundle.putString(KEY_SETTINGS_VERSION, String.valueOf(CURRENT_VERSION));
    bundle.putString(KEY_USERNAME, serverInfo.getUserName());
    bundle.putString(KEY_AUTH_PREEMPTIVE, Boolean.toString(serverInfo.isAuthPreemptive()));
    return bundle;
}

From source file:fr.paris.lutece.plugins.workflow.modules.rest.service.formatters.ActionResultFormatterXml.java

/**
 * Format the action result//from  w ww  .  java  2  s.com
 * @param sbXml the XML
 * @param actionResult the action result
 */
private void formatActionResult(StringBuffer sbXml, IActionResult actionResult) {
    XmlUtil.beginElement(sbXml, WorkflowRestConstants.TAG_ACTION_RESULT);

    XmlUtil.addElement(sbXml, WorkflowRestConstants.TAG_IS_SUCCESSFUL,
            Boolean.toString(actionResult.isSuccessful()));
    XmlUtil.addElement(sbXml, WorkflowRestConstants.TAG_ID_ACTION, actionResult.getIdAction());
    XmlUtil.addElement(sbXml, WorkflowRestConstants.TAG_ID_RESOURCE, actionResult.getIdResource());
    XmlUtil.addElement(sbXml, WorkflowRestConstants.TAG_RESOURCE_TYPE, actionResult.getResourceType());
    XmlUtil.addElement(sbXml, WorkflowRestConstants.TAG_MESSAGE, actionResult.getMessage());

    XmlUtil.endElement(sbXml, WorkflowRestConstants.TAG_ACTION_RESULT);
}

From source file:gobblin.util.test.RetentionTestHelper.java

/**
*
* Does gobblin retention for test data. {@link DatasetCleaner} which does retention in production can not be directly called as we need to resolve some
* runtime properties like ${testNameTempPath}. This directory contains all the setup data created for a test by {@link RetentionTestDataGenerator#setup()}.
* It is unique for each test./*from  w ww. ja  va 2 s.co  m*/
* The default {@link ConfigClient} used by {@link DatasetCleaner} connects to config store configs. We need to provide a
* mock {@link ConfigClient} since the configs are in classpath and not on config store.
*
* @param retentionConfigClasspathResource this is the same jobProps/config files used while running a real retention job
* @param testNameTempPath temp path for this test where test data is generated
*/
public static void clean(FileSystem fs, Path retentionConfigClasspathResource,
        Optional<Path> additionalJobPropsClasspathResource, Path testNameTempPath) throws Exception {

    Properties additionalJobProps = new Properties();
    if (additionalJobPropsClasspathResource.isPresent()) {
        try (final InputStream stream = RetentionTestHelper.class.getClassLoader()
                .getResourceAsStream(additionalJobPropsClasspathResource.get().toString())) {
            additionalJobProps.load(stream);
        }
    }

    if (retentionConfigClasspathResource.getName().endsWith(".job")) {

        Properties jobProps = new Properties();
        try (final InputStream stream = RetentionTestHelper.class.getClassLoader()
                .getResourceAsStream(retentionConfigClasspathResource.toString())) {
            jobProps.load(stream);
            for (Entry<Object, Object> entry : jobProps.entrySet()) {
                jobProps.put(entry.getKey(), StringUtils.replace((String) entry.getValue(),
                        "${testNameTempPath}", testNameTempPath.toString()));
            }
        }

        MultiCleanableDatasetFinder finder = new MultiCleanableDatasetFinder(fs, jobProps);
        for (Dataset dataset : finder.findDatasets()) {
            ((CleanableDataset) dataset).clean();
        }
    } else {
        Config testConfig = ConfigFactory.parseResources(retentionConfigClasspathResource.toString())
                .withFallback(ConfigFactory.parseMap(ImmutableMap.of("testNameTempPath",
                        PathUtils.getPathWithoutSchemeAndAuthority(testNameTempPath).toString())))
                .resolve();

        ConfigClient client = mock(ConfigClient.class);
        when(client.getConfig(any(String.class))).thenReturn(testConfig);
        Properties jobProps = new Properties();
        jobProps.setProperty(CleanableDatasetBase.SKIP_TRASH_KEY, Boolean.toString(true));
        jobProps.setProperty(ConfigurationKeys.CONFIG_MANAGEMENT_STORE_URI, "dummy");

        jobProps.putAll(additionalJobProps);

        @SuppressWarnings("unchecked")
        DatasetsFinder<CleanableDataset> finder = (DatasetsFinder<CleanableDataset>) GobblinConstructorUtils
                .invokeFirstConstructor(
                        Class.forName(
                                testConfig.getString(MultiCleanableDatasetFinder.DATASET_FINDER_CLASS_KEY)),
                        ImmutableList.of(fs, jobProps, testConfig, client),
                        ImmutableList.of(fs, jobProps, client));

        for (CleanableDataset dataset : finder.findDatasets()) {
            dataset.clean();
        }
    }
}

From source file:com.c77.androidstreamingclient.lib.RtpMediaDecoder.java

/**
 * @param surfaceView surface where to play video streaming
 * @param properties  used to configure the debugging variable
 *//*ww  w  .j a  v a  2  s.co m*/
public RtpMediaDecoder(SurfaceView surfaceView, Properties properties) {
    configuration = (properties != null) ? properties : new Properties();

    // Read configuration
    DEBUGGING = Boolean.parseBoolean(properties.getProperty(DEBUGGING_PROPERTY, "false"));
    bufferType = properties.getProperty(CONFIG_BUFFER_TYPE, bufferType);
    useNio = Boolean.parseBoolean(configuration.getProperty(CONFIG_USE_NIO, Boolean.toString(useNio)));
    receiveBufferSize = Integer.parseInt(
            configuration.getProperty(CONFIG_RECEIVE_BUFFER_SIZE, Integer.toString(receiveBufferSize)));

    log.info("RtpMediaDecoder started with params (" + DEBUGGING + "," + bufferType + "," + useNio + ","
            + receiveBufferSize + ")");

    this.surfaceView = surfaceView;
    surfaceView.getHolder().addCallback(this);
}

From source file:gov.nih.nci.calims2.taglib.form.ValidationTextBoxTag.java

/**
 * Adds the constraints.//from  w  w  w.  ja  va 2s  .c o  m
 * @param tag The tag to which the constraints must be added.
 */
protected void addConstraints(Tag tag) {
    tag.addAttribute("constraints", constraints);
    tag.addAttribute("regExp", pattern);
    tag.addAttribute("required", Boolean.toString(isRequired()));
    if (maxLength != null) {
        tag.addAttribute("maxLength", maxLength.toString());
    }
}

From source file:com.esri.geoportal.harvester.agp.AgpOutputBrokerDefinitionAdaptor.java

/**
 * Sets permission to cleanup.//from www .j a  v  a 2 s.  c o m
 * @param cleanup <code>true</code> to permit cleanup
 */
public void setCleanup(boolean cleanup) {
    this.cleanup = cleanup;
    set(P_FOLDER_CLEANUP, Boolean.toString(cleanup));
}

From source file:com.github.fritaly.graphml4j.GroupStyle.java

private void writeState(XMLStreamWriter writer, boolean closed) throws XMLStreamException {
    Validate.notNull(writer, "The given stream writer is null");

    writer.writeEmptyElement("y:State");
    writer.writeAttribute("closed", Boolean.toString(closed));
    writer.writeAttribute("closedHeight", String.format("%.1f", 50.0f)); // TODO Create property for closedHeight
    writer.writeAttribute("closedWidth", String.format("%.1f", 50.0f)); // TODO Create property for closedWidth

    // Infer the property innerGraphDisplayEnabled from the closed flag
    writer.writeAttribute("innerGraphDisplayEnabled", Boolean.toString(!closed));
}

From source file:ixa.pipe.wikify.DBpediaSpotlightClient.java

public Document extract(Text text, String host, String port) throws AnnotationException {

    LOG.info("Querying API.");
    String spotlightResponse = "";
    Document doc = null;/*from  w w  w. j  a  v  a  2s  .c om*/
    try {
        String url = host + ":" + port + "/rest/annotate";
        PostMethod method = new PostMethod(url);
        method.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
        NameValuePair[] params = { new NameValuePair("text", text.text()),
                new NameValuePair("confidence", Double.toString(CONFIDENCE)),
                new NameValuePair("support", Integer.toString(SUPPORT)),
                new NameValuePair("coreferenceResolution", Boolean.toString(COREFERENCE)) };
        method.setRequestBody(params);
        method.setRequestHeader(new Header("Accept", "text/xml"));
        spotlightResponse = request(method);
        doc = loadXMLFromString(spotlightResponse);
    } catch (javax.xml.parsers.ParserConfigurationException ex) {
    } catch (org.xml.sax.SAXException ex) {
    } catch (java.io.IOException ex) {
    }

    return doc;
}