Example usage for org.apache.commons.lang BooleanUtils isTrue

List of usage examples for org.apache.commons.lang BooleanUtils isTrue

Introduction

In this page you can find the example usage for org.apache.commons.lang BooleanUtils isTrue.

Prototype

public static boolean isTrue(Boolean bool) 

Source Link

Document

Checks if a Boolean value is true, handling null by returning false.

 BooleanUtils.isTrue(Boolean.TRUE)  = true BooleanUtils.isTrue(Boolean.FALSE) = false BooleanUtils.isTrue(null)          = false 

Usage

From source file:org.betaconceptframework.astroboa.model.jaxb.type.ComplexCmsPropertyType.java

public void addCmsProperty(CmsPropertyType cmsProperty) {

    if (cmsProperty != null) {
        if (cmsProperty instanceof SimpleCmsPropertyType
                && BooleanUtils.isTrue(((SimpleCmsPropertyType) cmsProperty).exportAsAnAttribute())) {
            getCmsPropertiesAsAttributes().put(cmsProperty.getQname(),
                    ((SimpleCmsPropertyType) cmsProperty).getContent());
        } else if (cmsProperty instanceof CmsPropertyTypeJAXBElement
                && ((CmsPropertyTypeJAXBElement) cmsProperty).getDeclaredType() == SimpleCmsPropertyType.class
                && BooleanUtils.isTrue(((CmsPropertyTypeJAXBElement<SimpleCmsPropertyType>) cmsProperty)
                        .getValue().exportAsAnAttribute())) {
            getCmsPropertiesAsAttributes().put(cmsProperty.getQname(),
                    ((CmsPropertyTypeJAXBElement<SimpleCmsPropertyType>) cmsProperty).getValue().getContent());
        } else {//ww w.  j  ava 2s. co  m
            getCmsProperties().add(cmsProperty);
        }
    }

}

From source file:org.betaconceptframework.astroboa.model.jaxb.visitor.ContentObjectMarshalContext.java

public Boolean aspectsAreVisited() {
    return BooleanUtils.isTrue(aspectsAreVisitedQueue.peekFirst());
}

From source file:org.betaconceptframework.astroboa.model.jaxb.visitor.ContentObjectMarshalVisitor.java

private boolean prettyPrintIsEnabled() throws PropertyException {
    return BooleanUtils.isTrue((Boolean) marshaller.getProperty(Marshaller.JAXB_FORMATTED_OUTPUT));
}

From source file:org.betaconceptframework.astroboa.model.jaxb.writer.JSONXmlStreamWriter.java

@Override
public void writeAttribute(String localName, String value) throws XMLStreamException {
    try {//from  w  ww.j av a 2s  .  c o  m

        if (!objectQueue.isEmpty()) {
            if (StringUtils.equals(CmsConstants.EXPORT_AS_AN_ARRAY_INSTRUCTION, localName)) {
                objectQueue.peek().exportAsAnArray = BooleanUtils.isTrue(BooleanUtils.toBoolean(value));
            } else {
                objectQueue.peek().addAttribute(localName, value);
            }

        }

    } catch (Exception e) {
        throw new XMLStreamException(e);
    }

}

From source file:org.betaconceptframework.astroboa.resourceapi.utility.ContentApiUtils.java

public static boolean isPrettyPrintEnabled(String prettyPrint) {

    if (prettyPrint == null) {
        return false;
    }/*  ww w  .  jav a  2  s  .  c om*/

    try {
        return BooleanUtils.isTrue(Boolean.valueOf(prettyPrint));
    } catch (Exception e) {
        logger.warn("Invalid value '{}' for prettyPrint parameter. Pretty Print will be disabled");
        return false;
    }
}

From source file:org.betaconceptframework.astroboa.resourceapi.utility.ContentApiUtils.java

public static boolean shouldUpdateLastModificationTime(String updateLastModificationTime) {

    //Default value is true
    if (updateLastModificationTime == null || updateLastModificationTime.trim().length() == 0) {
        return true;
    }/*from   w w  w .j av a  2s  .c o m*/

    try {
        return BooleanUtils.isTrue(Boolean.valueOf(updateLastModificationTime));
    } catch (Exception e) {
        logger.warn(
                "Invalid value '{}' for updateLastModificationTime parameter. Last modification time will be updated");
        return false;
    }
}

From source file:org.betaconceptframework.astroboa.resourceapi.utility.XmlSchemaGenerator.java

