Example usage for java.lang Boolean equals

List of usage examples for java.lang Boolean equals

Introduction

In this page you can find the example usage for java.lang Boolean equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Returns true if and only if the argument is not null and is a Boolean object that represents the same boolean value as this object.

Usage

From source file:org.jasig.ssp.util.sort.SortingAndPaging.java

public StringBuilder addStatusFilterToQuery(final StringBuilder query, String objectName,
        Boolean isInitialRestriction) {
    if (isFilteredByStatus()) {
        if (isInitialRestriction == null || isInitialRestriction.equals(true)) {
            query.append(" where ");
        } else {/*from  w ww.  j a  v a  2  s  .c  o  m*/
            query.append(" and ");
        }
        query.append(objectName);
        query.append(".objectStatus = :objectStatus");
    }
    return query;
}

From source file:org.amplafi.flow.web.components.FlowEntryPoint.java

/**
 * Checks to make sure that the FlowEntryPoint should be shown. Makes sure all needed values are provided.
 * @return true if {@link #getHidden()} != FALSE && {@link #getCondition()} != FALSE and there is a FlowTypeName or FlowLauncher.
 *///from   w w w .  ja  v  a  2 s. c  o m
public boolean isShowEntryPoint() {
    FlowLauncher flowLauncher = getActualFlowLauncher();
    if (flowLauncher == null) {
        // no valid FlowLauncher means cannot show flowEntry point.
        // perhaps we should throw exception - however this allows for the external code to have a method that supplies a flowLauncher conditionally.
        // otherwise we would require condition="ognl:flowLauncher != null" flowLauncher="ognl:flowLauncher"
        return false;
    } else {
        Boolean showValue;
        Boolean condition = getCondition();
        Boolean hidden = getHidden();
        if (hidden != null) {
            showValue = !hidden;
            ApplicationIllegalArgumentException.valid(condition == null || condition.equals(showValue),
                    "condition ", condition, " and not(hidden) ", showValue,
                    " parameters are contradicting each other -- really should only specify one or the other.");
        } else {
            showValue = condition;
        }
        if (showValue == null) {
            return isAlwaysShow() || !isSameAsActive();
        } else {
            return showValue;
        }
    }
}

From source file:org.sakaiproject.tool.assessment.facade.PublishedAssessmentFacade.java

public PublishedAssessmentFacade(PublishedAssessmentIfc data, Boolean loadSection) {
    setProperties(data);/* w  w w. java  2  s  .  co  m*/
    if (loadSection.equals(Boolean.TRUE))
        this.publishedSectionSet = data.getSectionSet();
}

From source file:ubic.gemma.analysis.preprocess.filter.ExpressionExperimentFilter.java

/**
 * Determine if the expression experiment uses two-color arrays.
 * //ww w.  ja  v a 2  s  .com
 * @param ee
 * @return
 * @throws UnsupportedOperationException if the ee uses both two color and one-color technologies.
 */
private Boolean isTwoColor() {
    Boolean answer = null;

    if (arrayDesignsUsed.isEmpty()) {
        throw new IllegalStateException();
    }

    for (ArrayDesign arrayDesign : arrayDesignsUsed) {
        TechnologyType techType = arrayDesign.getTechnologyType();
        boolean isTwoC = techType.equals(TechnologyType.TWOCOLOR) || techType.equals(TechnologyType.DUALMODE);
        if (answer != null && !answer.equals(isTwoC)) {
            throw new UnsupportedOperationException(
                    "Gemma cannot handle experiments that mix one- and two-color arrays");
        }
        answer = isTwoC;
    }
    return answer;
}

From source file:org.sakaiproject.message.tool.SynopticMessageAction.java

/**
 * doUpdate handles user clicking "Done" in Options panel (called for form input tags type="submit" named="eventSubmit_doUpdate")
 *///  w  w w. ja  v a2  s.com
