Java Code Examples for org.apache.commons.lang3.StringUtils.containsIgnoreCase()

The following are Jave code examples for showing how to use containsIgnoreCase() of the org.apache.commons.lang3.StringUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Saiy-PS   File: Speaker.java   View Source Code Vote up 7 votes
/**
 * Get the {@link Status} from the string equivalent
 *
 * @param status the string status
 * @return the equivalent {@link Status}
 */
public static Status getStatus(@Nullable final String status) {

    if (UtilsString.notNaked(status)) {

        if (StringUtils.containsIgnoreCase(NOTSTARTED.name(), status)) {
            return NOTSTARTED;
        } else if (StringUtils.containsIgnoreCase(RUNNING.name(), status)) {
            return RUNNING;
        } else if (StringUtils.containsIgnoreCase(FAILED.name(), status)) {
            return FAILED;
        } else if (StringUtils.containsIgnoreCase(SUCCEEDED.name(), status)) {
            return SUCCEEDED;
        }
    }

    return UNDEFINED;
}
 
Example 2
Project: Open_Source_ECOA_Toolset_AS5   File: TypesUtil.java   View Source Code Vote up 7 votes
public Library buildLibraryFromRecordType(Record rec) {
	Library ret = new Library();
	DataTypes types = new DataTypes();
	ret.setTypes(types);
	List<Field> fields = new ArrayList<Field>();
	fields.addAll(rec.getField());
	rec.getField().clear();
	for (Field field : fields) {
		if (StringUtils.containsIgnoreCase(field.getType(), ":")) {
			String[] vals = StringUtils.split(field.getType(), ":");
			field.setType(field.getType());
			Use use = new Use();
			use.setLibrary(LibraryUtil.getLibraryUseNameFromName(vals[0]));
			if (!existing(use, ret))
				ret.getUse().add(use);
		}
		rec.getField().add(field);
	}
	ret.getTypes().getSimpleOrRecordOrConstant().add(rec);
	return ret;
}
 
Example 3
Project: obevo   File: AseToH2SqlTranslator.java   View Source Code Vote up 6 votes
@Override
public String handleAnySqlPostTranslation(String string, Change change) {
    /*
     To make "ALTER TABLE some_Table ALTER COLUMN abcCol NOT NULL"  into
             "ALTER TABLE some_Table ALTER COLUMN abcCol SET NOT NULL"
     */
    //if this is "ALTER TABLE XYZ ALTER COLUMN ABC" statement
    Matcher alterTableAlterColumnMatcher = Pattern.compile("(?i)(alter\\s+table\\s+\\w+\\s+alter\\s+column\\s+\\w+\\s+)(.+)").matcher(string);
    if (alterTableAlterColumnMatcher.find()){

        //if this is ALTER TABLE ALTER COLUMN NULL/NOT NULL in Sybase dialect (without "SET" keyword)
        if( ! StringUtils.containsIgnoreCase(alterTableAlterColumnMatcher.group(2), "set") &&
                StringUtils.containsIgnoreCase(alterTableAlterColumnMatcher.group(2), "null") ){

            Matcher nullOrNotNull = Pattern.compile("(?i)(NOT\\s+NULL|NULL)(.*)").matcher(alterTableAlterColumnMatcher.group(2));
            if(nullOrNotNull.matches()){
                string = alterTableAlterColumnMatcher.group(1) + "SET " + nullOrNotNull.group(1) + nullOrNotNull.group(2);
            }
        }
    }
    return string;
}
 
Example 4
Project: SimpleRssReader   File: CurrentFeed.java   View Source Code Vote up 6 votes
public static SearchResultsCursor getSearchResults(final String query) {
    final List<Integer> positions = new ArrayList<>();
    final List<LinkedHashMap<Integer, Integer>> indicesTitle = new ArrayList<>();

    int i = 1;

    for (final SyndEntry entry : sCurrentFeed.getEntries()) {
        final String title = entry.getTitle();

        if (StringUtils.containsIgnoreCase(title, query)) {
            indicesTitle.add(SearchUtils.getIndicesForQuery(title, query));
            positions.add(i);
        }
        i++;
    }

    return new SearchResultsCursor(positions, indicesTitle);
}
 
