Project

General

Profile

« Previous | Next » 

Revision 58313611

Added by unknown about 7 years ago

ref #6286 latest changes to FloraHellenica import

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/greece/FloraHellenicaTaxonImport.java
19 19
import org.apache.log4j.Logger;
20 20
import org.springframework.stereotype.Component;
21 21

  
22
import eu.etaxonomy.cdm.api.service.ITermService;
22 23
import eu.etaxonomy.cdm.common.CdmUtils;
23 24
import eu.etaxonomy.cdm.ext.geo.GeoServiceArea;
24 25
import eu.etaxonomy.cdm.ext.geo.GeoServiceAreaAnnotatedMapping;
......
29 30
import eu.etaxonomy.cdm.model.description.CategoricalData;
30 31
import eu.etaxonomy.cdm.model.description.Distribution;
31 32
import eu.etaxonomy.cdm.model.description.Feature;
33
import eu.etaxonomy.cdm.model.description.FeatureNode;
34
import eu.etaxonomy.cdm.model.description.FeatureTree;
32 35
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
33 36
import eu.etaxonomy.cdm.model.description.State;
34 37
import eu.etaxonomy.cdm.model.description.TaxonDescription;
......
71 74
    private OrderedTermVocabulary<State> habitatVoc;
72 75
    private Map<String, State> lifeformMap = new HashMap<>();
73 76

  
77
    private OrderedTermVocabulary<PresenceAbsenceTerm> statusVoc;
78
    private PresenceAbsenceTerm rangeRestricted;
79
    private PresenceAbsenceTerm doubtfullyRangeRestricted;
80

  
81

  
74 82
    private OrderedTermVocabulary<State> chorologicalVoc;
83
    private Map<String, State> chorologyMap = new HashMap<>();
75 84

  
76 85

  
77 86
   private  static List<String> expectedKeys= Arrays.asList(new String[]{
......
80 89
            STATUS,CHOROLOGICAL_CATEGOGY,LIFE_FORM,"A","C","G","H","M","P","R","W", "Taxon"
81 90
    });
82 91

  
83
    private String lastFamily;
84 92
    private String lastGenus;
85 93
    private String lastSpecies;
86 94
    private NonViralNameParserImpl parser = NonViralNameParserImpl.NewInstance();
......
99 107
        initLifeformVocabulary(state);
100 108
        initHabitatVocabulary(state);
101 109
        initChorologicalVocabulary(state);
110
        initStatusVocabulary(state);
111
        makeFeatureTree(state);
102 112

  
103 113
        String line = state.getCurrentLine() + ": ";
104 114
        HashMap<String, String> record = state.getOriginalRecord();
......
111 121
        }
112 122

  
113 123
        String noStr = getValue(record, "Unique ID");
114
        Integer id = noStr == null? null : Integer.valueOf(noStr);
115 124
        Taxon taxon = makeTaxon(state, line, record, noStr);
116 125

  
117 126
        //Distribution
......
129 138
        state.putTaxon(noStr, taxon);
130 139
    }
131 140

  
141
    boolean hasFeatureTree = false;
142
    /**
143
     * @param state
144
     */
