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:net.packet.impl.PacketClient.java

@Override
public Notifications getNotifications(Date since, Boolean all, Integer pageNo, Integer perPage)
        throws PacketException {
    checkNullAndThrowError(pageNo, "Page no is required");

    Request request = new Request(Endpoint.NOTIFICATIONS).page(pageNo).perPage(perPage);

    if (null != since) {
        request.queryParam("since", isoDateFormatter.format(since));
    }//  w ww  .ja  va 2s  .co m

    if (null != all) {
        request.queryParam("all", all.toString());
    }

    return (Notifications) executeRequest(request).getData();
}

From source file:org.axway.grapes.utils.client.GrapesClient.java

/**
 * Return the list of module dependencies
 *
 * @param moduleName//from  w  w  w . ja v  a  2s  . c  o  m
 * @param moduleVersion
 * @param fullRecursive
 * @param corporate
 * @param thirdParty
 * @return List<Dependency>
 * @throws GrapesCommunicationException
 */
public List<Dependency> getModuleDependencies(final String moduleName, final String moduleVersion,
        final Boolean fullRecursive, final Boolean corporate, final Boolean thirdParty)
        throws GrapesCommunicationException {
    final Client client = getClient();
    final WebResource resource = client.resource(serverURL)
            .path(RequestUtils.getArtifactDependencies(moduleName, moduleVersion));
    final ClientResponse response = resource.queryParam(ServerAPI.SCOPE_COMPILE_PARAM, "true")
            .queryParam(ServerAPI.SCOPE_PROVIDED_PARAM, "true")
            .queryParam(ServerAPI.SCOPE_RUNTIME_PARAM, "true").queryParam(ServerAPI.SCOPE_TEST_PARAM, "true")
            .queryParam(ServerAPI.RECURSIVE_PARAM, fullRecursive.toString())
            .queryParam(ServerAPI.SHOW_CORPORATE_PARAM, corporate.toString())
            .queryParam(ServerAPI.SHOW_THIRPARTY_PARAM, thirdParty.toString())
            .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);

    client.destroy();
    if (ClientResponse.Status.OK.getStatusCode() != response.getStatus()) {
        final String message = "Failed to get module ancestors " + moduleName + " in version " + moduleVersion;
        LOG.error(message + ". Http status: " + response.getStatus());
        throw new GrapesCommunicationException(message, response.getStatus());
    }

    return response.getEntity(new GenericType<List<Dependency>>() {
    });
}

From source file:org.openstack.burrow.backend.http.BaseHttp.java

/**
 * Generates a List of Name/Value Pairs for a GetMessage to be carried out
 * /*from   www  . j av  a 2 s  . c om*/
 * @param request A GetMessage object
 * @return A List of Name/Value Pairs
 */
private List<NameValuePair> getQueryParameters(GetMessage request) {
    Boolean matchHidden = request.getMatchHidden();
    String detail = request.getDetail();
    Long wait = request.getWait();
    if ((matchHidden != null) || (detail != null) || (wait != null)) {
        List<NameValuePair> params = new ArrayList<NameValuePair>(3);
        if (matchHidden != null)
            params.add(new BasicNameValuePair("match_hidden", matchHidden.toString()));
        if (detail != null)
            params.add(new BasicNameValuePair("detail", detail));
        if (wait != null)
            params.add(new BasicNameValuePair("wait", wait.toString()));
        return params;
    } else {
        return null;
    }
}

From source file:com.cloud.hypervisor.xenserver.resource.Xenserver625StorageProcessor.java

@Override
protected String getVhdParent(final Connection conn, final String primaryStorageSRUuid,
        final String snapshotUuid, final Boolean isISCSI) {
    final String parentUuid = hypervisorResource.callHostPlugin(conn, "cloud-plugin-storage", "getVhdParent",
            "primaryStorageSRUuid", primaryStorageSRUuid, "snapshotUuid", snapshotUuid, "isISCSI",
            isISCSI.toString());

    if (parentUuid == null || parentUuid.isEmpty() || parentUuid.equalsIgnoreCase("None")) {
        s_logger.debug("Unable to get parent of VHD " + snapshotUuid + " in SR " + primaryStorageSRUuid);
        // errString is already logged.
        return null;
    }/*from  ww w  .jav  a 2  s  .c om*/
    return parentUuid;
}

From source file:com.baracuda.piepet.nexusrelease.nexus.StageClient.java

/**
 * Construct the XML message for a promoteRequest.
 * //from   w  w  w .j av a2s  . c om
 * @param stage The stage to target
 * @param description the description (used for promote - ignored otherwise)
 * @param autodrop <code>Boolean.TRUE</code> or <code>Boolean.FALSE</code> sets the autoDropAfterRelease to
 *           the appropriate value. <code>null</code> omits the value.
 * @return The XML for the promoteRequest.
 * @throws StageException if we could not determine if this server support async close or not.
 */
