Package org.apache.cxf.jaxrs.ext.search

Examples of org.apache.cxf.jaxrs.ext.search.PrimitiveStatement


        StringBuilder sb = getStringBuilder();
        if (sb == null) {
            sb = new StringBuilder();
        }
       
        PrimitiveStatement statement = sc.getStatement();
        if (statement != null) {
            if (statement.getProperty() != null) {
                String rvalStr = statement.getValue().toString();
                String name = getRealPropertyName(statement.getProperty());
              
                sb.append("(");
                if (sc.getConditionType() == ConditionType.NOT_EQUALS) {
                    sb.append("!");
                }
View Full Code Here


    }
   
    public void visit(SearchCondition<T> sc) {
        StringBuilder sb = getStringBuilder();
       
        PrimitiveStatement statement = sc.getStatement();
        if (statement != null) {
            if (statement.getProperty() != null) {
                String rvalStr = statement.getValue().toString().replaceAll("\\*", "%");
                String name = getRealPropertyName(statement.getProperty());
              
                if (tableAlias != null) {
                    name = tableAlias + "." + name;
                }
               
View Full Code Here

            if (table != null) {
                SearchUtils.startSqlQuery(sb, table, columns);
            }
        }
       
        PrimitiveStatement statement = sc.getStatement();
        if (statement != null) {
            if (statement.getProperty() != null) {
                String rvalStr = statement.getValue().toString().replaceAll("\\*", "%");
                String name = statement.getProperty();
                if (fieldMap != null) {
                    if (fieldMap.containsKey(name)) {
                        name = fieldMap.get(name);
                    } else {
                        LOG.warning("Unrecognized field alias : " + name);
View Full Code Here

        super(fieldMap);
    }
   
    public void visit(SearchCondition<T> sc) {
       
        PrimitiveStatement statement = sc.getStatement();
        if (statement != null) {
            if (statement.getProperty() != null) {
                String rvalStr = statement.getValue().toString();
                String name = getRealPropertyName(statement.getProperty());
              
                sb.append("(");
                if (sc.getConditionType() == ConditionType.NOT_EQUALS) {
                    sb.append("!");
                }
View Full Code Here

            builder = em.getCriteriaBuilder();
            cq = builder.createQuery(queryClass);
            root = cq.from(tClass);
            predStack.push(new ArrayList<Predicate>());
        }
        PrimitiveStatement statement = sc.getStatement();
        if (statement != null) {
            if (statement.getProperty() != null) {
                predStack.peek().add(buildPredicate(sc.getConditionType(),
                                                    statement.getProperty(),
                                                    statement.getValue(),
                                                    statement.getValueType()));
            }
        } else {
            predStack.push(new ArrayList<Predicate>());
            for (SearchCondition<T> condition : sc.getSearchConditions()) {
                condition.accept(this);
View Full Code Here

            if (table != null) {
                SearchUtils.startSqlQuery(sb, table, tableAlias, columns);
            }
        }
       
        PrimitiveStatement statement = sc.getStatement();
        if (statement != null) {
            if (statement.getProperty() != null) {
                String rvalStr = statement.getValue().toString().replaceAll("\\*", "%");
                String name = getRealPropertyName(statement.getProperty());
              
                if (tableAlias != null) {
                    name = tableAlias + "." + name;
                }
               
View Full Code Here

        SearchCondition<Condition> filter = parser.parse("name==ami*;level=gt=10");
        assertEquals(ConditionType.AND, filter.getConditionType());

        List<SearchCondition<Condition>> conditions = filter.getSearchConditions();
        assertEquals(2, conditions.size());
        PrimitiveStatement st1 = conditions.get(0).getStatement();
        PrimitiveStatement st2 = conditions.get(1).getStatement();
        assertTrue((ConditionType.EQUALS.equals(st1.getCondition())
            && ConditionType.GREATER_THAN.equals(st2.getCondition()))
            || (ConditionType.EQUALS.equals(st2.getCondition())
                && ConditionType.GREATER_THAN.equals(st1.getCondition())));

        assertTrue(filter.isMet(new Condition("amichalec", 12, new Date())));
        assertTrue(filter.isMet(new Condition("ami", 12, new Date())));
        assertFalse(filter.isMet(new Condition("ami", 8, null)));
View Full Code Here

        assertEquals(ConditionType.OR, filter.getConditionType());

        List<SearchCondition<Condition>> conditions = filter.getSearchConditions();
        assertEquals(2, conditions.size());

        PrimitiveStatement st1 = conditions.get(0).getStatement();
        PrimitiveStatement st2 = conditions.get(1).getStatement();
        assertTrue((ConditionType.EQUALS.equals(st1.getCondition())
            && ConditionType.GREATER_THAN.equals(st2.getCondition()))
            || (ConditionType.EQUALS.equals(st2.getCondition())
                && ConditionType.GREATER_THAN.equals(st1.getCondition())));

        assertTrue(filter.isMet(new Condition("ami", 0, new Date())));
        assertTrue(filter.isMet(new Condition("foo", 20, null)));
        assertFalse(filter.isMet(new Condition("foo", 0, null)));
View Full Code Here

    }
   
    public void visit(SearchCondition<T> sc) {
        StringBuilder sb = getStringBuilder();
       
        PrimitiveStatement statement = sc.getStatement();
        if (statement != null) {
            if (statement.getProperty() != null) {
                String name = getRealPropertyName(statement.getProperty());
                String value = getPropertyValue(name, statement.getValue());
                validatePropertyValue(name, value);
               
                value = SearchUtils.toSqlWildcardString(value, isWildcardStringMatch());
                value = SearchUtils.duplicateSingleQuoteIfNeeded(value);
               
View Full Code Here

    public void setContentsFieldMap(Map<String, String> map) {
        this.contentsFieldMap = map;
    }
   
    public void visit(SearchCondition<T> sc) {
        PrimitiveStatement statement = sc.getStatement();
        if (statement != null) {
            if (statement.getProperty() != null) {
                queryStack.peek().add(buildSimpleQuery(sc.getConditionType(),
                                         statement.getProperty(),
                                         statement.getValue()));
            }
        } else {
            queryStack.push(new ArrayList<Query>());
            for (SearchCondition<T> condition : sc.getSearchConditions()) {
                condition.accept(this);
View Full Code Here

TOP

Related Classes of org.apache.cxf.jaxrs.ext.search.PrimitiveStatement

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.