Example 5
Project: Open_Source_ECOA_Toolset_AS5   File: ServicesUtil.java   View Source Code Vote up 6 votes
public ServiceDefinition buildFromEvent(Event data) {
	ServiceDefinition ret = new ServiceDefinition();
	ret.setOperations(new Operations());
	ArrayList<Parameter> param = new ArrayList<Parameter>();
	ArrayList<Use> uses = new ArrayList<Use>();
	for (Parameter para : data.getInput()) {
		if (StringUtils.containsIgnoreCase(para.getType(), ":")) {
			String[] vals = StringUtils.split(para.getType(), ":");
			Use use = new Use();
			use.setLibrary(LibraryUtil.getLibraryUseNameFromName(vals[0]));
			if (!existing(use, uses))
				uses.add(use);
			para.setType(para.getType());
		}
		param.add(para);
	}
	data.getInput().clear();
	data.getInput().addAll(param);
	ret.getUse().clear();
	ret.getUse().addAll(uses);
	ret.getOperations().getDataOrEventOrRequestresponse().add(data);
	return ret;
}
 
Example 6
Project: Open_Source_ECOA_Toolset_AS5   File: TypesUtil.java   View Source Code Vote up 6 votes
public Library buildLibraryFromArrayType(Array arr) {
	Library ret = new Library();
	DataTypes types = new DataTypes();
	ret.setTypes(types);
	if (StringUtils.containsIgnoreCase(arr.getItemType(), ":")) {
		String[] vals = StringUtils.split(arr.getItemType(), ":");
		arr.setItemType(arr.getItemType());
		Use use = new Use();
		use.setLibrary(LibraryUtil.getLibraryUseNameFromName(vals[0]));
		if (!existing(use, ret))
			ret.getUse().add(use);
	}
	ret.getTypes().getSimpleOrRecordOrConstant().add(arr);
	return ret;
}
 
Example 7
Project: obevo   File: MsSqlToH2SqlTranslator.java   View Source Code Vote up 6 votes
@Override
public String handleAnySqlPostTranslation(String string, Change change) {
    /*
     To make "ALTER TABLE some_Table ALTER COLUMN abcCol NOT NULL"  into
             "ALTER TABLE some_Table ALTER COLUMN abcCol SET NOT NULL"
     */
    //if this is "ALTER TABLE XYZ ALTER COLUMN ABC" statement
    Matcher alterTableAlterColumnMatcher = Pattern.compile("(?i)(alter\\s+table\\s+\\w+\\s+alter\\s+column\\s+\\w+\\s+)(.+)").matcher(string);
    if (alterTableAlterColumnMatcher.find()) {

        //if this is ALTER TABLE ALTER COLUMN NULL/NOT NULL in Sybase dialect (without "SET" keyword)
        if (!StringUtils.containsIgnoreCase(alterTableAlterColumnMatcher.group(2), "set") &&
                StringUtils.containsIgnoreCase(alterTableAlterColumnMatcher.group(2), "null")) {

            Matcher nullOrNotNull = Pattern.compile("(?i)(NOT\\s+NULL|NULL)(.*)").matcher(alterTableAlterColumnMatcher.group(2));
            if (nullOrNotNull.matches()) {
                string = alterTableAlterColumnMatcher.group(1) + "SET " + nullOrNotNull.group(1) + nullOrNotNull.group(2);
            }
        }
    }
    return string;
}
 
Example 8
Project: redirector   File: Request.java   View Source Code Vote up 5 votes
public boolean isUrlMatchingEntity(String entity) {
    boolean isLast = StringUtils.endsWithIgnoreCase(url, RedirectorConstants.DELIMETER + entity);
    boolean isInTheMiddle = StringUtils.containsIgnoreCase(url, RedirectorConstants.DELIMETER + entity + RedirectorConstants.DELIMETER);
    boolean isLastBeforeQueryParam = StringUtils.containsIgnoreCase(url, RedirectorConstants.DELIMETER + entity + QUERY_PARAM_START);

    return  isLast || isInTheMiddle || isLastBeforeQueryParam;
}
 
