Project

General

Profile

Revision afcf48cb

IDafcf48cb0f262c2af062ff2b1cce2a5d030af9cb
Parent 28b766c5
Child dbcb39fb

Added by Andreas Müller about 2 years ago

fix typo and order in "Name not yet published"

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/outputmodel/OutputModelClassificationExport.java
14 14
import eu.etaxonomy.cdm.io.common.ICdmExport;
15 15
import eu.etaxonomy.cdm.io.common.mapping.out.IExportTransformer;
16 16
import eu.etaxonomy.cdm.model.taxon.Classification;
17
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
17 18

  
18 19
/**
19 20
 * @author k.luther
......
43 44
            Classification classification = getClassificationService().find(classificationUuid);
44 45
            if (classification == null){
45 46
                String message = String.format("Classification for given classification UUID not found. No data imported for %s", classificationUuid.toString());
47
                //TODO
46 48
                state.getResult().addWarning(message);
49
            }else{
50
//                gtTaxonNodeService().
51
                TaxonNode root = classification.getRootNode();
52
                for (TaxonNode child : root.getChildNodes()){
53
                    handleSingleTaxon(child);
54
                }
47 55
            }
48 56
        }
49 57
    }
50 58

  
51 59
    /**
60
     * @param child
61
     */
62
    private void handleSingleTaxon(TaxonNode child) {
63
        // TODO Auto-generated method stub
64
    }
65

  
66
    /**
52 67
     * {@inheritDoc}
53 68
     */
54 69
    @Override
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/terms/RepresentationCsvImport.java
59 59
                csvReader.close();
60 60
                return;
61 61
            }
62
            Set<Representation> representations = new HashSet<>();
62

  
63
            @SuppressWarnings("rawtypes")
64
            Set<DefinedTermBase> termsToSave = new HashSet<>();
65
            @SuppressWarnings("rawtypes")
66
            Set<TermVocabulary> vocsToSave = new HashSet<>();
63 67
            UUID langUuid = config.getLanguageUuid();
64 68
            DefinedTermBase<?> languageTerm = getTermService().find(langUuid);
