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 String toString() 

Source Link

Document

Returns a String object representing this Boolean's value.

Usage

From source file:com.p5solutions.core.json.JsonSerializer.java

/**
 * Write a boolean./* www . j a  v  a  2  s  . c o  m*/
 * 
 * @param output
 *          the output
 * @param value
 *          the value
 * @param charset
 *          the charset
 * @throws IOException
 *           Signals that an I/O exception has occurred.
 */
protected void writeBoolean(OutputStream output, Boolean source, Charset charset) throws IOException {
    output.write(source.toString().getBytes(charset));
}

From source file:finderbots.recommenders.hadoop.ActionSplitterJob.java

public List<FSDataInputStream> getActionFiles(Path baseInputDir) throws IOException {
    List<FSDataInputStream> files = new ArrayList<FSDataInputStream>();
    FileSystem fs = baseInputDir.getFileSystem(getConf());
    try {//from  w w  w .ja va 2s. c o m
        FileStatus inStat = fs.getFileStatus(baseInputDir);
        Boolean inputIsDir = inStat.isDir();
        LOGGER.info("\n======\n\n\n   Input path = " + baseInputDir.toString() + "\n" + "   isDir = "
                + inputIsDir.toString() + "\n\n\n======\n");
        if (inputIsDir) {
            FileStatus[] stats = fs.listStatus(baseInputDir);
            for (FileStatus fstat : stats) {
                String filename = fstat.getPath().getName();
                String regex = options.getInputFilePattern();
                Boolean match = filename.matches(regex);
                if (fstat.isDir()) {
                    files.addAll(getActionFiles(fstat.getPath()));
                } else if (fstat.getPath().getName().matches(options.getInputFilePattern())) {
                    //assume a regex was passed in and check for matches
                    files.add(fs.open(fstat.getPath()));
                } else if (
                //assume a simple ".tsv" or other included string was passed in
                //exclude system files, like the hadoop created files _SUCCEED, .crc's etc.
                fstat.getPath().getName().contains(options.getInputFilePattern()) && !fstat.isDir()
                        && !fstat.getPath().getName().startsWith("_")
                        && !fstat.getPath().getName().startsWith(".")
                        && !fstat.getPath().getName().startsWith("~")) {
                    files.add(fs.open(fstat.getPath()));
                }
            }
        } else if (// processing a single file as input but exclude system files
        inStat.getPath().getName().contains(options.getInputFilePattern())) {
            files.add(fs.open(inStat.getPath()));
        } else {// doesn't match any input pattern so no input
            throw new IOException("No input to process at: " + baseInputDir.toString());
        }
    } catch (IOException e) {
        LOGGER.error("Cannot find base of input file tree for: " + baseInputDir.toString());
        throw e;
    }
    return files;
}

From source file:cn.org.once.cstack.cli.utils.ModuleUtils.java

public String managePort(String moduleName, final String port, final Boolean open) {
    applicationUtils.checkConnectedAndApplicationSelected();

    Module module = findModule(moduleName);
    try {// w  w  w.j av  a2s .c  o m
        restUtils.sendPutCommand(authenticationUtils.finalHost + urlLoader.modulePrefix + "/" + module.getId(),
                authenticationUtils.getMap(), new HashMap<String, String>() {
                    private static final long serialVersionUID = 1L;
                    {
                        put("publishPort", open.toString());
                        put("port", port);
                    }
                }).get("body");
    } catch (ManagerResponseException e) {
        throw new CloudUnitCliException("Couldn't change port", e);
    }

    return "OK";
}

From source file:com.urbancode.ud.client.ComponentClient.java

public JSONArray getComponentVersionsJsonArray(String componentParam, Boolean getInactive)
        throws ClientProtocolException, IOException, JSONException {
    JSONArray result = null;//from ww w .  j  a va  2 s . c  om

    String uri = url + "/rest/deploy/component/" + encodePath(componentParam) + "/versions/"
            + encodePath(getInactive.toString());
    HttpGet method = new HttpGet(uri);
    HttpResponse response = invokeMethod(method);
    String body = getBody(response);

    result = new JSONArray(body);
    return result;
}

From source file:io.cloudslang.dependency.impl.services.DependencyServiceImpl.java

private void getDependencies(String[] gav, Boolean transitive) {
    System.setProperty(MavenConfig.MAVEN_ARTIFACT_PROPERTY, getResourceString(gav, transitive));
    System.setProperty(MavenConfig.MAVEN_CLASSWORLDS_CONF_PROPERTY,
            System.getProperty(MavenConfig.MAVEN_M2_CONF_PATH));
    System.setProperty(MavenConfig.TRANSITIVE_PROPERTY, transitive.toString());
    String[] args = new String[] { MavenConfig.MAVEN_SETTINGS_FILE_FLAG,
            System.getProperty(MavenConfig.MAVEN_SETTINGS_PATH), MavenConfig.DEPENDENCY_GET_COMMAND,
            MavenConfig.LOG_FILE_FLAG, constructGavLogFilePath(gav, "get") };

    try {// w w w . ja v a  2s .com
        invokeMavenLauncher(args);
        if (!transitive) {
            removeTestScopeDependencies(gav);
        }
    } catch (Exception e) {
        throw new IllegalStateException("Failed to download resources using Maven", e);
    } finally {
        System.getProperties().remove(MavenConfig.TRANSITIVE_PROPERTY);
    }

}