public void doUpdate(RunData data, Context context) {
    // access the portlet element id to find our state
    String peid = ((JetspeedRunData) data).getJs_peid();
    SessionState state = ((JetspeedRunData) data).getPortletSessionState(peid);

    String serviceName = (String) state.getAttribute(STATE_SERVICE_NAME);

    boolean allow_show_subject = true;
    boolean allow_channel_choice = false;

    // showSubject
    if (allow_show_subject) {
        if (serviceName.equals(SERVICENAME_DISCUSSION)) {
            // always show subject for Recent Discussion
            String showBody = data.getParameters().getString(FORM_SHOW_BODY);
            try {
                Boolean sb = new Boolean(showBody);
                if (!sb.equals((Boolean) state.getAttribute(STATE_SHOW_BODY))) {
                    state.setAttribute(STATE_SHOW_BODY, sb);
                    state.setAttribute(STATE_UPDATE, STATE_UPDATE);
                }
            } catch (Exception ignore) {
            }
        } else if (serviceName.equals(SERVICENAME_ANNOUNCEMENT)) {
            String showSubject = data.getParameters().getString(FORM_SHOW_SUBJECT);
            try {
                Boolean ss = new Boolean(showSubject);
                if (!ss.equals((Boolean) state.getAttribute(STATE_SHOW_SUBJECT))) {
                    state.setAttribute(STATE_SHOW_SUBJECT, ss);
                    state.setAttribute(STATE_UPDATE, STATE_UPDATE);
                }
            } catch (Exception ignore) {
            }
        }
    }

    // channel
    if (allow_channel_choice) {
        String placementContext = ToolManager.getCurrentPlacement().getContext();
        String newChannel = data.getParameters().getString(FORM_CHANNEL);
        String currentChannel = ((String) state.getAttribute(STATE_CHANNEL_REF))
                .substring(placementContext.length() + 1);

        if (newChannel != null && !newChannel.equals(currentChannel)) {
            String channel_ref = ((MessageService) state.getAttribute(STATE_SERVICE))
                    .channelReference(placementContext, newChannel);
            state.setAttribute(STATE_CHANNEL_REF, channel_ref);
            if (Log.getLogger("chef").isDebugEnabled())
                Log.debug("chef", this + ".doUpdate(): newChannel: " + channel_ref);
            // updateObservationOfChannel(state, peid);

            // update the tool config
            Placement placement = ToolManager.getCurrentPlacement();
            placement.getPlacementConfig().setProperty(PARAM_CHANNEL,
                    (String) state.getAttribute(STATE_CHANNEL_REF));

            // deliver an update to the title panel (to show the new title)
            String titleId = titlePanelUpdateId(peid);
            schedulePeerFrameRefresh(titleId);
        }
    }

    // days
    String daysValue = data.getParameters().getString(FORM_DAYS);
    try {
        Integer days = new Integer(daysValue);
        if (!days.equals((Integer) state.getAttribute(STATE_DAYS))) {
            state.setAttribute(STATE_DAYS, days);
            state.setAttribute(STATE_UPDATE, STATE_UPDATE);

            // recompute this which is used for selecting the messages for display
            long startTime = System.currentTimeMillis() - (days.longValue() * 24l * 60l * 60l * 1000l);
            state.setAttribute(STATE_AFTER_DATE, TimeService.newTime(startTime));
        }
    } catch (Exception ignore) {
    }

    // items
    String itemsValue = data.getParameters().getString(FORM_ITEMS);
    try {
        Integer items = new Integer(itemsValue);
        if (!items.equals((Integer) state.getAttribute(STATE_ITEMS))) {
            state.setAttribute(STATE_ITEMS, items);
            state.setAttribute(STATE_UPDATE, STATE_UPDATE);
        }
    } catch (Exception ignore) {
    }

    // length
    String lengthValue = data.getParameters().getString(FORM_LENGTH);
    try {
        Integer length = new Integer(lengthValue);
        if (!length.equals((Integer) state.getAttribute(STATE_LENGTH))) {
            state.setAttribute(STATE_LENGTH, length);
            state.setAttribute(STATE_UPDATE, STATE_UPDATE);
        }
    } catch (Exception ignore) {
    }

    // update the tool config
    Placement placement = ToolManager.getCurrentPlacement();
    placement.getPlacementConfig().setProperty(PARAM_CHANNEL, (String) state.getAttribute(STATE_CHANNEL_REF));
    placement.getPlacementConfig().setProperty(PARAM_DAYS,
            ((Integer) state.getAttribute(STATE_DAYS)).toString());
    placement.getPlacementConfig().setProperty(PARAM_ITEMS,
            ((Integer) state.getAttribute(STATE_ITEMS)).toString());
    placement.getPlacementConfig().setProperty(PARAM_LENGTH,
            ((Integer) state.getAttribute(STATE_LENGTH)).toString());
    placement.getPlacementConfig().setProperty(PARAM_SHOW_BODY,
            ((Boolean) state.getAttribute(STATE_SHOW_BODY)).toString());
    placement.getPlacementConfig().setProperty(PARAM_SHOW_SUBJECT,
            ((Boolean) state.getAttribute(STATE_SHOW_SUBJECT)).toString());

    // commit the change
    saveOptions();

    // we are done with customization... back to the main mode
    state.removeAttribute(STATE_MODE);

    // enable auto-updates while in view mode
    enableObservers(state);

}

