Project

General

Profile

Revision d33c0bce

IDd33c0bce9e9bc524a9130ec0dbfb70c7d99ce6a6
Parent cb9b1284
Child 29d21df0

Added by Katja Luther almost 4 years ago

adapt ABCD and GBIF imports to requirements of algae specimen and obeservation imports

View differences:

cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/occurrence/DataResponse.java
1
/**
2
* Copyright (C) 2017 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.ext.occurrence;
10

  
11
import java.net.URI;
12

  
13
/**
14
 * @author k.luther
15
 * @date 21.02.2017
16
 *
17
 */
18
public class DataResponse {
19
    protected final URI dataSetUri;
20

  
21
    protected final String[] tripleID;
22

  
23
    protected final Object dataHolder;
24

  
25
    /**
26
     * @param derivedUnitFacade
27
     * @param dataSetUrl
28
     */
29
    public DataResponse(Object abcdDataHolder, URI dataSetUrl,  String [] tripleID) {
30

  
31
        this.dataHolder = abcdDataHolder;
32
        this.dataSetUri = dataSetUrl;
33

  
34
        this.tripleID = tripleID;
35

  
36

  
37
    }
38

  
39
}
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/occurrence/bioCase/BioCaseResponse.java
1
/**
2
* Copyright (C) 2017 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.ext.occurrence.bioCase;
10

  
11
import java.net.URI;
12

  
13
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
14
import eu.etaxonomy.cdm.ext.occurrence.DataResponse;
15

  
16
/**
17
 * Wrapper class which holds a {@link DerivedUnitFacade} which was parsed from a GBIF JSON response.
18
 * Additionally it holds the {@link URI} to query the Biocase data set web service which
19
 * holds the endpoint URL of the original record and the {@link BiocaseDataSetProtocol}
20
 * @author k.luther
21
 * @date 21.02.2017
22
 *
23
 */
24

  
25
public class BioCaseResponse extends DataResponse{
26

  
27

  
28

  
29

  
30
        /**
31
         * @param derivedUnitFacade
32
         * @param dataSetUrl
33
         */
34
        public BioCaseResponse(Object abcdDataHolder, URI dataSetUrl,  String [] tripleID) {
35
            super(abcdDataHolder, dataSetUrl, tripleID);
36
        }
37

  
38
        public Object getAbcdDataHolder() {
39
            return dataHolder;
40
        }
41

  
42
        public URI getDataSetUri() {
43
            return dataSetUri;
44
        }
45

  
46

  
47
        public String[] getTripleID(){
48
            return tripleID;
49
        }
50

  
51

  
52

  
53

  
54
}
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/occurrence/gbif/GbifResponse.java
11 11
import java.net.URI;
12 12

  
13 13
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
14
import eu.etaxonomy.cdm.ext.occurrence.DataResponse;
14 15
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
15 16

  
16 17
/**
......
21 22
 * @date 27.05.2014
22 23
 *
23 24
 */
