Revision 44583

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureType.java
35 35
import java.util.Set;
36 36
import java.util.function.Predicate;
37 37
import java.util.zip.CRC32;
38
import org.apache.commons.collections4.ListUtils;
38 39
import org.apache.commons.lang3.ArrayUtils;
39 40
import org.apache.commons.lang3.StringUtils;
40 41

  
......
242 243
        return this.getCopy();
243 244
    }
244 245

  
246
    @Override
245 247
    public int getDefaultGeometryAttributeIndex() {
246 248
        return this.defaultGeometryAttributeIndex;
247 249
    }
248 250

  
251
    @Override
249 252
    public String getDefaultGeometryAttributeName() {
250 253
        return this.defaultGeometryAttributeName;
251 254
    }
252 255

  
256
    @Override
253 257
    public int getDefaultTimeAttributeIndex() {
254 258
        return this.defaultTimeAttributeIndex;
255 259
    }
256 260

  
261
    @Override
257 262
    public String getDefaultTimeAttributeName() {
258 263
        return this.defaultTimeAttributeName;
259 264
    }
260 265

  
266
    @Override
261 267
    public EditableFeatureType getEditable() {
262 268
        return new DefaultEditableFeatureType(this);
263 269
    }
264 270

  
271
    @Override
265 272
    public int getIndex(String name) {
266 273
        FeatureAttributeDescriptor attr;
267 274
        Iterator iter = this.iterator();
......
274 281
        return -1;
275 282
    }
276 283

  
284
    @Override
277 285
    public FeatureRules getRules() {
278 286
        return this.rules;
279 287
    }
280 288

  
289
    @Override
281 290
    public boolean hasEvaluators() {
282 291
        return this.hasEvaluators;
283 292
    }
......
290 299
        return this.requiredFields;
291 300
    }
292 301

  
302
    @Override
