Example usage for java.lang String equalsIgnoreCase

List of usage examples for java.lang String equalsIgnoreCase

Introduction

In this page you can find the example usage for java.lang String equalsIgnoreCase.

Prototype

public boolean equalsIgnoreCase(String anotherString) 

Source Link

Document

Compares this String to another String , ignoring case considerations.

Usage

From source file:com.galenframework.browser.SeleniumBrowserFactory.java

public static DesiredCapabilities getBrowserCapabilities(String driverParameter) {
    DesiredCapabilities capabilities = null;
    if (driverParameter.equalsIgnoreCase(FIREFOX)) {
        capabilities = DesiredCapabilities.firefox();
    }/*ww  w  .j av  a2 s.c  o  m*/
    if (driverParameter.equalsIgnoreCase(IE)) {
        capabilities = DesiredCapabilities.internetExplorer();
        capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
                true);
        capabilities.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
    }
    if (driverParameter.equalsIgnoreCase(CHROME)) {
        // chrome runs much faster
        capabilities = DesiredCapabilities.chrome();
    }
    return capabilities;
}

From source file:com.liferay.arquillian.maven.importer.LiferayPluginTestCase.java

protected static void setupPortalMinimal() {
    System.setProperty("liferay.version", LIFERAY_VERSION);

    System.setProperty("liferay.auto.deploy.dir", PORTAL_AUTO_DEPLOY_DIR);

    System.setProperty("liferay.app.server.deploy.dir", PORTAL_SERVER_DEPLOY_DIR);

    System.setProperty("liferay.app.server.lib.global.dir", PORTAL_SERVER_LIB_GLOBAL_DIR);

    System.setProperty("liferay.app.server.portal.dir", SERVER_PORTAL_DIR);

    try {/*from www .ja  v a  2 s .  co m*/
        ArchiverManager archiverManager = plexusContainer.lookup(ArchiverManager.class);

        assertNotNull(archiverManager);

        FileUtils.forceMkdir(new File(PORTAL_AUTO_DEPLOY_DIR));
        FileUtils.forceMkdir(new File(PORTAL_SERVER_DEPLOY_DIR));
        FileUtils.forceMkdir(new File(PORTAL_SERVER_LIB_GLOBAL_DIR));
        FileUtils.forceMkdir(new File(SERVER_PORTAL_DIR));

        final MavenResolverSystem mavenResolverSystem = Maven.configureResolver()
                .fromClassloaderResource("settings.xml");

        File[] dependencies = mavenResolverSystem.loadPomFromClassLoaderResource("liferay-setup.xml")
                .importRuntimeAndTestDependencies().resolve().withoutTransitivity().asFile();

        File warFile = null;

        for (File file : dependencies) {
            String fileName = file.getName();
            String fileExtension = FilenameUtils.getExtension(fileName);

            if (fileExtension.equalsIgnoreCase("jar")) {
                FileUtils.copyFile(file, new File(PORTAL_SERVER_LIB_GLOBAL_DIR, file.getName()));
            } else if (fileExtension.equalsIgnoreCase("war") && fileName.contains("portal-web")) {

                warFile = file;
            }
        }

        assertNotNull(warFile);

        // extract portal war

        UnArchiver unArchiver = archiverManager.getUnArchiver(warFile);
        unArchiver.setDestDirectory(new File(SERVER_PORTAL_DIR));
        unArchiver.setSourceFile(warFile);
        unArchiver.setOverwrite(false);
        unArchiver.extract();
        setup = true;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:at.pcgamingfreaks.StringUtils.java

public static boolean arrayContainsIgnoreCase(@NotNull String[] strings, @Nullable String searchFor) {
    Validate.notNull(strings);//from   www  .  j  a va 2  s  .  co  m
    for (String s : strings) {
        //noinspection ConstantConditions
        if ((s != null && s.equalsIgnoreCase(searchFor)) || (s == null && searchFor == null)) {
            return true;
        }
    }
    return false;
}

From source file:com.thoughtworks.go.i18n.LocalizedMessage.java

public static String userOperationSuccessful(String operation, int count) {
    if (operation.equalsIgnoreCase("ENABLE")) {
        return "Enabled " + count + " user(s) successfully.";
    }//from  ww  w.j  a  v a2  s  .c  o  m
    if (operation.equalsIgnoreCase("DISABLE")) {
        return "Disabled " + count + " user(s) successfully.";
    }

    if (operation.equalsIgnoreCase("APPLY_ROLES")) {
        return "Role(s)/Admin-Privilege modified for " + count + " user(s) successfully.";
    }

    if (operation.equalsIgnoreCase("ADD_ROLE")) {
        return "New role assigned to " + count + " user(s) successfully.";
    }

    throw new IllegalArgumentException("Unknown operation " + operation);
}

From source file:com.ultrapower.eoms.common.plugin.ecside.view.html.BuilderUtils.java

public static boolean showPagination(TableModel model) {
   String showToolBar=model.getTable().getToolbarLocation();
    return showToolBar!=null&&showToolBar.length()>0
    &&!showToolBar.equalsIgnoreCase("none")&&!showToolBar.equalsIgnoreCase("null")&&!showToolBar.equalsIgnoreCase("false");
}

From source file:Main.java

public static boolean isMyServiceRunning(Context context, String serviceClassName) {
    ActivityManager manager = (ActivityManager) context.getSystemService(Activity.ACTIVITY_SERVICE);
    for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
        if (serviceClassName.equalsIgnoreCase(service.service.getClassName())) {
            return true;
        }/*from   w w  w  .  j a  v a2  s.  c  o  m*/
    }
    return false;
}

From source file:net.maritimecloud.endorsement.utils.AccessControlUtil.java

public static boolean hasPermission(String permission) {
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    if (auth instanceof KeycloakAuthenticationToken) {
        logger.debug("OIDC permission lookup");
        // Keycloak authentication
        KeycloakAuthenticationToken kat = (KeycloakAuthenticationToken) auth;
        KeycloakSecurityContext ksc = (KeycloakSecurityContext) kat.getCredentials();
        Map<String, Object> otherClaims = ksc.getToken().getOtherClaims();
        if (otherClaims.containsKey(AccessControlUtil.PERMISSIONS_PROPERTY_NAME)) {
            String usersPermissions = (String) otherClaims.get(AccessControlUtil.PERMISSIONS_PROPERTY_NAME);
            String[] permissionList = usersPermissions.split(",");
            for (String per : permissionList) {
                if (per.equalsIgnoreCase(permission)) {
                    return true;
                }/*w w  w .j a va  2 s  .  c o  m*/
            }
        }
        /*} else if (auth instanceof PreAuthenticatedAuthenticationToken) {
            logger.debug("Certificate permission lookup");
            // Certificate authentication
            PreAuthenticatedAuthenticationToken token = (PreAuthenticatedAuthenticationToken) auth;
            // Check that the permission is granted to this user
            InetOrgPerson person = ((InetOrgPerson) token.getPrincipal());
            Collection<GrantedAuthority> authorities = person.getAuthorities();
            for (GrantedAuthority authority : authorities) {
        String usersPermissions = authority.getAuthority();
        String[] permissionList = usersPermissions.split(",");
        for (String per : permissionList) {
            if (per.equalsIgnoreCase(permission)) {
                return true;
            }
        }
            }*/
    } else {
        if (auth != null) {
            logger.debug("Unknown authentication method: " + auth.getClass());
        }
    }
    return false;
}

From source file:com.netflix.genie.common.dto.ClusterStatus.java

/**
 * Parse cluster status.//www  .j a va  2 s .co m
 *
 * @param value string to parse/convert into cluster status
 * @return UP, OUT_OF_SERVICE, TERMINATED if match
 * @throws GeniePreconditionException on invalid value
 */
public static ClusterStatus parse(final String value) throws GeniePreconditionException {
    if (StringUtils.isNotBlank(value)) {
        for (final ClusterStatus status : ClusterStatus.values()) {
            if (value.equalsIgnoreCase(status.toString())) {
                return status;
            }
        }
    }
    throw new GeniePreconditionException(
            "Unacceptable cluster status. Must be one of {UP, OUT_OF_SERVICE, TERMINATED}");
}

From source file:com.netflix.genie.common.dto.CommandStatus.java

/**
 * Parse command status./*from   www  . j a  va 2s. c o  m*/
 *
 * @param value string to parse/convert into command status
 * @return ACTIVE, DEPRECATED, INACTIVE if match
 * @throws GeniePreconditionException on invalid value
 */
public static CommandStatus parse(final String value) throws GeniePreconditionException {
    if (StringUtils.isNotBlank(value)) {
        for (final CommandStatus status : CommandStatus.values()) {
            if (value.equalsIgnoreCase(status.toString())) {
                return status;
            }
        }
    }
    throw new GeniePreconditionException(
            "Unacceptable command status. Must be one of {ACTIVE, DEPRECATED, INACTIVE}");
}

From source file:com.netflix.genie.common.model.JobStatus.java

/**
 * Parse job status./*from  www . j  a v a2  s . c o  m*/
 *
 * @param value string to parse/convert
 * @return INIT, RUNNING, SUCCEEDED, KILLED, FAILED if match
 * @throws GeniePreconditionException if invalid value passed in
 */
public static JobStatus parse(final String value) throws GeniePreconditionException {
    if (StringUtils.isNotBlank(value)) {
        for (final JobStatus status : JobStatus.values()) {
            if (value.equalsIgnoreCase(status.toString())) {
                return status;
            }
        }
    }
    throw new GeniePreconditionException(
            "Unacceptable job status. Must be one of {Init, Running, Succeeded, Killed, Failed}");
}