List of usage examples for org.apache.commons.lang BooleanUtils toBoolean
public static boolean toBoolean(String str)
Converts a String to a boolean (optimised for performance).
'true'
, 'on'
or 'yes'
(case insensitive) will return true
.
From source file:com.redhat.rhn.domain.monitoring.Probe.java
/** * Setter for notifyUnknown//from ww w.j a v a 2s. c o m * @param notifyUnknownIn to set */ public void setNotifyUnknown(Boolean notifyUnknownIn) { setNotifyUnknown(BooleanUtils.toBoolean(notifyUnknownIn) ? '1' : null); }
From source file:jp.co.opentone.bsol.linkbinder.service.correspon.impl.ImageTextDetectionServiceImpl.java
@Override public boolean canUse() { boolean result = BooleanUtils.toBoolean(SystemConfig.getValue(Constants.KEY_GOOGLE_VISION_USE)); if (!result) { log.warn("???????????????"); }//from w ww . j ava 2 s.co m return result; }
From source file:edu.mayo.cts2.framework.webapp.rest.config.MetaTypeRestConfig.java
protected boolean checkEnvironmentVariableOverride(String property, boolean value) { String enValue = System.getProperty(property); if (enValue != null) { return BooleanUtils.toBoolean(enValue); } else {/*from w w w .j a v a2 s .co m*/ return value; } }
From source file:info.magnolia.cms.filters.InterceptFilter.java
protected boolean previewMode() { // first check if its passed as a request parameter if (MgnlContext.getParameter(MGNL_PREVIEW_ATTRIBUTE) != null) { return Boolean.parseBoolean(MgnlContext.getParameter(MGNL_PREVIEW_ATTRIBUTE)); }/*from w w w .j a va 2s. c om*/ // then in attributes, i.e the session final Boolean value = (Boolean) MgnlContext.getAttribute(MGNL_PREVIEW_ATTRIBUTE, Context.SESSION_SCOPE); return BooleanUtils.toBoolean(value); }
From source file:mitm.common.security.ctl.CTLEntryEntity.java
@Override public boolean isAllowExpired() { String value = nameValues.get(ALLOW_EXPIRED_PROPERTY_NAME); return value != null ? BooleanUtils.toBoolean(value) : false; }
From source file:net.grinder.util.GrinderUtils.java
/** * Get the parameter passed by controller. When it's executed in the * validation mode, always returns the given default value(false). * * @since 3.2.3//from w w w . java 2s . c o m */ public static boolean getParamBoolean() { return BooleanUtils.toBoolean(getParam("false")); }
From source file:com.haulmont.cuba.gui.xml.layout.loaders.ColorPickerLoader.java
protected void loadSwatchesVisibility(ColorPicker component, Element element) { String swatchesVisible = element.attributeValue("swatchesVisible"); if (StringUtils.isNotEmpty(swatchesVisible)) { component.setSwatchesVisible(BooleanUtils.toBoolean(swatchesVisible)); }/*from w w w . j a va 2 s.c o m*/ }
From source file:fr.hoteia.qalingo.core.web.servlet.DispatcherServlet.java
private void initPlatformDevice(HttpServletRequest request) { final ServletContext context = getServletContext(); final ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(context); final RequestUtil requestUtil = (RequestUtil) ctx.getBean("requestUtil"); // DEVICE/*from www . jav a2 s. c o m*/ try { final WURFLHolder wurfl = (WURFLHolder) ctx.getBean("wurflHolder"); final WURFLManager manager = wurfl.getWURFLManager(); Device device = manager.getDeviceForRequest(request); String deviceFolder = "default"; if (device != null) { boolean isSmartPhone = BooleanUtils.toBoolean(device.getVirtualCapability("is_smartphone")); boolean isIPhoneOs = BooleanUtils.toBoolean(device.getVirtualCapability("is_iphone_os")); boolean isAndroid = BooleanUtils.toBoolean(device.getVirtualCapability("is_android")); if (isSmartPhone || isIPhoneOs || isAndroid) { deviceFolder = "mobile"; } } requestUtil.updateCurrentDevice(request, deviceFolder); } catch (Exception e) { LOG.error("", e); } }
From source file:info.magnolia.jcr.util.PropertyUtil.java
/** * Transforms a string to a jcr value object. *//*from w w w . ja v a 2 s. c o m*/ public static Value createValue(String valueStr, int type, ValueFactory valueFactory) { Value value = null; if (type == PropertyType.STRING) { value = valueFactory.createValue(valueStr); } else if (type == PropertyType.BOOLEAN) { value = valueFactory.createValue(BooleanUtils.toBoolean(valueStr)); } else if (type == PropertyType.DOUBLE) { try { value = valueFactory.createValue(Double.parseDouble(valueStr)); } catch (NumberFormatException e) { value = valueFactory.createValue(0d); } } else if (type == PropertyType.LONG) { try { value = valueFactory.createValue(Long.parseLong(valueStr)); } catch (NumberFormatException e) { value = valueFactory.createValue(0L); } } else if (type == PropertyType.DATE) { try { Calendar date = new GregorianCalendar(); try { String newDateAndTime = valueStr; String[] dateAndTimeTokens = newDateAndTime.split("T"); String newDate = dateAndTimeTokens[0]; String[] dateTokens = newDate.split("-"); int hour = 0; int minute = 0; int second = 0; int year = Integer.parseInt(dateTokens[0]); int month = Integer.parseInt(dateTokens[1]) - 1; int day = Integer.parseInt(dateTokens[2]); if (dateAndTimeTokens.length > 1) { String newTime = dateAndTimeTokens[1]; String[] timeTokens = newTime.split(":"); hour = Integer.parseInt(timeTokens[0]); minute = Integer.parseInt(timeTokens[1]); second = Integer.parseInt(timeTokens[2]); } date.set(year, month, day, hour, minute, second); // this is used in the searching date.set(Calendar.MILLISECOND, 0); date.setTimeZone(TimeZone.getTimeZone("GMT")); } // todo time zone?? catch (Exception e) { // ignore, it sets the current date / time } value = valueFactory.createValue(date); } catch (Exception e) { log.debug("Exception caught: " + e.getMessage(), e); } } return value; }
From source file:com.haulmont.cuba.gui.xml.layout.loaders.ColorPickerLoader.java
protected void loadRGBVisibility(ColorPicker component, Element element) { String rgbVisible = element.attributeValue("rgbVisible"); if (StringUtils.isNotEmpty(rgbVisible)) { component.setRGBVisible(BooleanUtils.toBoolean(rgbVisible)); }/*from w ww .j av a 2 s . c om*/ }