From source file:fr.mailjet.rest.impl.MessageRESTServiceImpl.java

@Override
public String tplModels(EnumReturnType parType, Integer parCategory, Boolean parCustom, Locale parLocale)
        throws UniformInterfaceException {
    MultivaluedMap<String, String> locParameters = this.createHTTPProperties(parType);
    if (parCategory != null) {
        locParameters.putSingle(_categoryTplModel, parCategory.toString());
    }//from ww w.  j av a 2  s  .c om
    if (parCustom != null) {
        locParameters.putSingle(_customTplModel, parCustom.toString());
    }
    if (parLocale != null) {
        locParameters.putSingle(_localeTplModel, parLocale.toString());
    }
    return this.createGETRequest("messageTplcategories", locParameters);
}

From source file:com.urbancode.ud.client.ComponentClient.java

public List<String> getComponentVersions(String componentParam, Boolean getInactive)
        throws ClientProtocolException, IOException, JSONException {
    List<String> result = new ArrayList<String>();

    String uri = url + "/rest/deploy/component/" + encodePath(componentParam) + "/versions/"
            + encodePath(getInactive.toString());
    HttpGet method = new HttpGet(uri);
    HttpResponse response = invokeMethod(method);
    String body = getBody(response);
    JSONArray resultJSON = new JSONArray(body);
    for (int i = 0; i < resultJSON.length(); i++) {
        JSONObject entry = resultJSON.getJSONObject(i);
        result.add(entry.getString("name"));
    }/*from   w w  w.  j  a  va2s .  c  om*/
    return result;
}

From source file:no.digipost.api.useragreements.client.ApiService.java

public StreamingRateLimitedResponse<UserId> getAgreementOwners(final SenderId senderId,
        final AgreementType agreementType, final Boolean smsNotificationsEnabled,
        final String requestTrackingId) {
    URIBuilder uriBuilder = new URIBuilder(serviceEndpoint)
            .setPath(userAgreementsPath(senderId) + "/agreement-owners")
            .setParameter(AgreementType.QUERY_PARAM_NAME, agreementType.getType());
    if (smsNotificationsEnabled != null) {
        uriBuilder.setParameter("invoice-sms-notification", smsNotificationsEnabled.toString());
    }/*from w w w .  j a v a2 s .  c o  m*/

    HttpGet request = newGetRequest(uriBuilder, requestTrackingId);
    request.setHeader(X_Digipost_UserId, brokerId.serialize());
    CloseableHttpResponse response = null;
    try {
        response = httpClient.execute(request);
        return new StreamingRateLimitedResponse<>(
                mapOkResponseOrThrowException(response, r -> unmarshallEntities(r, AgreementOwners.class)),
                AgreementOwners::getIdsAsStream);
    } catch (IOException ioe) {
        throw new RuntimeIOException(ioe.getMessage(), ioe);
    } catch (RuntimeException rte) {
        if (response != null) {
            try {
                response.close();
            } catch (IOException e) {
                rte.addSuppressed(e);
            }
        }
        throw rte;
    }
}

From source file:com.clustercontrol.jobmanagement.util.SendApprovalMail.java

private void setProperties(Properties prop, String key, int type) {
    switch (type) {
    case HinemosPropertyTypeConstant.TYPE_STRING:
        String strVal = HinemosPropertyUtil.getHinemosPropertyStr(key, null);
        if (strVal != null) {
            prop.setProperty(key, strVal);
        }/*from www  .  j ava 2s.  c  om*/
        break;
    case HinemosPropertyTypeConstant.TYPE_NUMERIC:
        Long longVal = HinemosPropertyUtil.getHinemosPropertyNum(key, null);
        if (longVal != null) {
            prop.setProperty(key, longVal.toString());
        }
        break;
    case HinemosPropertyTypeConstant.TYPE_TRUTH:
        Boolean boolVal = HinemosPropertyUtil.getHinemosPropertyBool(key, null);
        if (boolVal != null) {
            prop.setProperty(key, boolVal.toString());
        }
        break;
    default:
        //??????
        break;
    }
}

From source file:edu.northwestern.bioinformatics.studycalendar.restlets.representations.MultipleAssignmentScheduleJsonRepresentation.java

void createJSONScheduledActivities(JsonGenerator generator, Boolean hidden_activities,
        Collection<ScheduledActivity> scheduledActivities) throws IOException {
    generator.writeStartObject();//  w w  w.  j av  a 2  s  .  com
    if (hidden_activities != null) {
        JacksonTools.nullSafeWriteStringField(generator, "hidden_activities",
                "" + hidden_activities.toString());
    }
    generator.writeFieldName("activities");

    generator.writeStartArray();
    for (ScheduledActivity scheduledActivity : scheduledActivities) {
        createJSONScheduledActivity(generator, scheduledActivity);
    }
    generator.writeEndArray();
    generator.writeEndObject();
}