List of usage examples for org.apache.commons.lang BooleanUtils toBooleanDefaultIfNull
public static boolean toBooleanDefaultIfNull(Boolean bool, boolean valueIfNull)
Converts a Boolean to a boolean handling null
.
BooleanUtils.toBooleanDefaultIfNull(Boolean.TRUE, false) = true BooleanUtils.toBooleanDefaultIfNull(Boolean.FALSE, true) = false BooleanUtils.toBooleanDefaultIfNull(null, true) = true
From source file:com.adaptris.core.jms.JmsProducerImpl.java
boolean transactedSession() { return BooleanUtils.toBooleanDefaultIfNull(getTransactedSession(), false); }
From source file:com.adaptris.core.jms.JmsProducerImpl.java
protected boolean captureOutgoingMessageDetails() { return BooleanUtils.toBooleanDefaultIfNull(getCaptureOutgoingMessageDetails(), false); }
From source file:net.di2e.ecdr.commons.endpoint.rest.AbstractRestSearchEndpoint.java
protected boolean isIncludeStatus(MultivaluedMap<String, String> queryParameters) { // Include status is true unless explicitly set to false return BooleanUtils.toBooleanDefaultIfNull( SearchUtils.getBoolean(queryParameters.getFirst(SearchConstants.STATUS_PARAMETER)), true); }
From source file:org.biouno.unochoice.DynamicReferenceParameter.java
/** * Constructor called from Jelly with parameters. * * @param name name/* ww w . j a v a 2 s . c o m*/ * @param description description * @param script script * @param choiceType choice type * @param referencedParameters referenced parameters * @param omitValueField used in the UI to decide whether to include a hidden empty <input name=value>. * <code>false</code> by default. * @deprecated see JENKINS-32149 */ public DynamicReferenceParameter(String name, String description, Script script, String choiceType, String referencedParameters, Boolean omitValueField) { super(name, description, script, referencedParameters); this.choiceType = StringUtils.defaultIfBlank(choiceType, PARAMETER_TYPE_SINGLE_SELECT); this.omitValueField = BooleanUtils.toBooleanDefaultIfNull(omitValueField, Boolean.FALSE); }
From source file:org.biouno.unochoice.DynamicReferenceParameter.java
/** * Constructor called from Jelly with parameters. * * @param name name// ww w. j av a2s . c o m * @param description description * @param randomName parameter random generated name (uuid) * @param script script * @param choiceType choice type * @param referencedParameters referenced parameters * @param omitValueField used in the UI to decide whether to include a hidden empty <input name=value>. * <code>false</code> by default. */ @DataBoundConstructor public DynamicReferenceParameter(String name, String description, String randomName, Script script, String choiceType, String referencedParameters, Boolean omitValueField) { super(name, description, randomName, script, referencedParameters); this.choiceType = StringUtils.defaultIfBlank(choiceType, PARAMETER_TYPE_SINGLE_SELECT); this.omitValueField = BooleanUtils.toBooleanDefaultIfNull(omitValueField, Boolean.FALSE); }
From source file:org.kuali.rice.kew.impl.document.search.DocumentSearchCriteriaBoLookupableHelperService.java
/** * Returns true if the document handler should open in a new window. *//*from ww w. j a v a 2s. c o m*/ protected boolean isDocumentHandlerPopup() { return BooleanUtils.toBooleanDefaultIfNull( CoreFrameworkServiceLocator.getParameterService().getParameterValueAsBoolean( KewApiConstants.KEW_NAMESPACE, KRADConstants.DetailTypes.DOCUMENT_SEARCH_DETAIL_TYPE, KewApiConstants.DOCUMENT_SEARCH_DOCUMENT_POPUP_IND), DOCUMENT_HANDLER_POPUP_DEFAULT); }
From source file:org.kuali.rice.kew.impl.document.search.DocumentSearchCriteriaBoLookupableHelperService.java
/** * Returns true if the route log should open in a new window. *//*from ww w. jav a 2 s . c o m*/ public boolean isRouteLogPopup() { return BooleanUtils.toBooleanDefaultIfNull( CoreFrameworkServiceLocator.getParameterService().getParameterValueAsBoolean( KewApiConstants.KEW_NAMESPACE, KRADConstants.DetailTypes.DOCUMENT_SEARCH_DETAIL_TYPE, KewApiConstants.DOCUMENT_SEARCH_ROUTE_LOG_POPUP_IND), ROUTE_LOG_POPUP_DEFAULT); }
From source file:org.opencastproject.workflow.handler.composer.ConcatWorkflowOperationHandler.java
private Map<Integer, Tuple<TrackSelector, Boolean>> getTrackSelectors(WorkflowOperationInstance operation) throws WorkflowOperationException { Map<Integer, Tuple<TrackSelector, Boolean>> trackSelectors = new HashMap<Integer, Tuple<TrackSelector, Boolean>>(); for (String key : operation.getConfigurationKeys()) { String tags = null;// w w w . j a va 2s .com String flavor = null; Boolean mandatory = true; int number = -1; if (key.startsWith(SOURCE_TAGS_PREFIX) && !key.endsWith(MANDATORY_SUFFIX)) { number = NumberUtils.toInt(key.substring(SOURCE_TAGS_PREFIX.length()), -1); tags = operation.getConfiguration(key); mandatory = BooleanUtils.toBooleanObject(operation.getConfiguration( SOURCE_TAGS_PREFIX.concat(Integer.toString(number)).concat(MANDATORY_SUFFIX))); } else if (key.startsWith(SOURCE_FLAVOR_PREFIX) && !key.endsWith(MANDATORY_SUFFIX)) { number = NumberUtils.toInt(key.substring(SOURCE_FLAVOR_PREFIX.length()), -1); flavor = operation.getConfiguration(key); mandatory = BooleanUtils.toBooleanObject(operation.getConfiguration( SOURCE_FLAVOR_PREFIX.concat(Integer.toString(number)).concat(MANDATORY_SUFFIX))); } if (number < 0) continue; Tuple<TrackSelector, Boolean> selectorTuple = trackSelectors.get(number); if (selectorTuple == null) { selectorTuple = Tuple.tuple(new TrackSelector(), BooleanUtils.toBooleanDefaultIfNull(mandatory, false)); } else { selectorTuple = Tuple.tuple(selectorTuple.getA(), selectorTuple.getB() || BooleanUtils.toBooleanDefaultIfNull(mandatory, false)); } TrackSelector trackSelector = selectorTuple.getA(); if (StringUtils.isNotBlank(tags)) { for (String tag : StringUtils.split(tags, ",")) { trackSelector.addTag(tag); } } if (StringUtils.isNotBlank(flavor)) { try { trackSelector.addFlavor(flavor); } catch (IllegalArgumentException e) { throw new WorkflowOperationException("Source flavor '" + flavor + "' is malformed"); } } trackSelectors.put(number, selectorTuple); } return trackSelectors; }
From source file:org.opencastproject.workflow.handler.ConcatWorkflowOperationHandler.java
private Map<Integer, Tuple<TrackSelector, Boolean>> getTrackSelectors(WorkflowOperationInstance operation) throws WorkflowOperationException { Map<Integer, Tuple<TrackSelector, Boolean>> trackSelectors = new HashMap<Integer, Tuple<TrackSelector, Boolean>>(); for (String key : operation.getConfigurationKeys()) { String tags = null;/* w w w. java 2 s . co m*/ String flavor = null; Boolean mandatory = true; int number = -1; if (key.startsWith(SOURCE_TAGS_PREFIX) && !key.endsWith(MANDATORY_SUFFIX)) { number = NumberUtils.toInt(key.substring(SOURCE_TAGS_PREFIX.length()), -1); tags = operation.getConfiguration(key); mandatory = BooleanUtils.toBooleanObject(operation.getConfiguration( SOURCE_TAGS_PREFIX.concat(Integer.toString(number)).concat(MANDATORY_SUFFIX))); } else if (key.startsWith(SOURCE_FLAVOR_PREFIX) && !key.endsWith(MANDATORY_SUFFIX)) { number = NumberUtils.toInt(key.substring(SOURCE_FLAVOR_PREFIX.length()), -1); flavor = operation.getConfiguration(key); mandatory = BooleanUtils.toBooleanObject(operation.getConfiguration( SOURCE_FLAVOR_PREFIX.concat(Integer.toString(number)).concat(MANDATORY_SUFFIX))); } if (number < 0) continue; Tuple<TrackSelector, Boolean> selectorTuple = trackSelectors.get(number); if (selectorTuple == null) { selectorTuple = Tuple.tuple(new TrackSelector(), BooleanUtils.toBooleanDefaultIfNull(mandatory, true)); } else { selectorTuple = Tuple.tuple(selectorTuple.getA(), selectorTuple.getB() && BooleanUtils.toBooleanDefaultIfNull(mandatory, true)); } TrackSelector trackSelector = selectorTuple.getA(); if (StringUtils.isNotBlank(tags)) { for (String tag : StringUtils.split(tags, ",")) { trackSelector.addTag(tag); } } if (StringUtils.isNotBlank(flavor)) { try { trackSelector.addFlavor(flavor); } catch (IllegalArgumentException e) { throw new WorkflowOperationException("Source flavor '" + flavor + "' is malformed"); } } trackSelectors.put(number, selectorTuple); } return trackSelectors; }
From source file:org.springframework.cloud.netflix.ribbon.apache.RetryableRibbonLoadBalancingHttpClient.java
private RibbonApacheHttpResponse executeWithRetry(RibbonApacheHttpRequest request, LoadBalancedRetryPolicy retryPolicy, RetryCallback<RibbonApacheHttpResponse, IOException> callback) throws Exception { RetryTemplate retryTemplate = new RetryTemplate(); boolean retryable = request.getContext() == null ? true : BooleanUtils.toBooleanDefaultIfNull(request.getContext().getRetryable(), true); retryTemplate.setRetryPolicy(retryPolicy == null || !retryable ? new NeverRetryPolicy() : new RetryPolicy(request, retryPolicy, this, this.getClientName())); return retryTemplate.execute(callback); }