private void addElementForComplexProperty(Map<String, Object> property, boolean displayCardinality) {

    String minOccurs = "";
    String maxOccurs = "";

    if (displayCardinality) {
        minOccurs = " minOccurs=\""
                + (BooleanUtils.isTrue(Boolean.valueOf((String) property.get("mandatory"))) ? "1" : "0")
                + "\" ";
        maxOccurs = " maxOccurs=\""
                + (BooleanUtils.isTrue(Boolean.valueOf((String) property.get("multiple"))) ? "unbounded" : "1")
                + "\" ";
    }/*from   w  ww  .ja  va2  s  .  c om*/

    addLine("<xs:element name=\"" + property.get("name") + "\"" + minOccurs + maxOccurs + ">");

    addLabel((Map<String, Object>) property.get("label"));

    addComplexTypeAndArrayOfProperties((Map<String, Object>) property.get("arrayOfProperties"));

    addLine("</xs:element>");

}

From source file:org.betaconceptframework.astroboa.resourceapi.utility.XmlSchemaGenerator.java

private void addTopicReferenceProperty(Map<String, Object> property) {

    String name = (String) property.get("name");
    String minOccurs = BooleanUtils.isTrue(Boolean.valueOf((String) property.get("mandatory"))) ? "1" : "0";
    String maxOccurs = BooleanUtils.isTrue(Boolean.valueOf((String) property.get("multiple"))) ? "unbounded"
            : "1";
    String acceptedTaxonomies = (String) property.get("acceptedTaxonomies");

    if (StringUtils.isNotBlank(acceptedTaxonomies)) {
        acceptedTaxonomies = " bccmsmodel:acceptedTaxonomies=\"" + acceptedTaxonomies + "\" ";
    } else {//from ww  w  .j a va  2  s .c om
        acceptedTaxonomies = "";
    }

    addLine("<xs:element name=\"" + name + "\" type=\"bccmsmodel:topicType\" minOccurs=\"" + minOccurs
            + "\" maxOccurs=\"" + maxOccurs + "\"" + acceptedTaxonomies + ">");
    addLabel((Map<String, Object>) property.get("label"));
    addLine("</xs:element>");

}

From source file:org.betaconceptframework.astroboa.resourceapi.utility.XmlSchemaGenerator.java

private void addObjectReferenceProperty(Map<String, Object> property) {

    String name = (String) property.get("name");
    String minOccurs = BooleanUtils.isTrue(Boolean.valueOf((String) property.get("mandatory"))) ? "1" : "0";
    String maxOccurs = BooleanUtils.isTrue(Boolean.valueOf((String) property.get("multiple"))) ? "unbounded"
            : "1";
    String acceptedContentTypes = (String) property.get("acceptedContentTypes");

    if (StringUtils.isNotBlank(acceptedContentTypes)) {
        acceptedContentTypes = " bccmsmodel:acceptedContentTypes=\"" + acceptedContentTypes + "\" ";
    } else {/*from  w w w  .j  av  a2s .  c  om*/
        acceptedContentTypes = "";
    }

    addLine("<xs:element name=\"" + name + "\" type=\"bccmsmodel:contentObjectReferenceType\" minOccurs=\""
            + minOccurs + "\" maxOccurs=\"" + maxOccurs + "\"" + acceptedContentTypes + ">");
    addLabel((Map<String, Object>) property.get("label"));
    addLine("</xs:element>");

}

From source file:org.betaconceptframework.astroboa.resourceapi.utility.XmlSchemaGenerator.java

private void addStringProperty(Map<String, Object> property) {

    String name = (String) property.get("name");
    String minOccurs = BooleanUtils.isTrue(Boolean.valueOf((String) property.get("mandatory"))) ? "1" : "0";
    String maxOccurs = BooleanUtils.isTrue(Boolean.valueOf((String) property.get("multiple"))) ? "unbounded"
            : "1";
    String stringFormat = (String) property.get("stringFormat");

    if (StringUtils.isNotBlank(stringFormat)) {
        stringFormat = " bccmsmodel:stringFormat=\"" + stringFormat + "\" ";
    } else {//from ww  w .j a  va2 s  . co m
        stringFormat = "";
    }

    addLine("<xs:element name=\"" + name + "\" type=\"xs:string\" minOccurs=\"" + minOccurs + "\" maxOccurs=\""
            + maxOccurs + "\"" + stringFormat + ">");
    addLabel((Map<String, Object>) property.get("label"));
    addLine("</xs:element>");

}