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.github.jillesvangurp.urlbuilder.UrlBuilder.java

/**
 * Create a query parameter with a boolean value.
 * @param name parameter name/*from w  ww. j a  v  a 2 s  .  c o  m*/
 * @param value
 * @return the builder
 */
public UrlBuilder queryParam(String name, Boolean value) {
    if (value != null) {
        return queryParam(name, value.toString());
    } else {
        return null;
    }
}

From source file:ua.aits.crc.controller.SystemController.java

@RequestMapping(value = "/system/do/removefile", method = RequestMethod.GET)
public @ResponseBody String removeFileOrDir(HttpServletRequest request) {
    String path = request.getParameter("path");
    File temp = new File(Constants.home + path);
    Boolean result = temp.delete();
    return result.toString();
}

From source file:org.opendatakit.aggregate.format.element.OhmageJsonElementFormatter.java

@Override
public void formatBoolean(Boolean bool, FormElementModel element, String ordinalValue, Row row) {
    OhmageJsonTypes.text resp = new OhmageJsonTypes.text(element.getElementName(), bool.toString());
    responses.add(resp);//from ww  w. j a v a  2  s . c om
}

From source file:com.bvp.miniproject.ConfigureApplication.java

public boolean sendGetToServer() {
    int i = 0;//w w  w .  jav a2  s.c  o  m
    if (phpComplete) {
        try {
            char temp;
            /* EXECUTE THE GET REQUEST TO SERVER*/

            response = httpclient.execute(httpget);
            /* GET THE RESPONSE FROM THE SERVER */
            entity = response.getEntity();
            Log.d("here", "here");
            if (entity != null) {
                /* GET INPUT STREAM */
                InputStream instream = entity.getContent();
                while (((temp = (char) instream.read()) != -1) && (i < 5)) {
                    i++;
                    result.append(temp);

                }
            }
            Log.d("result:", result.toString());
            /**
             * parse the result
             */
            Boolean b;

            if (result.toString().charAt(0) == 't') {
                b = true;
            } else
                b = false;
            Log.d("got:", b.toString());

            return b;
        } catch (Exception e) {
            Log.d("IN GET TO SERVER", e.toString());
        } finally //finally 
        {
            httpget.abort();
        }
        return false;
    } else {
        return true;
    }
}

From source file:org.jasig.cas.client.configuration.WebXmlConfigurationStrategyImplTests.java

@Test
public void servletConfigValueForBoolean() {
    final ConfigurationKey<Boolean> key = ConfigurationKeys.ACCEPT_ANY_PROXY;
    final Boolean value = Boolean.TRUE;
    final MockServletContext context = (MockServletContext) this.filterConfig.getServletContext();
    context.addInitParameter(key.getName(), value.toString());
    assertEquals(value, this.impl.getBoolean(key));
}

From source file:net.solarnetwork.node.control.modbus.toggle.ModbusToggler.java

@Override
public List<SettingSpecifier> getSettingSpecifiers() {
    ModbusToggler defaults = new ModbusToggler();
    List<SettingSpecifier> results = new ArrayList<SettingSpecifier>(20);

    // get current value
    BasicTitleSettingSpecifier status = new BasicTitleSettingSpecifier("status", "N/A", true);
    try {//from  w w w .j a  va  2  s.co  m
        Boolean val = currentValue();
        status.setDefaultValue(val.toString());
    } catch (Exception e) {
        log.debug("Error reading {} status: {}", controlId, e.getMessage());
    }
    results.add(status);

    results.add(new BasicTextFieldSettingSpecifier("controlId", defaults.controlId));
    results.add(new BasicTextFieldSettingSpecifier("groupUID", defaults.getGroupUID()));
    results.add(new BasicTextFieldSettingSpecifier("modbusNetwork.propertyFilters['UID']", "Serial Port"));
    results.add(new BasicTextFieldSettingSpecifier("unitId", String.valueOf(defaults.getUnitId())));
    results.add(new BasicTextFieldSettingSpecifier("address", defaults.address.toString()));

    return results;
}

From source file:puma.application.evaluation.AdvancedDocumentController.java

private String access(Action action, MultiValueMap<String, String> params, Environment environment) {
    if (!params.containsKey("user") || !params.containsKey("document")) {
        throw new IllegalArgumentException("Provide at least user and document ids");
    }/*  w w w  .  ja  v a  2  s .c  o m*/
    User u = this.userService.byId(Long.parseLong(params.getFirst("user")));
    if (u == null)
        throw new IllegalArgumentException("Could not find user with specified id~!");
    Subject subject = new Subject(u.getId().toString());
    for (Attribute next : u.getAttributes())
        if (next.getFamily().getRetrievalStrategy().equals(RetrievalStrategy.PUSH))
            addAttribute(subject, next.getFamily().getXacmlIdentifier(), next.getValue());
    Document doc = this.docService.getDocumentById(Long.parseLong(params.getFirst("document")));
    if (doc == null)
        throw new IllegalArgumentException("Could not find document with specified id~!");
    params.remove("document");
    params.remove("user");
    puma.peputils.Object object = constructAuthzObject(doc, params);
    Boolean decision = ApplicationPEP.getInstance().isAuthorized(subject, object, action, environment);
    return decision.toString();
}

From source file:com.esri.geoevent.solutions.adapter.geomessage.DefenseOutboundAdapter.java

