001    /**
002     * Copyright (c) 2000-2012 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(name, value, ComparisonOperator.EQUALS);
032            }
033    
034            public Condition gt(String name, Object value) {
035                    return new FieldConditionImpl(
036                            name, value, ComparisonOperator.GREATER_THAN);
037            }
038    
039            public Condition gte(String name, Object value) {
040                    return new FieldConditionImpl(
041                            name, value, ComparisonOperator.GREATER_THAN_OR_EQUAL_TO);
042            }
043    
044            public Condition in(String name, Object value) {
045                    return new FieldConditionImpl(name, value, ComparisonOperator.IN);
046            }
047    
048            public Condition like(String name, Object value) {
049                    return new FieldConditionImpl(name, value, ComparisonOperator.LIKE);
050            }
051    
052            public Condition lt(String name, Object value) {
053                    return new FieldConditionImpl(
054                            name, value, ComparisonOperator.LESS_THAN);
055            }
056    
057            public Condition lte(String name, Object value) {
058                    return new FieldConditionImpl(
059                            name, value, ComparisonOperator.LESS_THAN_OR_EQUAL_TO);
060            }
061    
062            public Condition ne(String name, Object value) {
063                    return new FieldConditionImpl(
064                            name, value, ComparisonOperator.NOT_EQUALS);
065            }
066    
067            public Condition notIn(String name, Object value) {
068                    return new FieldConditionImpl(name, value, ComparisonOperator.NOT_IN);
069            }
070    
071    }