List of usage examples for java.lang Boolean toString
public String toString()
From source file:edu.kit.dama.mdm.admin.UserPropertyCollection.java
/** * Returns the value of the property with the provided key as string. If the * property is not found, the provided default value is returned. * * @param pKey The property key./*ww w. j a v a2 s .co m*/ * @param pDefaultValue The default value. * * @return The value of the property or the provided default value. */ public Boolean getBooleanProperty(final String pKey, Boolean pDefaultValue) { if (pDefaultValue == null) { return Boolean.parseBoolean(getStringProperty(pKey, null)); } return Boolean.parseBoolean(getStringProperty(pKey, pDefaultValue.toString())); }
From source file:com.urbancode.ud.client.PropertyClient.java
public UUID createPropDef(UUID propSheetDefId, String propSheetDefPath, String name, String description, String label, Boolean required, String type, String value) throws IOException, JSONException { UUID result;//from ww w . j a va2 s . c o m String uri = url + "/property/propSheetDef/" + encodePath(propSheetDefPath) + ".-1/propDefs"; JSONObject propDefObject = new JSONObject(); propDefObject.put("name", name); propDefObject.put("description", description); propDefObject.put("label", label); propDefObject.put("required", required.toString()); propDefObject.put("type", type); propDefObject.put("value", value); propDefObject.put("definitionGroupId", propSheetDefId); HttpPut method = new HttpPut(uri); method.setEntity(getStringEntity(propDefObject)); HttpResponse response = invokeMethod(method); String body = getBody(response); result = UUID.fromString(new JSONObject(body).getString("id")); return result; }
From source file:org.rundeck.api.ApiPathBuilder.java
/** * Append the given parameter (key and value). This will only append the parameter if it is not null, and make sure * to add the right separator ("?" or "&") before. The key and value will be separated by the "=" character. * * @param key of the parameter. Must not be null or empty * @param value of the parameter. May be null * @return this, for method chaining/*from ww w . java2 s. c om*/ */ public ApiPathBuilder param(String key, Boolean value) { if (value != null) { param(key, value.toString()); } return this; }
From source file:edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.ManagePagePreprocessor.java
private void addInputsToSubmission(ProcessDataGetterN3 pn, int counter, JSONObject jsonObject) { List<String> literalLabels = pn.getLiteralVarNamesBase(); List<String> uriLabels = pn.getUriVarNamesBase(); for (String literalLabel : literalLabels) { List<String> literalValues = new ArrayList<String>(); Object jsonValue = jsonObject.get(literalLabel); //Var names will depend on which data getter object this is on the page, so depends on counter String submissionLiteralName = pn.getVarName(literalLabel, counter); //Single value if (jsonValue instanceof String) { //TODO: Deal with multiple submission values //This retrieves the value for this particular json object String jsonString = jsonObject.getString(literalLabel); jsonString = pn.replaceEncodedQuotesWithEscapedQuotes(jsonString); literalValues.add(jsonString); } else if (jsonValue instanceof JSONArray) { JSONArray values = jsonObject.getJSONArray(literalLabel); literalValues = (List<String>) JSONSerializer.toJava(values); //Replacing encoded quotes here as well this.replaceEncodedQuotesInList(pn, literalValues); } else if (jsonValue instanceof Boolean) { Boolean booleanValue = jsonObject.getBoolean(literalLabel); //Adds string version literalValues.add(booleanValue.toString()); }//from w w w .j ava 2 s .co m String[] literalValuesSubmission = new String[literalValues.size()]; literalValuesSubmission = literalValues.toArray(literalValuesSubmission); //This adds literal, connecting the field with submission.addLiteralToForm(editConfiguration, editConfiguration.getField(submissionLiteralName), submissionLiteralName, literalValuesSubmission); } for (String uriLabel : uriLabels) { List<String> uriValues = new ArrayList<String>(); Object jsonValue = jsonObject.get(uriLabel); //Var names will depend on which data getter object this is on the page, so depends on counter String submissionUriName = pn.getVarName(uriLabel, counter); //if single value, then, add to values if (jsonValue instanceof String) { //Var names will depend on which data getter object this is on the page, so depends on counter //This retrieves the value for this particular json object and adds to list uriValues.add(jsonObject.getString(uriLabel)); } else if (jsonValue instanceof JSONArray) { //multiple values JSONArray values = jsonObject.getJSONArray(uriLabel); uriValues = (List<String>) JSONSerializer.toJava(values); } else { //This may include JSON Objects but no way to deal with these right now } String[] uriValuesSubmission = new String[uriValues.size()]; uriValuesSubmission = uriValues.toArray(uriValuesSubmission); //This adds literal, connecting the field with the value submission.addUriToForm(editConfiguration, submissionUriName, uriValuesSubmission); } //To get data getter uris, check if editing an existing set and include those as form inputs if (editConfiguration.isParamUpdate()) { //Although this is editing an existing page, new content might have been added which would not include //existing data getter URIs, so important to check whether the key exists within the json object in the first place String dataGetterURISubmissionName = pn.getDataGetterVarName(counter); if (jsonObject.containsKey("URI")) { String URIValue = jsonObject.getString("URI"); if (URIValue != null) { log.debug("Existing URI for data getter found: " + URIValue); submission.addUriToForm(editConfiguration, dataGetterURISubmissionName, new String[] { URIValue }); } } else { //if the URI is not included in the json object, this is a NEW data getter //and as such as we must ensure the URI is created submission.addUriToForm(editConfiguration, dataGetterURISubmissionName, new String[] { EditConfigurationConstants.NEW_URI_SENTINEL }); } } }
From source file:com.zextras.zimbradrive.soap.SearchRequestHdlr.java
private HttpResponse queryDriveOnCloudServerService(final ZimbraContext zimbraContext, final String query, Boolean isCaseSensitive, final String types) throws IOException { List<NameValuePair> driveOnCloudParameters = mCloudHttpRequestUtils .createDriveOnCloudAuthenticationParams(zimbraContext); driveOnCloudParameters.add(new BasicNameValuePair("query", query)); driveOnCloudParameters.add(new BasicNameValuePair("types", types)); driveOnCloudParameters.add(new BasicNameValuePair("caseSensitive", isCaseSensitive.toString())); return mCloudHttpRequestUtils.sendRequestToCloud(zimbraContext, driveOnCloudParameters, COMMAND + "Request", "2.0"); }
From source file:net.solarnetwork.node.control.jf2.lata.LATAController.java
private NodeControlInfoDatum newNodeControlInfoDatum(String controlId, Boolean status) { NodeControlInfoDatum info = new NodeControlInfoDatum(); info.setCreated(new Date()); info.setSourceId(controlId);//www. j a va 2 s . c o m info.setType(NodeControlPropertyType.Boolean); info.setReadonly(false); info.setValue(status.toString()); return info; }
From source file:com.netflix.simianarmy.aws.janitor.crawler.TestLaunchConfigJanitorCrawler.java
private void verifyLaunchConfig(Resource launchConfig, String lcName, Boolean usedByASG) { Assert.assertEquals(launchConfig.getResourceType(), AWSResourceType.LAUNCH_CONFIG); Assert.assertEquals(launchConfig.getId(), lcName); Assert.assertEquals(launchConfig.getRegion(), "us-east-1"); if (usedByASG != null) { Assert.assertEquals(/* w ww.ja v a2 s. c o m*/ launchConfig.getAdditionalField(LaunchConfigJanitorCrawler.LAUNCH_CONFIG_FIELD_USED_BY_ASG), usedByASG.toString()); } }
From source file:com.collective.celos.CelosClient.java
public void setWorkflowPaused(WorkflowID workflowID, Boolean paused) throws Exception { URIBuilder uriBuilder = new URIBuilder(address); uriBuilder.setPath(uriBuilder.getPath() + PAUSE_PATH); uriBuilder.addParameter(ID_PARAM, workflowID.toString()); uriBuilder.addParameter(PAUSE_NODE, paused.toString()); executePost(uriBuilder.build());//w w w . j a v a 2 s . c o m }
From source file:com.myjeeva.andromda.demo.service.test.SearchServiceWSITCase.java
/** * Invokes the indexDocument service method on SearchService. * /*from ww w . j av a2 s.c o m*/ * Operation parameters: * documents com.myjeeva.andromda.demo.vo.DocumentVO * Operation return: * indexDocumentResponse java.lang.Boolean */ @Test public void indexDocument() { System.out.println("Starting test: indexDocument for " + this.getName()); // TestCase.setUp and tearDown methods for each individual service method test com.myjeeva.andromda.demo.service.IndexDocumentImpl.indexDocumentSetUp(); // Customize CreateInput method if different default input data is required. com.myjeeva.andromda.demo.service.IndexDocument indexDocumentInput = com.myjeeva.andromda.demo.service.IndexDocumentImpl .indexDocumentCreateInput(); ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( new String[] { "cxf-client.xml" }); SearchServiceSEI client = (SearchServiceSEI) context.getBean("SearchServiceClient"); java.lang.Boolean indexDocumentResponse = null; try { indexDocumentResponse = client.indexDocument(indexDocumentInput.getDocuments() // java.util.List<com.myjeeva.andromda.demo.vo.DocumentVO> ); if (indexDocumentResponse == null) { System.out.println("indexDocumentResponse Result was valid and null"); } else { System.out.println(" Result = " + indexDocumentResponse.toString()); } } catch (Exception ex) { System.out.println("SearchService client.indexDocument" + " threw exception " + ex); throw new junit.framework.AssertionFailedError(ex.toString()); } com.myjeeva.andromda.demo.service.IndexDocumentImpl.indexDocumentTearDown(); System.out.println("Finished test for SearchService.indexDocument(documents)"); }
From source file:de.willuhn.jameica.hbci.passports.pintan.server.PinTanConfigImpl.java
/** * @see de.willuhn.jameica.hbci.passports.pintan.rmi.PinTanConfig#setChipTANUSB(java.lang.Boolean) *//*from ww w .j a v a2s.c om*/ @Override public void setChipTANUSB(Boolean b) throws RemoteException { settings.setAttribute(getID() + ".chiptan.usb.enabled", (String) (b != null ? b.toString() : null)); }