Example 9
Project: AEM   File: ImageUtils.java   View Source Code Vote up 5 votes
public static boolean isImage(Resource resource) {
    if (null != resource) {
        Asset asset = DamUtil.resolveToAsset(resource);
        if (null != asset) {
            String mimeType = asset.getMimeType();
            return StringUtils.containsIgnoreCase(mimeType, IMAGE);
        }
    }
    return false;
}
 
Example 10
Project: weixin_api   File: HttpUtil.java   View Source Code Vote up 5 votes
/**
 * 检查响应结果是否为文本内容
 * 
 * @param response
 * @return
 */
private static boolean isResponseText(CloseableHttpResponse response, Header responseEntityContentType) {
	String contentType = responseEntityContentType.getValue();
	if (StringUtils.containsIgnoreCase(contentType, "text")
			|| StringUtils.containsIgnoreCase(contentType, "json")) {
		return true;
	}
	return false;
}
 
Example 11
Project: NoraUi   File: NameUtilities.java   View Source Code Vote up 5 votes
public static boolean comparingNames(String name, String otherName) {
    for (String word : getNormalizeName(name).split(" ")) {
        if (!StringUtils.containsIgnoreCase(getNormalizeName(otherName).trim(), word)) {
            return false;
        }
    }
    return true;
}
 
Example 12
Project: para-search-elasticsearch   File: ProxyResourceHandler.java   View Source Code Vote up 5 votes
private Object getTransformedResponse(String appid, InputStream content, ContainerRequestContext ctx) {
	if (ctx.getUriInfo().getQueryParameters().containsKey("getRawResponse") ||
			StringUtils.containsIgnoreCase(getPath(ctx), "getRawResponse=")) {
		return content;
	} else {
		try {
			JsonNode tree = ParaObjectUtils.getJsonMapper().readTree(content);
			JsonNode hits = tree.at("/hits/hits");
			if (hits.isMissingNode()) {
				return tree;
			} else {
				List<String> keys = new LinkedList<String>();
				long count = tree.at("/hits/total").asLong();
				for (JsonNode hit : hits) {
					String id = hit.get("_id").asText();
					keys.add(id);
				}
				DAO dao = CoreUtils.getInstance().getDao();
				Map<String, ParaObject> fromDB = dao.readAll(appid, keys, true);
				Map<String, Object> result = new HashMap<>();
				result.put("items", fromDB);
				result.put("totalHits", count);
				return result;
			}
		} catch (IOException ex) {
			logger.error(null, ex);
		}
		return Collections.emptyMap();
	}
}
 
Example 13
Project: Open_Source_ECOA_Toolset_AS5   File: ServicesUtil.java   View Source Code Vote up 5 votes
public ServiceDefinition buildFromData(Data data) {
	ServiceDefinition ret = new ServiceDefinition();
	ret.setOperations(new Operations());
	if (StringUtils.containsIgnoreCase(data.getType(), ":")) {
		String[] vals = StringUtils.split(data.getType(), ":");
		Use use = new Use();
		use.setLibrary(LibraryUtil.getLibraryUseNameFromName(vals[0]));
		ret.getUse().add(use);
		data.setType(data.getType());
	}
	ret.getOperations().getDataOrEventOrRequestresponse().add(data);
	return ret;
}
 
