Revision b8853d8d
Added by Andreas Kohlbecker over 6 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationWorkingsetEditorPresenter.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.cdm.vaadin.view.name; |
10 | 10 |
|
11 |
import java.util.ArrayList; |
|
11 | 12 |
import java.util.Arrays; |
12 | 13 |
import java.util.EnumSet; |
13 | 14 |
import java.util.HashSet; |
... | ... | |
18 | 19 |
import org.vaadin.viritin.fields.AbstractElementCollection; |
19 | 20 |
|
20 | 21 |
import eu.etaxonomy.cdm.api.service.IRegistrationService; |
21 |
import eu.etaxonomy.cdm.cache.CdmEntityCache;
|
|
22 |
import eu.etaxonomy.cdm.cache.EntityCache;
|
|
22 |
import eu.etaxonomy.cdm.cache.CdmTransientEntityCacher;
|
|
23 |
import eu.etaxonomy.cdm.model.ICdmCacher;
|
|
23 | 24 |
import eu.etaxonomy.cdm.model.agent.AgentBase; |
24 | 25 |
import eu.etaxonomy.cdm.model.agent.Person; |
25 | 26 |
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; |
27 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
26 | 28 |
import eu.etaxonomy.cdm.model.location.Country; |
27 | 29 |
import eu.etaxonomy.cdm.model.name.Registration; |
28 | 30 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation; |
... | ... | |
80 | 82 |
*/ |
81 | 83 |
private EnumSet<CRUD> crud = null; |
82 | 84 |
|
83 |
private CdmEntityCache cache = null;
|
|
85 |
private ICdmCacher cache = new CdmTransientEntityCacher(this);
|
|
84 | 86 |
|
85 | 87 |
SpecimenTypeDesignationWorkingSetDTO<Registration> workingSetDto; |
86 | 88 |
|
... | ... | |
90 | 92 |
|
91 | 93 |
private ReferencePopupEditor referencePopupEditor; |
92 | 94 |
|
95 |
private java.util.Collection<CdmBase> rootEntities = new ArrayList<>(); |
|
96 |
|
|
93 | 97 |
protected CdmStore<Registration, IRegistrationService> getStore() { |
94 | 98 |
if(store == null){ |
95 | 99 |
store = new CdmStore<>(getRepo(), getRepo().getRegistrationService()); |
... | ... | |
124 | 128 |
// This method must go again into the presenter !!!! |
125 | 129 |
logger.info("Basing all typeDesignations on a new fieldUnit"); |
126 | 130 |
} |
127 |
cache = new CdmEntityCache(workingSetDto.getOwner()); |
|
131 |
cache.put(workingSetDto.getOwner()); |
|
132 |
rootEntities.add(workingSetDto.getOwner()); |
|
128 | 133 |
} else { |
129 | 134 |
// create a new workingset, for a new fieldunit which is the base for the workingset |
130 | 135 |
workingSetDto = specimenTypeDesignationWorkingSetService.create(idset.registrationId, idset.publicationId, idset.typifiedNameId); |
131 |
cache = new CdmEntityCache(workingSetDto.getOwner()); |
|
136 |
cache.put(workingSetDto.getOwner()); |
|
137 |
rootEntities.add(workingSetDto.getOwner()); |
|
132 | 138 |
} |
133 | 139 |
|
134 | 140 |
} else { |
... | ... | |
287 | 293 |
* {@inheritDoc} |
288 | 294 |
*/ |
289 | 295 |
@Override |
290 |
public EntityCache getCache() {
|
|
296 |
public ICdmCacher getCache() {
|
|
291 | 297 |
return cache; |
292 |
// if(((AbstractPopupEditor)getView()).isBeanLoaded()){ |
|
293 |
// } else { |
|
294 |
// return null; |
|
295 |
// } |
|
296 | 298 |
} |
297 | 299 |
|
298 | 300 |
/** |
... | ... | |
328 | 330 |
public void onCollectionEvent(EntityChangeEvent event){ |
329 | 331 |
|
330 | 332 |
Collection newCollection = getRepo().getCollectionService().load(event.getEntityId(), Arrays.asList(new String[]{"$.institute"})); |
331 |
cache.findAndUpdate(newCollection);
|
|
333 |
cache.getFromCache(newCollection);
|
|
332 | 334 |
|
333 | 335 |
for( CollectionRowItemCollection row : collectionPopuEditorSourceRows) { |
334 | 336 |
ToOneRelatedEntityCombobox<Collection> combobox = row.getComponent(ToOneRelatedEntityCombobox.class, 2); |
... | ... | |
359 | 361 |
public void onReferenceEvent(EntityChangeEvent event){ |
360 | 362 |
|
361 | 363 |
Reference newRef = getRepo().getReferenceService().load(event.getEntityId(), Arrays.asList(new String[]{"$"})); |
362 |
cache.findAndUpdate(newRef);
|
|
364 |
cache.getFromCache(newRef);
|
|
363 | 365 |
|
364 | 366 |
for( CollectionRowItemCollection row : collectionPopuEditorSourceRows) { |
365 | 367 |
ToOneRelatedEntityCombobox<Collection> combobox = row.getComponent(ToOneRelatedEntityCombobox.class, 6); |
... | ... | |
368 | 370 |
} |
369 | 371 |
|
370 | 372 |
|
373 |
/** |
|
374 |
* {@inheritDoc} |
|
375 |
*/ |
|
376 |
@Override |
|
377 |
public java.util.Collection<CdmBase> getRootEntities() { |
|
378 |
return rootEntities ; |
|
379 |
} |
|
380 |
|
|
381 |
|
|
371 | 382 |
|
372 | 383 |
} |
Also available in: Unified diff
ref #7206 replacing CdmEntityCache by CdmTransientEntityCacher and implementing EntityCacheDebugger