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:gateway.controller.AlertTriggerController.java

/**
 * Gets the list of Alerts/*from   ww  w .  j  a  v  a  2s .c o  m*/
 * 
 * @see "http://pz-swagger.stage.geointservices.io/#!/Alert/get_alert"
 * 
 * @return The list of Alerts, or an error
 */
@RequestMapping(value = "/alert", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "Get User Alerts", notes = "Gets all of the Alerts", tags = { "Alert", "Workflow" })
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "The list of Alerts.", response = AlertListResponse.class),
        @ApiResponse(code = 400, message = "Bad Request", response = ErrorResponse.class),
        @ApiResponse(code = 401, message = "Unauthorized", response = ErrorResponse.class),
        @ApiResponse(code = 500, message = "Internal Error", response = ErrorResponse.class) })
public ResponseEntity<?> getAlerts(
        @ApiParam(value = "Paginating large numbers of results. This will determine the starting page for the query.") @RequestParam(value = "page", required = false, defaultValue = DEFAULT_PAGE) Integer page,
        @ApiParam(value = "The number of results to be returned per query.") @RequestParam(value = "perPage", required = false, defaultValue = DEFAULT_PAGE_SIZE) Integer perPage,
        @ApiParam(value = "Indicates ascending or descending order.") @RequestParam(value = "order", required = false, defaultValue = DEFAULT_ORDER) String order,
        @ApiParam(value = "The data field to sort by.") @RequestParam(value = "sortBy", required = false, defaultValue = DEFAULT_SORTBY) String sortBy,
        @ApiParam(value = "The Trigger Id by which to filter results.") @RequestParam(value = "triggerId", required = false) String triggerId,
        @ApiParam(value = "If this flag is set to true, then Workflow objects otherwise referenced by a single Unique ID will be populated in full.") @RequestParam(value = "inflate", required = false) Boolean inflate,
        Principal user) {
    try {
        // Log the request
        logger.log(String.format("User %s has requested a list of Alerts.", gatewayUtil.getPrincipalName(user)),
                PiazzaLogger.INFO);

        // Validate params
        String validationError = null;
        if ((order != null && (validationError = gatewayUtil.validateInput("order", order)) != null)
                || (page != null && (validationError = gatewayUtil.validateInput("page", page)) != null)
                || (perPage != null
                        && (validationError = gatewayUtil.validateInput("perPage", perPage)) != null)) {
            return new ResponseEntity<PiazzaResponse>(new ErrorResponse(validationError, "Gateway"),
                    HttpStatus.BAD_REQUEST);
        }

        try {
            // Broker the request to Workflow
            String url = String.format("%s/%s?page=%s&perPage=%s&order=%s&sortBy=%s&triggerId=%s&inflate=%s",
                    WORKFLOW_URL, "alert", page, perPage, order, sortBy != null ? sortBy : "",
                    triggerId != null ? triggerId : "", inflate != null ? inflate.toString() : false);
            return new ResponseEntity<String>(restTemplate.getForObject(url, String.class), HttpStatus.OK);
        } catch (HttpClientErrorException | HttpServerErrorException hee) {
            LOGGER.error("Error querying Alerts.", hee);
            return new ResponseEntity<PiazzaResponse>(
                    gatewayUtil.getErrorResponse(
                            hee.getResponseBodyAsString().replaceAll("}", " ,\"type\":\"error\" }")),
                    hee.getStatusCode());
        }
    } catch (Exception exception) {
        String error = String.format("Error querying Alerts by user %s: %s", gatewayUtil.getPrincipalName(user),
                exception.getMessage());
        LOGGER.error(error, exception);
        logger.log(error, PiazzaLogger.ERROR);
        return new ResponseEntity<PiazzaResponse>(new ErrorResponse(error, "Gateway"),
                HttpStatus.INTERNAL_SERVER_ERROR);
    }
}

From source file:com.clxcommunications.xms.ApiConnection.java

