Project

General

Profile

« Previous | Next » 

Revision 87272062

Added by Patrick Plitzner about 8 years ago

Fix taxon node creation for nodes with no parents

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportClassification.java
117 117
        if(taxonBaseCL!=null){//null check necessary because not all taxa exist in the checklist
118 118
            createParentChildNodes(checklistClassification, id, gueltString, taxZusatzString, taxonBaseCL, parentCL);
119 119
        }
120

  
121
        if(taxonBaseGL!= null && taxonBaseCL!=null
122
                && taxonBaseGL.getUuid().equals(taxonBaseCL.getUuid())){
123
            RedListUtil.logMessage(id, "Same UUID for "+taxonBaseGL+ " (Gesamtliste) and "+taxonBaseCL+" (Checkliste", logger);
124
        }
125
        if(parentGL!=null && parentCL!=null && parentGL.getUuid().equals(parentCL.getUuid())){
126
            RedListUtil.logMessage(id, "Same UUID for "+parentGL+ " (Gesamtliste) and "+parentCL+" (Checkliste", logger);
127
        }
120 128
    }
121 129

  
122 130
    private void createParentChildNodes(Classification classification, long id, String gueltString,
123 131
            String taxZusatzString, TaxonBase taxonBase, Taxon parent) {
124
        if(parent==null){
125
            RedListUtil.logMessage(id, "parent taxon of "+taxonBase+"  is null." , logger);
126
            return;
127
        }
128 132
        if(taxonBase==null){
129
            RedListUtil.logMessage(id, "child taxon/synonym of "+parent+"  is null." , logger);
133
            RedListUtil.logMessage(id, "child taxon/synonym of "+parent+"  is null. ("+classification.getTitleCache()+")" , logger);
130 134
            return;
131 135
        }
132 136
        //taxon
......
134 138
            //misapplied name
135 139
            String appendedPhrase = taxonBase.getAppendedPhrase();
136 140
            if(appendedPhrase!=null && appendedPhrase.equals(RedListUtil.AUCT)){
141
                if(parent==null){
142
                    RedListUtil.logMessage(id, "parent taxon of misapplied name "+taxonBase+"  is null. ("+classification.getTitleCache()+")" , logger);
143
                    return;
144
                }
137 145
                parent.addMisappliedName((Taxon) taxonBase, null, null);
138 146
            }
139 147
            else{
......
148 156
        }
149 157
        //synonym
150 158
        else if(taxonBase.isInstanceOf(Synonym.class)){
159
            if(parent==null){
160
                RedListUtil.logMessage(id, "parent taxon of synonym "+taxonBase+"  is null. ("+classification.getTitleCache()+")" , logger);
161
                return;
162
            }
151 163
            //basionym
152 164
            if(gueltString.equals(RedListUtil.GUELT_BASIONYM)){
153 165
                parent.addHomotypicSynonym((Synonym) taxonBase, null, null);
......
182 194
        }
183 195
        //set sec reference
184 196
        taxonBase.setSec(classification.getReference());
197
        taxonBase.setTitleCache(null, false);//refresh title cache
185 198
    }
186 199

  
187 200
    @Override
......
219 232
        Classification checklistClassification = Classification.NewInstance("Checkliste");
220 233
        checklistClassification.setUuid(RedListUtil.checkListClassificationUuid);
221 234
        Reference checklistReference = ReferenceFactory.newGeneric();
222
        checklistReference.setUuid(RedListUtil.checkListClassificationUuid);
223
        checklistReference.setTitle("Gesamtliste");
235
        checklistReference.setUuid(RedListUtil.checkListReferenceUuid);
236
        checklistReference.setTitle("Checkliste");
224 237
        checklistClassification.setReference(checklistReference);
225 238
        getClassificationService().save(checklistClassification);
226 239
    }
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListUtil.java
34 34
//    public static final UUID checkListClassificationUuid = UUID.fromString("e19bb2e6-d898-4793-8cd4-d866eeb1f872");
35 35
//    public static final UUID checkListClassificationUuid = UUID.fromString("53e81162-5c2d-425b-bbe6-6e8d12e85790");
36 36

  
37

  
38

  
39

  
40

  
41

  
42

  
43

  
44

  
45

  
46

  
47 37
    public static final String NAME_NAMESPACE = "name";
48 38
    public static final String TAXON_GESAMTLISTE_NAMESPACE = "taxon_gesamt_liste";
49 39
    public static final String TAXON_CHECKLISTE_NAMESPACE = "taxon_checkliste";
50 40
    public static final String AUTHOR_NAMESPACE = "author";
51 41

  
42

  
43
    //cell content
44
    public static final String HYBRID_CHAR = "";
52 45
    public static final String AUCT = "auct.";
53 46
    public static final String EX = " ex ";
54 47
    public static final String GUELT_BASIONYM = "b";
55 48
    public static final String GUELT_SYNONYM = "x";
56 49
    public static final String GUELT_ACCEPTED_TAXON = "1";
57 50

  
58

  
51
    //column names
59 52
    public static final String GUELT = "GUELT";
60 53
    public static final String LOWER = "LOWER";
61 54
    public static final String NAMNR = "NAMNR";

Also available in: Unified diff