293 303
    public List getSRSs() {
294 304
        if (this.srsList == null) {
295 305
            ArrayList tmp = new ArrayList();
......
321 331
        return this.srsList;
322 332
    }
323 333

  
334
    @Override
324 335
    public IProjection getDefaultSRS() {
325 336
        if (this.getDefaultGeometryAttributeIndex() < 0) {
326 337
            return null;
......
449 460
            // Set the constants attributes.
450 461
            if (!ArrayUtils.isEmpty(constantsNames)) {
451 462
                for (String name : constantsNames) {
452
                    if (!requiredAttrnames.contains(name)) {
463
                    if (!requiredAttrnames.contains(name.toLowerCase())) {
453 464
                        DefaultFeatureAttributeDescriptor attr = (DefaultFeatureAttributeDescriptor) this.get(name);
454 465
                        attr.setConstantValue(true);
455 466
                    }
......
505 516
        return hasOID;
506 517
    }
507 518

  
519
    @Override
508 520
    public String toString() {
509 521
        StringBuffer s = new StringBuffer();
510 522
        s.append(this.getId());
......
521 533
        return s.toString();
522 534
    }
523 535

  
536
    @Override
524 537
    public Iterator<FeatureAttributeDescriptor> iterator() {
525 538
        return getIterator(super.iterator());
526 539
    }
......
537 550
            this.iterator = iter;
538 551
        }
539 552

  
553
        @Override
540 554
        public boolean hasNext() {
541 555
            return iterator.hasNext();
542 556
        }
543 557

  
558
        @Override
544 559
        public Object next() {
545 560
            return iterator.next();
546 561
        }
547 562

  
563
        @Override
548 564
        public void remove() {
549 565
            throw new UnsupportedOperationException();
550 566
        }
551 567

  
552 568
    }
553 569

  
570
    @Override
554 571
    public boolean allowAutomaticValues() {
555 572
        return this.allowAtomaticValues;
556 573
    }
557 574

  
575
    @Override
558 576
    public FeatureAttributeDescriptor[] getAttributeDescriptors() {
559 577
        return (FeatureAttributeDescriptor[]) super
560 578
                .toArray(new FeatureAttributeDescriptor[super.size()]);
......
607 625
                .get(this.defaultGeometryAttributeIndex);
608 626
    }
609 627

  
628
    @Override
610 629
    public boolean equals(Object o) {
611 630
        if (this == o) {
612 631
            return true;
......
646 665
    /**
647 666
     * Start of DynClass interface implementation READONLY
648 667
     */
668
    @Override
649 669
    public DynField addDynField(String name) {
650 670
        throw new UnsupportedOperationException();
651 671
    }
652 672

  
673
    @Override
653 674
    public DynField getDeclaredDynField(String name) {
654 675
        return (DynField) getAttributeDescriptor(name);
655 676
    }
656 677

  
678
    @Override
657 679
    public DynField[] getDeclaredDynFields() {
658 680
        return (DynField[]) getAttributeDescriptors();
659 681
    }
660 682

  
683
    @Override
661 684
    public String getDescription() {
662 685
        return this.description;
663 686
    }
664 687

  
688
    @Override
665 689
    public DynField getDynField(String name) {
666 690
        return (DynField) getAttributeDescriptor(name);
667 691
    }
668 692

  
693
    @Override
669 694
    public DynField[] getDynFields() {
670 695
        return (DynField[]) getAttributeDescriptors();
671 696
    }
672 697

  
698
    @Override
673 699
    public String getName() {
674 700
        return this.id + "_" + internalID;
675 701
    }
676 702

  
703
    @Override
677 704
    public void removeDynField(String name) {
678 705
        throw new UnsupportedOperationException();
679 706

  
680 707
    }
681 708

  
709
    @Override
682 710
    public void addDynMethod(DynMethod dynMethod) {
683 711
        throw new UnsupportedOperationException();
684 712

  
......
689 717

  
690 718
    }
691 719

  
720
    @Override
692 721
    public void extend(String dynClassName) {
693 722
        throw new UnsupportedOperationException();
694 723

  
695 724
    }
696 725

  
726
    @Override
697 727
    public void extend(String namespace, String dynClassName) {
698 728
        throw new UnsupportedOperationException();
699 729

  
700 730
    }
701 731

  
732
    @Override
702 733
    public DynMethod getDeclaredDynMethod(String name)
703 734
            throws DynMethodException {
704 735
        return null;
705 736
    }
706 737

  
738
    @Override
707 739
    public DynMethod[] getDeclaredDynMethods() throws DynMethodException {
708 740
        return null;
709 741
    }
710 742

  
743
    @Override
711 744
    public DynMethod getDynMethod(String name) throws DynMethodException {
712 745
        return null;
713 746
    }
714 747

  
748
    @Override
715 749
    public DynMethod getDynMethod(int code) throws DynMethodException {
716 750
        return null;
717 751
    }
718 752

  
753
    @Override
719 754
    public DynMethod[] getDynMethods() throws DynMethodException {
720 755
        return null;
721 756
    }
722 757

  
758
    @Override
723 759
    public DynClass[] getSuperDynClasses() {
724 760
        return null;
725 761
    }
726 762

  
763
    @Override
727 764
    public boolean isInstance(DynObject dynObject) {
728 765
        if (dynObject.getDynClass().getName() == getName()) {
729 766
            return true;
......
731 768
        return false;
732 769
    }
733 770

  
771
    @Override
734 772
    public DynObject newInstance() {
735 773

  
736 774
        throw new UnsupportedOperationException();
737 775
    }
738 776

  
777
    @Override
739 778
    public void removeDynMethod(String name) {
740 779
        throw new UnsupportedOperationException();
741 780

  
742 781
    }
743 782

  
783
    @Override
744 784
    public DynField addDynFieldChoice(String name, int type,
745 785
            Object defaultValue, DynObjectValueItem[] values,
746 786
            boolean mandatory, boolean persistent) {
747 787
        throw new UnsupportedOperationException();
748 788
    }
749 789

  
790
    @Override
750 791
    public DynField addDynFieldRange(String name, int type,
751 792
            Object defaultValue, Object min, Object max, boolean mandatory,
752 793
            boolean persistent) {
753 794
        throw new UnsupportedOperationException();
754 795
    }
755 796

  
797
    @Override
756 798
    public DynField addDynFieldSingle(String name, int type,
757 799
            Object defaultValue, boolean mandatory, boolean persistent) {
758 800
        throw new UnsupportedOperationException();
759 801
    }
760 802

  
803
    @Override
761 804
    public void validate(DynObject object) throws DynObjectValidateException {
762 805
        //FIXME: not sure it's the correct code
763 806
        if (object instanceof Feature) {
......
769 812
        throw new DynObjectValidateException(this.id);
770 813
    }
771 814

  
815
    @Override
772 816
    public DynField addDynFieldLong(String name) {
773 817
        throw new UnsupportedOperationException();
774 818
    }
775 819

  
820
    @Override
776 821
    public DynField addDynFieldChoice(String name, int type,
777 822
            Object defaultValue, DynObjectValueItem[] values) {
778 823
        throw new UnsupportedOperationException();
779 824
    }
780 825

  
826
    @Override
781 827
    public DynField addDynFieldRange(String name, int type,
782 828
            Object defaultValue, Object min, Object max) {
783 829
        throw new UnsupportedOperationException();
784 830
    }
785 831

  
832
    @Override
786 833
    public DynField addDynFieldSingle(String name, int type, Object defaultValue) {
787 834
        throw new UnsupportedOperationException();
788 835
    }
789 836

  
837
    @Override
790 838
    public DynField addDynFieldString(String name) {
791 839
        throw new UnsupportedOperationException();
792 840
    }
793 841

  
842
    @Override
794 843
    public DynField addDynFieldInt(String name) {
795 844
        throw new UnsupportedOperationException();
796 845
    }
797 846

  
847
    @Override
798 848
    public DynField addDynFieldDouble(String name) {
799 849
        throw new UnsupportedOperationException();
800 850
    }
801 851

  
852
    @Override
802 853
    public DynField addDynFieldFloat(String name) {
803 854
        throw new UnsupportedOperationException();
804 855
    }
......
807 858
        throw new UnsupportedOperationException();
808 859
    }
809 860

  
861
    @Override
810 862
    public DynField addDynFieldList(String name) {
811 863
        throw new UnsupportedOperationException();
812 864
    }
813 865

  
866
    @Override
814 867
    public DynField addDynFieldMap(String name) {
815 868
        throw new UnsupportedOperationException();
816 869
    }
817 870

  
871
    @Override
818 872
    public DynField addDynFieldObject(String name) {
819 873
        throw new UnsupportedOperationException();
820 874
    }
821 875

  
876
    @Override
822 877
    public DynField addDynFieldSet(String name) {
823 878
        throw new UnsupportedOperationException();
824 879
    }
825 880

  
881
    @Override
826 882
    public DynField addDynFieldArray(String name) {
827 883
        throw new UnsupportedOperationException();
828 884
    }
829 885

  
886
    @Override
830 887
    public DynField addDynFieldDate(String name) {
831 888
        throw new UnsupportedOperationException();
832 889
    }
833 890

  
891
    @Override
834 892
    public void extend(DynStruct struct) {
835 893
        throw new UnsupportedOperationException();
836 894
    }
837 895

  
896
    @Override
838 897
    public String getFullName() {
839 898
        // TODO: usar el DynClassName
840 899
        return this.id;
841 900
    }
842 901

  
902
    @Override
843 903
    public String getNamespace() {
844 904
        return "DALFeature";
845 905
    }
846 906

  
907
    @Override
847 908
    public DynStruct[] getSuperDynStructs() {
848 909
        return null;
849 910
    }
850 911

  
912
    @Override
851 913
    public void setDescription(String description) {
852 914
        this.description = description;
853 915
    }
854 916

  
917
    @Override
855 918
    public void setNamespace(String namespace) {
856 919
        throw new UnsupportedOperationException();
857 920
    }
858 921

  
922
    @Override
859 923
    public DynField addDynFieldFile(String name) {
860 924
        throw new UnsupportedOperationException();
861 925
    }
862 926

  
927
    @Override
863 928
    public DynField addDynFieldFolder(String name) {
864 929
        throw new UnsupportedOperationException();
865 930
    }
866 931

  
932
    @Override
867 933
    public DynField addDynFieldURL(String name) {
868 934
        throw new UnsupportedOperationException();
869 935
    }
870 936

  
937
    @Override
871 938
    public DynField addDynFieldURI(String name) {
872 939
        throw new UnsupportedOperationException();
873 940
    }
874 941

  
942
    @Override
875 943
    public boolean isExtendable(DynStruct dynStruct) {
876 944
        return false;
877 945
    }
......
881 949

  
882 950
    }
883 951

  
952
    @Override
884 953
    public void remove(DynStruct superDynStruct) {
885 954
        // TODO Auto-generated method stub
886 955

  
......
891 960

  
892 961
    }
893 962

  
963
    @Override
894 964
    public FeatureAttributeDescriptor getDefaultTimeAttribute() {
895 965
        if (this.defaultTimeAttributeIndex < 0) {
896 966
            return null;
......
1109 1179
    }
1110 1180
    
1111 1181
                
1182
    @Override
1112 1183
    public String getNewFieldName() {
1113 1184
        I18nManager i18n = ToolsLocator.getI18nManager();
1114 1185
        String prefix = i18n.getTranslation("_Field");
1115 1186
        String fieldName;
1116 1187
        for (int i = 1; i < 1000; i++) {
1117
            fieldName = prefix +"-"+i;
1188
            fieldName = prefix+i;
1118 1189
            if( this.get(fieldName)==null ) {
1119 1190
                return fieldName;
1120 1191
            }
1121 1192
        }
1122
        fieldName = prefix + "-" + (new Date()).getTime();
1193
        fieldName = prefix + (new Date()).getTime();
1123 1194
        return fieldName;
1124 1195
    }
1125 1196
    
1197
    @Override
1126 1198
   public FeatureType getOriginalFeatureType()  {
1127 1199
        DefaultFeatureStore store = (DefaultFeatureStore) this.getStore();
1128 1200
        if (store==null) {

Also available in: Unified diff