Project

General

Profile

« Previous | Next » 

Revision 2c298347

Added by Patrick Plitzner over 7 years ago

ref #5448 Add new rank "forme"

  • did some refactoring and advanced logging

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportClassification.java
169 169

  
170 170
        //Gesamtliste
171 171
        TaxonBase<?> taxonBase = state.getRelatedObject(RedListUtil.TAXON_GESAMTLISTE_NAMESPACE, String.valueOf(id), TaxonBase.class);
172
        taxonBase.setSec(gesamtListeClassification.getReference());
172 173
        Taxon parent = state.getRelatedObject(RedListUtil.TAXON_GESAMTLISTE_NAMESPACE, parentId, Taxon.class);
173 174
        if(parent!=null && !parent.isInstanceOf(Taxon.class)){
174 175
            RedListUtil.logMessage(id, parent+" is no taxon but is a parent of "+taxonBase+" (Gesamtliste)", logger);
......
182 183
                Taxon family = (Taxon) state.getRelatedObject(RedListUtil.FAMILY_NAMESPACE_GESAMTLISTE, familieString);
183 184
                gesamtListeClassification.addParentChild(family, HibernateProxyHelper.deproxy(taxonBase, Taxon.class), null, null);
184 185
                //Buttler/Checklist taxon
185
                if(CdmUtils.isNotBlank(clTaxonString) && clTaxonString.equals("b")){
186
                if(CdmUtils.isNotBlank(clTaxonString) && clTaxonString.equals(RedListUtil.CL_TAXON_B)){
186 187
                    checklistClassification.addParentChild(family, HibernateProxyHelper.deproxy(taxonBase, Taxon.class), null, null);
188
                    taxonBase.setSec(checklistClassification.getReference());
187 189
                }
188 190
                if(family.getTaxonNodes().isEmpty()){
189 191
                    gesamtListeClassification.addChildTaxon(family, null, null);
......
198 200
        else{
199 201
            createParentChildNodes(gesamtListeClassification, id, gueltString, taxZusatzString, taxonBase, parent);
200 202
            //Buttler/Checklist taxon
201
            if(CdmUtils.isNotBlank(clTaxonString) && clTaxonString.equals("b")){
202
                if(taxonBase.isInstanceOf(Taxon.class)){
203
                    createParentChildNodes(checklistClassification, id, gueltString, taxZusatzString, taxonBase, parent);
203
            if(CdmUtils.isNotBlank(clTaxonString) && clTaxonString.equals(RedListUtil.CL_TAXON_B)){
204
                if(!checklistClassification.isTaxonInTree(parent)){
205
                    RedListUtil.logInfoMessage(id, parent+" is parent taxon but is not in checklist. Skipping child "+taxonBase, logger);
204 206
                }
205
                else if(taxonBase.isInstanceOf(Synonym.class)){
206
                    //if it is a synonym it is already added to the accepted taxon
207
                    //so we just change the sec reference
208
                    taxonBase.setSec(checklistClassification.getReference());
209
                    taxonBase.setTitleCache(null);
207
                else{
208
                    if(taxonBase.isInstanceOf(Taxon.class)){
209
                        createParentChildNodes(checklistClassification, id, gueltString, taxZusatzString, taxonBase, parent);
210
                    }
211
                    else if(taxonBase.isInstanceOf(Synonym.class)){
212
                        //if it is a synonym it is already added to the accepted taxon
213
                        //so we just change the sec reference
214
                        taxonBase.setSec(checklistClassification.getReference());
215
                        taxonBase.setTitleCache(null);
216
                    }
210 217
                }
211 218

  
212 219
            }
213 220
        }
221
        taxonBase.setTitleCache(null, false);//refresh title cache
214 222

  
215 223
        //add taxa for concept relationships to E, W, K, AW, AO, R, O, S
216 224
        addTaxonToClassification(classificationE, RedListUtil.CLASSIFICATION_NAMESPACE_E, relationE, taxonBase, id, state);
......
325 333
        }
326 334
        //set sec reference
327 335
        taxonBase.setSec(classification.getReference());
328
        taxonBase.setTitleCache(null, false);//refresh title cache
329 336
    }
330 337

  
331 338
    @Override
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportNames.java
166 166
        //---TAXON---
167 167
        TaxonBase<?> taxonBase = importTaxon(rs, name, state);
168 168
        if(taxonBase==null){
169
            RedListUtil.logMessage(id, "Taxon for name "+name+" could not be created.", logger);
169
            RedListUtil.logMessage(id, "!SERIOUS ERROR! Taxon for name "+name+" could not be created!", logger);
170 170
            return;
171 171
        }
172 172

  
......
235 235
            taxonBase = Synonym.NewInstance(name, null);
236 236
        }
237 237
        else{
238
            RedListUtil.logMessage(id, "Taxon was not created!! Unknown value for "+RedListUtil.GUELT+"!", logger);
238 239
            return null;
239 240
        }
240 241

  
......
615 616
            else if(rankStr.equals("KMB")){
616 617
                return getRank(state, RedListUtil.uuidRankCombination, "Combination", "Combination", "", (OrderedTermVocabulary<Rank>) Rank.GENUS().getVocabulary(), null, RankClass.Infraspecific);
617 618
            }
619
            else if(rankStr.equals("'FO")){
620
                return getRank(state, RedListUtil.uuidRankForme, "Forme'", "Forme'", "", (OrderedTermVocabulary<Rank>) Rank.GENUS().getVocabulary(), null, RankClass.Infraspecific);
621
            }
618 622
            else{
619 623
                rank = state.getTransformer().getRankByKey(rankStr);
620 624
            }
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListUtil.java
50 50
    public static final UUID uuidRankLusus = UUID.fromString("4c8e12f6-2c16-4eda-a7d9-2fd247dcce789");
51 51
    public static final UUID uuidRankSubspeciesPrincipes = UUID.fromString("b6b9351b-6beb-431d-8c7a-d30fe0cf3a90");
52 52
    public static final UUID uuidRankCombination = UUID.fromString("ec2c580e-416a-4ecf-85df-d03641f3bd64");
53
    public static final UUID uuidRankForme = UUID.fromString("05b4f66f-5559-4e44-bbb8-70744a5ea64a");
53 54

  
54 55
    public static final String NAME_NAMESPACE = "name";
55 56
    public static final String AUTHOR_NAMESPACE = "author";
......
71 72
    public static final String GUELT_BASIONYM = "b";
72 73
    public static final String GUELT_SYNONYM = "x";
73 74
    public static final String GUELT_ACCEPTED_TAXON = "1";
75
    public static final String CL_TAXON_B = "b";
76
    public static final String CL_TAXON_K = "k";
74 77
    public static final String HYB_X = "x";
75 78
    public static final String HYB_XF = "xf";
76 79
    public static final String HYB_XS = "xs";
......
86 89
    public static final String NAMNR = "NAMNR";
87 90
    public static final String SEQNUM = "SEQNUM";
88 91
    public static final String GUELT = "GUELT";
89
    public static final String LOWER = "LOWER";
92
    public static final String LOWER = "LOWER_G";
90 93
    public static final String AUTOR_BASI = "AUTOR_BASI";
91 94
    public static final String AUTOR_KOMB = "AUTOR_KOMB";
92 95
    public static final String ZUSATZ = "ZUSATZ";
......
120 123
    public static final String AO = "AO";
121 124
    public static final String R = "R";
122 125
    public static final String O = "O";
123
    public static final String S = "S";
126
    public static final String S = "S1";
127
    public static final String S2 = "S2";
124 128

  
125 129
    public static void logMessage(long id, String message, Logger logger){
126 130
        logger.error(NAMNR+": "+id+" "+message);

Also available in: Unified diff