145
    private void makeFeatureTree(SimpleExcelTaxonImportState<CONFIG> state) {
146
        if (hasFeatureTree  ){
147
            return;
148
        }
149
        if (getFeatureTreeService().find(state.getConfig().getUuidFeatureTree()) != null){
150
            hasFeatureTree = true;
151
            return;
152
        }
153
        FeatureTree result = FeatureTree.NewInstance(state.getConfig().getUuidFeatureTree());
154
        result.setTitleCache(state.getConfig().getFeatureTreeTitle(), true);
155
        FeatureNode root = result.getRoot();
156
        FeatureNode newNode;
157

  
158
        ITermService service = getTermService();
159
        Feature newFeature = (Feature)service.find(Feature.DISTRIBUTION().getUuid());
160
        newNode = FeatureNode.NewInstance(newFeature);
161
        root.addChild(newNode);
162

  
163
        newFeature = (Feature)service.find(FloraHellenicaTransformer.uuidFloraHellenicaChorologyFeature);
164
        newNode = FeatureNode.NewInstance(newFeature);
165
        root.addChild(newNode);
166

  
167
        newFeature = (Feature)service.find(Feature.LIFEFORM().getUuid());
168
        newNode = FeatureNode.NewInstance(newFeature);
169
        root.addChild(newNode);
170

  
171
        newFeature = (Feature)service.find(Feature.HABITAT().getUuid());
172
        newNode = FeatureNode.NewInstance(newFeature);
173
        root.addChild(newNode);
174

  
175

  
176
        newFeature = (Feature)service.find(Feature.NOTES().getUuid());
177
        newNode = FeatureNode.NewInstance(newFeature);
178
        root.addChild(newNode);
179

  
180
        getFeatureTreeService().saveOrUpdate(result);
181
        hasFeatureTree = true;
182

  
183
    }
184

  
132 185
    /**
133 186
     * @param state
134 187
     * @param line
......
139 192
            TaxonDescription desc) {
140 193

  
141 194
        HashMap<String, String> record = state.getOriginalRecord();
142
        String value = getValue(record, CHOROLOGICAL_CATEGOGY);
143
        //TODO
195
        String valueStr = getValue(record, CHOROLOGICAL_CATEGOGY);
144 196

  
197
        String value = valueStr;
198
        if (value == null){
199
            return;
200
        }
201
        Feature choroFeature = getFeature(state, FloraHellenicaTransformer.uuidFloraHellenicaChorologyFeature,
202
                "Chorology", "The Chorological Category", "Choro", null);
203
        CategoricalData catData = CategoricalData.NewInstance(choroFeature);
204

  
205
        String[] splits = value.split(" & ");
206
        replaceDirection(splits, line);
207
        for (String split: splits){
208
            String[] splitsA = split.split("/");
209
            for (String splitA : splitsA){
210
                String[] splitsB = splitA.split(", ");
211
                for (String splitB : splitsB){
212
                    splitB = normalizeChorology(splitB);
213
                    State choroTerm = chorologyMap.get(splitB);
214
                    if (choroTerm == null){
215
                        logger.warn(line + "Some chorology could not be recognized in: " + value + "; Term was: " +splitB);
216
                    }else{
217
                        catData.addStateData(choroTerm);
218
                    }
219
                }
220
            }
221
        }
222
        desc.addElement(catData);
223
    }
145 224

  
225
    /**
226
     * @param splitB
227
     * @return
228
     */
229
    private String normalizeChorology(String choroStr) {
230
        choroStr = choroStr.trim()
231
                .replace("BK", "Bk")
232
                .replace("Austral.", "Austr.")
233
                .replace("trop.As.", "trop. As.");
234
        if (choroStr.startsWith("[") && !choroStr.endsWith("]")){
235
            choroStr += "]";
236
        }else if (!choroStr.startsWith("[") && choroStr.endsWith("]")){
237
            choroStr = "[" + choroStr;
238
        }
239
        return choroStr;
240
    }
146 241

  
242
    /**
243
     * @param splits
244
     * @param line
245
     */
246
    private void replaceDirection(String[] splits, String line) {
247
        if (splits.length > 1){
248
            String[] divs = splits[1].split("-");
249
            if (divs.length == 2){
250
                splits[0] = splits[0] + "-" + divs[1];
251
            }else{
252
                logger.warn(line + "Splits[1] has not expected format: " + splits[1]);
253
            }
254
        }
147 255
    }
