Revision 46105 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/feature/spi/SQLBuilderBase.java

View differences:

SQLBuilderBase.java
73 73
    protected TableNameBuilder table_name;
74 74

  
75 75
    protected abstract class AbstractStatementPart extends AbstractValue {
76

  
76
        
77 77
    }
78 78

  
79 79
    protected abstract class AbstractStatement extends AbstractStatementPart {
80

  
80
        @Override
81
        public Value clone() throws CloneNotSupportedException {
82
            throw new CloneNotSupportedException();
83
        }
81 84
    }
82 85

  
83 86
    protected class ColumnDescriptorBase implements ColumnDescriptor {
......
328 331
            this.name = name;
329 332
            this.table = table;
330 333
        }
334
        
335
        @Override
336
        public ColumnBase clone() throws CloneNotSupportedException {
337
            ColumnBase other = (ColumnBase) super.clone();
338
            other.table = (TableNameBuilder) org.gvsig.tools.lang.Cloneable.cloneQuietly(table);
339
            return other;
340
        }
331 341

  
342

  
332 343
        @Override
333 344
        public String name() {
334 345
            return this.name;
......
392 403

  
393 404
        public TableNameBuilderBase() {
394 405
        }
395

  
406
        
396 407
        @Override
397 408
        public void accept(Visitor visitor, VisitorFilter filter) {
398 409
            if (filter==null || filter.accept(this)) {
......
527 538
            this.distinct = false;
528 539
            this.all = false;
529 540
        }
530

  
541
        
531 542
        @Override
543
        public CountBuilderBase clone() throws CloneNotSupportedException {
544
            CountBuilderBase other = (CountBuilderBase) super.clone();
545
            other.value = (Value) org.gvsig.tools.lang.Cloneable.cloneQuietly(value);
546
            return other;
547
        }
548
        
549
        @Override
532 550
        public CountBuilder all() {
533 551
            this.all = true;
534 552
            return this;
......
586 604
            this.table = table;
587 605
            this.expression = expression;
588 606
        }
607
        
608
        @Override
609
        public JoinBase clone() throws CloneNotSupportedException {
610
            JoinBase other = (JoinBase) super.clone();
611
            other.table = (TableNameBuilder) org.gvsig.tools.lang.Cloneable.cloneQuietly(table);
612
            other.expression = (Value) org.gvsig.tools.lang.Cloneable.cloneQuietly(expression);
613
            return other;
614
        }
589 615

  
590 616
        @Override
591 617
        public String toString() {
......
625 651
            this.passthrough = null;
626 652
            this.joins = null;
627 653
        }
654
        
655
        @Override
656
        public FromBuilderBase clone() throws CloneNotSupportedException {
657
            FromBuilderBase other = (FromBuilderBase) super.clone();
658
            other.tableName = (TableNameBuilder) org.gvsig.tools.lang.Cloneable.cloneQuietly(tableName);
659
            if (joins!=null) {
660
                for (int i = 0; i < joins.size(); i++) {
661
                    other.joins.set(i, (JoinBase) joins.get(i).clone());
662
                }
663
            }
664
            return other;
665
        }
628 666

  
629 667
        @Override
630 668
        public FromBuilder left_join(TableNameBuilder table, Value expression) {
......
705 743
        protected Value value = null;
706 744
        protected boolean asGeometry = false;
707 745
        protected TableNameBuilder table;
746
        
747
        @Override
748
        public SelectColumnBuilderBase clone() throws CloneNotSupportedException {
749
            SelectColumnBuilderBase other = (SelectColumnBuilderBase) super.clone();
750
            other.value = (Value) org.gvsig.tools.lang.Cloneable.cloneQuietly(value);
751
            other.name = (Variable) org.gvsig.tools.lang.Cloneable.cloneQuietly(name);
752
            other.table = (TableNameBuilder) org.gvsig.tools.lang.Cloneable.cloneQuietly(table);
753
            return other;
754
        }
708 755

  
709 756
        @Override
710 757
        public void accept(Visitor visitor, VisitorFilter filter) {
......
851 898
        public OrderByBuilderBase() {
852 899
            this.ascending = true;
853 900
        }
854

  
901
        
855 902
        @Override
903
        public OrderByBuilderBase clone() throws CloneNotSupportedException {
904
            OrderByBuilderBase other = (OrderByBuilderBase) super.clone();
905
            other.value = (Value) org.gvsig.tools.lang.Cloneable.cloneQuietly(value);
906
            return other;
907
        }
908
        
909
        @Override
856 910
        public void accept(Visitor visitor, VisitorFilter filter) {
857 911
            if (filter==null || filter.accept(this)) {
858 912
                visitor.visit(this);
......
877 931
        }
878 932
        
879 933
        @Override
934
        public boolean isColumn(Value value) {
935
            if(value instanceof ExpressionBuilder.Variable){
936
                return isColumn(((ExpressionBuilder.Variable)value).name());
937
            }
938
            return this.value == value;
939
        }
940
        
941
        @Override
880 942
        public OrderByBuilder value(Value expression) {
881 943
            this.value = expression;
882 944
            return this;
......
1157 1219
            return order;
1158 1220
        }
1159 1221
        
1222
        public OrderByBuilder getOrderBy(Value column) {
1223
            if(this.order_by == null){
1224
                return null;
1225
            }
1226
            for (OrderByBuilder orderByBuilder : this.order_by) {
1227
                if(orderByBuilder.isColumn(column)){
1228
                    return orderByBuilder;
1229
                }
1230
            }
1231
            return null;
1232
        }
1233
        
1160 1234
        public OrderByBuilder getOrderBy(String column) {
1161 1235
            if(this.order_by == null){
1162 1236
                return null;
......
1375 1449
            this.role = role;
1376 1450
            this.privileges = new HashSet<>();
1377 1451
        }
1452
        
1453
        @Override
1454
        public GrantRoleBuilderBase clone() throws CloneNotSupportedException {
1455
            GrantRoleBuilderBase other = (GrantRoleBuilderBase) super.clone();
1456
            other.table = (TableNameBuilder) org.gvsig.tools.lang.Cloneable.cloneQuietly(table);
1457
            other.privileges = (Set<Privilege>) org.gvsig.tools.lang.Cloneable.cloneQuietly(privileges);
1458
            
1459
            return other;
1460
        }
1378 1461

  
1379 1462
        @Override
1380 1463
        public GrantRoleBuilder privilege(Privilege privilege) {

Also available in: Unified diff