Example 14
Project: Open_Source_ECOA_Toolset_AS5   File: TypesUtil.java   View Source Code Vote up 5 votes
public Library buildLibraryFromSimpleType(Simple simple) {
	Library ret = new Library();
	DataTypes types = new DataTypes();
	ret.setTypes(types);
	if (StringUtils.containsIgnoreCase(simple.getType(), ":")) {
		String[] vals = StringUtils.split(simple.getType(), ":");
		simple.setType(simple.getType());
		Use use = new Use();
		use.setLibrary(LibraryUtil.getLibraryUseNameFromName(vals[0]));
		if (!existing(use, ret))
			ret.getUse().add(use);
	}
	ret.getTypes().getSimpleOrRecordOrConstant().add(simple);
	return ret;
}
 
Example 15
Project: koryphe   File: StringContains.java   View Source Code Vote up 5 votes
@Override
public boolean test(final String input) {
    if (null == input || null == value) {
        return false;
    }
    if (ignoreCase) {
        return StringUtils.containsIgnoreCase(input, value);
    }
    return input.contains(value);
}
 
Example 16
Project: Biliomi   File: XmlElementPathBeanPredicate.java   View Source Code Vote up 5 votes
/**
 * Match numeric values (ignores case)
 */
private static boolean testNumber(Number a, Number b, RestFilterOperator operator) {
  switch (operator) {
    case EQUALS:
      return a.doubleValue() == b.doubleValue();
    case CONTAINS:
      return StringUtils.containsIgnoreCase(String.valueOf(a), String.valueOf(b));
    case LESSER_THAN:
      return a.doubleValue() < b.doubleValue();
    case GREATER_THAN:
      return a.doubleValue() > b.doubleValue();
    default:
      return false;
  }
}
 
Example 17
Project: saluki   File: ConsulRegistryService.java   View Source Code Vote up 5 votes
private Set<String> buildQueryCondition(String search, String dimension, Boolean accurate) {
    Set<String> beAboutToQuery = Sets.newHashSet();
    Map<String, Pair<Set<GrpcHost>, Set<GrpcHost>>> servicesPassing = registryRepository.getAllPassingService();
    for (Map.Entry<String, Pair<Set<GrpcHost>, Set<GrpcHost>>> entry : servicesPassing.entrySet()) {
        String serviceKey = entry.getKey();
        Triple<String, String, String> appNameServiceVersion = getAppNameServiceVersion(serviceKey);
        String appName = appNameServiceVersion.getLeft();
        String serviceName = appNameServiceVersion.getMiddle();
        if (dimension.equals("service")) {
            if (accurate) {
                if (StringUtils.equalsIgnoreCase(serviceName, search)) {
                    beAboutToQuery.add(serviceKey);
                }
            } else {
                if (StringUtils.containsIgnoreCase(serviceName, search)) {
                    beAboutToQuery.add(serviceKey);
                }
            }
        } else {
            if (accurate) {
                if (StringUtils.equalsIgnoreCase(appName, search)) {
                    beAboutToQuery.add(serviceKey);
                }
            } else {
                if (StringUtils.containsIgnoreCase(appName, search)) {
                    beAboutToQuery.add(serviceKey);
                }
            }
        }
    }
    return beAboutToQuery;
}
 
Example 18
Project: Biliomi   File: XmlElementPathBeanPredicate.java   View Source Code Vote up 5 votes
/**
 * Match String values (ignores case)
 */
private static boolean testString(String a, String b, RestFilterOperator operator) {
  switch (operator) {
    case EQUALS:
      return a.equalsIgnoreCase(b);
    case CONTAINS:
      return StringUtils.containsIgnoreCase(a, b);
    case LESSER_THAN:
      return a.length() < b.length();
    case GREATER_THAN:
      return a.length() > b.length();
    default:
      return false;
  }
}
 
Example 19
Project: scoold   File: Profile.java   View Source Code Vote up 4 votes
public boolean hasBadge(Badge b) {
	return StringUtils.containsIgnoreCase(badges, ",".concat(b.toString()).concat(","));
}
 
Example 20
Project: poppynotes   File: InCommingNoteEncryptingFilter.java   View Source Code Vote up 4 votes
boolean isNotesPath(StringBuffer url) {
	return StringUtils.containsIgnoreCase(url.toString(), NOTES_PATH);
}