@SuppressWarnings("incomplete-switch")
@Override/*from  w ww  .j a  va2  s . c o m*/
public synchronized void receive(GeoEvent geoEvent) {

    ByteBuffer byteBuffer = ByteBuffer.allocate(10 * 1024);
    Integer wkid = -1;
    String message = "";

    message += "<geomessage v=\"1.0\">\n\r";
    message += "<_type>";
    message += messageType;
    message += "</_type>\n\r";
    message += "<_action>";
    message += "update";
    message += "</_action>\n\r";
    String messageid = UUID.randomUUID().toString();
    message += "<_id>";
    message += "{" + messageid + "}";
    message += "</_id>\n\r";
    MapGeometry geom = geoEvent.getGeometry();
    if (geom.getGeometry().getType() == com.esri.core.geometry.Geometry.Type.Point) {
        Point p = (Point) geom.getGeometry();
        message += "<_control_points>";
        message += ((Double) p.getX()).toString();
        message += ",";
        message += ((Double) p.getY()).toString();
        message += "</_control_points>\n\r";
        wkid = ((Integer) geom.getSpatialReference().getID());
    }

    if (wkid > 0) {
        String wkidValue = wkid.toString();
        message += "<_wkid>";
        message += wkidValue.toString();
        message += "</_wkid>\n\r";
    }
    GeoEventDefinition definition = geoEvent.getGeoEventDefinition();
    for (FieldDefinition fieldDefinition : definition.getFieldDefinitions()) {

        String attributeName = fieldDefinition.getName();
        Object value = geoEvent.getField(attributeName);

        if (value == null || value.equals("null")) {
            continue;
        }
        FieldType t = fieldDefinition.getType();
        if (t != FieldType.Geometry) {
            message += "<" + attributeName + ">";

            switch (t) {
            case String:
                // if(((String)value).isEmpty())
                // continue;
                message += value;
                break;
            case Date:
                Date date = (Date) value;
                message += (formatter.format(date));
                break;
            case Double:
                Double doubleValue = (Double) value;
                message += doubleValue.toString();
                break;
            case Float:
                Float floatValue = (Float) value;
                message += floatValue.toString();
                break;

            case Integer:
                Integer intValue = (Integer) value;
                message += intValue.toString();
                break;
            case Long:
                Long longValue = (Long) value;
                message += longValue.toString();
                break;
            case Short:
                Short shortValue = (Short) value;
                message += shortValue.toString();
                break;
            case Boolean:
                Boolean booleanValue = (Boolean) value;
                message += booleanValue.toString();
                break;

            }
            message += "</" + attributeName + ">\n\r";
        } else {
            if (definition.getIndexOf(attributeName) == definition.getIndexOf("GEOMETRY")) {
                continue;
            } else {
                String json = GeometryEngine.geometryToJson(wkid, (Geometry) value);
                message += "<" + attributeName + ">";
                message += json;
                message += "</" + attributeName + ">\n\r";
            }
            break;
        }

    }
    message += "</geomessage>";
    // stringBuffer.append("</geomessages>");
    message += "\r\n";

    ByteBuffer buf = charset.encode(message);
    if (buf.position() > 0)
        buf.flip();

    try {
        byteBuffer.put(buf);
    } catch (BufferOverflowException ex) {
        LOG.error(
                "Csv Outbound Adapter does not have enough room in the buffer to hold the outgoing data.  Either the receiving transport object is too slow to process the data, or the data message is too big.");
    }
    byteBuffer.flip();
    super.receive(byteBuffer, geoEvent.getTrackId(), geoEvent);
    byteBuffer.clear();
}

From source file:org.springframework.social.box.api.impl.FolderTemplate.java

@Override
public void deleteFolder(String folderId, Boolean recursive) {
    if (recursive == null) {
        recursive = false;//from  w  w w  . j  a  v a2 s.  c o  m
    }
    boxOperation(HttpMethod.DELETE, FOLDER_OPERATION + folderId + "?recursive=" + recursive.toString());
}

From source file:hydrograph.ui.dataviewer.filter.FilterValidator.java

private boolean validate(String type, String value, DebugDataViewer debugDataViewer, String fieldName)
        throws ParseException {
    if (FilterConstants.TYPE_BOOLEAN.equals(type)) {
        Boolean convertedBoolean = Boolean.valueOf(value);
        if (!StringUtils.equalsIgnoreCase(convertedBoolean.toString(), value)) {
            return false;
        }//  w  w w .j  a v  a2s.c  o  m
    } else if (FilterConstants.TYPE_DOUBLE.equals(type)) {
        Double.valueOf(value);
    } else if (FilterConstants.TYPE_FLOAT.equals(type)) {
        Float.valueOf(value);
    } else if (FilterConstants.TYPE_INTEGER.equals(type)) {
        Integer.valueOf(value);
    } else if (FilterConstants.TYPE_LONG.equals(type)) {
        Long.valueOf(value);
    } else if (FilterConstants.TYPE_SHORT.equals(type)) {
        Short.valueOf(value);
    } else if (FilterConstants.TYPE_STRING.equals(type)) {
        String.valueOf(value);
    } else if (FilterConstants.TYPE_BIGDECIMAL.equals(type)) {
        new BigDecimal(value);
    } else if (FilterConstants.TYPE_DATE.equals(type)) {
        String debugFileName = debugDataViewer.getDebugFileName();
        String debugFileLocation = debugDataViewer.getDebugFileLocation();
        Fields dataViewerFileSchema = ViewDataSchemaHelper.INSTANCE.getFieldsFromSchema(
                debugFileLocation + debugFileName + AdapterConstants.SCHEMA_FILE_EXTENTION);
        for (Field field : dataViewerFileSchema.getField()) {
            if (field.getName().equalsIgnoreCase(fieldName)) {
                SimpleDateFormat sdf = new SimpleDateFormat(field.getFormat());
                sdf.parse(value);
            }
        }

    }
    return true;

}