/**
 * Asynchronously performs a dry run of the given batch.
 * //  ww w .  j  a  v  a 2  s  . co m
 * @param sms
 *            the batch to dry run
 * @param perRecipient
 *            whether the per-recipient result should be populated
 * @param numRecipients
 *            the number of recipients to populate
 * @param callback
 *            a callback that is invoked when dry run is complete
 * @return a future whose result is the dry run result
 */
public Future<MtBatchDryRunResult> createBatchDryRunAsync(MtBatchSmsCreate sms, Boolean perRecipient,
        Integer numRecipients, FutureCallback<MtBatchDryRunResult> callback) {
    List<NameValuePair> params = new ArrayList<NameValuePair>(2);

    if (perRecipient != null) {
        params.add(new BasicNameValuePair("per_recipient", perRecipient.toString()));
    }

    if (numRecipients != null) {
        params.add(new BasicNameValuePair("number_of_recipients", numRecipients.toString()));
    }

    HttpPost req = post(batchDryRunEndpoint(params), sms);

    HttpAsyncRequestProducer requestProducer = new BasicAsyncRequestProducer(endpointHost(), req);
    HttpAsyncResponseConsumer<MtBatchDryRunResult> responseConsumer = jsonAsyncConsumer(
            MtBatchDryRunResult.class);

    return httpClient().execute(requestProducer, responseConsumer, callbackWrapper().wrap(callback));
}

From source file:org.finra.dm.tools.common.databridge.DataBridgeWebClient.java

/**
 * Retrieves S3 key prefix from the Data Management Service.
 *
 * @param manifest the manifest file information
 * @param businessObjectDataVersion the business object data version (optional)
 * @param createNewVersion if not set, only initial version of the business object data is allowed to be created.  This parameter is ignored, when the
 * business object data version is specified.
 *
 * @return the S3 key prefix//  w w  w  . ja v  a2s . c  om
 * @throws IOException if an I/O error was encountered.
 * @throws JAXBException if a JAXB error was encountered.
 * @throws URISyntaxException if a URI syntax error was encountered.
 */
protected S3KeyPrefixInformation getS3KeyPrefix(DataBridgeBaseManifestDto manifest,
        Integer businessObjectDataVersion, Boolean createNewVersion)
        throws IOException, JAXBException, URISyntaxException {
    LOGGER.info("Retrieving S3 key prefix from the Data Management Service...");

    StringBuilder uriPathBuilder = new StringBuilder(151);
    uriPathBuilder.append(DM_APP_REST_URI_PREFIX + "/businessObjectData");
    // The namespace is optional. If not specified, do not add to the REST URI.
    if (StringUtils.isNotBlank(manifest.getNamespace())) {
        uriPathBuilder.append("/namespaces/").append(manifest.getNamespace());
    }
    uriPathBuilder.append("/businessObjectDefinitionNames/").append(manifest.getBusinessObjectDefinitionName());
    uriPathBuilder.append("/businessObjectFormatUsages/").append(manifest.getBusinessObjectFormatUsage());
    uriPathBuilder.append("/businessObjectFormatFileTypes/").append(manifest.getBusinessObjectFormatFileType());
    uriPathBuilder.append("/businessObjectFormatVersions/").append(manifest.getBusinessObjectFormatVersion());
    uriPathBuilder.append("/s3KeyPrefix");

    String uriPath = uriPathBuilder.toString();

    URIBuilder uriBuilder = new URIBuilder().setScheme(getUriScheme())
            .setHost(dmRegServerAccessParamsDto.getDmRegServerHost())
            .setPort(dmRegServerAccessParamsDto.getDmRegServerPort()).setPath(uriPath)
            .setParameter("partitionKey", manifest.getPartitionKey())
            .setParameter("partitionValue", manifest.getPartitionValue())
            .setParameter("createNewVersion", createNewVersion.toString());

    if (!CollectionUtils.isEmpty(manifest.getSubPartitionValues())) {
        uriBuilder.setParameter("subPartitionValues",
                dmStringHelper.join(manifest.getSubPartitionValues(), "|", "\\"));
    }

    if (businessObjectDataVersion != null) {
        uriBuilder.setParameter("businessObjectDataVersion", businessObjectDataVersion.toString());
    }

    S3KeyPrefixInformation s3KeyPrefixInformation;
    try (CloseableHttpClient client = HttpClientBuilder.create().build()) {
        HttpGet request = new HttpGet(uriBuilder.build());
        request.addHeader("Accepts", "application/xml");

        // If SSL is enabled, set the client authentication header.
        if (dmRegServerAccessParamsDto.getUseSsl()) {
            request.addHeader(getAuthorizationHeader());
        }

        LOGGER.info(String.format("    HTTP GET URI: %s", request.getURI().toString()));
        LOGGER.info(String.format("    HTTP GET Headers: %s", Arrays.toString(request.getAllHeaders())));

        s3KeyPrefixInformation = getS3KeyPrefixInformation(httpClientOperations.execute(client, request));
    }

    LOGGER.info("Successfully retrieved S3 key prefix from the Data Management Service.");
    LOGGER.info("    S3 key prefix: " + s3KeyPrefixInformation.getS3KeyPrefix());

    return s3KeyPrefixInformation;
}

