Project

General

Profile

Revision 2d006ce7

ID2d006ce76d0d97f55d7fbde695e0bea93d117270
Parent 0f14b608
Child 633a72e4

Added by Katja Luther about 1 year ago

filter intext references in cdmlight export

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/cdmLight/CdmLightClassificationExport.java
464 464
                   for (Language language: textData.getMultilanguageText().keySet()){
465 465
                       String[] csvLineLanguage = csvLine.clone();
466 466
                       LanguageString langString = textData.getLanguageText(language);
467

  
468
                       csvLineLanguage[table.getIndex(CdmLightExportTable.FACT_TEXT)] = langString.getText();
467
                       String text = langString.getText();
468
                       if (state.getConfig().isFilterIntextReferences()){
469
                           text = filterIntextReferences(langString.getText());
470
                       }
471
                       csvLineLanguage[table.getIndex(CdmLightExportTable.FACT_TEXT)] = text;
469 472
                       csvLineLanguage[table.getIndex(CdmLightExportTable.LANGUAGE)] = language.getLabel();
470 473
                       state.getProcessor().put(table, textData, csvLineLanguage);
471 474
                   }
......
481 484

  
482 485

  
483 486
    /**
487
     * @param text
488
     * @return
489
     */
490
    private String filterIntextReferences(String text) {
491
        /*
492
         * (<cdm:reference cdmId='fbd19251-efee-4ded-b780-915000f66d41' intextId='1352d42c-e201-4155-a02a-55360d3b563e'>Ridley in Fl. Malay Pen. 3 (1924) 22</cdm:reference>)
493
         */
494

  
495
       String newText = text.replaceAll("<cdm:reference cdmId='[a-z0-9\\-]*' intextId='[a-z0-9\\-]*'>","");
496
       newText = newText.replaceAll("</cdm:reference>","");
497
       return newText;
498
    }
499

  
500
    /**
484 501
     * @param state
485 502
     * @param specimenFacts
486 503
     */
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/cdmLight/CdmLightExportConfigurator.java
37 37

  
38 38
    private boolean createZipFile = false;
39 39

  
40
    private boolean isFilterIntextReferences = true;
41

  
40 42
    /**
41 43
     * @param transformer
42 44
     */
......
124 126
    }
125 127

  
126 128

  
129
    public boolean isFilterIntextReferences() {
130
        return isFilterIntextReferences;
131
    }
132

  
133

  
134
    public void setRemoveIntextReferences(boolean isRemoveIntextReferences) {
135
        this.isFilterIntextReferences = isRemoveIntextReferences;
136
    }
137

  
138

  
127 139
//    public Set<UUID> getTaxonNodeUuids() {
128 140
//        return taxonNodeUuids;
129 141
//    }

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)