Revision 1a2cb532
Added by Andreas Kohlbecker almost 5 years ago
src/main/java/eu/etaxonomy/cdm/service/SpecimenTypeDesignationWorkingSetServiceImpl.java | ||
---|---|---|
70 | 70 |
|
71 | 71 |
public static final List<String> TAXON_NAME_INIT_STRATEGY = Arrays.asList(new String []{ |
72 | 72 |
"$", |
73 |
"nomenclaturalReference.authorship", |
|
74 |
"nomenclaturalReference.inReference.authorship", |
|
75 |
"nomenclaturalReference.inReference.inReference.authorship", |
|
73 |
"nomenclaturalReference.authorship.$",
|
|
74 |
"nomenclaturalReference.inReference.authorship.$",
|
|
75 |
"nomenclaturalReference.inReference.inReference.authorship.$",
|
|
76 | 76 |
"status.type", |
77 | 77 |
"typeDesignations" |
78 | 78 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/NameTypeDesignationPresenter.java | ||
---|---|---|
26 | 26 |
import eu.etaxonomy.cdm.api.service.dto.RegistrationDTO; |
27 | 27 |
import eu.etaxonomy.cdm.api.service.name.TypeDesignationSetManager.TypeDesignationWorkingSet; |
28 | 28 |
import eu.etaxonomy.cdm.api.service.registration.IRegistrationWorkingSetService; |
29 |
import eu.etaxonomy.cdm.format.ReferenceEllypsisFormatter; |
|
29 | 30 |
import eu.etaxonomy.cdm.format.ReferenceEllypsisFormatter.LabelType; |
30 | 31 |
import eu.etaxonomy.cdm.model.common.Annotation; |
31 | 32 |
import eu.etaxonomy.cdm.model.name.NameTypeDesignation; |
32 | 33 |
import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus; |
33 | 34 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
34 | 35 |
import eu.etaxonomy.cdm.model.reference.Reference; |
36 |
import eu.etaxonomy.cdm.persistence.dao.initializer.EntityInitStrategy; |
|
35 | 37 |
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD; |
36 | 38 |
import eu.etaxonomy.cdm.service.CdmFilterablePagingProvider; |
37 | 39 |
import eu.etaxonomy.cdm.service.CdmStore; |
... | ... | |
114 | 116 |
*/ |
115 | 117 |
@Override |
116 | 118 |
protected NameTypeDesignation loadCdmEntity(UUID uuid) { |
117 |
List<String> initStrategy = Arrays.asList(new String []{
|
|
119 |
EntityInitStrategy initStrategy = new EntityInitStrategy(Arrays.asList(new String []{
|
|
118 | 120 |
"$", |
119 | 121 |
"annotations.*", // * is needed as log as we are using a table in FilterableAnnotationsField |
120 | 122 |
"typifiedNames.typeDesignations", // important !! |
121 | 123 |
"typeName.$", |
122 |
"citation.authorship.$", |
|
123 |
"citation.inReference.authorship.$", |
|
124 |
"citation.inReference.inReference.authorship.$" |
|
124 |
"citation" |
|
125 | 125 |
} |
126 |
); |
|
126 |
));
|
|
127 | 127 |
|
128 |
initStrategy.extend("citation", ReferenceEllypsisFormatter.INIT_STRATEGY, false); |
|
128 | 129 |
NameTypeDesignation typeDesignation; |
129 | 130 |
if(uuid != null){ |
130 |
typeDesignation = (NameTypeDesignation) getRepo().getNameService().loadTypeDesignation(uuid, initStrategy); |
|
131 |
typeDesignation = (NameTypeDesignation) getRepo().getNameService().loadTypeDesignation(uuid, initStrategy.getPropertyPaths());
|
|
131 | 132 |
} else { |
132 | 133 |
typeDesignation = createNewBean(); |
133 | 134 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNameEditorPresenter.java | ||
---|---|---|
30 | 30 |
import com.vaadin.ui.Field; |
31 | 31 |
|
32 | 32 |
import eu.etaxonomy.cdm.api.service.INameService; |
33 |
import eu.etaxonomy.cdm.format.ReferenceEllypsisFormatter; |
|
33 | 34 |
import eu.etaxonomy.cdm.format.ReferenceEllypsisFormatter.LabelType; |
34 | 35 |
import eu.etaxonomy.cdm.model.agent.AgentBase; |
35 | 36 |
import eu.etaxonomy.cdm.model.agent.Person; |
... | ... | |
49 | 50 |
import eu.etaxonomy.cdm.model.term.TermType; |
50 | 51 |
import eu.etaxonomy.cdm.persistence.dao.common.Restriction; |
51 | 52 |
import eu.etaxonomy.cdm.persistence.dao.common.Restriction.Operator; |
53 |
import eu.etaxonomy.cdm.persistence.dao.initializer.EntityInitStrategy; |
|
52 | 54 |
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD; |
53 | 55 |
import eu.etaxonomy.cdm.service.CdmFilterablePagingProvider; |
54 | 56 |
import eu.etaxonomy.cdm.service.TaxonNameStringFilterablePagingProvider; |
... | ... | |
100 | 102 |
"homotypicalGroup.typifiedNames" |
101 | 103 |
); |
102 | 104 |
|
103 |
public static final List<String> REFERENCE_INIT_STRATEGY = Arrays.asList("authorship", "inReference.authorship", "inReference.inReference.authorship", "inReference.inReference.inReference.authorship");
|
|
105 |
public static List<String> REFERENCE_INIT_STRATEGY = ReferenceEllypsisFormatter.INIT_STRATEGY;
|
|
104 | 106 |
|
105 | 107 |
|
106 | 108 |
private static final Logger logger = Logger.getLogger(TaxonNameEditorPresenter.class); |
... | ... | |
155 | 157 |
getView().getExBasionymAuthorshipField().setFilterableTeamPagingProvider(termOrPersonPagingProvider, this); |
156 | 158 |
getView().getExBasionymAuthorshipField().setFilterablePersonPagingProvider(personPagingProvider, this); |
157 | 159 |
|
158 |
getView().getNomReferenceCombobox().getSelect().setCaptionGenerator( |
|
159 |
new ReferenceEllypsisCaptionGenerator(LabelType.NOMENCLATURAL, getView().getNomReferenceCombobox().getSelect()) |
|
160 |
); |
|
161 | 160 |
nomReferencePagingProvider = pagingProviderFactory.referencePagingProvider(); |
162 | 161 |
nomReferencePagingProvider.setInitStrategy(REFERENCE_INIT_STRATEGY); |
163 | 162 |
getView().getNomReferenceCombobox().loadFrom(nomReferencePagingProvider, nomReferencePagingProvider, nomReferencePagingProvider.getPageSize()); |
164 | 163 |
getView().getNomReferenceCombobox().setNestedButtonStateUpdater(new ToOneRelatedEntityButtonUpdater<Reference>(getView().getNomReferenceCombobox())); |
165 |
getView().getNomReferenceCombobox().getSelect().setCaptionGenerator(new ReferenceEllypsisCaptionGenerator(LabelType.BIBLIOGRAPHIC, getView().getNomReferenceCombobox().getSelect()) |
|
166 |
); |
|
164 |
getView().getNomReferenceCombobox().getSelect().setCaptionGenerator(new ReferenceEllypsisCaptionGenerator(LabelType.NOMENCLATURAL, getView().getNomReferenceCombobox().getSelect())); |
|
167 | 165 |
getView().getNomReferenceCombobox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<>(getView().getNomReferenceCombobox(), this)); |
168 | 166 |
getView().getNomReferenceCombobox().getSelect().addValueChangeListener( e -> updateOrthographicCorrectionRestriction()); |
169 | 167 |
|
... | ... | |
281 | 279 |
@Override |
282 | 280 |
protected TaxonName loadCdmEntity(UUID identifier) { |
283 | 281 |
|
284 |
List<String> initStrategy = Arrays.asList( |
|
282 |
EntityInitStrategy initStrategy = new EntityInitStrategy( |
|
283 |
Arrays.asList( |
|
285 | 284 |
"$", |
286 | 285 |
"annotations.type", |
287 | 286 |
"annotations.*", // needed as log as we are using a table in FilterableAnnotationsField |
288 | 287 |
"rank.vocabulary", // needed for comparing ranks |
289 | 288 |
|
290 |
"nomenclaturalReference.authorship", |
|
291 |
"nomenclaturalReference.inReference.authorship", |
|
292 |
"nomenclaturalReference.inReference.inReference.authorship", |
|
293 |
"nomenclaturalReference.inReference.inReference.inReference.authorship", |
|
289 |
"nomenclaturalReference", |
|
294 | 290 |
|
295 | 291 |
"status.type", |
296 |
"status.citation.authorship.$", |
|
297 |
"status.citation.inReference.authorship.$", |
|
298 |
"status.citation.inReference.inReference.authorship.$", |
|
292 |
"status.citation", |
|
299 | 293 |
|
300 | 294 |
"combinationAuthorship", |
301 | 295 |
"exCombinationAuthorship", |
... | ... | |
312 | 306 |
"relationsToThisName.fromName.nomenclaturalReference.inReference.inReference.inReference.authorship", |
313 | 307 |
"relationsToThisName.fromName.relationsToThisName", |
314 | 308 |
"relationsToThisName.fromName.relationsFromThisName", |
315 |
"relationsToThisName.citation.authorship", |
|
316 |
"relationsToThisName.citation.inReference.authorship", |
|
317 |
"relationsToThisName.citation.inReference.inReference.authorship", |
|
318 |
|
|
309 |
"relationsToThisName.citation", |
|
319 | 310 |
"relationsFromThisName", |
320 | 311 |
"homotypicalGroup.typifiedNames" |
321 |
); |
|
312 |
) |
|
313 |
); |
|
314 |
initStrategy.extend("nomenclaturalReference", ReferenceEllypsisFormatter.INIT_STRATEGY, false); |
|
315 |
initStrategy.extend("status.citation", ReferenceEllypsisFormatter.INIT_STRATEGY, false); |
|
316 |
initStrategy.extend("relationsToThisName.citation", ReferenceEllypsisFormatter.INIT_STRATEGY, false); |
|
322 | 317 |
|
323 | 318 |
TaxonName taxonName; |
324 | 319 |
if(identifier != null){ |
325 |
taxonName = getRepo().getNameService().load(identifier, initStrategy); |
|
320 |
taxonName = getRepo().getNameService().load(identifier, initStrategy.getPropertyPaths());
|
|
326 | 321 |
} else { |
327 | 322 |
taxonName = createCdmEntity(); |
328 | 323 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferenceEditorPresenter.java | ||
---|---|---|
23 | 23 |
import com.vaadin.spring.annotation.SpringComponent; |
24 | 24 |
|
25 | 25 |
import eu.etaxonomy.cdm.api.service.IService; |
26 |
import eu.etaxonomy.cdm.format.ReferenceEllypsisFormatter; |
|
26 | 27 |
import eu.etaxonomy.cdm.format.ReferenceEllypsisFormatter.LabelType; |
27 | 28 |
import eu.etaxonomy.cdm.model.agent.AgentBase; |
28 | 29 |
import eu.etaxonomy.cdm.model.agent.Institution; |
... | ... | |
35 | 36 |
import eu.etaxonomy.cdm.model.reference.ReferenceType; |
36 | 37 |
import eu.etaxonomy.cdm.persistence.dao.common.Restriction; |
37 | 38 |
import eu.etaxonomy.cdm.persistence.dao.common.Restriction.Operator; |
39 |
import eu.etaxonomy.cdm.persistence.dao.initializer.EntityInitStrategy; |
|
38 | 40 |
import eu.etaxonomy.cdm.service.CdmFilterablePagingProvider; |
39 | 41 |
import eu.etaxonomy.cdm.service.UserHelperAccess; |
40 | 42 |
import eu.etaxonomy.cdm.vaadin.event.EditorActionTypeFilter; |
... | ... | |
159 | 161 |
@Override |
160 | 162 |
protected Reference loadCdmEntity(UUID identifier) { |
161 | 163 |
|
162 |
List<String> initStrategy = Arrays.asList(new String []{
|
|
164 |
EntityInitStrategy initStrategy = new EntityInitStrategy(Arrays.asList(new String []{
|
|
163 | 165 |
"$", |
164 | 166 |
"annotations.*", // needed as log as we are using a table in FilterableAnnotationsField |
165 | 167 |
} |
166 |
); |
|
168 |
)); |
|
169 |
initStrategy.extend("", ReferenceEllypsisFormatter.INIT_STRATEGY, false); |
|
167 | 170 |
|
168 | 171 |
Reference reference; |
169 | 172 |
if(identifier != null){ |
170 |
reference = getRepo().getReferenceService().load(identifier, initStrategy); |
|
173 |
reference = getRepo().getReferenceService().load(identifier, initStrategy.getPropertyPaths());
|
|
171 | 174 |
} else { |
172 | 175 |
reference = createNewBean(); |
173 | 176 |
} |
Also available in: Unified diff
ref #8209 modularization of reference init strategies by using the EntitiyInitStrategy class