Project

General

Profile

« Previous | Next » 

Revision 8876144e

Added by Andreas Müller over 2 years ago

ref #9771 first incomplete version of Cdm2CdmVocabularyImport

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/cdm2cdm/Cdm2CdmImportState.java
9 9
package eu.etaxonomy.cdm.io.cdm2cdm;
10 10

  
11 11
import java.util.HashMap;
12
import java.util.HashSet;
12 13
import java.util.Map;
14
import java.util.Set;
13 15
import java.util.UUID;
14 16

  
15 17
import eu.etaxonomy.cdm.api.application.ICdmRepository;
......
29 31

  
30 32
    private Map<UUID, CdmBase> permanentCache = new HashMap<>();
31 33

  
34
    private Map<UUID, CdmBase> sessionCache = new HashMap<>();
35
    private Map<Class,Set<UUID>> existingObjects = new HashMap<>();
36
    private Set<CdmBase> toSave = new HashSet<>();
37

  
32 38
//************************ CONSTRUCTOR **********************************/
33 39

  
34 40
    protected Cdm2CdmImportState(Cdm2CdmImportConfigurator config) {
......
50 56
    public void putPermanent(UUID uuid, CdmBase cdmBase) {
51 57
        permanentCache.put(uuid, cdmBase);
52 58
    }
59

  
60
    //session cache
61
    public CdmBase getFromSessionCache(UUID uuid) {
62
        return sessionCache.get(uuid);
63
    }
64
    public void putToSessionCache(CdmBase cdmBase) {
65
        this.sessionCache.put(cdmBase.getUuid(), cdmBase);
66
    }
67
    public void clearSessionCache(){
68
        this.sessionCache.clear();
69
    }
70

  
71
    //existing objects
72
    public Set<UUID> getExistingObjects(Class clazz) {
73
        return existingObjects.get(clazz);
74
    }
75
    public void putExistingObjects(Class clazz, Set<UUID> uuids) {
76
        this.existingObjects.put(clazz, uuids);
77
    }
78

  
79
    //to save
80
    public Set<CdmBase> getToSave() {
81
        return toSave;
82
    }
83
    public void addToSave(CdmBase toSave) {
84
        this.toSave.add(toSave);
85
    }
86
    public void removeToSave(CdmBase toSave) {
87
        this.toSave.add(toSave);
88
    }
89
    public void clearToSave() {
90
        this.toSave.clear();
91
    }
53 92
}

Also available in: Unified diff