| 1 | /** |
| 2 | * Copyright (C) 2008 NetMind Consulting Bt. |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Lesser General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 3 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Lesser General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Lesser General Public |
| 15 | * License along with this library; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | */ |
| 18 | |
| 19 | package hu.netmind.beankeeper.parser; |
| 20 | |
| 21 | import java.util.List; |
| 22 | import java.util.ArrayList; |
| 23 | |
| 24 | /** |
| 25 | * This term represents a table entry which is exactly specified |
| 26 | * with all parameters needed to be included into an sql statement. |
| 27 | * @author Brautigam Robert |
| 28 | * @version Revision: $Revision$ |
| 29 | */ |
| 30 | public class SpecifiedTableTerm extends TableTerm |
| 31 | { |
| 32 | private List relatedLeftTerms; // To related classes (super-, or sub-classes) |
| 33 | private List referencedLeftTerms; // To referenced classes (x.y) |
| 34 | |
| 35 | public SpecifiedTableTerm(SpecifiedTableTerm source) |
| 36 | { |
| 37 | super(source); |
| 38 | relatedLeftTerms = new ArrayList(source.getRelatedLeftTerms()); |
| 39 | referencedLeftTerms = new ArrayList(source.getReferencedLeftTerms()); |
| 40 | } |
| 41 | |
| 42 | public SpecifiedTableTerm(TableTerm source) |
| 43 | { |
| 44 | super(source); |
| 45 | relatedLeftTerms = new ArrayList(); |
| 46 | referencedLeftTerms = new ArrayList(); |
| 47 | } |
| 48 | |
| 49 | public SpecifiedTableTerm(String tableName, String alias) |
| 50 | { |
| 51 | super(tableName,alias); |
| 52 | relatedLeftTerms = new ArrayList(); |
| 53 | referencedLeftTerms = new ArrayList(); |
| 54 | } |
| 55 | |
| 56 | public SpecifiedTableTerm deepCopy() |
| 57 | { |
| 58 | SpecifiedTableTerm result = new SpecifiedTableTerm(this); |
| 59 | result.setRelatedLeftTerms(new ArrayList(getRelatedLeftTerms())); |
| 60 | result.setReferencedLeftTerms(new ArrayList(getReferencedLeftTerms())); |
| 61 | return result; |
| 62 | } |
| 63 | |
| 64 | public List getRelatedLeftTerms() |
| 65 | { |
| 66 | return relatedLeftTerms; |
| 67 | } |
| 68 | public void setRelatedLeftTerms(List relatedLeftTerms) |
| 69 | { |
| 70 | this.relatedLeftTerms=relatedLeftTerms; |
| 71 | } |
| 72 | |
| 73 | public List getReferencedLeftTerms() |
| 74 | { |
| 75 | return referencedLeftTerms; |
| 76 | } |
| 77 | public void setReferencedLeftTerms(List referencedLeftTerms) |
| 78 | { |
| 79 | this.referencedLeftTerms=referencedLeftTerms; |
| 80 | } |
| 81 | |
| 82 | public String toString() |
| 83 | { |
| 84 | return super.toString()+relatedLeftTerms+referencedLeftTerms; |
| 85 | } |
| 86 | |
| 87 | public static class LeftjoinEntry |
| 88 | { |
| 89 | public TableTerm term; |
| 90 | public Expression expression; |
| 91 | |
| 92 | public String toString() |
| 93 | { |
| 94 | return " (join "+term+" on "+expression.toString()+")"; |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | |