Example usage for org.apache.commons.lang StringUtils equalsIgnoreCase

List of usage examples for org.apache.commons.lang StringUtils equalsIgnoreCase

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils equalsIgnoreCase.

Prototype

public static boolean equalsIgnoreCase(String str1, String str2) 

Source Link

Document

Compares two Strings, returning true if they are equal ignoring the case.

Usage

From source file:edu.cornell.mannlib.vitro.webapp.visualization.entitycomparison.OrganizationUtilityFunctions.java

public static Entity mergeEntityIfShareSameURI(Entity entityA, Entity entityB) {

    if (StringUtils.equalsIgnoreCase(entityA.getEntityURI(), entityB.getEntityURI())) {

        Entity mergedEntity = new Entity(entityA.getEntityURI());

        if (StringUtils.isNotBlank(entityA.getEntityLabel())) {

            mergedEntity.setEntityLabel(entityA.getEntityLabel());

        } else if (StringUtils.isNotBlank(entityB.getEntityLabel())) {

            mergedEntity.setEntityLabel(entityB.getEntityLabel());
        }/*from  www .  jav a 2s  .  c  o  m*/

        mergedEntity.addSubEntitities(entityA.getSubEntities());
        mergedEntity.addSubEntitities(entityB.getSubEntities());

        mergedEntity.addParents(entityA.getParents());
        mergedEntity.addParents(entityB.getParents());

        return mergedEntity;

    } else {
        return null;
    }

}

From source file:com.sfs.beans.UserBean.java

/**
 * Checks if is member of.//from   ww w.  j  a  v a2s .  c o m
 *
 * @param group the group
 *
 * @return true, if is member of
 */
public final boolean isMemberOf(final String group) {
    boolean value = false;
    if (this.memberOf != null) {
        for (String groupName : this.memberOf) {
            if (StringUtils.equalsIgnoreCase(groupName, group)) {
                value = true;
            }
        }
    }
    return value;
}

From source file:info.magnolia.cms.security.MgnlGroup.java

/**
 * removed node/*  ww  w. j  av a  2 s  .  co m*/
 * @param name
 * @param nodeName
 */
private void remove(String name, String nodeName) {
    try {
        HierarchyManager hm;
        if (StringUtils.equalsIgnoreCase(nodeName, NODE_ROLES))
            hm = MgnlContext.getHierarchyManager(ContentRepository.USER_ROLES);
        else
            hm = MgnlContext.getHierarchyManager(ContentRepository.USER_GROUPS);
        Content node = groupNode.getContent(nodeName);

        for (Iterator iter = node.getNodeDataCollection().iterator(); iter.hasNext();) {
            NodeData nodeData = (NodeData) iter.next();
            // check for the existence of this ID
            try {
                if (hm.getContentByUUID(nodeData.getString()).getName().equalsIgnoreCase(name)) {
                    nodeData.delete();
                }
            } catch (ItemNotFoundException e) {
                if (log.isDebugEnabled())
                    log.debug("Role [ " + name + " ] does not exist in the ROLES repository");
            } catch (IllegalArgumentException e) {
                if (log.isDebugEnabled())
                    log.debug(nodeData.getHandle() + " has invalid value");
            }
        }
        groupNode.save();
    } catch (RepositoryException e) {
        log.error("failed to remove " + name + " from user [" + this.getName() + "]", e);
    }
}

From source file:hydrograph.ui.propertywindow.widgets.customwidgets.DropDownWidget.java

