Example usage for org.apache.commons.lang3 BooleanUtils toStringYesNo

List of usage examples for org.apache.commons.lang3 BooleanUtils toStringYesNo

Introduction

In this page you can find the example usage for org.apache.commons.lang3 BooleanUtils toStringYesNo.

Prototype

public static String toStringYesNo(final boolean bool) 

Source Link

Document

Converts a boolean to a String returning 'yes' or 'no' .

 BooleanUtils.toStringYesNo(true)   = "yes" BooleanUtils.toStringYesNo(false)  = "no" 

Usage

From source file:gov.nih.nci.caintegrator.web.ajax.GenomicDataSourceAjaxUpdater.java

/**
 * Updates studyConfiguration status.//from ww  w . j  a v  a  2 s  .com
 * @param username to update the status to.
 * @param genomicSource to update.
 * @param checkDeployButton determines whether to update the deploy button or not.
 */
public void updateJobStatus(String username, GenomicDataSourceConfiguration genomicSource,
        boolean checkDeployButton) {
    Util utilThis = getDwrUtil(username);
    String genomicSourceId = genomicSource.getId().toString();
    utilThis.setValue(JOB_HOST_NAME + genomicSourceId, genomicSource.getServerProfile().getHostname());
    utilThis.setValue(JOB_EXPERIMENT_IDENTIFIER + genomicSourceId, genomicSource.getExperimentIdentifier());
    updateRowFileDescriptions(utilThis, genomicSource, genomicSourceId);
    utilThis.setValue(JOB_DATA_TYPE + genomicSourceId, genomicSource.getDataType().getValue());
    utilThis.setValue(JOB_DEPLOYMENT_STATUS + genomicSourceId, getStatusMessage(genomicSource.getStatus()));
    utilThis.setValue(JOB_LAST_MODIFIED_DATE + genomicSourceId, genomicSource.getDisplayableLastModifiedDate());
    utilThis.setValue(JOB_NEW_DATA_AVAILABLE + genomicSourceId,
            StringUtils.capitalize(BooleanUtils.toStringYesNo(genomicSource.isDataRefreshed())));
    updateRowActions(genomicSource, utilThis, genomicSourceId);
}

From source file:gov.nih.nci.caintegrator.web.ajax.StudyDeploymentAjaxUpdater.java

/**
 * Updates studyConfiguration status./*from   w  w  w .  ja va2s .c  o m*/
 * @param username to update the status to.
 * @param studyConfiguration to update.
 */
public void updateJobStatus(String username, StudyConfiguration studyConfiguration) {
    Util utilThis = getDwrUtil(username);
    String studyConfigurationId = studyConfiguration.getId().toString();
    String descriptionDivId = JOB_STUDY_DESCRIPTION + "div_" + studyConfigurationId;
    utilThis.setValue(JOB_STUDY_NAME + studyConfigurationId, studyConfiguration.getStudy().getShortTitleText());
    utilThis.setValue(JOB_STUDY_DESCRIPTION + studyConfigurationId, "<s:div id=\"" + descriptionDivId + "\">"
            + studyConfiguration.getStudy().getLongTitleText() + "</s:div>");
    utilThis.setValue(JOB_LAST_MODIFIED_BY + studyConfigurationId,
            studyConfiguration.getLastModifiedBy().getUsername());
    utilThis.setValue(JOB_STUDY_STATUS + studyConfigurationId,
            getStatusMessage(studyConfiguration.getStatus()));
    utilThis.setValue(JOB_START_DATE + studyConfigurationId,
            getDateString(studyConfiguration.getDeploymentStartDate()));
    utilThis.setValue(JOB_FINISH_DATE + studyConfigurationId,
            getDateString(studyConfiguration.getDeploymentFinishDate()));
    utilThis.setValue(JOB_NEW_DATA_AVAILABLE + studyConfigurationId,
            StringUtils.capitalize(BooleanUtils.toStringYesNo(studyConfiguration.isDataRefreshed())));
    updateRowActions(studyConfiguration, utilThis, studyConfigurationId);
    utilThis.addFunctionCall("truncateDescriptionDiv", descriptionDivId);
}

From source file:yoyo.framework.standard.shared.commons.lang.BooleanUtilsTest.java

@Test
public void test() {
    assertThat(BooleanUtils.and(new boolean[] { true }), is(true));
    assertThat(BooleanUtils.and(new boolean[] { true, false }), is(false));
    assertThat(BooleanUtils.isFalse(false), is(true));
    assertThat(BooleanUtils.isNotFalse(false), is(false));
    assertThat(BooleanUtils.isNotTrue(true), is(false));
    assertThat(BooleanUtils.isTrue(true), is(true));
    assertThat(BooleanUtils.negate(Boolean.FALSE), is(true));
    assertThat(BooleanUtils.or(new boolean[] { true }), is(true));
    assertThat(BooleanUtils.or(new boolean[] { true, false }), is(true));
    assertThat(BooleanUtils.toBoolean(Boolean.TRUE), is(true));
    assertThat(BooleanUtils.toBoolean(0), is(false));
    assertThat(BooleanUtils.toBoolean(1), is(true));
    assertThat(BooleanUtils.toBoolean((String) null), is(false));
    assertThat(BooleanUtils.toBoolean("true"), is(true));
    assertThat(BooleanUtils.toBoolean("hoge"), is(false));
    assertThat(BooleanUtils.toBooleanDefaultIfNull(null, false), is(false));
    assertThat(BooleanUtils.toBooleanObject(0), is(Boolean.FALSE));
    assertThat(BooleanUtils.toBooleanObject(1), is(Boolean.TRUE));
    assertThat(BooleanUtils.toInteger(true), is(1));
    assertThat(BooleanUtils.toInteger(false), is(0));
    assertThat(BooleanUtils.toIntegerObject(true), is(Integer.valueOf(1)));
    assertThat(BooleanUtils.toIntegerObject(false), is(Integer.valueOf(0)));
    assertThat(BooleanUtils.toString(true, "true", "false"), is("true"));
    assertThat(BooleanUtils.toString(false, "true", "false"), is("false"));
    assertThat(BooleanUtils.toStringOnOff(true), is("on"));
    assertThat(BooleanUtils.toStringOnOff(false), is("off"));
    assertThat(BooleanUtils.toStringTrueFalse(true), is("true"));
    assertThat(BooleanUtils.toStringTrueFalse(false), is("false"));
    assertThat(BooleanUtils.toStringYesNo(true), is("yes"));
    assertThat(BooleanUtils.toStringYesNo(false), is("no"));
    assertThat(BooleanUtils.xor(new boolean[] { true }), is(true));
    assertThat(BooleanUtils.xor(new boolean[] { true, false }), is(true));
    assertThat(BooleanUtils.xor(new boolean[] { true, true }), is(false));
}