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:info.magnolia.jaas.principal.AbstractPrincipalList.java

/**
 * Checks if the role name exist in this list.
 * @param name//from  www.jav a 2 s  . com
 */
@Override
public boolean has(String name) {
    Iterator listIterator = this.list.iterator();
    while (listIterator.hasNext()) {
        String roleName = (String) listIterator.next();
        if (StringUtils.equalsIgnoreCase(name, roleName)) {
            return true;
        }
    }
    return false;
}

From source file:hydrograph.ui.graph.editor.JobDeleteParticipant.java

@Override
protected boolean initialize(Object element) {
    this.modifiedResource = (IFile) element;
    IProject[] iProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
    for (IProject iProject : iProjects) {
        if (StringUtils.equals(iProject.getName(), modifiedResource.getFullPath().segment(0))) {
            if (StringUtils.equalsIgnoreCase(Messages.PROPERTIES_EXT, modifiedResource.getFileExtension())) {
                return deleteCorrospondingXmlAndJobFileifUserDeletePropertyFile(iProject);
            } else if (StringUtils.equalsIgnoreCase(Messages.JOB_EXT, modifiedResource.getFileExtension())) {
                return deleteCorrospondingXmlAndPropertyFileifUserDeleteJobFile(iProject);
            } else if (StringUtils.equalsIgnoreCase(Messages.XML_EXT, modifiedResource.getFileExtension())) {
                return deleteCorrospondingJobAndPropertyFileifUserDeleteXmlFile(iProject);
            }/*from w  w w. j  av  a 2s .  c  o m*/
        }
    }

    return true;
}

From source file:com.amalto.core.storage.DispatchWrapper.java

public static boolean isMDMInternal(String clusterName) {
    if (clusterName != null) {
        String pureClusterName = StorageWrapper.getPureClusterName(clusterName);
        for (String internalClusterName : getInternalClusterNames()) {
            if (StringUtils.equalsIgnoreCase(internalClusterName, pureClusterName)) {
                return true;
            }// w  ww.ja  va2  s.  c  om
        }
    }
    return false;
}

From source file:com.github.restdriver.serverdriver.http.Header.java

@Generated("Eclipse")
@Override/*from   ww w  .  j  a v a2 s  .c  o m*/
public boolean equals(Object object) {
    if (this == object) {
        return true;
    }

    if (!(object instanceof Header)) {
        return false;
    }

    Header other = (Header) object;

    return StringUtils.equalsIgnoreCase(name, other.name) && StringUtils.equals(value, other.value);

}

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

public boolean hasAny(final String principalName, final String resourceName, final String resourceTypeName) {
    long start = System.currentTimeMillis();
    try {/*from   w  w  w  . j a  va 2  s . com*/
        String sessionName;
        if (StringUtils.equalsIgnoreCase(resourceTypeName, NODE_ROLES)) {
            sessionName = RepositoryConstants.USER_ROLES;
        } else {
            sessionName = RepositoryConstants.USER_GROUPS;
        }

        // this is an original code from old ***Managers.
        // TODO: If you ever need to speed it up, turn it around - retrieve group or role by its name and read its ID, then loop through IDs this user has assigned to find out if he has that one or not.
        final Collection<String> groupsOrRoles = MgnlContext
                .doInSystemContext(new JCRSessionOp<Collection<String>>(getRepositoryName()) {

                    @Override
                    public Collection<String> exec(Session session) throws RepositoryException {
                        List<String> list = new ArrayList<String>();
                        Node principal = findPrincipalNode(principalName, session);
                        if (principal == null) {
                            log.debug("No User '" + principalName + "' found in repository");
                            return list;
                        }
                        Node groupsOrRoles = principal.getNode(resourceTypeName);

                        for (PropertyIterator props = groupsOrRoles.getProperties(); props.hasNext();) {
                            Property property = props.nextProperty();
                            try {
                                // just get all the IDs of given type assigned to the principal
                                list.add(property.getString());
                            } catch (ItemNotFoundException e) {
                                log.debug("Role [{}] does not exist in the {} repository", resourceName,
                                        resourceTypeName);
                            } catch (IllegalArgumentException e) {
                                log.debug("{} has invalid value", property.getPath());
                            } catch (ValueFormatException e) {
                                log.debug("{} has invalid value", property.getPath());
                            }
                        }
                        return list;
                    }
                });

        // check if any of the assigned IDs match the requested name
        return MgnlContext.doInSystemContext(new JCRSessionOp<Boolean>(sessionName) {

            @Override
            public Boolean exec(Session session) throws RepositoryException {
                for (String groupOrRole : groupsOrRoles) {
                    // check for the existence of this ID
                    try {
                        if (session.getNodeByIdentifier(groupOrRole).getName().equalsIgnoreCase(resourceName)) {
                            return true;
                        }
                    } catch (RepositoryException e) {
                        log.debug("Role [{}] does not exist in the ROLES repository", resourceName);
                    }
                }
                return false;
            }
        });

    } catch (RepositoryException e) {
        // Item not found or access denied ...
        log.debug(e.getMessage(), e);
    } finally {
        log.debug("checked {} for {} in {}ms.",
                new Object[] { resourceName, resourceTypeName, (System.currentTimeMillis() - start) });
    }
    return false;
}