From source file:com.google.appinventor.components.runtime.GameClient.java

private void postMakeNewInstance(final String requestedInstanceId, final Boolean makePublic) {
    AsyncCallbackPair<JSONObject> makeNewGameCallback = new AsyncCallbackPair<JSONObject>() {
        public void onSuccess(final JSONObject response) {
            processInstanceLists(response);
            NewInstanceMade(InstanceId());
            FunctionCompleted("MakeNewInstance");
        }//from   www. j  a  v  a2s  .co  m

        public void onFailure(final String message) {
            WebServiceError("MakeNewInstance", message);
        }
    };

    postCommandToGameServer(NEW_INSTANCE_COMMAND,
            Lists.<NameValuePair>newArrayList(new BasicNameValuePair(PLAYER_ID_KEY, UserEmailAddress()),
                    new BasicNameValuePair(GAME_ID_KEY, GameId()),
                    new BasicNameValuePair(INSTANCE_ID_KEY, requestedInstanceId),
                    new BasicNameValuePair(INSTANCE_PUBLIC_KEY, makePublic.toString())),
            makeNewGameCallback, true);
}

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

protected String getVhdParent(final Connection conn, final String primaryStorageSRUuid,
        final String snapshotUuid, final Boolean isISCSI) {
    final String parentUuid = hypervisorResource.callHostPlugin(conn, "vmopsSnapshot", "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  w ww .j a va 2s  .  co  m
    return parentUuid;
}

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

private Long getSnapshotSize(final Connection conn, final String primaryStorageSRUuid,
        final String snapshotUuid, final Boolean isISCSI, final int wait) {
    final String physicalSize = hypervisorResource.callHostPluginAsync(conn, "vmopsSnapshot", "getSnapshotSize",
            wait, "primaryStorageSRUuid", primaryStorageSRUuid, "snapshotUuid", snapshotUuid, "isISCSI",
            isISCSI.toString());
    if (physicalSize == null || physicalSize.isEmpty()) {
        return (long) 0;
    } else {//w w w. ja v  a2 s  .  c om
        return Long.parseLong(physicalSize);
    }
}

From source file:com.vmware.bdd.cli.commands.ClusterCommands.java

@CliCommand(value = "cluster start", help = "Start a cluster")
public void startCluster(
        @CliOption(key = { "name" }, mandatory = true, help = "The cluster name") final String clusterName,
        @CliOption(key = {
                "force" }, mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false", help = "Force start cluster") final Boolean forceStart) {

    Map<String, String> queryStrings = new HashMap<String, String>();
    queryStrings.put(Constants.QUERY_ACTION_KEY, Constants.QUERY_ACTION_START);
    queryStrings.put(Constants.FORCE_CLUSTER_OPERATION_KEY, forceStart.toString());
    // rest invocation
    try {/*from  w  ww. j a v a2 s  .co m*/
        restClient.actionOps(clusterName, queryStrings);
        CommandsUtils.printCmdSuccess(Constants.OUTPUT_OBJECT_NODES_IN_CLUSTER,
                Constants.OUTPUT_OP_RESULT_START);

    } catch (CliRestException e) {
        CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_NODES_IN_CLUSTER, Constants.OUTPUT_OP_START,
                Constants.OUTPUT_OP_RESULT_FAIL, e.getMessage());
    }
}

From source file:fr.itldev.koya.alfservice.KoyaContentService.java

public Map<String, String> createContentNode(NodeRef parent, String fileName, String name, String mimetype,
        String encoding, InputStream contentInputStream) throws KoyaServiceException {
    Boolean rename = false;
    if (name == null) {
        name = koyaNodeService.getUniqueValidFileNameFromTitle(fileName);

        rename = !fileName.equals(name);
    }/*  ww  w  . ja va2s.  c o m*/

    /**
     * CREATE NODE
     */
    NodeRef createdNode;
    try {
        final Map<QName, Serializable> properties = new HashMap<>();
        properties.put(ContentModel.PROP_NAME, name);
        properties.put(ContentModel.PROP_TITLE, fileName);
        ChildAssociationRef car = nodeService.createNode(parent, ContentModel.ASSOC_CONTAINS,
                QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name), ContentModel.TYPE_CONTENT,
                properties);
        createdNode = car.getChildRef();
    } catch (DuplicateChildNodeNameException ex) {
        throw new KoyaServiceException(KoyaErrorCodes.FILE_UPLOAD_NAME_EXISTS, fileName);
    } catch (IllegalArgumentException ex) {
        logger.error(fileName);
        throw ex;
    }

    /**
     * ADD CONTENT TO CREATED NODE
     *
     */
    ContentWriter writer = this.contentService.getWriter(createdNode, ContentModel.PROP_CONTENT, true);
    if (mimetype != null) {
        writer.setMimetype(mimetype);
    } else {
        writer.guessMimetype(fileName);
    }
    if (encoding != null) {
        writer.setEncoding(encoding);
    }
    writer.guessEncoding();
    writer.putContent(contentInputStream);

    Map<String, String> retMap = new HashMap<>();

    retMap.put("filename", name);
    retMap.put("originalFilename", fileName);
    retMap.put("rename", rename.toString());
    retMap.put("size", Long.toString(writer.getSize()));

    return retMap;
}

