Project

General

Profile

Revision 97e2d1bd

ID97e2d1bdcaa60e15aca450abb04d8493b2ff3a36
Parent 20821e94
Child 5ca1634c

Added by Patrick Plitzner over 1 year ago

ref #6774 Refactor export class inheritance

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/descriptive/owl/out/StructureTreeOwlExportConfigurator.java
15 15

  
16 16
import org.apache.log4j.Logger;
17 17

  
18
import eu.etaxonomy.cdm.database.ICdmDataSource;
19
import eu.etaxonomy.cdm.io.common.XmlExportConfiguratorBase;
18
import eu.etaxonomy.cdm.io.common.ExportConfiguratorBase;
19
import eu.etaxonomy.cdm.io.common.mapping.out.IExportTransformer;
20 20
import eu.etaxonomy.cdm.model.term.FeatureTree;
21 21

  
22 22

  
......
26 26
 * @since May 2, 2019
27 27
 *
28 28
 */
29
public class StructureTreeOwlExportConfigurator extends XmlExportConfiguratorBase<StructureTreeOwlExportState> {
29
public class StructureTreeOwlExportConfigurator extends ExportConfiguratorBase<StructureTreeOwlExportState, IExportTransformer, File> {
30 30

  
31 31
    private static final long serialVersionUID = -4360021755279592592L;
32 32

  
......
37 37
    private List<UUID> vocabularyUuids;
38 38

  
39 39

  
40
    private StructureTreeOwlExportConfigurator(
41
            ICdmDataSource source,
42
            File destinationFolder,
43
            List<FeatureTree> featureTrees,
44
            List<UUID> vocabularyUuids) {
45
        super(destinationFolder, source, null);
46
        this.featureTrees = featureTrees;
47
        this.vocabularyUuids = vocabularyUuids;
40
    private StructureTreeOwlExportConfigurator() {
41
        super(null);
48 42
    }
49 43

  
50
    public static StructureTreeOwlExportConfigurator NewInstance(
51
            ICdmDataSource source,
52
            File destinationFolder,
53
            List<FeatureTree> featureTrees,
54
            List<UUID> vocabularyUuids) {
55
        return new StructureTreeOwlExportConfigurator(source, destinationFolder, featureTrees, vocabularyUuids);
44
    public static StructureTreeOwlExportConfigurator NewInstance() {
45
        return new StructureTreeOwlExportConfigurator();
56 46
    }
57 47

  
58 48
    @Override
......
77 67
        return vocabularyUuids;
78 68
    }
79 69

  
70
    public void setFeatureTrees(List<FeatureTree> featureTrees) {
71
        this.featureTrees = featureTrees;
72
    }
73

  
74
    public void setVocabularyUuids(List<UUID> vocabularyUuids) {
75
        this.vocabularyUuids = vocabularyUuids;
76
    }
77

  
78
    @Override
79
    public String getDestinationNameString() {
80
        return null;
81
    }
82

  
80 83
}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/descriptive/owl/out/StructureTreeOwlExportState.java
8 8
*/
9 9
package eu.etaxonomy.cdm.io.descriptive.owl.out;
10 10

  
11
import java.io.File;
12

  
11 13
import org.apache.log4j.Logger;
12 14

  
13 15
import com.hp.hpl.jena.rdf.model.Model;
14 16
import com.hp.hpl.jena.rdf.model.ModelFactory;
15 17
import com.hp.hpl.jena.rdf.model.Property;
16 18

  
17
import eu.etaxonomy.cdm.io.common.XmlExportState;
19
import eu.etaxonomy.cdm.io.common.ExportStateBase;
20
import eu.etaxonomy.cdm.io.common.mapping.out.IExportTransformer;
18 21
import eu.etaxonomy.cdm.io.descriptive.owl.OwlConstants;
19 22

  
20 23
/**
......
23 26
 * @since May 2, 2019
24 27
 *
25 28
 */
26
public class StructureTreeOwlExportState extends XmlExportState<StructureTreeOwlExportConfigurator>{
29
public class StructureTreeOwlExportState extends ExportStateBase<StructureTreeOwlExportConfigurator, IExportTransformer, File>{
27 30

  
28 31
    static Property propHasSubStructure;
29 32
    static Property propHasRepresentation;
cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/owl/out/OwlExportTest.java
60 60
    @DataSet(loadStrategy=CleanSweepInsertLoadStrategy.class, value="/eu/etaxonomy/cdm/database/BlankDataSet.xml")
61 61
    public void testEmptyData(){
62 62
        File destinationFolder = null;
63
        StructureTreeOwlExportConfigurator config = StructureTreeOwlExportConfigurator.NewInstance(
64
                null,
65
                destinationFolder,
66
                createFeatureTree(),
67
                Collections.EMPTY_LIST);
63
        StructureTreeOwlExportConfigurator config = StructureTreeOwlExportConfigurator.NewInstance();
64
        config.setFeatureTrees(createFeatureTree());
65
        config.setVocabularyUuids(Collections.EMPTY_LIST);
66
        config.setDestination(destinationFolder);
68 67
        config.setTarget(TARGET.EXPORT_DATA);
69 68
        ExportResult result = defaultExport.invoke(config);
70 69
        System.out.println(result.createReport());

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)