From source file:org.crank.javax.faces.component.MenuRenderer.java

protected void renderOption(FacesContext context, UIComponent component, SelectItem curItem)
        throws IOException {

    ResponseWriter writer = context.getResponseWriter();
    assert (writer != null);

    writer.writeText("\t", component, null);
    writer.startElement("option", component);

    String valueString = getFormattedValue(context, component, curItem.getValue());
    writer.writeAttribute("value", valueString, "value");

    Object submittedValues[] = getSubmittedSelectedValues(context, component);
    //Class type = String.class;
    Object valuesArray = null;//from  w ww  .  jav a2 s  .  c o  m
    Object itemValue = null;

    boolean isSelected = false;
    boolean containsValue = false;
    if (submittedValues != null) {
        containsValue = containsaValue(submittedValues);
        if (containsValue) {
            valuesArray = submittedValues;
            itemValue = valueString;
        } else {
            valuesArray = getCurrentSelectedValues(context, component);
            itemValue = curItem.getValue();
        }
    } else {
        valuesArray = getCurrentSelectedValues(context, component);
        itemValue = curItem.getValue();
    }
    if (valuesArray != null) {
        //type = valuesArray.getClass().getComponentType();
    }

    Map<String, Object> requestMap = context.getExternalContext().getRequestMap();
    requestMap.put(ConverterPropertyEditorBase.TARGET_COMPONENT_ATTRIBUTE_NAME, component);
    Object newValue = null;
    //        try {
    //            newValue = context.getApplication().getExpressionFactory().
    //                 coerceToType(itemValue, type);
    //        } catch (Exception e) {
    //            // this should catch an ELException, but there is a bug
    //            // in ExpressionFactory.coerceToType() in GF
    //            newValue = null;
    //        }

    newValue = itemValue;

    isSelected = isSelected(newValue, valuesArray);

    if (isSelected) {
        writer.writeAttribute("selected", true, "selected");
    }

    String labelClass = null;
    Boolean disabledAttr = (Boolean) component.getAttributes().get("disabled");
    boolean componentDisabled = false;
    if (disabledAttr != null) {
        if (disabledAttr.equals(Boolean.TRUE)) {
            componentDisabled = true;
        }
    }

    // if the component is disabled, "disabled" attribute would be rendered
    // on "select" tag, so don't render "disabled" on every option.
    if ((!componentDisabled) && curItem.isDisabled()) {
        writer.writeAttribute("disabled", true, "disabled");
    }

    if (componentDisabled || curItem.isDisabled()) {
        labelClass = (String) component.getAttributes().get("disabledClass");
    } else {
        labelClass = (String) component.getAttributes().get("enabledClass");
    }
    if (labelClass != null) {
        writer.writeAttribute("class", labelClass, "labelClass");
    }

    if (curItem.isEscape()) {
        String label = curItem.getLabel();
        if (label == null) {
            label = curItem.getValue().toString();
        }
        writer.writeText(label, component, "label");
    } else {
        writer.write(curItem.getLabel());
    }
    writer.endElement("option");
    writer.writeText("\n", component, null);

}

From source file:com.flexive.faces.renderer.FxSelectRenderer.java

/**
 * Render a single option/*from   ww w .  j  av  a2s.  c om*/
 *
 * @param context           faces context
 * @param component         the current component
 * @param converter         the converter
 * @param curItem           the item to render
 * @param currentSelections the current selections
 * @param submittedValues   all submitted values
 * @throws IOException on errors
 */
