001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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    }