Package net.sf.ehcache.search

Examples of net.sf.ehcache.search.SearchException


        return new StoreQueryImpl();
    }

    private void checkFrozen() {
        if (frozen) {
            throw new SearchException("Query is frozen and cannot be mutated");
        }
    }
View Full Code Here


        if (attributeValue == null) {
            return false;
        } else {
            AttributeType attrType = AttributeType.typeFor(getAttributeName(), attributeValue);
            if (!getType().equals(attrType)) {
                throw new SearchException("Expecting attribute of type " + getType().name() + " but was " + attrType.name());
            }

            if (getType().equals(AttributeType.STRING)) {
                return ((String) this.value).equalsIgnoreCase((String) attributeValue);
            } else {
View Full Code Here

        AttributeType minType = AttributeType.typeFor(attributeName, min);
        AttributeType maxType = AttributeType.typeFor(attributeName, max);

        if (minType != maxType) {
            throw new SearchException("Different types for min (" + minType + ") and max (" + maxType + ")");
        }

        return minType;
    }
View Full Code Here

            AttributeType at = AttributeType.typeFor(attributeName, value);
            if (rv == null) {
                rv = at;
            } else if (at != rv) {
                throw new SearchException("Multiple types detected in collection: " + at + " and " + rv);
            }
        }
        return rv;
    }
View Full Code Here

        if (attrValue == null) {
            return false;
        } else {
            AttributeType attrType = AttributeType.typeFor(getAttributeName(), attrValue);
            if (!type.equals(attrType)) {
                throw new SearchException("Expecting attribute of type " + type.name() + " but was " + attrType.name());
            }
            if (AttributeType.STRING.equals(type)) {
                for (Object o : values) {
                    if (attrValue.toString().equalsIgnoreCase(o.toString())) {
                        return true;
View Full Code Here

    public ComparableValue(String attributeName, AttributeType type) {
        this.attributeName = attributeName;
        this.type = type;

        if (!this.type.isComparable()) {
            throw new SearchException("Illegal (non-comparable) type for comparsion (" + type + ")");
        }
    }
View Full Code Here

        if (attrValue == null) {
            return false;
        } else {
            AttributeType attrType = AttributeType.typeFor(getAttributeName(), attrValue);
            if (!getType().equals(attrType)) {
                throw new SearchException("Expecting attribute of type " + getType().name() + " but was " + attrType.name());
            }

            if (getType().equals(AttributeType.STRING)) {
                return executeComparableString((Comparable) attrValue);
            } else {
View Full Code Here

     * @param attributeName attribute name
     * @param regex expression
     */
    public ILike(String attributeName, String regex) {
        if ((attributeName == null) || (regex == null)) {
            throw new SearchException("Both the attribute name and regex must be non null.");
        }

        this.attributeName = attributeName;
        this.regex = regex;
        this.pattern = convertRegex(regex.trim());
View Full Code Here

        return regex;
    }

    private static Pattern convertRegex(final String expr) {
        if (expr.length() == 0) {
            throw new SearchException("Zero length regex");
        }

        StringBuilder javaRegex = new StringBuilder("^");

        boolean escape = false;
        for (int i = 0; i < expr.length(); i++) {
            char ch = expr.charAt(i);

            if (escape) {
                switch (ch) {
                    case '\\':
                    case '?':
                    case '*': {
                        javaRegex.append(Pattern.quote(lowerCase(ch)));
                        break;
                    }

                    default: {
                        throw new SearchException("Illegal escape character (" + ch + ") in regex: " + expr);
                    }
                }

                escape = false;
            } else {
View Full Code Here

    Results executeQuery(StoreQuery query) throws SearchException {

        if (!query.requestsKeys() && !query.requestsValues() && query.requestedAttributes().isEmpty() && query.getAggregatorInstances().isEmpty()) {
            String msg = "No results specified. " +
            "Please specify one or more of includeKeys(), includeValues(), includeAggregator() or includeAttribute()";
            throw new SearchException(msg);
        }

        if (isStatisticsEnabled()) {
            long start = System.currentTimeMillis();
            Results results = this.compoundStore.executeQuery(query);
View Full Code Here

TOP

Related Classes of net.sf.ehcache.search.SearchException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.