148 256

  
149 257
    /**
......
480 588
            TaxonDescription desc, String key, UUID uuid, String line, String id) {
481 589
        HashMap<String, String> record = state.getOriginalRecord();
482 590
        String value = getValue(record, key);
483
        if (value != null){
484
            NamedArea area = getNamedArea(state, uuid, null, null, null, null, null);
485
            Distribution dist;
591
        NamedArea area = getNamedArea(state, uuid, null, null, null, null, null);
592
        Distribution dist;
593
        if (value == null || ".".equals(value) ){
594
            dist = Distribution.NewInstance(area, PresenceAbsenceTerm.NATIVE());
486 595
            if (".".equals(value)){
487
                dist = Distribution.NewInstance(area, PresenceAbsenceTerm.ABSENT());
488 596
                logger.warn(line + "'.' Should not exist anmore as a distribution status: '" + value + "' for " + key);
489
            }else if ("Range-restricted".equals(value)){
490
                dist = Distribution.NewInstance(area, PresenceAbsenceTerm.ENDEMIC_FOR_THE_RELEVANT_AREA());
491
            }else if ("?Range-restricted".equals(value)){
492
                dist = Distribution.NewInstance(area, PresenceAbsenceTerm.ENDEMIC_FOR_THE_RELEVANT_AREA());
493
            }else if ("Xenophyte".equals(value)){
494
                dist = Distribution.NewInstance(area, PresenceAbsenceTerm.INTRODUCED());
495
            }else if ("?Xenophyte".equals(value)){
496
                dist = Distribution.NewInstance(area, PresenceAbsenceTerm.INTRODUCED_DOUBTFULLY_INTRODUCED());
497
            }else {
498
                logger.warn(line + "Not matching status. This should not happpen '" + value + "' for " + key);
499
                return;
500 597
            }
501
            desc.addElement(dist);
502
            dist.addImportSource(id, getWorksheetName(), getSourceCitation(state), line);
598
        }else if ("Range-restricted".equals(value)){
599
            dist = Distribution.NewInstance(area, rangeRestricted);
600
        }else if ("?Range-restricted".equals(value)){
601
            dist = Distribution.NewInstance(area, doubtfullyRangeRestricted);
602
        }else if ("Xenophyte".equals(value)){
603
            dist = Distribution.NewInstance(area, PresenceAbsenceTerm.INTRODUCED());
604
        }else if ("?Xenophyte".equals(value)){
605
            dist = Distribution.NewInstance(area, PresenceAbsenceTerm.INTRODUCED_DOUBTFULLY_INTRODUCED());
606
        }else {
607
            logger.warn(line + "Not matching status. This should not happpen '" + value + "' for " + key);
608
            return;
503 609
        }
610
        desc.addElement(dist);
611
        dist.addImportSource(id, getWorksheetName(), getSourceCitation(state), line);
504 612
    }
505 613

  
506 614
    @SuppressWarnings("unchecked")
......
577 685
                description, label, null, termSourceUri);
578 686
        chorologicalVoc.setUuid(vocUuid);
579 687

  
580
        addChorological(state, "Bk", "Balkan", "", FloraHellenicaTransformer.uuidChorologicalBk);
581
        addChorological(state, "BI", "Balkan-Italy", "", FloraHellenicaTransformer.uuidChorologicalBI);
582
        addChorological(state, "BA", "Balkan-Anatolia", "", FloraHellenicaTransformer.uuidChorologicalBA);
583
        addChorological(state, "BC", "Balkan-Central Europe", "", FloraHellenicaTransformer.uuidChorologicalBC);
584
        addChorological(state, "EM", "East Mediterranean", "", FloraHellenicaTransformer.uuidChorologicalEM);
585
        addChorological(state, "Me", "Mediterranean", "", FloraHellenicaTransformer.uuidChorologicalMe);
586
        addChorological(state, "MA", "Mediterranean-Atlantic", "", FloraHellenicaTransformer.uuidChorologicalMA);
587
        addChorological(state, "ME", "Mediterranean-European", "", FloraHellenicaTransformer.uuidChorologicalME);
588
        addChorological(state, "MS", "Mediterranean-SW Asian", "", FloraHellenicaTransformer.uuidChorologicalMS);
589
        addChorological(state, "EA", "European-SW Asian", "", FloraHellenicaTransformer.uuidChorologicalEA);
590
        addChorological(state, "ES", "Euro-Siberian", "", FloraHellenicaTransformer.uuidChorologicalES);
591
        addChorological(state, "Eu", "European", "", FloraHellenicaTransformer.uuidChorologicalEu);
592
        addChorological(state, "Pt", "Paleotemperate", "", FloraHellenicaTransformer.uuidChorologicalPt);
593
        addChorological(state, "Ct", "Circumtemperate", "", FloraHellenicaTransformer.uuidChorologicalCt);
594
        addChorological(state, "IT", "Irano-Turanian", "", FloraHellenicaTransformer.uuidChorologicalIT);
595
        addChorological(state, "SS", "Saharo-Sindian", "", FloraHellenicaTransformer.uuidChorologicalSS);
596
        addChorological(state, "ST", "Subtropical-tropical", "", FloraHellenicaTransformer.uuidChorologicalST);
597
        addChorological(state, "Bo", "(Circum-) Boreal", "", FloraHellenicaTransformer.uuidChorologicalBo);
598
        addChorological(state, "AA", "Arctic-Alpine", "", FloraHellenicaTransformer.uuidChorologicalAA);
599
        addChorological(state, "Co", "Cosmopolitan", "", FloraHellenicaTransformer.uuidChorologicalCo);
600 688
        addChorological(state, "*", "Greek endemic", "Greek endemics (incl. single-island and single-mountain endemics)", FloraHellenicaTransformer.uuidChorologicalStar);
689
        addChorological(state, "Bk", "Balkan", "Taxa restricted to Balkan countries, occasionally extending to adjacent parts of SE Europe", FloraHellenicaTransformer.uuidChorologicalBk);
690
        addChorological(state, "BI", "Balkan-Italy", "Taxa restricted to Balkan countries and Italy (amphi-Adreatic)", FloraHellenicaTransformer.uuidChorologicalBI);
691
        addChorological(state, "BA", "Balkan-Anatolia", "Taxa restricted to Balkan countries and to Asia minor (Anatolia), occasionally extending to S Ukraine (Crimea), adjacent Caucasian countries (Georgia, Armenia) or N Iraq", FloraHellenicaTransformer.uuidChorologicalBA);
692
        addChorological(state, "BC", "Balkan-Central Europe", "Taxa distributed in the Balkans, Carpathians, Alps and adjacent areas (mainly in the mountains)", FloraHellenicaTransformer.uuidChorologicalBC);
693
        addChorological(state, "EM", "East Mediterranean", "Taxa restricted to the E Mediterranean, occasionally extending to S Italy or adjacent Caucasian countries", FloraHellenicaTransformer.uuidChorologicalEM);
694
        addChorological(state, "Me", "Mediterranean", "Taxa with a circum-Mediterranean distribution including Portugal, occasionally extending to the Caucasus area and N Iran", FloraHellenicaTransformer.uuidChorologicalMe);
695
        addChorological(state, "MA", "Mediterranean-Atlantic", "Taxa restricted to maritime W Europe and the Mediterranean", FloraHellenicaTransformer.uuidChorologicalMA);
696
        addChorological(state, "ME", "Mediterranean-European", "Taxa restricted to the Mediterranean and temperate Europe, occasionally extending to NW Africa and the Caucasus area", FloraHellenicaTransformer.uuidChorologicalME);
697
        addChorological(state, "MS", "Mediterranean-SW Asian", "Taxa distributed in one or more Mediterranean countries and extending to SW and C Asia", FloraHellenicaTransformer.uuidChorologicalMS);
698
        addChorological(state, "EA", "European-SW Asian", "Eruopean taxa (occasionally reachin N Africa) with a distribution extending to SW Asia, occasionally reaching C Asia", FloraHellenicaTransformer.uuidChorologicalEA);
699
        addChorological(state, "ES", "Euro-Siberian", "Taxa with main distribution in temperate Eurasia (occasionally reaching the Caucasus area)", FloraHellenicaTransformer.uuidChorologicalES);
700
        addChorological(state, "Eu", "European", "Taxa with a distribution all over Europe. In S European countries this category in fact represents the C European element", FloraHellenicaTransformer.uuidChorologicalEu);
701
        addChorological(state, "Pt", "Paleotemperate", "Taxa of extratropical Eurasia including the Himalaya and E Asia, not (or at most marginally) extending to North America", FloraHellenicaTransformer.uuidChorologicalPt);
702
        addChorological(state, "Ct", "Circumtemperate", "Taxa of both extratropical Eurasia and North America", FloraHellenicaTransformer.uuidChorologicalCt);
703
        addChorological(state, "IT", "Irano-Turanian", "Taxa with main distribution in arid SW and C Asia, extrazonally extending to the Mediterranean", FloraHellenicaTransformer.uuidChorologicalIT);
704
        addChorological(state, "SS", "Saharo-Sindian", "Taxa with main distribution in arid N Africa and SQ Asia, extrazonally extending to the Mediterranean", FloraHellenicaTransformer.uuidChorologicalSS);
705
        addChorological(state, "ST", "Subtropical-tropical", "Taxa widespread in the warmer regions of both hemispheres", FloraHellenicaTransformer.uuidChorologicalST);
706
        addChorological(state, "Bo", "(Circum-)Boreal", "Taxa with main distribution in N and high-montane Eurasia (occasionally extending to North America)", FloraHellenicaTransformer.uuidChorologicalBo);
707
        addChorological(state, "AA", "Arctic-Alpine", "Taxa with main distribution beyound the N and aove the high-montane timerlines o fEurasia (occasionally extending to North America)", FloraHellenicaTransformer.uuidChorologicalAA);
708
        addChorological(state, "Co", "Cosmopolitan", "Taxa distributed in all continents, i.e. beyond the N hemisphere. This category may be given in brackets after the known or supposed native distribution in cases of taxa that have been spread worldwide by humans", FloraHellenicaTransformer.uuidChorologicalCo);
709

  
710
        addChorological(state, "[trop.]", "[tropical]", "", FloraHellenicaTransformer.uuidChorologicaltrop);
711
        addChorological(state, "[subtrop.]", "[subtropical]", "", FloraHellenicaTransformer.uuidChorologicalsubtrop);
712
        addChorological(state, "[paleotrop.]", "[paleotropical]", "", FloraHellenicaTransformer.uuidChorologicalpaleotrop);
713
        addChorological(state, "[neotrop.]", "[neotropical]", "", FloraHellenicaTransformer.uuidChorologicalneotrop);
714
        addChorological(state, "[pantrop.]", "[pantropical]", "", FloraHellenicaTransformer.uuidChorologicalpantrop);
715
        addChorological(state, "[N-Am.]", "[North American]", "", FloraHellenicaTransformer.uuidChorologicalN_Am);
716
        addChorological(state, "[S-Am.]", "[South American]", "", FloraHellenicaTransformer.uuidChorologicalS_Am);
717
        addChorological(state, "[E-As.]", "[East Asian]", "", FloraHellenicaTransformer.uuidChorologicalE_As);
718
        addChorological(state, "[SE-As.", "[South East Asian]", "", FloraHellenicaTransformer.uuidChorologicalSE_As);
719
        addChorological(state, "[S-Afr.]", "[South African]", "", FloraHellenicaTransformer.uuidChorologicalS_Afr);
720
        addChorological(state, "[Arab.]", "[Arabian]", "", FloraHellenicaTransformer.uuidChorologicalArab);
721
        addChorological(state, "[Arab. NE-Afr.]", "[Arabian and North East African]", "", FloraHellenicaTransformer.uuidChorologicalArab_NE_Afr);
722
        addChorological(state, "[Caucas.]", "[Caucasian]", "", FloraHellenicaTransformer.uuidChorologicalCaucas);
723
        addChorological(state, "[Pontic]", "[Pontic]", "", FloraHellenicaTransformer.uuidChorologicalPontic);
724
        addChorological(state, "[Europ.]", "[European]", "", FloraHellenicaTransformer.uuidChorologicalEurop);
725
        addChorological(state, "[Austr.]", "[Australian]", "", FloraHellenicaTransformer.uuidChorologicalAustral);
726

  
727
        addChorological(state, "[W-Med.]", "[West Mediterranean]", "", FloraHellenicaTransformer.uuidChorologicalW_Med);
728
        addChorological(state, "[C-Med.]", "[Central Mediterranean]", "", FloraHellenicaTransformer.uuidChorologicalC_Med);
729
        addChorological(state, "[W-Eur.]", "[West European]", "", FloraHellenicaTransformer.uuidChorologicalW_Eur);
730
        addChorological(state, "[S-Eur.]", "[South European]", "", FloraHellenicaTransformer.uuidChorologicalS_Eur);
731
        addChorological(state, "[C-Am.]", "[Central American]", "", FloraHellenicaTransformer.uuidChorologicalC_Am);
732
        addChorological(state, "[C-As.]", "[Central Asian]", "", FloraHellenicaTransformer.uuidChorologicalC_As);
733
        addChorological(state, "[SW-As.]", "[South West Asian]", "", FloraHellenicaTransformer.uuidChorologicalSW_As);
734
        addChorological(state, "[unknown]", "[unknown]", "", FloraHellenicaTransformer.uuidChorologicalUnknown);
735
        addChorological(state, "[N-Afr.]", "[North African]", "", FloraHellenicaTransformer.uuidChorologicalN_Afr);
736
        addChorological(state, "[Am.]", "[American]", "", FloraHellenicaTransformer.uuidChorologicalAm);
737
        addChorological(state, "[paleosubtrop.]", "[paleosubtropical]", "", FloraHellenicaTransformer.uuidChorologicalPaleosubtrop);
738
        addChorological(state, "[SW-Eur.]", "[South West European]", "", FloraHellenicaTransformer.uuidChorologicalSW_Eur);
739

  
740
        addChorological(state, "[S-As.]", "[South Asian]", "", FloraHellenicaTransformer.uuidChorologicalS_As);
741
        addChorological(state, "[NE-Afr.]", "[North East African]", "", FloraHellenicaTransformer.uuidChorologicalNE_Afr);
742
        addChorological(state, "[NW-Afr.]", "[North West African]", "", FloraHellenicaTransformer.uuidChorologicalNW_Afr);
743
        addChorological(state, "[trop. Afr.]", "[tropical African]", "", FloraHellenicaTransformer.uuidChorologicalTrop_Afr);
744
        addChorological(state, "[Afr.]", "[Arican]", "", FloraHellenicaTransformer.uuidChorologicalAfr);
745
        addChorological(state, "[As.]", "[Asian]", "", FloraHellenicaTransformer.uuidChorologicalAs);
746
        addChorological(state, "[W-As.]", "[West Asian]", "", FloraHellenicaTransformer.uuidChorologicalW_As);
747
        addChorological(state, "[C-Eur.]", "[Central European]", "", FloraHellenicaTransformer.uuidChorologicalC_Eur);
748
        addChorological(state, "[E-Afr.]", "[East African]", "", FloraHellenicaTransformer.uuidChorologicalE_Afr);
749
        addChorological(state, "[W-Austr.]", "[West Australian]", "", FloraHellenicaTransformer.uuidChorologicalW_Austr);
750
        addChorological(state, "[trop. As.]", "[tropical Asian]", "", FloraHellenicaTransformer.uuidChorologicaltrop_As);
751

  
752
        addChorological(state, "[Co]", "[Cosmopolitan]", "Taxa distributed in all continents, i.e. beyond the N hemisphere. This category may be given in brackets after the known or supposed native distribution in cases of taxa that have been spread worldwide by humans", FloraHellenicaTransformer.uuidChorological__Co_);
601 753

  
602 754
        this.getVocabularyService().save(chorologicalVoc);
603 755
        return;
......
613 765
     * @param uuidchorologicalstar
614 766
     */
