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.hichinaschool.flashcards.libanki.Collection.java

/** Return a list of card ids */
public List<Long> findCards(String search, Boolean order) {
    return new Finder(this).findCards(search, order.toString());
}

From source file:com.linkedin.harisekhon.Utils.java

public static final void println(Boolean b) {
    println(b.toString());
}

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

/**
 * Generates a List of Name/Value Pairs for a UpdateMessage to be carried out
 * /*  ww  w  .j a  va2 s  .c  o m*/
 * @param request A UpdateMessage object
 * @return A List of Name/Value Pairs
 */
private List<NameValuePair> getQueryParameters(UpdateMessage request) {
    Boolean matchHidden = request.getMatchHidden();
    Long ttl = request.getTtl();
    Long hide = request.getHide();
    String detail = request.getDetail();
    Long wait = request.getWait();
    if ((matchHidden != null) || (ttl != null) || (hide != null) || (detail != null) || (wait != null)) {
        List<NameValuePair> params = new ArrayList<NameValuePair>(3);
        if (matchHidden != null)
            params.add(new BasicNameValuePair("match_hidden", matchHidden.toString()));
        if (ttl != null)
            params.add(new BasicNameValuePair("ttl", ttl.toString()));
        if (hide != null)
            params.add(new BasicNameValuePair("hide", hide.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.groupon.odo.client.Client.java

/**
 * Turn this profile on or off/* w w w.j  av a 2s. co  m*/
 *
 * @param enabled true or false
 * @return true on success, false otherwise
 */
public boolean toggleProfile(Boolean enabled) {
    // TODO: make this return values properly
    BasicNameValuePair[] params = { new BasicNameValuePair("active", 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.groupon.odo.client.Client.java

/**
 * Enable/disable a server mapping//from w w w.j a v  a  2 s .  co  m
 *
 * @param serverMappingId ID of server mapping
 * @param enabled true to enable, false to disable
 * @return updated info for the ServerRedirect
 */
public ServerRedirect enableServerMapping(int serverMappingId, Boolean enabled) {
    ServerRedirect redirect = new ServerRedirect();
    BasicNameValuePair[] params = { new BasicNameValuePair("enabled", enabled.toString()),
            new BasicNameValuePair("profileIdentifier", this._profileName) };
    try {
        JSONObject response = new JSONObject(doPost(BASE_SERVER + "/" + serverMappingId, params));
        redirect = getServerRedirectFromJSON(response);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
    return redirect;
}

From source file:serverTools.java

public String getServerNetworkInfos(String node, Boolean force) {
    String result = "";
    try {//from  w w w  .j  ava2s .  c o  m
        JSONObject joAction = new JSONObject();
        joAction.put("name", "get");
        joAction.put("request", "networks");
        ArrayList<String> optList = new ArrayList<String>();
        optList.add("force=" + force.toString());
        joAction.put("options", optList);

        result = callOvnmanager(node, joAction.toString());
    } catch (Exception e) {
        log(ERROR, "getServerNetworkInfos", e);
        return "Failed: " + e.toString();
    }
    return result;
}

From source file:com.blackducksoftware.integration.jira.config.HubJiraConfigController.java

@PUT
@Consumes(MediaType.APPLICATION_JSON)/*from ww  w. j av a 2  s.  c  o m*/
public Response put(final HubJiraConfigSerializable config, @Context final HttpServletRequest request) {
    try {
        final PluginSettings settings = pluginSettingsFactory.createGlobalSettings();
        final String username = userManager.getRemoteUsername(request);
        final Response response = checkUserPermissions(request, settings);
        if (response != null) {
            return response;
        }
        transactionTemplate.execute(new TransactionCallback() {
            @Override
            public Object doInTransaction() {
                final List<JiraProject> jiraProjects = getJiraProjects(projectManager.getProjectObjects());
                config.setJiraProjects(jiraProjects);
                final HubServicesFactory hubServicesFactory = createHubServicesFactory(settings, config);
                if (hubServicesFactory == null) {
                    return config;
                }
                final List<HubProject> hubProjects = getHubProjects(hubServicesFactory, config);
                config.setHubProjects(hubProjects);
                config.setJiraProjects(jiraProjects);
                validateInterval(config);
                validateCreator(config, settings);
                validateMapping(config);
                if (getValue(settings, HubJiraConfigKeys.HUB_CONFIG_JIRA_FIRST_SAVE_TIME) == null) {
                    final SimpleDateFormat dateFormatter = new SimpleDateFormat(
                            RestConnection.JSON_DATE_FORMAT);
                    dateFormatter.setTimeZone(java.util.TimeZone.getTimeZone("Zulu"));
                    setValue(settings, HubJiraConfigKeys.HUB_CONFIG_JIRA_FIRST_SAVE_TIME,
                            dateFormatter.format(new Date()));
                }
                final String previousInterval = getStringValue(settings,
                        HubJiraConfigKeys.HUB_CONFIG_JIRA_INTERVAL_BETWEEN_CHECKS);
                setValue(settings, HubJiraConfigKeys.HUB_CONFIG_JIRA_INTERVAL_BETWEEN_CHECKS,
                        config.getIntervalBetweenChecks());
                final String issueCreatorJiraUser = config.getCreator();
                logger.debug("Setting issue creator jira user to: " + issueCreatorJiraUser);
                setValue(settings, HubJiraConfigKeys.HUB_CONFIG_JIRA_ISSUE_CREATOR_USER, issueCreatorJiraUser);
                setValue(settings, HubJiraConfigKeys.HUB_CONFIG_JIRA_POLICY_RULES_JSON,
                        config.getPolicyRulesJson());
                setValue(settings, HubJiraConfigKeys.HUB_CONFIG_JIRA_PROJECT_MAPPINGS_JSON,
                        config.getHubProjectMappingsJson());
                setValue(settings, HubJiraConfigKeys.HUB_CONFIG_JIRA_ADMIN_USER, username);
                updateHubTaskInterval(previousInterval, config.getIntervalBetweenChecks());
                logger.debug("User input: createVulnerabilityIssues: " + config.isCreateVulnerabilityIssues());
                final Boolean createVulnerabilityIssuesChoice = config.isCreateVulnerabilityIssues();
                logger.debug("Setting createVulnerabilityIssuesChoice to "
                        + createVulnerabilityIssuesChoice.toString());
                setValue(settings, HubJiraConfigKeys.HUB_CONFIG_CREATE_VULN_ISSUES_CHOICE,
                        createVulnerabilityIssuesChoice.toString());

                return null;
            }
        });
    } catch (final Exception e) {
        final String msg = "Exception during save: " + e.getMessage();
        logger.error(msg, e);
        config.setErrorMessage(msg);
    }
    if (config.hasErrors()) {
        logger.error(
                "There are one or more errors in the configuration: " + config.getConsolidatedErrorMessage());
        config.enhanceMappingErrorMessage();
        return Response.ok(config).status(Status.BAD_REQUEST).build();
    }
    return Response.noContent().build();
}

From source file:fr.gouv.culture.vitam.eml.PstExtract.java

private Element extractInfoActivity(PSTActivity activity) {
    Element root = XmlDom.factory.createElement("activity");

    String value = null;//from w w w  .ja va 2  s  . com

    value = activity.getLogType();
    if (value != null && !value.isEmpty()) {
        root.add(XmlDom.factory.createElement("LogType").addText(value));
    }
    Date date = activity.getLogStart();
    if (date != null) {
        root.add(XmlDom.factory.createElement("LogStart").addText(date.toString()));
    }
    Integer ival = activity.getLogDuration();
    root.add(XmlDom.factory.createElement("LogDuration").addText(ival.toString()));
    date = activity.getLogEnd();
    if (date != null) {
        root.add(XmlDom.factory.createElement("LogEnd").addText(date.toString()));
    }
    ival = activity.getLogFlags();
    root.add(XmlDom.factory.createElement("LogFlags").addText(ival.toString()));
    Boolean bval = activity.isDocumentPrinted();
    root.add(XmlDom.factory.createElement("isDocumentPrinted").addText(bval.toString()));
    bval = activity.isDocumentSaved();
    root.add(XmlDom.factory.createElement("isDocumentSaved").addText(bval.toString()));
    bval = activity.isDocumentRouted();
    root.add(XmlDom.factory.createElement("isDocumentRouted").addText(bval.toString()));
    bval = activity.isDocumentPosted();
    root.add(XmlDom.factory.createElement("isDocumentPosted").addText(bval.toString()));
    value = activity.getLogTypeDesc();
    if (value != null && !value.isEmpty()) {
        root.add(XmlDom.factory.createElement("LogTypeDesc").addText(value));
    }
    return root;
}

From source file:fr.gouv.culture.vitam.eml.PstExtract.java

private Element extractInfoTask(PSTTask task) {
    Element root = XmlDom.factory.createElement("task");

    String value = null;//from   w  w  w . ja  v  a  2  s.c o m

    Integer ival = task.getTaskStatus();
    root.add(XmlDom.factory.createElement("TaskStatus").addText(ival.toString()));
    Double dval = task.getPercentComplete();
    root.add(XmlDom.factory.createElement("PercentComplete").addText(dval.toString()));
    Boolean bval = task.isTeamTask();
    root.add(XmlDom.factory.createElement("isTeamTask").addText(bval.toString()));
    Date date = task.getTaskStartDate();
    if (date != null) {
        root.add(XmlDom.factory.createElement("TaskStartDate").addText(date.toString()));
    }
    date = task.getTaskDueDate();
    if (date != null) {
        root.add(XmlDom.factory.createElement("TaskDueDate").addText(date.toString()));
    }
    date = task.getTaskDateCompleted();
    if (date != null) {
        root.add(XmlDom.factory.createElement("TaskDateCompleted").addText(date.toString()));
    }
    ival = task.getTaskActualEffort();
    root.add(XmlDom.factory.createElement("TaskActualEffort").addText(ival.toString()));
    ival = task.getTaskEstimatedEffort();
    root.add(XmlDom.factory.createElement("TaskEstimatedEffort").addText(ival.toString()));
    ival = task.getTaskVersion();
    root.add(XmlDom.factory.createElement("TaskVersion").addText(ival.toString()));
    bval = task.isTaskComplete();
    root.add(XmlDom.factory.createElement("isTaskComplete").addText(bval.toString()));
    value = task.getTaskOwner();
    if (value != null && !value.isEmpty()) {
        root.add(XmlDom.factory.createElement("TaskOwner").addText(value));
    }
    value = task.getTaskAssigner();
    if (value != null && !value.isEmpty()) {
        root.add(XmlDom.factory.createElement("TaskAssigner").addText(value));
    }
    value = task.getTaskLastUser();
    if (value != null && !value.isEmpty()) {
        root.add(XmlDom.factory.createElement("TaskLastUser").addText(value));
    }
    ival = task.getTaskOrdinal();
    root.add(XmlDom.factory.createElement("TaskOrdinal").addText(ival.toString()));
    bval = task.isTaskFRecurring();
    root.add(XmlDom.factory.createElement("isTaskFRecurring").addText(bval.toString()));
    value = task.getTaskRole();
    if (value != null && !value.isEmpty()) {
        root.add(XmlDom.factory.createElement("TaskRole").addText(value));
    }
    ival = task.getTaskOwnership();
    root.add(XmlDom.factory.createElement("TaskOwnership").addText(ival.toString()));
    ival = task.getAcceptanceState();
    root.add(XmlDom.factory.createElement("AcceptanceState").addText(ival.toString()));
    return root;
}

From source file:org.finra.herd.tools.uploader.UploaderWebClient.java

/**
 * Gets the business object data upload credentials.
 *
 * @param manifest the manifest//from ww  w. j  a v  a2s.  c om
 * @param storageName the storage name
 * @param businessObjectDataVersion the version of the business object data
 * @param createNewVersion specifies to provide credentials fof the next business object data version
 *
 * @return {@link BusinessObjectDataUploadCredential}
 * @throws URISyntaxException When error occurs while URI creation
 * @throws IOException When error occurs communicating with server
 * @throws JAXBException When error occurs parsing the XML
 */
public BusinessObjectDataUploadCredential getBusinessObjectDataUploadCredential(
        DataBridgeBaseManifestDto manifest, String storageName, Integer businessObjectDataVersion,
        Boolean createNewVersion) throws URISyntaxException, IOException, JAXBException {
    URIBuilder uriBuilder = new URIBuilder().setScheme(getUriScheme())
            .setHost(regServerAccessParamsDto.getRegServerHost())
            .setPort(regServerAccessParamsDto.getRegServerPort())
            .setPath(String.join("/", HERD_APP_REST_URI_PREFIX, "businessObjectData", "upload", "credential",
                    "namespaces", manifest.getNamespace(), "businessObjectDefinitionNames",
                    manifest.getBusinessObjectDefinitionName(), "businessObjectFormatUsages",
                    manifest.getBusinessObjectFormatUsage(), "businessObjectFormatFileTypes",
                    manifest.getBusinessObjectFormatFileType(), "businessObjectFormatVersions",
                    manifest.getBusinessObjectFormatVersion(), "partitionValues", manifest.getPartitionValue()))
            .setParameter("storageName", storageName);
    if (manifest.getSubPartitionValues() != null) {
        uriBuilder.setParameter("subPartitionValues",
                herdStringHelper.join(manifest.getSubPartitionValues(), "|", "\\"));
    }
    if (businessObjectDataVersion != null) {
        uriBuilder.setParameter("businessObjectDataVersion", businessObjectDataVersion.toString());
    }
    if (createNewVersion != null) {
        uriBuilder.setParameter("createNewVersion", createNewVersion.toString());
    }
    HttpGet httpGet = new HttpGet(uriBuilder.build());
    httpGet.addHeader("Accepts", DEFAULT_ACCEPT);
    if (regServerAccessParamsDto.isUseSsl()) {
        httpGet.addHeader(getAuthorizationHeader());
    }
    try (CloseableHttpClient httpClient = httpClientOperations.createHttpClient()) {
        LOGGER.info("Retrieving upload credentials from registration server...");
        return getBusinessObjectDataUploadCredential(httpClientOperations.execute(httpClient, httpGet));
    }
}