001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.dynamicdatamapping.storage.query;
016    
017    /**
018     * @author Marcellus Tavares
019     */
020    public class ConditionFactoryImpl implements ConditionFactory {
021    
022            public Junction conjunction() {
023                    return new JunctionImpl(LogicalOperator.AND);
024            }
025    
026            public Junction disjunction() {
027                    return new JunctionImpl(LogicalOperator.OR);
028            }
029    
030            public Condition eq(String name, Object value) {
031                    return new FieldConditionImpl(
032                            name, value, ComparisonOperator.EQUALS);
033            }
034    
035            public Condition gt(String name, Object value) {
036                    return new FieldConditionImpl(
037                            name, value, ComparisonOperator.GREATER_THAN);
038            }
039    
040            public Condition gte(String name, Object value) {
041                    return new FieldConditionImpl(
042                            name, value, ComparisonOperator.GREATER_THAN_OR_EQUAL_TO);
043            }
044    
045            public Condition in(String name, Object value) {
046                    return new FieldConditionImpl(
047                            name, value, ComparisonOperator.IN);
048            }
049    
050            public Condition like(String name, Object value) {
051                    return new FieldConditionImpl(
052                            name, value, ComparisonOperator.LIKE);
053            }
054    
055            public Condition lt(String name, Object value) {
056                    return new FieldConditionImpl(
057                            name, value, ComparisonOperator.LESS_THAN);
058            }
059    
060            public Condition lte(String name, Object value) {
061                    return new FieldConditionImpl(
062                            name, value, ComparisonOperator.LESS_THAN_OR_EQUAL_TO);
063            }
064    
065            public Condition ne(String name, Object value) {
066                    return new FieldConditionImpl(
067                            name, value, ComparisonOperator.NOT_EQUALS);
068            }
069    
070            public Condition notIn(String name, Object value) {
071                    return new FieldConditionImpl(
072                            name, value, ComparisonOperator.NOT_IN);
073            }
074    
075    }