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:cn.org.once.cstack.cli.utils.ServerUtils.java

public String mountVolume(String name, String path, Boolean mode, String containerName,
        String applicationName) {
    Application application = applicationUtils.getSpecificOrCurrentApplication(applicationName);

    if (containerName == null) {
        containerName = application.getServer().getName();
    }// ww w . j  ava2 s .c o  m

    try {
        Map<String, String> parameters = new HashMap<>();
        parameters.put("containerName", containerName);
        parameters.put("path", path);

        if (mode.equals(true))
            parameters.put("mode", "ro");
        else
            parameters.put("mode", "rw");

        parameters.put("volumeName", name);
        parameters.put("applicationName", application.getName());
        restUtils.sendPutCommand(authenticationUtils.finalHost + "/server/volume", authenticationUtils.getMap(),
                parameters);
    } catch (ManagerResponseException e) {
        throw new CloudUnitCliException("Couldn't mount volume", e);
    }

    return "This volume has successful been mounted";
}

From source file:org.jasig.ssp.dao.PersonDao.java

private Boolean setCoachAlias(Criteria criteria, String alias, Boolean created) {
    if (created.equals(true))
        return created;
    criteria.createAlias("coach", alias);
    return true;/* w  ww.ja v  a2s .  co  m*/
}

From source file:org.openmrs.module.metadatasharing.web.controller.ImportController.java

/**
 * A page where we ask user if he wants to add a subscription the initial checkout of which
 * produced errors/*from ww w . j  av a2  s. c  o m*/
 */
@RequestMapping(value = INVALID_SUBSCRIPTION_PATH, method = RequestMethod.GET)
public String invalidSubscription(@ModelAttribute(IMPORTED_PACKAGE) ImportedPackage importedPackage,
        @RequestParam(value = "add", required = false) Boolean add, HttpSession session, Model model) {
    if (add != null && add.equals(true)) {
        MetadataSharing.getService().saveImportedPackage(importedPackage);
        session.setAttribute(WebConstants.OPENMRS_MSG_ATTR, "metadatasharing.subscription.added");
        return WebUtils.redirect(LIST_PATH);
    }
    return null;
}

From source file:gr.abiss.calipso.wicket.asset.ItemAssetsPanel.java

/**
 * //from   w ww  . j a  va  2  s. c  o m
 * @param assetsModel
 * @param isViewMode
 * @return 
 */
