Revision 0844524a
Added by Andreas Kohlbecker about 6 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/NameTypeDesignationPresenter.java | ||
---|---|---|
12 | 12 |
import java.util.EnumSet; |
13 | 13 |
import java.util.HashSet; |
14 | 14 |
import java.util.List; |
15 |
import java.util.UUID; |
|
15 | 16 |
|
16 | 17 |
import org.springframework.beans.factory.annotation.Autowired; |
17 | 18 |
import org.springframework.context.annotation.Scope; |
... | ... | |
71 | 72 |
if(identifier instanceof Integer || identifier == null){ |
72 | 73 |
return super.loadBeanById(identifier); |
73 | 74 |
// } else if(identifier instanceof TypedEntityReference && ((TypedEntityReference)identifier).getType().equals(TaxonName.class)) { |
74 |
// typifiedNameInContext = getRepo().getNameService().find(((TypedEntityReference)identifier).getId());
|
|
75 |
// typifiedNameInContext = getRepo().getNameService().find(((TypedEntityReference)identifier).getUuid());
|
|
75 | 76 |
// bean = super.loadBeanById(null); |
76 | 77 |
} else { |
77 | 78 |
TypeDesignationWorkingsetEditorIdSet idset = (TypeDesignationWorkingsetEditorIdSet)identifier; |
78 |
RegistrationDTO regDTO = registrationWorkingSetService.loadDtoById(idset.registrationId);
|
|
79 |
RegistrationDTO regDTO = registrationWorkingSetService.loadDtoByUuid(idset.registrationUuid);
|
|
79 | 80 |
typifiedNameInContext = regDTO.getTypifiedName(); |
80 | 81 |
// find the working set |
81 | 82 |
TypeDesignationWorkingSet typeDesignationWorkingSet = regDTO.getTypeDesignationWorkingSet(idset.baseEntityRef); |
... | ... | |
85 | 86 |
throw new RuntimeException("TypeDesignationWorkingsetEditorIdSet references not a NameTypeDesignation"); |
86 | 87 |
} |
87 | 88 |
// TypeDesignationWorkingSet for NameTyped only contain one item!!! |
88 |
int nameTypeDesignationId = typeDesignationWorkingSet.getTypeDesignations().get(0).getId();
|
|
89 |
return super.loadBeanById(nameTypeDesignationId);
|
|
89 |
UUID nameTypeDesignationUuid = typeDesignationWorkingSet.getTypeDesignations().get(0).getUuid();
|
|
90 |
return super.loadBeanById(nameTypeDesignationUuid);
|
|
90 | 91 |
} |
91 | 92 |
} |
92 | 93 |
|
... | ... | |
95 | 96 |
* {@inheritDoc} |
96 | 97 |
*/ |
97 | 98 |
@Override |
98 |
protected NameTypeDesignation loadCdmEntityById(Integer identifier) {
|
|
99 |
protected NameTypeDesignation loadCdmEntity(UUID uuid) {
|
|
99 | 100 |
List<String> initStrategy = Arrays.asList(new String []{ |
100 | 101 |
"$", |
101 | 102 |
"typifiedNames.typeDesignations", // important !! |
... | ... | |
105 | 106 |
); |
106 | 107 |
|
107 | 108 |
NameTypeDesignation typeDesignation; |
108 |
if(identifier != null){
|
|
109 |
typeDesignation = (NameTypeDesignation) getRepo().getNameService().loadTypeDesignation(identifier, initStrategy);
|
|
109 |
if(uuid != null){
|
|
110 |
typeDesignation = (NameTypeDesignation) getRepo().getNameService().loadTypeDesignation(uuid, initStrategy);
|
|
110 | 111 |
} else { |
111 | 112 |
if(beanInstantiator != null){ |
112 | 113 |
typeDesignation = beanInstantiator.createNewBean(); |
... | ... | |
153 | 154 |
* {@inheritDoc} |
154 | 155 |
*/ |
155 | 156 |
@Override |
156 |
protected void guaranteePerEntityCRUDPermissions(Integer identifier) {
|
|
157 |
protected void guaranteePerEntityCRUDPermissions(UUID identifier) {
|
|
157 | 158 |
if(crud != null){ |
158 | 159 |
newAuthorityCreated = UserHelper.fromSession().createAuthorityForCurrentUser(NameTypeDesignation.class, identifier, crud, null); |
159 | 160 |
} |
... | ... | |
251 | 252 |
typeNamePopup.grantToCurrentUser(EnumSet.of(CRUD.UPDATE, CRUD.DELETE)); |
252 | 253 |
typeNamePopup.withDeleteButton(true); |
253 | 254 |
// TODO configure Modes??? |
254 |
typeNamePopup.loadInEditor(action.getEntityId());
|
|
255 |
typeNamePopup.loadInEditor(action.getEntityUuid());
|
|
255 | 256 |
|
256 | 257 |
} |
257 | 258 |
|
Also available in: Unified diff
switching vom id based to uuid based ui navigation and entity references