65 69
            if (languageTerm == null || !languageTerm.isInstanceOf(Language.class)){
......
71 75

  
72 76
            int i = 0;
73 77
            for (String[] strs : lines){
74
                Representation rep = handleSingleLine(config, strs, language, i);
75
                if (rep != null){
76
                    representations.add(rep);
78
                TermBase term = handleSingleLine(config, strs, language, i);
79
                if (term != null){
80
                    if (term.isInstanceOf(DefinedTermBase.class)){
81
                        termsToSave.add(CdmBase.deproxy(term, DefinedTermBase.class));
82
                    }else if (term.isInstanceOf(TermVocabulary.class)){
83
                        vocsToSave.add(CdmBase.deproxy(term, TermVocabulary.class));
84
                    }else{
85
                        csvReader.close();
86
                        throw new IllegalArgumentException("Term class type not yet supported: " + term.getClass().getSimpleName());
87
                    }
77 88
                }
78 89
                i++;
79 90
            }
80 91
            csvReader.close();
81
            getTermService().saveOrUpdateRepresentations(representations);
92
            getTermService().saveOrUpdate(termsToSave);
93
            getVocabularyService().saveOrUpdate(vocsToSave);
82 94

  
83 95
        } catch (IOException e) {
84 96
            throw new RuntimeException(e);
......
92 104
     * @param i line counter
93 105
     * @return
94 106
     */
95
    private Representation handleSingleLine(RepresentationCsvImportConfigurator config, String[] strs,
107
    private TermBase handleSingleLine(RepresentationCsvImportConfigurator config, String[] strs,
96 108
            Language language, int i) {
97 109
        if (strs.length<1){
98 110
            String message = String.format(
......
124 136
            return null;
125 137
        }
126 138
        //skip column 1, it is for default language label, but not used during import
127
        String label = strs[2];
139
        String label = null;
128 140
        String description = null;
129 141
        String abbrev = null;
130 142
        if (isNotBlank(strs[2])){
......
149 161
        Representation representation = term.getRepresentation(language);
150 162
        if (representation == null){
151 163
            representation = Representation.NewInstance(description, label, abbrev, language);
164
            term.addRepresentation(representation);
152 165
        }
153 166
        if (label != null || config.isOverrideWithEmpty()){
154 167
            representation.setLabel(label);
......
159 172
        if (abbrev != null || config.isOverrideWithEmpty()){
160 173
            representation.setAbbreviatedLabel(abbrev);
161 174
        }
162
        return representation;
175
        return term;
163 176
    }
164 177

  
165 178
    /**
cdmlib-model/src/main/resources/terms/NomenclaturalStatusType.csv
27 27
"92a76bd0-6ea8-493f-98e0-4be0b98c092f",,"Subnudum","Subnudum","nom. subnud."
28 28
"ed508710-deef-44b1-96f6-1ce6d2c9c884",,"New combination","New combination","comb. nov."
29 29
"39a25673-f716-4ec7-ae27-2498fce43166",,"Orthography Rejected","Orthography Rejected","orth. rej."
30
"51429574-c6f9-4aa1-bab9-0bbc5b160ba1",,"Name not yet publised","Not yet published","ined."
30
"51429574-c6f9-4aa1-bab9-0bbc5b160ba1",,"Not yet published","Name not yet published","ined."
cdmlib-model/src/main/resources/terms/Rank_la.csv
31 31
"4aa6890b-0363-4899-8d7c-ee0cb78e6166","Tribe","Tribus","Tribus",,
32 32
"ae41ecc5-5165-4126-9d24-79939ae5d822","Subtribe","Subtribus","Subtribus",,
33 33
"1ec02e8f-f2b7-4c65-af9f-b436b34c79a3","Infratribe","Infratribus","Infratribus",,
34
"1fdc0b93-c354-441a-8406-091e0303ff5c","Suprageneric Taxon","Ohne Rang (über Gattung)","'Ohne Rang' Rang oberhalb Gattung: Der Übergattungs-Name hat mit Grund keinen Rang",,
35
"1b11c34c-48a8-4efa-98d5-84f7f66ef43a","Genus","Gattung","Gattung",,
36
"78786e16-2a70-48af-a608-494023b91904","Subgenus","Subgattung","Subgattung",,
37
"a9972969-82cd-4d54-b693-a096422f13fa","Infragenus","Infragattung","Infragattung",,
38
"3edff68f-8527-49b5-bf91-7e4398bb975c","Section bot.","Abteilung bot.","Abteilung (Botanik)",,
39
"d20f5b61-d463-4448-8f8a-c1ff1f262f59","Subsection bot.","Subabteilung bot.","Subsection (Botanik)",,
34
"1fdc0b93-c354-441a-8406-091e0303ff5c","Suprageneric Taxon",,,,
35
"1b11c34c-48a8-4efa-98d5-84f7f66ef43a","Genus","Genus","Genus",,
36
"78786e16-2a70-48af-a608-494023b91904","Subgenus","Subgenus","Subgenus",,
37
"a9972969-82cd-4d54-b693-a096422f13fa","Infragenus","Infragenus","Infragenus",,
38
"3edff68f-8527-49b5-bf91-7e4398bb975c","Section bot.","Sectio bot.","Sectio (botanica)",,
39
"d20f5b61-d463-4448-8f8a-c1ff1f262f59","Subsection bot.","Sectio bot.","Subsectio (botanica)",,
40 40
"d7381ecf-48f8-429b-9c54-f461656978cd","Series","Series","Series",,
41 41
"80c9a263-f4db-4a13-b6c2-b7fec1aa1200","Subseries","Subseries","Subseries",,
42
"41bcc6ac-37d3-4fd4-bb80-3cc5b04298b9","Unranked (infrageneric)","Ohne Rang (infragenerisch)","'Ohne Rang' Rang innerhalb Gattung: Der Infragattungs-Name hat mit Grund keinen Rang",,
42
"41bcc6ac-37d3-4fd4-bb80-3cc5b04298b9","Unranked (infrageneric)",,,,
43 43
"1ecae058-4217-4f75-9c27-6d8ba099ac7a","Species Aggregate",,,,
44 44
"d1988a11-292b-46fa-8fb7-bc64ea6d8fc6","Species Group",,,,
45 45
"b301f787-f319-4ccc-a10f-b4ed3b99a86d","Species","Species","Species",,
......
52 52
"2f4f4303-a099-47e3-9048-d749d735423b","Patho Variety","Patho Varietas","Patho Varietas",,
53 53
"9a83862a-7aee-480c-a98d-4bceaf8712ca","Subvariety","Subvarietas","Subvarietas",,
54 54
"bff22f84-553a-4429-a4e7-c4b3796c3a18","Subsubvariety","Subsubvarietas","Subsubvarietas",,
55
"8810d1ba-6a34-4ae3-a355-919ccd1cd1a5","Proles","Proles",,,,
55
"8810d1ba-6a34-4ae3-a355-919ccd1cd1a5","Proles","Proles","Proles",,,
56 56
"196dee39-cfd8-4460-8bf0-88b83da27f62","Race","Race",,,,
57
"1fafa596-a8e7-4e62-a378-3cc8cb3627ca","Sublusus","Sublusus",,,,
57
"1fafa596-a8e7-4e62-a378-3cc8cb3627ca","Sublusus","Sublusus","Sublusus",,
58 58
"2cc740c9-cebb-43c8-9b06-1bef79e6a56a","Convar",,,,
59 59
"0461281e-458a-47b9-8d41-19a3d39356d5","Form","Forma","Forma",,
60 60
"bed20aee-2f5a-4635-9c02-eff06246d067","Special Form",,,,

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)