private WebMarkupContainer renderAssetList(final IModel assetsModel, final boolean isViewMode) {

    //Assets list container ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    final WebMarkupContainer itemAssetsListContainer = new WebMarkupContainer("itemAssetsListContainer");

    //Assets list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    final SimpleAttributeModifier sam = new SimpleAttributeModifier("class", "alt");

    if (!isViewMode) {
        Label hCheckbox = new Label("hCheckbox", localize("asset.assetPanel.choose"));
        itemAssetsListContainer.add(hCheckbox);
    } else {
        itemAssetsListContainer.add(new WebMarkupContainer("hCheckbox").setVisible(false));
    }

    ListView assetsListView = new ListView("assetsList", assetsModel) {
        protected void populateItem(final ListItem listItem) {
            if (listItem.getIndex() % 2 != 0) {
                listItem.add(sam);
            } //if

            final Asset asset = (Asset) listItem.getModelObject();

            WebMarkupContainer chooseContainer = new WebMarkupContainer("chooseContainer");
            listItem.add(chooseContainer);

            if (!isViewMode) {
                // TODO:
                final CheckBox chooseAssetCheckBox = new CheckBox("choose",
                        new Model(selectedAssets.contains(asset)));

                if (isEditMode) {
                    if (allItemAssetsList.contains(asset)) {
                        chooseAssetCheckBox.setDefaultModelObject(new String("1"));
                        selectedAssets.add(asset);
                    } //if
                } //if
                chooseContainer.add(chooseAssetCheckBox);
                chooseAssetCheckBox.setOutputMarkupId(true);

                chooseAssetCheckBox.add(new AjaxFormComponentUpdatingBehavior("onchange") {
                    @Override
                    protected void onUpdate(AjaxRequestTarget target) {
                        if (chooseAssetCheckBox.getModelObject() != null) {
                            Boolean isSelected = (Boolean) chooseAssetCheckBox.getModelObject();
                            if (isSelected.equals(true)) {
                                selectedAssets.add(asset);
                            } else {
                                selectedAssets.remove(asset);
                            }
                        }
                    }
                });
            } else {
                chooseContainer.add(new WebMarkupContainer("choose").setVisible(false));
                chooseContainer.setVisible(false);
            } //else

            // --- Asset Type ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            Label assetType = new Label("assetType",
                    localize(asset.getAssetType().getNameTranslationResourceKey()));
            listItem.add(assetType);

            final WebMarkupContainer customAttributesContainer = new WebMarkupContainer(
                    "customAttributesContainer");
            customAttributesContainer.setOutputMarkupId(true);
            listItem.add(customAttributesContainer);

            final WebMarkupContainer customAttributesPanelContainer = new WebMarkupContainer(
                    "customAttributesPanel");
            customAttributesPanelContainer.setOutputMarkupId(true);
            customAttributesContainer.add(customAttributesPanelContainer);

            ExpandCustomAttributesLink customAttributesLink = new ExpandCustomAttributesLink(
                    "showCustomAttributesLink", asset);
            customAttributesLink.setComponentWhenCollapsed(customAttributesPanelContainer);
            customAttributesLink.setTargetComponent(customAttributesContainer);
            customAttributesLink.setImageWhenCollapsed(new CollapsedPanel("imagePanel"));
            customAttributesLink.setImageWhenExpanded(new ExpandedPanel("imagePanel"));

            CollapsedPanel imagePanel = new CollapsedPanel("imagePanel");
            customAttributesLink.add(imagePanel);

            listItem.add(customAttributesLink);

            // --- Inventory Code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            listItem.add(new Label("inventoryCode", asset.getInventoryCode()));
            //format and display dates
            SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");

            // --- Support Start Date ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            if (asset.getSupportStartDate() != null) {
                listItem.add(new Label("supportStartDate", dateFormat.format(asset.getSupportStartDate()))
                        .add(new SimpleAttributeModifier("class", "date")));
            } else {
                listItem.add(new Label("supportStartDate", ""));
            }

            // --- Support End Date ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            if (asset.getSupportEndDate() != null) {
                listItem.add(new Label("supportEndDate", dateFormat.format(asset.getSupportEndDate()))
                        .add(AssetsUtils.getSupportEndDateStyle(asset.getSupportEndDate())));
            } else {
                listItem.add(new Label("supportEndDate", ""));
            }

        }
    };
    itemAssetsListContainer.add(assetsListView);
    itemAssetsListContainer.setOutputMarkupId(true);

    return itemAssetsListContainer;
}

From source file:com.gst.infrastructure.core.api.JsonCommand.java

private boolean differenceExists(final Boolean baseValue, final Boolean workingCopyValue) {
    boolean differenceExists = false;

    if (baseValue != null) {
        differenceExists = !baseValue.equals(workingCopyValue);
    } else {//from w w w .j  a  v a2  s.co  m
        differenceExists = workingCopyValue != null;
    }

    return differenceExists;
}

From source file:com.sun.faces.renderkit.html_basic.MenuRenderer.java

protected void renderOption(FacesContext context, UIComponent component, SelectItem curItem)
        throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    Util.doAssert(writer != null);

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

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

    Object submittedValues[] = getSubmittedSelectedValues(context, component);
    boolean isSelected;
    if (submittedValues != null) {
        isSelected = isSelected(valueString, submittedValues);
    } else {//w  w  w.j av  a 2s.  c  om
        Object selectedValues = getCurrentSelectedValues(context, component);
        isSelected = isSelected(curItem.getValue(), selectedValues);
    }

    if (isSelected) {
        writer.writeAttribute("selected", "selected", "selected");
    }
    if (curItem.isDisabled()) {
        writer.writeAttribute("disabled", "disabled", "disabled");
    }

    String labelClass = null;
    Boolean disabledAttr = (Boolean) component.getAttributes().get("disabled");
    boolean componentDisabled = false;
    if (disabledAttr != null) {
        if (disabledAttr.equals(Boolean.TRUE)) {
            componentDisabled = true;
        }
    }
    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");
    }

    writer.writeText(curItem.getLabel(), "label");
    writer.endElement("option");
    writer.writeText("\n", null);

}

From source file:org.fenixedu.qubdocs.ui.documenttemplates.AcademicServiceRequestTemplateController.java

