001    /**
002     * Copyright (c) 2000-2012 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(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    }