From source file:org.esupportail.bigbluebutton.domain.DomainServiceImpl.java

@Override
public String createMeetingUrl(String meetingID, String meetingName, String welcome, String viewerPassword,
        String moderatorPassword, Integer voiceBridge, Boolean record, String username) {

    String base_url_create = BBBServerUrl + "api/create?";
    String base_url_join = BBBServerUrl + "api/join?";

    String welcome_param = "";
    String checksum = "";

    String attendee_password_param = "&attendeePW=" + viewerPassword;
    String moderator_password_param = "&moderatorPW=" + moderatorPassword;
    String voice_bridge_param = "";
    String logoutURL_param = "";
    String record_param = "";

    WebUtils utils = new WebUtils();

    if ((welcome != null) && !welcome.equals("")) {
        welcome_param = "&welcome=" + utils.urlEncode(welcome);
    }//from  ww  w  . j a  v a  2s  .co  m

    if ((moderatorPassword != null) && !moderatorPassword.equals("")) {
        moderator_password_param = "&moderatorPW=" + utils.urlEncode(moderatorPassword);
    }

    if ((viewerPassword != null) && !viewerPassword.equals("")) {
        attendee_password_param = "&attendeePW=" + utils.urlEncode(viewerPassword);
    }

    if ((voiceBridge != null) && !voiceBridge.equals("")) {
        voice_bridge_param = "&voiceBridge=" + voiceBridge;
    }

    if ((BBBLogoutUrl != null) && !BBBLogoutUrl.equals("")) {
        logoutURL_param = "&logoutURL=" + utils.urlEncode(BBBLogoutUrl);
    }

    if ((record != null) && !record.equals("")) {
        record_param = "&record=" + record.toString();
    }

    //
    // Now create the URL
    //

    String create_parameters = "name=" + utils.urlEncode(meetingName) + "&meetingID="
            + utils.urlEncode(meetingID) + welcome_param + attendee_password_param + moderator_password_param
            + voice_bridge_param + record_param + logoutURL_param;

    String url = base_url_create + create_parameters + "&checksum="
            + utils.checksum("create" + create_parameters + BBBSecuritySalt);

    return url;
}