protected void renderOption(FacesContext context, UIComponent component, Converter converter,
        SelectItem curItem, Object currentSelections, Object[] submittedValues) throws IOException {
    ResponseWriter writer = context.getResponseWriter();

    writer.writeText("\t", component, null);
    writer.startElement("option", component);

    String valueString = getFormattedValue(context, component, curItem.getValue(), converter);
    writer.writeAttribute("value", valueString, "value");
    if (curItem instanceof FxJSFSelectItem) {
        //apply the style attribute if it is available
        writer.writeAttribute("style", ((FxJSFSelectItem) curItem).getStyle(), null);
    } else if (curItem.getValue() instanceof ObjectWithColor) {
        //apply the color to the style attribute
        String color = ((ObjectWithColor) (curItem.getValue())).getColor();
        if (!StringUtils.isEmpty(color))
            writer.writeAttribute("style", "color:" + color, null);
    }

    Object valuesArray;
    Object itemValue;
    boolean containsValue;
    if (submittedValues != null) {
        containsValue = FxJsfComponentUtils.containsaValue(submittedValues);
        if (containsValue) {
            valuesArray = submittedValues;
            itemValue = valueString;
        } else {
            valuesArray = currentSelections;
            itemValue = curItem.getValue();
        }
    } else {
        valuesArray = currentSelections;
        itemValue = curItem.getValue();
    }

    if (FxJsfComponentUtils.isSelectItemSelected(context, component, itemValue, valuesArray, converter)) {
        writer.writeAttribute("selected", true, "selected");
    }

    Boolean disabledAttr = (Boolean) component.getAttributes().get("disabled");
    boolean componentDisabled = disabledAttr != null && disabledAttr.equals(Boolean.TRUE);

    // if the component is disabled, "disabled" attribute would be rendered
    // on "select" tag, so don't render "disabled" on every option.
    if ((!componentDisabled) && curItem.isDisabled())
        writer.writeAttribute("disabled", true, "disabled");

    String labelClass;
    if (componentDisabled || curItem.isDisabled())
        labelClass = (String) component.getAttributes().get("disabledClass");
    else
        labelClass = (String) component.getAttributes().get("enabledClass");

    if (labelClass != null)
        writer.writeAttribute("class", labelClass, "labelClass");

    if (curItem.isEscape()) {
        String label = curItem.getLabel();
        if (label == null)
            label = valueString;
        writer.writeText(label, component, "label");
    } else
        writer.write(curItem.getLabel());

    writer.endElement("option");
    writer.writeText("\n", component, null);
}

From source file:org.apache.pig.impl.logicalLayer.LOForEach.java

/**
 * A helper method to check if the foreach has a flattened element
 * //  w w w. j  a  va2s  . co m
 * @return true if any of the expressions in the foreach has a flatten;
 *         false otherwise
 */
public Pair<Boolean, List<Integer>> hasFlatten() {
    boolean hasFlatten = false;
    List<Integer> flattenedColumns = new ArrayList<Integer>();
    for (int i = 0; i < mFlatten.size(); ++i) {
        Boolean b = mFlatten.get(i);
        if (b.equals(true)) {
            hasFlatten = true;
            flattenedColumns.add(i);
        }
    }
    return new Pair<Boolean, List<Integer>>(hasFlatten, flattenedColumns);
}

From source file:org.alfresco.repo.dictionary.DictionaryModelType.java

/**
 * On update properties behaviour implementation
 * // ww w .j av a 2 s  . c  om
 * @param nodeRef   the node reference
 * @param before    the values of the properties before update
 * @param after     the values of the properties after the update
 */
public void onUpdateProperties(NodeRef nodeRef, Map<QName, Serializable> before,
        Map<QName, Serializable> after) {
    if (logger.isTraceEnabled()) {
        logger.trace("onUpdateProperties: nodeRef=" + nodeRef + " ["
                + AlfrescoTransactionSupport.getTransactionId() + "]");
    }

    Boolean beforeValue = (Boolean) before.get(ContentModel.PROP_MODEL_ACTIVE);
    Boolean afterValue = (Boolean) after.get(ContentModel.PROP_MODEL_ACTIVE);

    if (beforeValue == null && afterValue != null) {
        queueModel(nodeRef);
    } else if (afterValue == null && beforeValue != null) {
        // Remove the model since the value has been cleared
        queueModel(nodeRef);
    } else if (beforeValue != null && afterValue != null && beforeValue.equals(afterValue) == false) {
        queueModel(nodeRef);
    }
}

From source file:no.abmu.questionnaire.service.QuestionnaireServiceHelperH3Impl.java

private ReportStatus createReportStatus(OrganisationUnitForBrowsing orgForBrowse,
        QuestionnaireData questionnaireData, String finishFieldNumber) {

    Boolean yes = true;/*from   ww  w  .j  ava2  s  .  co m*/

    if (questionnaireData == null) {
        return new ReportStatusImpl(orgForBrowse);
    }

    BooleanFieldData booleanFieldData = (BooleanFieldData) questionnaireData.getFieldData(finishFieldNumber);
    if (booleanFieldData == null) {
        return new ReportStatusImpl(orgForBrowse, REPORT_EXIST);
    }

    Boolean booleanFieldDataValue = booleanFieldData.getValue();
    if (booleanFieldDataValue == null) {
        return new ReportStatusImpl(orgForBrowse, REPORT_EXIST);
    }

    if (booleanFieldDataValue.equals(yes)) {
        return new ReportStatusImpl(orgForBrowse, REPORT_EXIST, REPORT_IS_FINISH);
    } else {
        return new ReportStatusImpl(orgForBrowse, REPORT_EXIST, REPORT_IS_NOT_FINISH);
    }

}