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

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

Introduction

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

Prototype

public static boolean equalsIgnoreCase(final CharSequence str1, final CharSequence str2) 

Source Link

Document

Compares two CharSequences, returning true if they represent equal sequences of characters, ignoring case.

null s are handled without exceptions.

Usage

From source file:com.glaf.core.service.impl.MxDataModelServiceImpl.java

@Transactional
public void deleteAll(String tableName, Collection<String> businessKeys) {
    List<ColumnDefinition> cols = tableDefinitionService.getColumnDefinitionsByTableName(tableName);
    if (cols != null && !cols.isEmpty()) {
        for (ColumnDefinition col : cols) {
            if (StringUtils.equalsIgnoreCase(col.getColumnName(), "BUSINESSKEY_")) {
                TableModel tableModel = new TableModel();
                tableModel.setTableName(tableName);
                ColumnModel cm = new ColumnModel();
                cm.setColumnName("BUSINESSKEY_");
                cm.setJavaType(col.getJavaType());
                cm.setCollectionValues(businessKeys);
                tableModel.addColumn(cm);
                tableDataService.deleteTableData(tableModel);
                break;
            }/*  ww w.  j  a v  a  2 s .  c  o m*/
            if (StringUtils.equalsIgnoreCase(col.getColumnName(), "ID_")) {
                TableModel tableModel = new TableModel();
                tableModel.setTableName(tableName);
                ColumnModel cm = new ColumnModel();
                cm.setColumnName("ID_");
                cm.setJavaType(col.getJavaType());
                cm.setCollectionValues(businessKeys);
                tableModel.addColumn(cm);
                tableDataService.deleteTableData(tableModel);
                break;
            }
        }
    }
}

From source file:com.nike.cerberus.config.CmsEnvPropertiesLoader.java

private String getObject(String path) {
    final GetObjectRequest request = new GetObjectRequest(bucketName, path);

    try {//from   w w w  .  j  a v  a2 s . c  o m
        S3Object s3Object = s3Client.getObject(request);
        InputStream object = s3Object.getObjectContent();
        return IOUtils.toString(object, Charset.defaultCharset());
    } catch (AmazonServiceException ase) {
        if (StringUtils.equalsIgnoreCase(ase.getErrorCode(), "NoSuchKey")) {
            final String errorMessage = String.format("The S3 object doesn't exist. Bucket: %s, Key: %s",
                    bucketName, request.getKey());
            logger.debug(errorMessage);
            throw new IllegalStateException(errorMessage);
        } else {
            logger.error("Unexpected error communicating with AWS.", ase);
            throw ase;
        }
    } catch (IOException e) {
        String errorMessage = String.format(
                "Unable to read contents of S3 object. Bucket: %s, Key: %s, Expected Encoding: %s", bucketName,
                request.getKey(), Charset.defaultCharset());
        logger.error(errorMessage);
        throw new IllegalStateException(errorMessage, e);
    }
}

From source file:com.glaf.dts.domain.TransformExcecution.java

public boolean isExecutable() {
    if (StringUtils.equalsIgnoreCase(execute, "1") || StringUtils.equalsIgnoreCase(execute, "Y")
            || StringUtils.equalsIgnoreCase(execute, "true")) {
        return true;
    }/*from w w  w. j  av  a2s.  c o m*/
    return false;
}

From source file:com.cognifide.aet.job.common.datafilters.jserrorsfilter.JsErrorsFilter.java

private boolean matchStrings(String paramValue, String errorValue) {
    return StringUtils.isEmpty(paramValue) || StringUtils.equalsIgnoreCase(paramValue, errorValue);
}

From source file:$.UserAction.java

@Action(name = "/{username}/edit", method = HttpMethod.POST)
    public ActionResult updateUser(@ActionParam("username") String username, @ActionParam("user") DefaultUser user,
            @ActionParam("roles") String[] roles, @ActionParam("confirmPassword") String confirmPassword) {
        validateUser(user, confirmPassword);

        if (hasFieldErrors()) {
            ActionResult actionResult = new ActionResult("freemarker", "/view/admin/user/user-form.ftl");

            showRoles(actionResult, username);

            return actionResult;
        }//from   w w w  . j  a v  a  2  s  .  c  o m

        User u = userManager.saveUser(user);
        String redirectUri = "/admin/users/" + u.getUsername() + "/edit?success";

        if (StringUtils.equalsIgnoreCase(username, "-")) {
            redirectUri = "/admin/users?success";
        } else {
            for (Role r : userManager.findRoleByUser(u, null)) {
                userManager.removeRoleFromUser(u, r);
            }
        }

        if (roles != null) {
            for (String r : roles) {
                DefaultRole role = new DefaultRole();
                role.setName(r);

                userManager.addRoleToUser(u, role);
            }
        }

        return new ActionResult("redirect", redirectUri);
    }

From source file:com.mcparland.john.TabsURL.java

/**
 * Select the appropriate tab depending on URL fragment.
 *//*w  w  w . j  av  a2  s.c  om*/
public void selectTab() {
    final String fragment = UI.getCurrent().getPage().getUriFragment();
    if (null == fragment) {
        setSelectedTab(0);
    } else {
        Iterator<Component> compIt = iterator();
        while (compIt.hasNext()) {
            final Component tab = compIt.next();
            final String tabName = tab.getCaption();
            final String tabNameAsURLFragment = convertNameToFragment(tabName);
            // Check tab name against the URL fragment.
            if (null != tabNameAsURLFragment && StringUtils.equalsIgnoreCase(fragment, tabNameAsURLFragment)) {
                setSelectedTab(tab);
                return;
            }
        }
        // Yikes, finished the while loop and no tab selected.
        setSelectedTab(0);
    }
}