@Override
public void attachToPropertySubGroup(AbstractELTContainerWidget container) {

    ELTDefaultSubgroupComposite eltSuDefaultSubgroupComposite = new ELTDefaultSubgroupComposite(
            container.getContainerControl());
    eltSuDefaultSubgroupComposite.createContainerWidget();

    Utils.INSTANCE.loadProperties();/*from  w w  w .j  a va2s .c  o  m*/
    this.cursor = container.getContainerControl().getDisplay().getSystemCursor(SWT.CURSOR_HAND);
    AbstractELTWidget defaultLabel = new ELTDefaultLable(dropDownConfig.getName());
    eltSuDefaultSubgroupComposite.attachWidget(defaultLabel);
    setPropertyHelpWidget((Control) defaultLabel.getSWTWidgetControl());

    AbstractELTWidget defaultCombo = new ELTDefaultCombo()
            .defaultText(convertToArray(dropDownConfig.getItems()));
    eltSuDefaultSubgroupComposite.attachWidget(defaultCombo);
    combo = (Combo) defaultCombo.getSWTWidgetControl();
    combo.select(0);

    if (!StringUtils.equalsIgnoreCase(propertyName, "failOnError")) {
        ELTDefaultTextBox eltDefaultTextBox = new ELTDefaultTextBox().grabExcessHorizontalSpace(true);
        eltSuDefaultSubgroupComposite.attachWidget(eltDefaultTextBox);
        eltDefaultTextBox.visibility(false);
        text = (Text) eltDefaultTextBox.getSWTWidgetControl();

        txtDecorator = WidgetUtility.addDecorator(text,
                Messages.bind(Messages.EMPTY_FIELD, dropDownConfig.getName()));

        ListenerHelper helper = new ListenerHelper();
        helper.put(HelperType.CONTROL_DECORATION, txtDecorator);

        try {
            for (Listners listenerNameConstant : dropDownConfig.getDropDownListeners()) {
                IELTListener listener = listenerNameConstant.getListener();
                defaultCombo.attachListener(listener, propertyDialogButtonBar, helper,
                        defaultCombo.getSWTWidgetControl(), eltDefaultTextBox.getSWTWidgetControl());
            }
            for (Listners listenerNameConstant : dropDownConfig.getTextBoxListeners()) {
                IELTListener listener = listenerNameConstant.getListener();
                eltDefaultTextBox.attachListener(listener, propertyDialogButtonBar, helper,
                        eltDefaultTextBox.getSWTWidgetControl());
            }
        } catch (Exception exception) {
            logger.error("Failed in attaching listeners to {}, {}", dropDownConfig.getName(), exception);
        }
    }
    addComboSelectionListner();
    populateWidget();
}

From source file:com.sfs.whichdoctor.formatter.TrainingStatusFormatter.java

/**
 * Gets the reports filtered by type.//from  ww  w .j a va 2s .  c om
 *
 * @param status the status
 * @param type the type
 * @param format the format
 * @return the reports by type
 */
private static String getReportsByType(final TrainingStatusBean status, final String type,
        final String format) {

    StringBuilder sb = new StringBuilder();

    if (status.getReportsStatus() != null) {
        for (String key : status.getReportsStatus().keySet()) {
            ReportStatus rs = status.getReportsStatus().get(key);

            if (StringUtils.equalsIgnoreCase(rs.getReportType(), type)) {

                if (sb.length() > 0) {
                    if (StringUtils.equalsIgnoreCase(format, "html")) {
                        sb.append("<br />");
                    } else {
                        sb.append(", ");
                    }
                }
                sb.append(rs.getReportStatus());
                sb.append(" - ");
                sb.append(rs.getAuthors());
            }
        }
    }
    return sb.toString();
}

From source file:com.zb.app.websocket.server.wrapper.SessionWrapper.java

@Override
public boolean equals(Object obj) {
    if (obj == null) {
        return false;
    }/*  ww  w  .j  av  a  2  s  .  c  o m*/
    if (getClass() != obj.getClass()) {
        return false;
    }
    final SessionWrapper other = (SessionWrapper) obj;
    if (!StringUtils.equalsIgnoreCase(this.id, other.id)) {
        return false;
    }
    // if (StringUtils.equalsIgnoreCase(this.id, other.id) && !this.clientWrapper.equals(other.clientWrapper)) {
    // return false;
    // }
    if (this == obj) {
        return true;
    }
    return true;
}

From source file:hydrograph.ui.propertywindow.ftp.AuthenticationWidget.java

/**
 * The Function used to open new dialog for additional params
 *///from  ww  w .j a v a 2s. co m