private List<AcademicServiceRequestTemplate> filterSearchTemplates(java.lang.Boolean active,
        org.fenixedu.commons.i18n.LocalizedString name,
        org.fenixedu.academic.domain.serviceRequests.ServiceRequestType serviceRequestType,
        java.lang.Boolean custom) {

    return getSearchUniverseSearchTemplatesDataSet()
            .filter(academicServiceRequestTemplate -> active == null
                    || active.equals(academicServiceRequestTemplate.getActive()))
            .filter(academicServiceRequestTemplate -> name == null || name.isEmpty() || name.getLocales()
                    .stream()//  w w  w . j  a v  a 2s. co m
                    .allMatch(locale -> academicServiceRequestTemplate.getName().getContent(locale) != null
                            && academicServiceRequestTemplate.getName().getContent(locale).toLowerCase()
                                    .contains(name.getContent(locale).toLowerCase())))
            .filter(academicServiceRequestTemplate -> serviceRequestType == null
                    || serviceRequestType == academicServiceRequestTemplate.getServiceRequestType())
            .filter(academicServiceRequestTemplate -> custom == null
                    || custom.equals(academicServiceRequestTemplate.getCustom()))
            .collect(Collectors.toList());
}

From source file:org.opencms.ui.dialogs.availability.CmsAvailabilityDialog.java

/**
 * Actually performs the availability change.<p>
 *
 * @return the ids of the changed resources
 *
 * @throws CmsException if something goes wrong
 */// ww  w. j a v  a 2  s  . c o m
protected List<CmsUUID> changeAvailability() throws CmsException {

    Date released = m_releasedField.getValue();
    Date expired = m_expiredField.getValue();
    boolean resetReleased = m_resetReleased.getValue().booleanValue();
    boolean resetExpired = m_resetExpired.getValue().booleanValue();
    boolean modifySubresources = m_subresourceModificationField.getValue().booleanValue();
    List<CmsUUID> changedIds = new ArrayList<CmsUUID>();
    for (CmsResource resource : m_dialogContext.getResources()) {
        changeAvailability(resource, released, resetReleased, expired, resetExpired, modifySubresources);
        changedIds.add(resource.getStructureId());
    }

    String notificationInterval = m_notificationIntervalField.getValue().trim();
    int notificationIntervalInt = 0;
    try {
        notificationIntervalInt = Integer.parseInt(notificationInterval);
    } catch (NumberFormatException e) {
        LOG.warn(e.getLocalizedMessage(), e);
    }
    Boolean notificationEnabled = m_notificationEnabledField.getValue();
    boolean notificationSettingsUnchanged = notificationInterval.equals(m_initialNotificationInterval)
            && notificationEnabled.equals(m_initialNotificationEnabled);

    CmsObject cms = A_CmsUI.getCmsObject();
    if (!notificationSettingsUnchanged) {
        for (CmsResource resource : m_dialogContext.getResources()) {
            performSingleResourceNotification(A_CmsUI.getCmsObject(), cms.getSitePath(resource),
                    notificationEnabled.booleanValue(), notificationIntervalInt,
                    m_modifySiblingsField.getValue().booleanValue());
        }

    }
    return changedIds;
}

From source file:org.broadinstitute.sting.utils.variantcontext.VariantContextUtils.java

private static Map<String, Object> mergeVariantContextAttributes(VariantContext vc1, VariantContext vc2) {
    Map<String, Object> mergedAttribs = new HashMap<String, Object>();

    List<VariantContext> vcList = new LinkedList<VariantContext>();
    vcList.add(vc1);//from  ww w .j a  v  a2 s.  c o  m
    vcList.add(vc2);

    String[] MERGE_OR_ATTRIBS = { VCFConstants.DBSNP_KEY };
    for (String orAttrib : MERGE_OR_ATTRIBS) {
        boolean attribVal = false;
        for (VariantContext vc : vcList) {
            Boolean val = vc.getAttributeAsBooleanNoException(orAttrib);
            if (val != null)
                attribVal = (attribVal || val);
            if (attribVal) // already true, so no reason to continue:
                break;
        }
        mergedAttribs.put(orAttrib, attribVal);
    }

    // Merge ID fields:
    String iDVal = null;
    for (VariantContext vc : vcList) {
        String val = vc.getAttributeAsStringNoException(VariantContext.ID_KEY);
        if (val != null && !val.equals(VCFConstants.EMPTY_ID_FIELD)) {
            if (iDVal == null)
                iDVal = val;
            else
                iDVal += VCFConstants.ID_FIELD_SEPARATOR + val;
        }
    }
    if (iDVal != null)
        mergedAttribs.put(VariantContext.ID_KEY, iDVal);

    return mergedAttribs;
}