From source file:io.github.moosbusch.lumpi.gui.form.editor.binding.spi.AbstractButtonFormEditorBindMapping.java

@Override
public State toState(Object value) {
    if (value != null) {
        if (value instanceof Boolean) {
            if ((Boolean) value) {
                return State.SELECTED;
            } else {
                return State.UNSELECTED;
            }/*w  w  w . j a v  a2 s  . c  om*/
        } else if (value instanceof Number) {
            Number n = (Number) value;
            if (n.intValue() == -1) {
                return State.UNSELECTED;
            } else if (n.intValue() == 0) {
                return State.MIXED;
            } else if (n.intValue() == 1) {
                return State.SELECTED;
            }
        } else if (value instanceof String) {
            if (StringUtils.equalsIgnoreCase(value.toString(), State.UNSELECTED.toString())) {
                return State.UNSELECTED;
            } else if (StringUtils.equalsIgnoreCase(value.toString(), State.SELECTED.toString())) {
                return State.SELECTED;
            } else if (StringUtils.equalsIgnoreCase(value.toString(), State.MIXED.toString())) {
                return State.MIXED;
            }
        }
    }

    return State.UNSELECTED;
}

From source file:com.cognifide.aet.job.common.comparators.layout.LayoutComparator.java

private boolean areInputsIdentical(ArtifactsDAO artifactsDAO, ComparatorProperties properties) {
    String collectedMD5 = artifactsDAO.getArtifactMD5(properties, properties.getCollectedId());
    String patternMD5 = artifactsDAO.getArtifactMD5(properties, properties.getPatternId());
    return StringUtils.equalsIgnoreCase(collectedMD5, patternMD5);
}

From source file:com.adobe.acs.commons.http.headers.impl.MonthlyExpiresHeaderFilter.java

@Override
protected void doActivate(ComponentContext context) throws Exception {
    super.doActivate(context);

    @SuppressWarnings("unchecked")
    Dictionary<String, Object> props = context.getProperties();
    dayOfMonth = PropertiesUtil.toString(props.get(PROP_EXPIRES_DAY_OF_MONTH), null);

    if (StringUtils.isBlank(dayOfMonth)) {
        throw new ConfigurationException(PROP_EXPIRES_DAY_OF_MONTH, "Day of month must be specified.");
    }//w  ww .jav a2 s  . co  m

    if (!StringUtils.equalsIgnoreCase(LAST, dayOfMonth)) {
        // Make sure it's a valid value for Calendar.
        try {
            int intDay = Integer.parseInt(dayOfMonth);
            Calendar test = Calendar.getInstance();
            if (intDay < test.getMinimum(Calendar.DAY_OF_MONTH)) {
                throw new ConfigurationException(PROP_EXPIRES_DAY_OF_MONTH,
                        "Day of month is smaller than minimum allowed value.");
            }
            if (intDay > test.getActualMaximum(Calendar.DAY_OF_MONTH)) {
                throw new ConfigurationException(PROP_EXPIRES_DAY_OF_MONTH,
                        "Day of month is larger than least maximum allowed value.");
            }
        } catch (NumberFormatException ex) {
            throw new ConfigurationException(PROP_EXPIRES_DAY_OF_MONTH, "Day of month is not a valid value.");
        }
    }
}

From source file:com.mirth.connect.server.util.ServerSMTPConnection.java

public void send(String toList, String ccList, String from, String subject, String body, String charset)
        throws EmailException {
    Email email = new SimpleEmail();

    // Set the charset if it was specified. Otherwise use the system's default.
    if (StringUtils.isNotBlank(charset)) {
        email.setCharset(charset);// w w w .j  a  va2  s. c  o  m
    }

    email.setHostName(host);
    email.setSmtpPort(Integer.parseInt(port));
    email.setSocketConnectionTimeout(socketTimeout);
    email.setDebug(true);

    if (useAuthentication) {
        email.setAuthentication(username, password);
    }

    if (StringUtils.equalsIgnoreCase(secure, "TLS")) {
        email.setStartTLSEnabled(true);
    } else if (StringUtils.equalsIgnoreCase(secure, "SSL")) {
        email.setSSLOnConnect(true);
        email.setSslSmtpPort(port);
    }

    // These have to be set after the authenticator, so that a new mail session isn't created
    ConfigurationController configurationController = ControllerFactory.getFactory()
            .createConfigurationController();
    email.getMailSession().getProperties().setProperty("mail.smtp.ssl.protocols", StringUtils.join(
            MirthSSLUtil.getEnabledHttpsProtocols(configurationController.getHttpsClientProtocols()), ' '));
    email.getMailSession().getProperties().setProperty("mail.smtp.ssl.ciphersuites", StringUtils.join(
            MirthSSLUtil.getEnabledHttpsCipherSuites(configurationController.getHttpsCipherSuites()), ' '));

    for (String to : StringUtils.split(toList, ",")) {
        email.addTo(to);
    }

    if (StringUtils.isNotEmpty(ccList)) {
        for (String cc : StringUtils.split(ccList, ",")) {
            email.addCc(cc);
        }
    }

    email.setFrom(from);
    email.setSubject(subject);
    email.setMsg(body);
    email.send();
}