List of usage examples for java.lang Boolean parseBoolean
public static boolean parseBoolean(String s)
From source file:com.turn.splicer.Config.java
public boolean getBoolean(String field) { return Boolean.parseBoolean(properties.getProperty(field)); }
From source file:com.openedit.users.BaseGroup.java
public boolean hasPermission(String inPermission) { for (Iterator iterator = getPermissions().iterator(); iterator.hasNext();) { Object existingpermission = (Object) iterator.next(); if (existingpermission.equals(inPermission)) { return true; }/*w w w . j a v a 2 s. c o m*/ } String ok = getPropertyContainer().getString(inPermission); if (Boolean.parseBoolean(ok)) { return true; } return false; }
From source file:com.spotify.styx.api.StyxConfigResource.java
private Response<StyxConfig> patchStyxConfig(Request request) { final Optional<String> enabledParameter = request.parameter("enabled"); if (!enabledParameter.isPresent()) { return Response.forStatus(Status.BAD_REQUEST.withReasonPhrase("Missing 'enabled' query parameter")); }// www . ja v a 2s .c o m final boolean enabled = Boolean.parseBoolean(enabledParameter.get()); try { storage.setGlobalEnabled(enabled); } catch (IOException e) { throw Throwables.propagate(e); } return Response.forPayload(StyxConfig.create(enabled)); }
From source file:io.cloudslang.content.httpclient.build.RequestConfigBuilder.java
public RequestConfig buildRequestConfig() { HttpHost proxy = null;/*w w w.j av a 2 s.c o m*/ final int proxyPortNumber; if (proxyHost != null && !proxyHost.isEmpty()) { proxyPortNumber = Utils.validatePortNumber(proxyPort); proxy = new HttpHost(proxyHost, proxyPortNumber); } int connectionTimeout = Integer.parseInt(this.connectionTimeout); int socketTimeout = Integer.parseInt(this.socketTimeout); //todo should we also allow user to enable redirects prohibited by the HTTP specification (on POST and PUT)? See 'LaxRedirectStrategy' return RequestConfig.custom() .setConnectTimeout(connectionTimeout <= 0 ? connectionTimeout : connectionTimeout * 1000) .setSocketTimeout(socketTimeout <= 0 ? socketTimeout : socketTimeout * 1000).setProxy(proxy) .setRedirectsEnabled(Boolean.parseBoolean(followRedirects)).build(); }
From source file:org.jasig.portlet.weather.service.AbstractWeatherService.java
public List<SavedLocation> getSavedLocations(PortletPreferences prefs) { final String[] locationCodes = prefs.getValues(LOCATION_CODES, new String[0]); final String[] locations = prefs.getValues(LOCATIONS, new String[0]); String[] units = prefs.getValues(UNITS, null); final String[] metrics = prefs.getValues(METRICS, null); //Handling for old metrics flag approach for storing temp units if (metrics != null) { units = new String[metrics.length]; for (int index = 0; index < metrics.length; index++) { if (Boolean.parseBoolean(metrics[index])) { units[index] = TemperatureUnit.C.toString(); } else { units[index] = TemperatureUnit.F.toString(); }/* w w w .j a va 2s . c om*/ } } final List<SavedLocation> savedLocations = new ArrayList<SavedLocation>(locationCodes.length); for (int locationIndex = 0; locationIndex < locationCodes.length; locationIndex++) { if (locationCodes[locationIndex] == null) { logger.warn( "A null location was stored at index '{}' this should be resolved when SavedLocations are next stored for this user", locationIndex); continue; } savedLocations.add(new SavedLocation(locationCodes[locationIndex], locationIndex < locations.length ? locations[locationIndex] : null, locationIndex < units.length ? TemperatureUnit.safeValueOf(units[locationIndex]) : TemperatureUnit.F)); } return savedLocations; }
From source file:org.killbill.billing.plugin.avatax.client.AvaTaxClient.java
public AvaTaxClient(final Properties properties) throws GeneralSecurityException { super(properties.getProperty(AvaTaxActivator.PROPERTY_PREFIX + "url"), properties.getProperty(AvaTaxActivator.PROPERTY_PREFIX + "accountNumber"), properties.getProperty(AvaTaxActivator.PROPERTY_PREFIX + "licenseKey"), properties.getProperty(AvaTaxActivator.PROPERTY_PREFIX + "proxyHost"), ClientUtils.getIntegerProperty(properties, "proxyPort"), ClientUtils.getBooleanProperty(properties, "strictSSL")); this.companyCode = properties.getProperty(AvaTaxActivator.PROPERTY_PREFIX + "companyCode"); this.commitDocuments = Boolean .parseBoolean(properties.getProperty(AvaTaxActivator.PROPERTY_PREFIX + "commitDocuments")); }
From source file:edu.emory.cci.aiw.i2b2etl.dest.config.xml.ConceptsSection.java
@Override protected void put(Node node) throws ConfigurationInitException { List<ModifierSpec> msList = new ArrayList<>(); NodeList nL = node.getChildNodes(); for (int i = 0; i < nL.getLength(); i++) { Node section = nL.item(i); if (section.getNodeType() == Node.ELEMENT_NODE) { if (section.getNodeName().equals("modifier")) { NamedNodeMap nnm = section.getAttributes(); msList.add(new ModifierSpec(readAttribute(nnm, "displayName", false), readAttribute(nnm, "codePrefix", false), readAttribute(nnm, "property", true), readAttribute(nnm, "value", false))); }/*from w w w . j a va 2s. c o m*/ } } NamedNodeMap nnm = node.getAttributes(); String valueTypeStr = readAttribute(nnm, "valueType", false); FolderSpec folderSpec = new FolderSpec(null, new String[] { readAttribute(nnm, "proposition", true) }, readAttribute(nnm, "property", false), readAttribute(nnm, "conceptCodePrefix", false), valueTypeStr != null ? ValueTypeCode.valueOf(valueTypeStr) : ValueTypeCode.UNSPECIFIED, Boolean.parseBoolean(readAttribute(nnm, "alreadyLoaded", false)), msList.toArray(new ModifierSpec[msList.size()])); this.folders.add(folderSpec); }
From source file:com.rapid.actions.Timer.java
@Override public String getJavaScript(RapidRequest rapidRequest, Application application, Page page, Control control, JSONObject jsonDetails) throws Exception { String js = ""; if (_actions != null) { if (_actions.size() > 0) { // get whether we repeat boolean repeat = Boolean.parseBoolean(getProperty("repeat")); // open the function depending on whether repeat or not if (repeat) { js = "setInterval("; } else { js = "setTimeout("; }//w w w. j av a2 s . c om // start the function js += " function() {\n"; // loop the actions for (Action action : _actions) { js += " " + action.getJavaScript(rapidRequest, application, page, control, jsonDetails).trim() .replace("\n", "\n ") + "\n"; } // close the function and add the duration js += "}," + getProperty("duration") + ");\n"; } } return js; }
From source file:com.tuplejump.stargate.util.CQLUnitD.java
public static CQLUnitD getCQLUnit(com.tuplejump.stargate.util.CQLDataSet ds) { CQLUnitD cassandraCQLUnit = null;//from w w w . ja v a2s . com String clusterStr = System.getProperty("cluster", "false"); if (logger.isInfoEnabled()) { logger.info("Env prop - cluster - {}", clusterStr); } boolean cluster = Boolean.parseBoolean(clusterStr); if (cluster) { Properties props = new Properties(); try { props.load(getSeedProps()); String nodes = props.getProperty("nodes", "EMPTY"); if (nodes != "EMPTY") { Map<String, Integer> hostsAndPorts = getHostsAndPorts(nodes); if (logger.isDebugEnabled()) { logger.debug("**** Starting CQLUnitD in CLUSTER mode **** "); logger.debug("Hosts - {}", hostsAndPorts); } cassandraCQLUnit = new CQLUnitD(ds, hostsAndPorts); } } catch (IOException e) { throw new RuntimeException(e); } } else { if (logger.isDebugEnabled()) { logger.debug("**** Starting CQLUnitD in EMBEDDED mode **** "); } cassandraCQLUnit = new CQLUnitD(ds, "cas.yaml"); } return cassandraCQLUnit; }
From source file:org.bigtester.ate.xmlschema.RepeatStepBeanDefinitionParser.java
/** * {@inheritDoc}//w w w . jav a 2 s . co m */ @Override protected AbstractBeanDefinition parseInternal(@Nullable Element element, @Nullable ParserContext parserContext) { // Here we parse the Spring elements such as < property> if (parserContext == null || element == null) throw GlobalUtils.createNotInitializedException("element and parserContext"); BeanDefinition bDef = super.parseInternal(element, parserContext); bDef.setBeanClassName(RepeatStep.class.getName()); String startStepname = element.getAttribute(XsdElementConstants.ATTR_REPEATSTEP_STARTSTEPNAME); if (StringUtils.hasText(startStepname)) { bDef.getConstructorArgumentValues().addGenericArgumentValue(startStepname); } String endStepname = element.getAttribute(XsdElementConstants.ATTR_REPEATSTEP_ENDSTEPNAME); if (StringUtils.hasText(endStepname)) { bDef.getConstructorArgumentValues().addGenericArgumentValue(endStepname); } boolean continuef = Boolean .parseBoolean(element.getAttribute(XsdElementConstants.ATTR_REPEATSTEP_CONTINUEONFAILURE)); bDef.getPropertyValues().addPropertyValue(XsdElementConstants.ATTR_REPEATSTEP_CONTINUEONFAILURE, continuef); int iter = Integer.parseInt(element.getAttribute(XsdElementConstants.ATTR_REPEATSTEP_NUMBEROFITERATIONS)); bDef.getPropertyValues().addPropertyValue(XsdElementConstants.ATTR_REPEATSTEP_NUMBEROFITERATIONS, iter); boolean asserterSame = Boolean .parseBoolean(element.getAttribute(XsdElementConstants.ATTR_REPEATSTEP_ASSERTERVALUESREMAINSAME)); bDef.getPropertyValues().addPropertyValue(XsdElementConstants.ATTR_REPEATSTEP_ASSERTERVALUESREMAINSAME, asserterSame); parserContext.getRegistry().registerBeanDefinition(element.getAttribute("id"), bDef); return (AbstractBeanDefinition) bDef; }