24
public class GbifResponse {
25
public class GbifResponse extends DataResponse {
26

  
27

  
25 28

  
26
    private final DerivedUnitFacade derivedUnitFacade;
27
    private final URI dataSetUri;
28 29
    private final GbifDataSetProtocol dataSetProtocol;
29
    private final String[] tripleID;
30

  
30 31
    private final TaxonNameBase scientificName;
31 32
    /**
32 33
     * @param derivedUnitFacade
33 34
     * @param dataSetUrl
34 35
     */
35 36
    public GbifResponse(DerivedUnitFacade derivedUnitFacade, URI dataSetUrl, GbifDataSetProtocol dataSetProtocol, String [] tripleID, TaxonNameBase scientificName) {
36
        super();
37
        this.derivedUnitFacade = derivedUnitFacade;
38
        this.dataSetUri = dataSetUrl;
39
        this.dataSetProtocol = dataSetProtocol;
40
        this.tripleID = tripleID;
37
        super(derivedUnitFacade,dataSetUrl, tripleID);
38
       this.dataSetProtocol = dataSetProtocol;
39

  
41 40
        this.scientificName = scientificName;
42 41

  
43 42
    }
44 43

  
45 44
    public DerivedUnitFacade getDerivedUnitFacade() {
46
        return derivedUnitFacade;
45
        return (DerivedUnitFacade)dataHolder;
47 46
    }
48 47

  
49 48
    public URI getDataSetUri() {
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/specimen/abcd206/in/Abcd206DataHolder.java
39 39

  
40 40

  
41 41

  
42

  
43 42
    protected List<String> associatedUnitIds;
44 43

  
45 44

  
46 45
    protected String institutionCode;
46
    /**
47
     * @return the institutionCode
48
     */
49
    public String getInstitutionCode() {
50
        return institutionCode;
51
    }
52

  
53

  
54

  
55

  
56
    /**
57
     * @param institutionCode the institutionCode to set
58
     */
59
    public void setInstitutionCode(String institutionCode) {
60
        this.institutionCode = institutionCode;
61
    }
62

  
63

  
64

  
65

  
66
    /**
67
     * @return the collectionCode
68
     */
69
    public String getCollectionCode() {
70
        return collectionCode;
71
    }
72

  
73

  
74

  
75

  
76
    /**
77
     * @param collectionCode the collectionCode to set
78
     */
79
    public void setCollectionCode(String collectionCode) {
80
        this.collectionCode = collectionCode;
81
    }
82

  
47 83
    protected String collectionCode;
48 84

  
49 85

  
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/specimen/abcd206/in/Abcd206Import.java
259 259
                    //import unit + field unit data
260 260
                    state.setAssociatedUnitIds(state.getDataHolder().getAssociatedUnitIds());
261 261
                    this.handleSingleUnit(state, item);
262
                    if (state.getConfig().isGetSiblings()){
263
                        getSiblings(state, sourceUri);
264
                    }
262

  
263
//                    if (state.getConfig().isGetSiblings() && (state.getDataHolder().getKindOfUnit().toLowerCase().indexOf("clone")>-1 || state.getDataHolder().getRecordBasis().toLowerCase().indexOf("sample")>-1)){
264
//                        getSiblings(state, sourceUri);
265
//                    }
265 266

  
266 267
                }
267 268
                if(((Abcd206ImportConfigurator)state.getConfig()).isDeduplicateReferences()){
......
765 766
                                    state.reset();
766 767
                                    state.setPrefix(associationWrapper.getPrefix());
767 768
                                    Abcd206ImportParser.setUnitPropertiesXML((Element) associatedUnits.item(m), new Abcd206XMLFieldGetter(state.getDataHolder(), state.getPrefix()), state);
768
                                   // logger.debug("derived unit: " + state.getDerivedUnitBase().toString() + " associated unit: " +state.getDataHolder().getKindOfUnit() + ", " + state.getDataHolder().accessionNumber + ", " + state.getDataHolder().getRecordBasis() + ", " + state.getDataHolder().getUnitID());
769
                                    logger.debug("derived unit: " + state.getDerivedUnitBase().toString() + " associated unit: " +state.getDataHolder().getKindOfUnit() + ", " + state.getDataHolder().accessionNumber + ", " + state.getDataHolder().getRecordBasis() + ", " + state.getDataHolder().getUnitID());
769 770
                                    handleSingleUnit(state, associatedUnits.item(m));
770 771

  
771 772
                                    DerivedUnit associatedUnit = state.getDerivedUnitBase();
......
970 971
            if (state.getDataHolder().getKindOfUnit().toLowerCase().indexOf("clone")>-1) {
971 972
                kindOfUnit = getKindOfUnit(state, null, "clone culture", "clone culture", "cc", null);
972 973
            }
973
            else if (state.getDataHolder().getRecordBasis().toLowerCase().startsWith("live"))  {
974
            else if (state.getDataHolder().getKindOfUnit().toLowerCase().startsWith("live"))  {
974 975
                kindOfUnit = getKindOfUnit(state, null, "live sample", "live sample", "ls", null);
975 976
            }
976 977

  
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/specimen/abcd206/in/Abcd206ImportParser.java
73 73
            abcdFieldGetter.getAssociatedUnitIds(root);
74 74
            abcdFieldGetter.getUnitNotes(root);
75 75
            boolean referencefound = abcdFieldGetter.getReferences(root);
76
            if (!referencefound) {
76
            if (!referencefound && state.getRef() != null) {
77 77
                String[]a = {state.getRef().getTitleCache(),"",""};
78 78
                state.getDataHolder().getReferenceList().add(a);
79 79
            }

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)