protected String createPromoteRequestPayload(Stage stage, String description, Boolean autodrop)
        throws StageException {
    // TODO? this is missing the targetRepoID which is needed for promote...
    // if the description contains a CDATA END tag then split it across multiple CDATA sections.
    String escapedDescr = (description == null) ? "" : description;
    if (escapedDescr.contains("]]>")) {
        escapedDescr = escapedDescr.replace("]]>", "]]]]><![CDATA[>");
    }
    if (autodrop != null) {
        return String.format(
                "<?xml version=\"1.0\" encoding=\"UTF-8\"?><promoteRequest><data><autoDropAfterRelease>%s</autoDropAfterRelease><stagedRepositoryId>%s</stagedRepositoryId><description><![CDATA[%s]]></description></data></promoteRequest>",
                autodrop.toString(), stage.getStageID(), escapedDescr);
    }
    return String.format(
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?><promoteRequest><data><stagedRepositoryId>%s</stagedRepositoryId><description><![CDATA[%s]]></description></data></promoteRequest>",
            stage.getStageID(), escapedDescr);
}

From source file:com.groupon.odo.client.Client.java

protected boolean toggleOverride(String pathName, String type, Boolean enabled) {
    BasicNameValuePair[] params = { new BasicNameValuePair(type, enabled.toString()),
            new BasicNameValuePair("profileIdentifier", this._profileName) };
    try {/*from  w  w  w . j  a v  a2s .  co m*/
        JSONObject response = new JSONObject(doPost(BASE_PATH + uriEncode(pathName), params));
        if (response.getBoolean(type) == enabled) {
            return true;
        }
    } catch (Exception e) {
        // some sort of error
        e.printStackTrace();
    }
    return false;
}

From source file:com.groupon.odo.client.Client.java

/**
 * Reset all overrrides//from   w w w  . j  a  v a2  s .  co  m
 *
 * @return true if successful, otherwise false
 */
public boolean resetProfile() {
    Boolean enabled = new Boolean(true);
    BasicNameValuePair[] params = { new BasicNameValuePair("reset", enabled.toString()) };

    try {
        String uri = BASE_PROFILE + uriEncode(this._profileName) + "/" + BASE_CLIENTS + "/";
        if (_clientId == null) {
            uri += "-1";
        } else {
            uri += _clientId;
        }
        JSONObject response = new JSONObject(doPost(uri, params));
    } catch (Exception e) {
        // some sort of error
        System.out.println(e.getMessage());
        return false;
    }
    return true;
}

From source file:com.ibm.xsp.webdav.WebDavManager.java

/**
 * loads the meta repository that contains all the repositories we currently
 * use as well as the global parameters now stored in the webDAVManager
 *///from   w  w  w.j a v a2s  .com
private void loadMetaRepository() {
    // Load the Meta Repository -- and the style
    Properties metaProp = new Properties(); // to be loaded from file
    InputStream in = this.getClass().getResourceAsStream(WebDavManager.METAREPOPROPFILE);
    try {
        metaProp.load(in);
    } catch (IOException e) {
        LOGGER.error(e);
    }

    // Now load the values with sensible defaults
    String configLocation = metaProp.getProperty("repository-location",
            DAVRepositoryMETA.DEFAULT_REPOSITORY_LOCATION);
    String propfindStyle = metaProp.getProperty("style-name", DAVRepositoryMETA.DEFAULT_PROPFIND_STYLE);
    String rootStyle = metaProp.getProperty("root-style-name", DAVRepositoryMETA.DEFAULT_ROOT_STYLE);
    Boolean autoreload = new Boolean(metaProp.getProperty("auto-reload", "true"));
    Boolean canReset = new Boolean(metaProp.getProperty("allow-reset", "false"));
    String tempDir = metaProp.getProperty(INIT_KEY_TEMPDIR, DEFAULT_TMP_DIR);

    // Apply them to the repository and the manager
    this.repositoryMeta = DAVRepositoryMETA.getRepository(configLocation);
    this.repositoryMeta.setAutoReloadRepositoryList(autoreload.booleanValue());
    this.setRootPropfindStyle(rootStyle);
    this.setPropfindStyle(propfindStyle);
    this.setTempDir(tempDir);
    this.allowReset = canReset.booleanValue();

    // Write to the logger
    LOGGER.debug("Root-Style name:" + this.getRootPropfindStyle());
    LOGGER.debug("Repository-Style name:" + this.getPropfindStyle());
    LOGGER.debug("Configuration location:" + configLocation);
    LOGGER.debug("Can auto reload list:" + autoreload.toString());
    LOGGER.debug("Can reset:" + canReset.toString());
    LOGGER.debug("Temp Dir:" + tempDir);

}

From source file:pt.meocloud.sdk.MeoCloudImpl.java

/**
 * Max file size: 2048MB/*  w  w  w  .  j ava  2s  .  c o  m*/
 * Disallowed characters: +*<>:"/\|?*
 * */