615 767
    private void addChorological(SimpleExcelTaxonImportState<CONFIG> state, String abbrevLabel, String label,
616
            String string3, UUID uuidChorological) {
617
        State chorological = addState(state, abbrevLabel, label, label, uuidChorological, chorologicalVoc);
618

  
619

  
768
            String desc, UUID uuidChorological) {
769
        desc = isBlank(desc)? label : desc;
770
        State chorologyTerm = addState(state, abbrevLabel, label, desc, uuidChorological, chorologicalVoc);
771
        chorologyMap.put(abbrevLabel, chorologyTerm);
620 772
    }
621 773

  
622 774
    /**
......
635 787
                description, stateLabel, abbrev);
636 788
        newState.setUuid(uuid);
637 789
        newState.setIdInVocabulary(abbrev);
638
        newState.setIdInVocabulary(abbrev);
639 790
        voc.addTerm(newState);
640 791
        return newState;
641 792
    }
642 793

  
794
    private PresenceAbsenceTerm addStatus(SimpleExcelTaxonImportState<CONFIG> state,
795
            String abbrev, String stateLabel, String description, UUID uuid, OrderedTermVocabulary<PresenceAbsenceTerm> voc) {
796
        PresenceAbsenceTerm newStatus = PresenceAbsenceTerm.NewPresenceInstance(
797
                description, stateLabel, abbrev);
798
        newStatus.setUuid(uuid);
799
        newStatus.setIdInVocabulary(abbrev);
800
        newStatus.setSymbol(abbrev);
801
        voc.addTerm(newStatus);
802
        return newStatus;
803
    }
804

  
643 805
    private void initHabitatVocabulary(SimpleExcelTaxonImportState<CONFIG> state) {
644 806
        if (habitatVoc == null){
645 807
            UUID uuid = FloraHellenicaTransformer.uuidFloraHellenicaHabitatVoc;
......
650 812
        }
651 813
    }
652 814

  
815
    private void initStatusVocabulary(SimpleExcelTaxonImportState<CONFIG> state) {
816
        if (statusVoc == null){
817
            UUID uuid = FloraHellenicaTransformer.uuidFloraHellenicaStatusVoc;
818
            statusVoc = (OrderedTermVocabulary<PresenceAbsenceTerm>)this.getVocabularyService().find(uuid);
819
            if (statusVoc == null){
820
                createStatusVoc(state, uuid);
821
            }
822
        }
823
    }
824

  
825
    /**
826
     * @param state
827
     */
