Project

General

Profile

Revision 9539d5a9

ID9539d5a9c9cd54aa03bf9abe0ddc0c573a43f4c3
Parent a7424be1
Child 79de4982

Added by Andreas Müller over 2 years ago

ref #6510 adapte rank label activator

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/app/edaphobase/EdaphobaseRankActivator.java
20 20
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
21 21
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK;
22 22
import eu.etaxonomy.cdm.io.terms.RepresentationCsvImportConfigurator;
23
import eu.etaxonomy.cdm.model.common.Language;
23 24

  
24 25
/**
25 26
 * @author a.mueller
......
31 32
    private static final Logger logger = Logger.getLogger(EdaphobaseRankActivator.class);
32 33

  
33 34
    //database validation status (create, update, validate ...)
34
    static DbSchemaValidation dbSchemaValidation = DbSchemaValidation.CREATE;
35
    static DbSchemaValidation dbSchemaValidation = DbSchemaValidation.VALIDATE;
35 36

  
36 37
    static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
37 38
//    static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_edaphobase();
38 39
//    static final ICdmDataSource cdmDestination = CdmDestinations.cdm_production_edaphobase();
39 40

  
40
    static final InputStreamReader rankSource = getGermanRanks();
41

  
42 41
    //check - import
43 42
    static CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
44 43

  
45
    private void doImport(InputStreamReader source, ICdmDataSource cdmDestination){
46

  
44
    private void doImport(ICdmDataSource cdmDestination){
47 45

  
46
        InputStreamReader source = getGermanRanks();
48 47
        RepresentationCsvImportConfigurator config= RepresentationCsvImportConfigurator.NewInstance(source, cdmDestination);
49 48
        config.setDbSchemaValidation(dbSchemaValidation);
49
        config.setLanguageUuid(Language.uuidGerman);
50 50

  
51 51
        CdmDefaultImport<RepresentationCsvImportConfigurator> myImport = new CdmDefaultImport<RepresentationCsvImportConfigurator>();
52 52
        myImport.invoke(config);
53 53

  
54
    }
54
        config.setLanguageUuid(Language.uuidLatin);
55
        config.setSource(getLatinRanks());
56
        myImport.invoke(config);
55 57

  
58
    }
56 59

  
57
    /**
58
     * @return
59
     * @throws IOException
60
     */
61
    private static InputStreamReader getGermanRanks() {
60
    private InputStreamReader getGermanRanks() {
62 61
        String filename = "Rank_de.csv";
63 62
        String path = "terms" + CdmUtils.getFolderSeperator() + filename;
64 63
        try {
......
69 68
            System.exit(-1);
70 69
            return null;
71 70
        }
71
    }
72 72

  
73
    private InputStreamReader getLatinRanks() {
74
        String filename = "Rank_la.csv";
75
        String path = "terms" + CdmUtils.getFolderSeperator() + filename;
76
        try {
77
            InputStreamReader input = CdmUtils.getUtf8ResourceReader(path);
78
            return input;
79
        } catch (IOException e) {
80
            e.printStackTrace();
81
            System.exit(-1);
82
            return null;
83
        }
73 84
    }
74 85

  
75 86

  
......
78 89
     */
79 90
    public static void main(String[] args) {
80 91
        EdaphobaseRankActivator me = new EdaphobaseRankActivator();
81
        me.doImport(rankSource, cdmDestination);
92
        me.doImport(cdmDestination);
82 93
        System.exit(0);
83 94
    }
84 95
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)