From source file:io.kamax.mxisd.backend.sql.GenericSqlDirectoryProvider.java

public UserDirectorySearchResult search(String searchTerm, GenericSqlProviderConfig.Query query) {
    try (Connection conn = pool.get()) {
        log.info("Will execute query: {}", query.getValue());
        try (PreparedStatement stmt = conn.prepareStatement(query.getValue())) {
            setParameters(stmt, searchTerm);

            try (ResultSet rSet = stmt.executeQuery()) {
                UserDirectorySearchResult result = new UserDirectorySearchResult();
                result.setLimited(false);

                while (rSet.next()) {
                    processRow(rSet).ifPresent(e -> {
                        if (StringUtils.equalsIgnoreCase("localpart", query.getType())) {
                            e.setUserId(new MatrixID(e.getUserId(), mxCfg.getDomain()).getId());
                        }/*from   w w  w .ja va 2 s  .c o  m*/
                        result.addResult(e);
                    });
                }

                return result;
            }
        }
    } catch (SQLException e) {
        throw new InternalServerError(e);
    }
}

From source file:com.edgenius.wiki.ext.tabs.TabsHandler.java

public List<RenderPiece> handle(RenderContext renderContext, Map<String, String> values)
        throws RenderHandlerException {

    Map<String, Map<String, String>> tabsMap = (Map<String, Map<String, String>>) renderContext
            .getGlobalParam(TabsHandler.class.getName());
    if (tabsMap == null || tabsMap.size() == 0) {
        //No valid tab found for tabs
        return null;
    }/*  w  w  w.ja  v a  2  s  .  c  o  m*/

    String grpKey = values.get(Macro.GROUP_KEY);

    //tabKey and tabName - see TabMacro.java
    Map<String, String> tabList = tabsMap.get(grpKey);
    if (tabList == null || tabList.size() == 0) {
        //No valid tab found for tabs
        return null;
    }

    try {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("tabsID", grpKey);
        String sel = StringUtils.trim(values.get("select"));
        if (!StringUtils.isBlank(sel)) {
            int idx = 0;
            for (Entry<String, String> entry : tabList.entrySet()) {
                if (StringUtils.equalsIgnoreCase(entry.getValue(), sel)) {
                    map.put("selectTab", idx);
                    break;
                }
                idx++;
            }
        }
        map.put("tabMap", tabList);
        return Arrays
                .asList((RenderPiece) new TextModel(pluginService.renderMacro("tabs", map, renderContext)));
    } catch (PluginRenderException e) {
        log.error("Unable to render Tab plugin", e);
        throw new RenderHandlerException("Tabs can't be rendered.");
    }

}

From source file:de.iteratec.iteraplan.businesslogic.exchange.legacyExcel.importer.AttributeSheetImporter.java

/**
 * Checks if the value in the current cell holder is a boolean
 * @param cellValueHolder//from  w w w .j a  va  2 s .  c o  m
 */
protected boolean isBooleanValue(CellValueHolder cellValueHolder) {
    String yesString = MessageAccess.getStringOrNull("global.yes", getLocale());
    String noString = MessageAccess.getStringOrNull("global.no", getLocale());

    if (StringUtils.equalsIgnoreCase(cellValueHolder.getAttributeValue(), yesString)
            || StringUtils.equalsIgnoreCase(cellValueHolder.getAttributeValue(), noString)) {
        return true;
    }

    return false;
}

From source file:com.microsoft.alm.plugin.external.commands.UpdateWorkspaceMappingCommand.java

@Override
public ToolRunner.ArgumentBuilder getArgumentBuilder() {
    final String subCommand = getSubCommand();
    final ToolRunner.ArgumentBuilder builder = super.getArgumentBuilder().addSwitch(subCommand)
            .addSwitch("workspace", workspaceName);
    if (removeMapping) {
        // When removing a mapping, it cannot contain the "/*" notation at the end
        builder.add(WorkspaceHelper.getNormalizedServerPath(mapping.getServerPath()));
    } else {//from  ww  w .  ja  v a  2 s. co  m
        builder.add(mapping.getServerPath());
    }
    if (StringUtils.equalsIgnoreCase(subCommand, SUB_MAP)) {
        builder.add(mapping.getLocalPath());
    }
    return builder;
}

From source file:com.sfs.whichdoctor.webservice.PublishServiceImpl.java

/**
 * Record the incoming ISB message as long as the key is valid.
 *
 * @param keyVal the key// ww  w .j a  v  a  2  s  .  c om
 * @param source the source
 * @param targetVal the target
 * @param xmlPayload the xml payload
 *
 * @return the string
 */
public final String Deliver(final String keyVal, final String source, final String targetVal,
        final String xmlPayload) {
    String outcome = "";

    /* Validate the ISB key - if it does not match do not process */
    if (StringUtils.equalsIgnoreCase(keyVal, this.key)) {
        outcome = deliverMessage(source, targetVal, xmlPayload);
    } else {
        outcome = "ERROR - Invalid ISB key";
    }
    return outcome;
}