828
    private void createStatusVoc(SimpleExcelTaxonImportState<CONFIG> state, UUID vocUuid) {
829
        //voc
830
        URI termSourceUri = null;
831
        String label = "Checklist of Greece Status";
832
        String description = "Status as used in the Checklist of Greece";
833
        statusVoc = OrderedTermVocabulary.NewInstance(TermType.PresenceAbsenceTerm,
834
                description, label, null, termSourceUri);
835
        statusVoc.setUuid(vocUuid);
836

  
837
        rangeRestricted = addStatus(state, "RR", "Range-restricted", "", FloraHellenicaTransformer.uuidStatusRangeRestricted, statusVoc);
838
        doubtfullyRangeRestricted = addStatus(state, "?RR", "?Range-restricted", "", FloraHellenicaTransformer.uuidStatusRangeRestrictedDoubtfully, statusVoc);
839

  
840
        this.getVocabularyService().save(statusVoc);
841
        return;
842
    }
843

  
653 844

  
654 845
    /**
655 846
     * @param state
......
703 894

  
704 895
        //greece country
705 896
        String countryLabel = "Greece";
706
        greece = NamedArea.NewInstance(
707
                countryLabel, countryLabel, null);
897
        greece = NamedArea.NewInstance(countryLabel, countryLabel, "GR");
708 898
        greece.setUuid(FloraHellenicaTransformer.uuidAreaGreece);
899
        greece.setIdInVocabulary("GR");
900
        greece.setSymbol("GR");
709 901
        areasVoc.addTerm(greece);
710 902
        //FIXME
711 903
//        addMapping(greece, xx "mex_adm0", "iso", "MEX");

Also available in: Unified diff