public void newWindowLauncher() {
    String[] optionList = null;
    initialMap = new LinkedHashMap<>(initialMap);

    String protocolText = null;
    for (AbstractWidget widget : widgets) {
        if (widget.getPropertyName().equals("protocolSelection")) {
            FTPProtocolDetails protocolDetails = (FTPProtocolDetails) widget.getProperties()
                    .get("protocolSelection");
            if (protocolDetails != null) {
                if (StringUtils.equalsIgnoreCase(protocolDetails.getProtocol(), "FTP")) {
                    optionList = new String[] { Constants.STAND_AUTH };
                    protocolText = protocolDetails.getProtocol();
                } else if (StringUtils.equalsIgnoreCase(protocolDetails.getProtocol(), "SFTP")) {
                    optionList = new String[] { Constants.STAND_AUTH, "User ID and Key" };
                    protocolText = protocolDetails.getProtocol();
                } else if (StringUtils.equalsIgnoreCase(protocolDetails.getProtocol(), "AWS S3 HTTPS")) {
                    optionList = new String[] { "AWS S3 Access Key", "AWS S3 Property File" };
                    protocolText = protocolDetails.getProtocol();
                }
            }
        }
    }

    String selectedText = protocolText;
    boolean bol = initialMap.entrySet().stream()
            .anyMatch(val -> val.getValue().getProtocolSelection().equals(selectedText));
    if (!bol) {
        initialMap = new LinkedHashMap<>();
    }

    //optionList = new String[]{"Basic Auth", "User Id & Key"/*, "Basic Auth & Key"*/};
    FTPAuthenticEditorDialog authenticationEditorDialog = new FTPAuthenticEditorDialog(shell,
            runtimeConfig.getWindowLabel(), propertyDialogButtonBar, initialMap, cursor, optionList,
            protocolText);
    authenticationEditorDialog.open();
    Map<String, FTPAuthOperationDetails> newValues = authenticationEditorDialog.getAdditionalParameterDetails();

    if (isAnyUpdate(initialMap, newValues)) {
        propertyDialogButtonBar.enableApplyButton(true);
    }

    initialMap = newValues;
    showHideErrorSymbol(widgets);
}

From source file:gov.nih.nci.ncicb.tcga.dcc.dam.webservice.WSFilterAdapter.java

/**
 * Allow for usage of center name/*from   w w w  .j  a v a2  s  .c o m*/
 * <p/>
 * If the center is other than an Id, then a match will be searched among all the centers with the condition that the match
 * supports the platform (the platform *must* be set prior to the center)
 *
 * @param centerAsString the name of the center to be set
 */
@Override
public void setCenter(final String centerAsString) {
    final String platFormTypeC = trimFirstAndLastComma(getPlatformType());
    if (!StringUtils.isBlank(centerAsString)) {
        String res = "";
        for (final String center : centerAsString.split(",", -1)) {
            res += processCenter(center, platFormTypeC) + ",";
        }
        super.setCenter(res.substring(0, res.length() - 1));
    } else {
        // added check to allow blank values for clinical type data
        if (!StringUtils.equalsIgnoreCase(platFormTypeC,
                NonplatformType.NONPLATFORMTYPE_CLINICAL.getAssociatedPseudoPlatformType())) {
            throw new WebApplicationException(WebServiceUtil.getStatusResponse(
                    HttpStatusCode.PRECONDITION_FAILED,
                    "Center cannot be null." + HTML_NEW_LINE + HTML_NEW_LINE + getAllCenterListForHtml()));
        }
    }
}

From source file:com.sfs.whichdoctor.beans.GroupBean.java

/**
 * Gets the group dn.//from   w w  w.j  ava  2  s.  co m
 *
 * @return the group dn
 */
public final String getGroupDN() {
    if (StringUtils.isBlank(this.groupDN) || StringUtils.equalsIgnoreCase(this.groupDN, "null")) {
        this.groupDN = "";
    }
    return this.groupDN;
}

From source file:gov.nih.nci.cabig.caaers.tools.spring.tabbedflow.AutomaticSaveAjaxableFormController.java

protected boolean isAjaxRequest(HttpServletRequest request) {
    if (StringUtils.equalsIgnoreCase(request.getParameter(getAjaxRequestParamName()), "true"))
        return true;
    return false;
}