@Override
public MeoCloudResponse<Metadata> uploadFile(String filePath, String path, Boolean overwrite,
        String parentRevision) {
    try {
        String builderPath = String.format("/%s/%s/%s%s", MEOCLOUD_API_VERSION, MEOCLOUD_API_METHOD_FILES,
                apiMode.getCode(), path);
        URIBuilder builder = new URIBuilder();
        builder.setScheme(MEOCLOUD_SCHEME);
        builder.setHost(MEOCLOUD_API_CONTENT_ENDPOINT);
        builder.setPath(builderPath);
        List<NameValuePair> parameters = new LinkedList<>();
        if (overwrite != null) {
            builder.addParameter(OVERWRITE_PARAM, overwrite.toString());
            parameters.add(new BasicNameValuePair(OVERWRITE_PARAM, overwrite.toString()));
        }
        if (parentRevision != null) {
            builder.addParameter(PARENT_REV_PARAM, parentRevision);
            parameters.add(new BasicNameValuePair(PARENT_REV_PARAM, parentRevision));
        }
        String apiCall = builder.build().toString();
        HttpClient client = HttpClientBuilder.create().build();
        HttpPost post = new HttpPost(apiCall);
        signHttpRequest(post, "POST", apiCall, parameters);
        FileEntity fileEntity = new FileEntity(new File(filePath));
        //         fileEntity.setChunked(true);
        post.setEntity(fileEntity);
        HttpResponse response = client.execute(post);
        Integer statusCode = response.getStatusLine().getStatusCode();
        MeoCloudResponse<Metadata> meoCloudResponse = new MeoCloudResponse<>();
        meoCloudResponse.setCode(statusCode);
        if (statusCode == HttpStatus.SC_OK) {
            String responseBody = convertStreamToString(response.getEntity().getContent());
            Metadata metatada = Metadata.fromJson(responseBody, Metadata.class);
            meoCloudResponse.setResponse(metatada);
        } else
            process(meoCloudResponse, statusCode);
    } catch (Exception e) {
        log.error("Exception caught uploading file.", e);
    }
    return null;
}

From source file:ch.lipsch.subsonic4j.internal.SubsonicServiceImpl.java

@Override
public void createUser(String username, String password, Boolean ldapAuthenticated, Boolean adminRole,
        Boolean settingsRole, Boolean streamRole, Boolean jukeboxRole, Boolean downloadRole, Boolean uploadRole,
        Boolean playlistRole, Boolean coverArtRole, Boolean commentRole, Boolean podcastRole)
        throws SubsonicException {
    throwIfDisposed();/*  ww  w .ja  v a 2s.  c  om*/
    String restifiedUrl = SubsonicUtil.restifySubsonicUrl(getUrl(), PATH_CREATE_USER);
    restifiedUrl = SubsonicUtil.appendCredentialsAsFirstParam(restifiedUrl, getCredentialsProvider());
    restifiedUrl = SubsonicUtil.appendIfSet(restifiedUrl, "username", username);
    restifiedUrl = SubsonicUtil.appendIfSet(restifiedUrl, "password", password);
    restifiedUrl = SubsonicUtil.appendIfSet(restifiedUrl, "ldapAuthenticated",
            ldapAuthenticated == null ? null : ldapAuthenticated.toString());
    restifiedUrl = SubsonicUtil.appendIfSet(restifiedUrl, "adminRole",
            adminRole == null ? null : adminRole.toString());
    restifiedUrl = SubsonicUtil.appendIfSet(restifiedUrl, "settingsRole",
            settingsRole == null ? null : settingsRole.toString());
    restifiedUrl = SubsonicUtil.appendIfSet(restifiedUrl, "streamRole",
            streamRole == null ? null : streamRole.toString());
    restifiedUrl = SubsonicUtil.appendIfSet(restifiedUrl, "jukeboxRole",
            jukeboxRole == null ? null : jukeboxRole.toString());
    restifiedUrl = SubsonicUtil.appendIfSet(restifiedUrl, "downloadRole",
            downloadRole == null ? null : downloadRole.toString());
    restifiedUrl = SubsonicUtil.appendIfSet(restifiedUrl, "uploadRole",
            uploadRole == null ? null : uploadRole.toString());
    restifiedUrl = SubsonicUtil.appendIfSet(restifiedUrl, "playlistRole",
            playlistRole == null ? null : playlistRole.toString());
    restifiedUrl = SubsonicUtil.appendIfSet(restifiedUrl, "coverArtRole",
            coverArtRole == null ? null : coverArtRole.toString());
    restifiedUrl = SubsonicUtil.appendIfSet(restifiedUrl, "commentRole",
            commentRole == null ? null : commentRole.toString());
    restifiedUrl = SubsonicUtil.appendIfSet(restifiedUrl, "podcastRole",
            podcastRole == null ? null : podcastRole.toString());

    fetchResponse(restifiedUrl);
}