From source file:calculadora.controlador.ControladorComandos.java

/**
 * Busca el comando que se le paso al constructor y llama a la calculadora
 * para que ejecute el comando con los argumentos de entrada.
 *
 * Este metodo utiliza el <b>return</b> para devolver los resultados una vez
 * encuentra un comando devuelve el resultado y no pasa por los demas
 * sentencias./*from w w w . j  a  v  a  2  s  . co  m*/
 *
 * Se debe controlar cada uno de los comandos y pasarle los numeros a la
 * calculadora.
 *
 * Nota: -Si en la linea de comandos de entrada no hay ningun comando de la
 * aplicacion no devuelve una cadena vacia para que no muestre nada en
 * pantalla.
 *
 * -Si la opcion es de ayuda se le pasa una cadena unica que interpretara el
 * controlador principal para mostrar la ayuda.
 *
 * -Nunca se devuelve null
 *
 * Refacotorizado varias veces, antes estaba toda la busqueda concentrada en
 * el metodo.
 *
 * @see ControladorCalc#Todos los metodos
 * @see Object#toString()
 * @return String el resultado de la operacion
 * @throws IllegalArgumentException argumentos no son correctos
 * @throws NumberFormatException tipos de argumentos erroneos
 */
public String busquedaDeComandos() throws IllegalArgumentException, NumberFormatException {

    String resultado = "";
    //Resultado de las posibles operaciones
    Double result;
    Boolean resultBoo;

    //Si el comando es help
    if (cmdLine.hasOption(HELP)) {
        if (cmdLine.hasOption(PROPERTY)) {
            //Devuelvo un valor unico posible para decirle al controlador
            //principal que tiene que mostrar la ayuda de el comando -D
            resultado = "AYUDAPROPERTY";
        } else {
            //Devuelvo un valor unico posible para decirle al controlador
            //principal que tiene que mostrar la ayuda a la vista
            resultado = "AYUDA";
        }
    } else //Si el comando es exit
    if (cmdLine.hasOption(EXIT)) {
        //Devuelvo un valor unico posible para decirle al controlador
        //principal que tiene que salirse de la linea de comandos
        resultado = "EXIT";
    } else /* Propiedades */ if (cmdLine.hasOption("D")) {
        //Devuelve el resultado de la conversion
        resultado = conversor();
    } else if ((result = operacionesAritmetricas()) != null) {
        /* OperacionesAritmetricas */
        //Resultado de las posibles operaciones
        resultado = result.toString();
    } else if ((result = operacionesTrigonometricas()) != null) {
        /* OperacionesTrigonometricas */
        resultado = result.toString();
    } else if ((resultBoo = tablasVerdad()) != null) {
        /* Tablas de verdad */
        //Resultado de las posibles operaciones booleanas
        resultado = resultBoo.toString();
    }

    //Devuelve el resultado 
    return resultado;
}