Project

General

Profile

Revision 0844524a

ID0844524abbb9f0319866eb357b70bee8331d0059
Parent 88b5520d
Child 6d6d19d1

Added by Andreas Kohlbecker over 2 years ago

switching vom id based to uuid based ui navigation and entity references

View differences:

src/main/java/eu/etaxonomy/cdm/service/CdmUserHelper.java
10 10

  
11 11
import java.io.Serializable;
12 12
import java.util.EnumSet;
13
import java.util.UUID;
13 14

  
14 15
import org.apache.log4j.Logger;
15 16
import org.springframework.beans.factory.annotation.Autowired;
......
159 160
    }
160 161

  
161 162
    @Override
163
    public boolean userHasPermission(Class<? extends CdmBase> cdmType, UUID entitiyUuid, Object ... args){
164
        EnumSet<CRUD> crudSet = crudSetFromArgs(args);
165
        try {
166
            CdmBase entity = repo.getCommonService().find(cdmType, entitiyUuid);
167
            return permissionEvaluator.hasPermission(getAuthentication(), entity, crudSet);
168
        } catch (PermissionDeniedException e){
169
            //IGNORE
170
        }
171
        return false;
172
    }
173

  
174
    @Override
162 175
    public boolean userHasPermission(Class<? extends CdmBase> cdmType, Object ... args){
163 176
        EnumSet<CRUD> crudSet = crudSetFromArgs(args);
164 177
        try {
......
260 273
    }
261 274

  
262 275
    /**
276
     * @param username
277
     * @param cdmType
278
     * @param entitiyUuid
279
     * @param crud
280
     * @return
281
     */
282
    @Override
283
    public CdmAuthority createAuthorityFor(String username, Class<? extends CdmBase> cdmType, UUID entitiyUuid, EnumSet<CRUD> crud, String property) {
284

  
285
        CdmBase cdmEntity = repo.getCommonService().find(cdmType, entitiyUuid);
286
        return createAuthorityFor(username, cdmEntity, crud, property);
287
    }
288

  
289
    /**
263 290
     * {@inheritDoc}
264 291
     */
265 292
    @Override
......
280 307
    }
281 308

  
282 309
    /**
310
     * @param cdmType
311
     * @param entitiyUuid
312
     * @param crud
313
     * @return
314
     */
315
    @Override
316
    public CdmAuthority createAuthorityForCurrentUser(Class<? extends CdmBase> cdmType, UUID entitiyUuid, EnumSet<CRUD> crud, String property) {
317
        return createAuthorityFor(userName(), cdmType, entitiyUuid, crud, property);
318
    }
319

  
320
    /**
283 321
     * {@inheritDoc}
284 322
     */
285 323
    @Override
src/main/java/eu/etaxonomy/cdm/service/IRegistrationWorkingSetService.java
10 10

  
11 11
import java.util.Collection;
12 12
import java.util.Set;
13
import java.util.UUID;
13 14

  
14 15
import eu.etaxonomy.cdm.api.service.pager.Pager;
15 16
import eu.etaxonomy.cdm.model.common.User;
......
31 32
     */
32 33
    public RegistrationDTO loadDtoById(Integer id);
33 34

  
35
    public RegistrationDTO loadDtoByUuid(UUID uuid);
36

  
34 37
    public Pager<RegistrationDTO> pageDTOs(Integer pageSize, Integer pageIndex);
35 38

  
36 39
    public Pager<RegistrationDTO> pageDTOs(User submitter, Collection<RegistrationStatus> includedStatus,
......
43 46
     */
44 47
    public RegistrationWorkingSet loadWorkingSetByReferenceID(Integer referenceID) throws RegistrationValidationException;
45 48

  
46
    public Set<RegistrationDTO> loadBlockingRegistrations(Integer blockedRegistrationId);
49
    /**
50
     * @param referenceID
51
     * @return
52
     */
53
    public RegistrationWorkingSet loadWorkingSetByReferenceUuid(UUID referenceUuid) throws RegistrationValidationException;
54

  
55
    public Set<RegistrationDTO> loadBlockingRegistrations(UUID blockedRegistrationUuid);
47 56

  
48 57
}
src/main/java/eu/etaxonomy/cdm/service/ISpecimenTypeDesignationWorkingSetService.java
8 8
*/
9 9
package eu.etaxonomy.cdm.service;
10 10

  
11
import java.util.UUID;
12

  
11 13
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
12 14
import eu.etaxonomy.cdm.model.common.VersionableEntity;
13 15
import eu.etaxonomy.cdm.model.name.Registration;
......
21 23
 */
22 24
public interface ISpecimenTypeDesignationWorkingSetService {
23 25

  
24
    public SpecimenTypeDesignationWorkingSetDTO<Registration> create(int registrationId, int publicationId, int typifiedNameId);
26
    public SpecimenTypeDesignationWorkingSetDTO<Registration> create(UUID registrationUuid, UUID publicationUuid, UUID typifiedNameUuid);
25 27

  
26 28
    /**
27 29
     * @param id the CDM Entity id
28 30
     * @return
29 31
     */
30
    public SpecimenTypeDesignationWorkingSetDTO<Registration> loadDtoByIds(int registrationId, TypedEntityReference<? extends IdentifiableEntity<?>> baseEntityRef);
32
    public SpecimenTypeDesignationWorkingSetDTO<Registration> load(UUID registrationUuid,
33
            TypedEntityReference<? extends IdentifiableEntity<?>> baseEntityRef);
31 34

  
32 35
    SpecimenTypeDesignationWorkingSetDTO<Registration> fixMissingFieldUnit(SpecimenTypeDesignationWorkingSetDTO<Registration> bean);
33 36

  
src/main/java/eu/etaxonomy/cdm/service/RegistrationWorkingSetService.java
15 15
import java.util.List;
16 16
import java.util.Optional;
17 17
import java.util.Set;
18
import java.util.UUID;
18 19

  
19 20
import org.apache.log4j.Logger;
21
import org.hibernate.Hibernate;
20 22
import org.springframework.beans.factory.annotation.Autowired;
21 23
import org.springframework.beans.factory.annotation.Qualifier;
22 24
import org.springframework.stereotype.Service;
......
152 154
    }
153 155

  
154 156

  
157
    /**
158
     * @param id the Registration entity id
159
     * @return
160
     */
161
    @Override
162
    public RegistrationDTO loadDtoByUuid(UUID uuid) {
163
        Registration reg = repo.getRegistrationService().load(uuid, REGISTRATION_INIT_STRATEGY);
164
        inititializeSpecimen(reg);
165
        return new RegistrationDTO(reg);
166
    }
167

  
168

  
155 169
    @Override
156 170
    public Pager<RegistrationDTO> pageDTOs(Integer pageSize, Integer pageIndex) {
157 171

  
......
183 197
     * @throws RegistrationValidationException
184 198
     */
185 199
    @Override
200
    public RegistrationWorkingSet loadWorkingSetByReferenceUuid(UUID referenceUuid) throws RegistrationValidationException {
201

  
202
        Reference reference = repo.getReferenceService().find(referenceUuid);
203
        repo.getReferenceService().load(reference.getUuid()); // needed to avoid the problem described in #7331
204

  
205
        Pager<Registration> pager = repo.getRegistrationService().page(Optional.of(reference), null, null, null, REGISTRATION_INIT_STRATEGY);
206

  
207
        /* for debugging https://dev.e-taxonomy.eu/redmine/issues/7331 */
208
        // debugIssue7331(pager);
209
        return new RegistrationWorkingSet(makeDTOs(pager.getRecords()));
210
    }
211

  
212
    /**
213
     * {@inheritDoc}
214
     * @throws RegistrationValidationException
215
     */
216
    @Override
186 217
    public RegistrationWorkingSet loadWorkingSetByReferenceID(Integer referenceID) throws RegistrationValidationException {
187 218

  
188 219
        Reference reference = repo.getReferenceService().find(referenceID);
......
190 221

  
191 222
        Pager<Registration> pager = repo.getRegistrationService().page(Optional.of(reference), null, null, null, REGISTRATION_INIT_STRATEGY);
192 223

  
193
        /* for debugging https://dev.e-taxonomy.eu/redmine/issues/7331
224
        /* for debugging https://dev.e-taxonomy.eu/redmine/issues/7331 */
225
        // debugIssue7331(pager);
226

  
227
        return new RegistrationWorkingSet(makeDTOs(pager.getRecords()));
228
    }
229

  
230

  
231
    /**
232
     * @param pager
233
     */
234
    @SuppressWarnings("unused")
235
    private void debugIssue7331(Pager<Registration> pager) {
194 236
        for(Registration reg : pager.getRecords()){
195 237
            if(reg.getName() != null && reg.getName().getNomenclaturalReference().getAuthorship() != null){
196 238
                Reference ref = (Reference) reg.getName().getNomenclaturalReference();
......
201 243
                logger.debug("NO AUTHORS");
202 244
            }
203 245
        }
204
        */
205
        return new RegistrationWorkingSet(makeDTOs(pager.getRecords()));
206 246
    }
207 247

  
208 248
    @Override
209
    public Set<RegistrationDTO> loadBlockingRegistrations(Integer blockedRegistrationId){
249
    public Set<RegistrationDTO> loadBlockingRegistrations(UUID blockedRegistrationUuid){
210 250

  
211
        Registration registration = repo.getRegistrationService().load(blockedRegistrationId, BLOCKING_REGISTRATION_INIT_STRATEGY);
251
        Registration registration = repo.getRegistrationService().load(blockedRegistrationUuid, BLOCKING_REGISTRATION_INIT_STRATEGY);
212 252
        Set<Registration> registrations = registration.getBlockedBy();
213 253

  
214 254
        Set<RegistrationDTO> blockingSet = new HashSet<>();
src/main/java/eu/etaxonomy/cdm/service/SpecimenTypeDesignationWorkingSetServiceImpl.java
13 13
import java.util.Iterator;
14 14
import java.util.List;
15 15
import java.util.Set;
16
import java.util.UUID;
16 17

  
17 18
import org.hibernate.Session;
18 19
import org.jboss.logging.Logger;
......
85 86
     * {@inheritDoc}
86 87
     */
87 88
    @Override
88
    public SpecimenTypeDesignationWorkingSetDTO<Registration> create(int registrationId, int publicationId, int typifiedNameId) {
89
    public SpecimenTypeDesignationWorkingSetDTO<Registration> create(UUID registrationUuid, UUID publicationUuid, UUID typifiedNameUuid) {
89 90
        FieldUnit newfieldUnit = FieldUnit.NewInstance();
90
        Registration reg = repo.getRegistrationService().load(registrationId, RegistrationWorkingSetService.REGISTRATION_INIT_STRATEGY);
91
        TaxonName typifiedName = repo.getNameService().load(typifiedNameId, TAXON_NAME_INIT_STRATEGY);
92
        Reference citation = repo.getReferenceService().load(publicationId, Arrays.asList("$"));
91
        Registration reg = repo.getRegistrationService().load(registrationUuid, RegistrationWorkingSetService.REGISTRATION_INIT_STRATEGY);
92
        TaxonName typifiedName = repo.getNameService().load(typifiedNameUuid, TAXON_NAME_INIT_STRATEGY);
93
        Reference citation = repo.getReferenceService().load(publicationUuid, Arrays.asList("$"));
93 94
        SpecimenTypeDesignationWorkingSetDTO<Registration> workingSetDto = new SpecimenTypeDesignationWorkingSetDTO<Registration>(reg, newfieldUnit, citation, typifiedName);
94 95
        return workingSetDto;
95 96
    }
......
99 100
     */
100 101
    @Override
101 102
    @Transactional
102
    public SpecimenTypeDesignationWorkingSetDTO<Registration> loadDtoByIds(int registrationId, TypedEntityReference<? extends IdentifiableEntity<?>> baseEntityRef) {
103
        RegistrationDTO regDTO = registrationWorkingSetService.loadDtoById(registrationId);
103
    public SpecimenTypeDesignationWorkingSetDTO<Registration> load(UUID registrationUuid, TypedEntityReference<? extends IdentifiableEntity<?>> baseEntityRef) {
104
        RegistrationDTO regDTO = registrationWorkingSetService.loadDtoByUuid(registrationUuid);
104 105
        // find the working set
105 106
        TypeDesignationWorkingSet typeDesignationWorkingSet = regDTO.getTypeDesignationWorkingSet(baseEntityRef);
106 107
        SpecimenTypeDesignationWorkingSetDTO<Registration> workingSetDto = regDTO.getSpecimenTypeDesignationWorkingSetDTO(typeDesignationWorkingSet.getBaseEntityReference());
......
114 115
            // in case the base unit of the working set is not a FieldUnit all contained TypeDesignations must be modified
115 116
            // so that they are based on an empty FieldUnit with an associated Gathering Event
116 117

  
117
            Registration reg = repo.getRegistrationService().find(bean.getOwner().getId());
118
            Registration reg = repo.getRegistrationService().find(bean.getOwner().getUuid());
118 119
            RegistrationDTO regDTO = new RegistrationDTO(reg);
119 120

  
120 121
            FieldUnit fieldUnit = FieldUnit.NewInstance();
......
124 125

  
125 126
            VersionableEntity baseEntity = bean.getBaseEntity();
126 127
            Set<TypeDesignationBase> typeDesignations = regDTO.getTypeDesignationsInWorkingSet(
127
                    new TypedEntityReference(baseEntity.getClass(), baseEntity.getId(), baseEntity.toString())
128
                    new TypedEntityReference(baseEntity.getClass(), baseEntity.getUuid(), baseEntity.toString())
128 129
                    );
129 130
            for(TypeDesignationBase td : typeDesignations){
130 131
                DerivationEvent de = DerivationEvent.NewInstance();//
src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/RegistrationItem.java
13 13
import java.util.Collection;
14 14
import java.util.EnumSet;
15 15
import java.util.Set;
16
import java.util.UUID;
16 17

  
17 18
import org.joda.time.DateTime;
18 19
import org.joda.time.format.ISODateTimeFormat;
......
191 192
        this.regDto = regDto;
192 193

  
193 194
        NavigationEvent navigationEvent = null;
194
        if(regDto.getCitationID() != null) {
195
        if(regDto.getCitationUuid() != null) {
195 196
            navigationEvent = new NavigationEvent(
196 197
                    RegistrationWorksetViewBean.NAME,
197
                    Integer.toString(regDto.getCitationID())
198
                    regDto.getCitationUuid().toString()
198 199
                    );
199 200
        } else {
200 201
            setComponentError(new UserError("Citation is missing"));
......
208 209
        this.parentView = parentView;
209 210

  
210 211
        ReferenceEditorAction referenceEditorAction = null;
211
        if(workingSet.getCitationId() != null){
212
            if(UserHelper.fromSession().userHasPermission(Reference.class, workingSet.getCitationId(), CRUD.UPDATE)){
213
                referenceEditorAction = new ReferenceEditorAction(EditorActionType.EDIT, workingSet.getCitationId(), null, parentView);
212
        if(workingSet.getCitationUuid() != null){
213
            if(UserHelper.fromSession().userHasPermission(Reference.class, workingSet.getCitationUuid(), CRUD.UPDATE)){
214
                referenceEditorAction = new ReferenceEditorAction(EditorActionType.EDIT, workingSet.getCitationUuid(), null, parentView);
214 215
            }
215
            PermissionDebugUtils.addGainPerEntityPermissionButton(this, Reference.class, workingSet.getCitationId(), EnumSet.of(CRUD.UPDATE, CRUD.DELETE), null);
216
            PermissionDebugUtils.addGainPerEntityPermissionButton(this, Reference.class, workingSet.getCitationUuid(), EnumSet.of(CRUD.UPDATE, CRUD.DELETE), null);
216 217
        } else {
217 218
            if(UserHelper.fromSession().userHasPermission(Reference.class, CRUD.CREATE, null, null, parentView)){
218 219
                referenceEditorAction = new ReferenceEditorAction(EditorActionType.ADD);
......
245 246
            getMessageButton().addClickListener(e -> {
246 247
                ShowDetailsEvent detailsEvent;
247 248
                if(regDto != null){
248
                    detailsEvent = new ShowDetailsEvent<RegistrationDTO, Integer>(
249
                    detailsEvent = new ShowDetailsEvent<RegistrationDTO, UUID>(
249 250
                            e,
250 251
                            RegistrationDTO.class,
251
                            regDto.getId(),
252
                            regDto.getUuid(),
252 253
                            VALIDATION_PROBLEMS);
253 254
                } else {
254
                    detailsEvent = new ShowDetailsEvent<RegistrationWorkingSet, Integer>(
255
                    detailsEvent = new ShowDetailsEvent<RegistrationWorkingSet, UUID>(
255 256
                            e,
256 257
                            RegistrationWorkingSet.class,
257 258
                            null,
......
329 330
        }
330 331
    }
331 332

  
332
    public int getRegistrationId(){
333
        return regDto.getId();
333
    public UUID getRegistrationUuid(){
334
        return regDto.getUuid();
334 335
    }
335 336

  
336 337
    /**
src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/RegistrationItemNameAndTypeButtons.java
11 11
import java.util.ArrayList;
12 12
import java.util.EnumSet;
13 13
import java.util.List;
14
import java.util.UUID;
14 15

  
15 16
import org.apache.log4j.Logger;
16 17

  
......
74 75
        if(regDto.getNameRef() != null){
75 76
            Button nameButton = new Button("Name:");
76 77
            nameButton.setDescription("Edit the Name");
77
            nameIdButton = new IdButton<TaxonName>(TaxonName.class, regDto.getNameRef().getId(), nameButton);
78
            nameIdButton = new IdButton<TaxonName>(TaxonName.class, regDto.getNameRef().getUuid(), nameButton);
78 79
            Label nameLabel = new Label(regDto.getNameRef().getLabel());
79 80
            nameLabel.setWidthUndefined();
80 81
            boolean userHasPermission = UserHelper.fromSession().userHasPermission(regDto.registration().getName(), CRUD.UPDATE);
81 82
            nameButton.setReadOnly(isRegistrationLocked || ! userHasPermission);
82 83

  
83 84
            addComponent(nameIdButton.getButton());
84
            PermissionDebugUtils.addGainPerEntityPermissionButton(this, TaxonName.class, regDto.getNameRef().getId(),
85
            PermissionDebugUtils.addGainPerEntityPermissionButton(this, TaxonName.class, regDto.getNameRef().getUuid(),
85 86
                    EnumSet.of(CRUD.UPDATE, CRUD.DELETE), null);
86 87
            addComponent(nameLabel);
87 88
        } else {
......
91 92
                addComponent(nameLabel);
92 93
            }
93 94
        }
94
        boolean userHasAddPermission = UserHelper.fromSession().userHasPermission(Registration.class, regDto.getId(), CRUD.UPDATE);
95
        boolean userHasAddPermission = UserHelper.fromSession().userHasPermission(Registration.class, regDto.getUuid(), CRUD.UPDATE);
95 96
        if(regDto.getOrderdTypeDesignationWorkingSets() != null){
96 97
            for(TypedEntityReference<TypeDesignationBase<?>> baseEntityRef : regDto.getOrderdTypeDesignationWorkingSets().keySet()) {
97 98
                TypeDesignationWorkingSet typeDesignationWorkingSet = regDto.getOrderdTypeDesignationWorkingSets().get(baseEntityRef);
......
99 100
                String buttonLabel = SpecimenOrObservationBase.class.isAssignableFrom(baseEntityRef.getType()) ? "Type": "NameType";
100 101
                Button tdButton = new Button(buttonLabel + ":");
101 102
                tdButton.setDescription("Edit the type designation working set");
102
                boolean userHasUpdatePermission = UserHelper.fromSession().userHasPermission(baseEntityRef.getType(), baseEntityRef.getId(), CRUD.UPDATE, CRUD.DELETE);
103
                boolean userHasUpdatePermission = UserHelper.fromSession().userHasPermission(baseEntityRef.getType(), baseEntityRef.getUuid(), CRUD.UPDATE, CRUD.DELETE);
103 104
                tdButton.setReadOnly(isRegistrationLocked || !userHasUpdatePermission);
104 105
                addComponent(tdButton);
105 106

  
106 107
                PermissionDebugUtils.addGainPerEntityPermissionButton(this, SpecimenOrObservationBase.class,
107
                        baseEntityRef.getId(), EnumSet.of(CRUD.UPDATE, CRUD.DELETE), RegistrationStatus.PREPARATION.name());
108
                        baseEntityRef.getUuid(), EnumSet.of(CRUD.UPDATE, CRUD.DELETE), RegistrationStatus.PREPARATION.name());
108 109

  
109 110
                typeDesignationButtons.add(new TypeDesignationWorkingSetButton(
110 111
                        typeDesignationWorkingSet.getWorkingsetType(),
......
207 208
    }
208 209

  
209 210
    public class IdButton<T> {
210
        private Integer id;
211
        private UUID uuid;
211 212
        private Class<T> entityType;
212 213
        private Button button;
213 214

  
214
        public IdButton(Class<T> type, Integer id, Button button){
215
        public IdButton(Class<T> type, UUID uuid, Button button){
215 216
            this.entityType = type;
216
            this.id = id;
217
            this.uuid = uuid;
217 218
            this.button = button;
218 219
        }
219 220

  
220 221
        /**
221 222
         * @return the id
222 223
         */
223
        public Integer getId() {
224
            return id;
224
        public UUID getUuid() {
225
            return uuid;
225 226
        }
226 227

  
227 228
        /**
src/main/java/eu/etaxonomy/cdm/vaadin/event/AbstractEditorAction.java
9 9
package eu.etaxonomy.cdm.vaadin.event;
10 10

  
11 11
import java.util.Stack;
12
import java.util.UUID;
12 13

  
13 14
import com.vaadin.ui.Component;
14 15

  
......
38 39
        this(action, null, source, sourceView);
39 40
    }
40 41

  
41
    public AbstractEditorAction(EditorActionType action, Integer entityId, Component source, AbstractView sourceView) {
42
        this(action, entityId, source, sourceView, null);
42
    public AbstractEditorAction(EditorActionType action, UUID entityUuid, Component source, AbstractView sourceView) {
43
        this(action, entityUuid, source, sourceView, null);
43 44
    }
44 45

  
45 46
    /**
......
57 58
     *            Editor actions from previous views and editors that lead to the point
58 59
     *            from where this action is spawned.
59 60
     */
60
    public AbstractEditorAction(EditorActionType action, Integer entityId, Component source, AbstractView sourceView,
61
    public AbstractEditorAction(EditorActionType action, UUID entityUuid, Component source, AbstractView sourceView,
61 62
            Stack<EditorActionContext> context) {
62
        super(action, entityId, sourceView);
63
        super(action, entityUuid, sourceView);
63 64
        this.sourceComponent = source;
64 65
        this.context = context;
65 66
    }
src/main/java/eu/etaxonomy/cdm/vaadin/event/AbstractEntityEvent.java
8 8
*/
9 9
package eu.etaxonomy.cdm.vaadin.event;
10 10

  
11
import java.util.UUID;
12

  
11 13
import eu.etaxonomy.vaadin.mvp.AbstractView;
12 14

  
13 15
/**
......
17 19
 */
18 20
public abstract class AbstractEntityEvent<T extends Enum> {
19 21

  
20
    private Integer entityId = null;
22
    private UUID entityUuid = null;
21 23

  
22 24
    protected T type;
23 25

  
24 26
    private AbstractView sourceView = null;
25 27

  
26
    public AbstractEntityEvent(T type, Integer entityId, AbstractView sourceView) {
27
        this.entityId = entityId;
28
    public AbstractEntityEvent(T type, UUID entityUuid, AbstractView sourceView) {
29
        this.entityUuid = entityUuid;
28 30
        this.type = type;
29 31
        this.sourceView = sourceView;
30 32
        if(type == null){
......
35 37
    /**
36 38
     * @return the entityId
37 39
     */
38
    public Integer getEntityId() {
39
        return entityId;
40
    public UUID getEntityUuid() {
41
        return entityUuid;
40 42
    }
41 43

  
42 44
    public T getType() {
src/main/java/eu/etaxonomy/cdm/vaadin/event/CollectionEditorAction.java
8 8
*/
9 9
package eu.etaxonomy.cdm.vaadin.event;
10 10

  
11
import java.util.UUID;
12

  
11 13
import com.vaadin.ui.Component;
12 14

  
13 15
import eu.etaxonomy.vaadin.event.EditorActionType;
......
40 42
     * @param source
41 43
     * @param sourceView
42 44
     */
43
    public CollectionEditorAction(EditorActionType action, Integer entityId, Component source, AbstractView sourceView) {
44
        super(action, entityId, source, sourceView);
45
    public CollectionEditorAction(EditorActionType action, UUID entityUuid, Component source, AbstractView sourceView) {
46
        super(action, entityUuid, source, sourceView);
45 47
    }
46 48

  
47 49
}
src/main/java/eu/etaxonomy/cdm/vaadin/event/EntityChangeEvent.java
33 33
    private T entity;
34 34

  
35 35
    public EntityChangeEvent(T entity, Type type, AbstractView sourceView) {
36
        super(type, entity.getId(), sourceView);
36
        super(type, entity.getUuid(), sourceView);
37 37
        this.entityType = (Class<T>) entity.getClass();
38 38
        this.entity = entity;
39 39
    }
src/main/java/eu/etaxonomy/cdm/vaadin/event/ReferenceEditorAction.java
8 8
*/
9 9
package eu.etaxonomy.cdm.vaadin.event;
10 10

  
11
import java.util.UUID;
12

  
11 13
import com.vaadin.ui.Component;
12 14

  
13 15
import eu.etaxonomy.vaadin.event.EditorActionType;
......
40 42
     * @param source
41 43
     * @param sourceView
42 44
     */
43
    public ReferenceEditorAction(EditorActionType action, Integer entityId, Component source, AbstractView sourceView) {
44
        super(action, entityId, source, sourceView);
45
    public ReferenceEditorAction(EditorActionType action, UUID entityUuid, Component source, AbstractView sourceView) {
46
        super(action, entityUuid, source, sourceView);
45 47
    }
46 48

  
47 49
}
src/main/java/eu/etaxonomy/cdm/vaadin/event/RegistrationEditorAction.java
8 8
*/
9 9
package eu.etaxonomy.cdm.vaadin.event;
10 10

  
11
import java.util.UUID;
12

  
11 13
import com.vaadin.ui.Component;
12 14

  
13 15
import eu.etaxonomy.vaadin.event.EditorActionType;
......
41 43
     * @param source
42 44
     * @param sourceView
43 45
     */
44
    public RegistrationEditorAction(EditorActionType action, Integer entityId, Component source, AbstractView sourceView) {
45
        super(action, entityId, source, sourceView);
46
    public RegistrationEditorAction(EditorActionType action, UUID entityUuid, Component source, AbstractView sourceView) {
47
        super(action, entityUuid, source, sourceView);
46 48
    }
47 49

  
48 50

  
src/main/java/eu/etaxonomy/cdm/vaadin/event/TaxonNameEditorAction.java
9 9
package eu.etaxonomy.cdm.vaadin.event;
10 10

  
11 11
import java.util.Stack;
12
import java.util.UUID;
12 13

  
13 14
import com.vaadin.ui.Component;
14 15

  
......
41 42
     * @param source
42 43
     * @param sourceView
43 44
     */
44
    public TaxonNameEditorAction(EditorActionType action, Integer entityId, Component source, AbstractView sourceView) {
45
        super(action, entityId, source, sourceView);
45
    public TaxonNameEditorAction(EditorActionType action, UUID entityUuid, Component source, AbstractView sourceView) {
46
        super(action, entityUuid, source, sourceView);
46 47
    }
47 48

  
48 49
    /**
......
52 53
     * @param sourceView
53 54
     * @param context
54 55
     */
55
    public TaxonNameEditorAction(EditorActionType action, Integer entityId, Component source, AbstractView sourceView,
56
    public TaxonNameEditorAction(EditorActionType action, UUID entityUuid, Component source, AbstractView sourceView,
56 57
            Stack<EditorActionContext> context) {
57
        super(action, entityId, source, sourceView, context);
58
        super(action, entityUuid, source, sourceView, context);
58 59
    }
59 60

  
60 61

  
src/main/java/eu/etaxonomy/cdm/vaadin/event/TypeDesignationWorkingsetEditorAction.java
9 9
package eu.etaxonomy.cdm.vaadin.event;
10 10

  
11 11
import java.util.Stack;
12
import java.util.UUID;
12 13

  
13 14
import com.vaadin.ui.Component;
14 15

  
......
28 29

  
29 30
    private TypeDesignationWorkingSetType workingSetType;
30 31

  
31
    private int registrationId;
32
    private UUID registrationUuid;
32 33

  
33
    private int typifiedNameId;
34
    private UUID typifiedNameUuid;
34 35

  
35 36
    private TypedEntityReference<IdentifiableEntity<?>> baseEntityRef;
36 37

  
37 38
    /**
38 39
     *
39 40
     * @param action
40
     * @param typeDesignationWorkingsetId
41
     * @param baseEntityRef
41 42
     * @param workingSetType
42 43
     * @param registrationId
43 44
     * @param source
......
45 46
     */
46 47
    public TypeDesignationWorkingsetEditorAction(EditorActionType action, TypedEntityReference<IdentifiableEntity<?>> baseEntityRef,
47 48
            TypeDesignationWorkingSetType workingSetType,
48
            int registrationId, int typifiedNameId,
49
            UUID registrationUuid, UUID typifiedNameUuid,
49 50
            Component source, AbstractView sourceView, Stack<EditorActionContext> context) {
50 51
        super(action, null, source, sourceView);
51 52
        this.baseEntityRef = baseEntityRef;
52
        this.registrationId = registrationId;
53
        this.typifiedNameId = typifiedNameId;
53
        this.registrationUuid = registrationUuid;
54
        this.typifiedNameUuid = typifiedNameUuid;
54 55
        this.workingSetType = workingSetType;
55 56
        this.context = context;
56 57

  
......
60 61
     *
61 62
     * @param action
62 63
     * @param workingSetType
63
     * @param registrationId
64
     * @param registrationUuid
64 65
     * @param source
65 66
     * @param sourceView
66 67
     */
67 68
    public TypeDesignationWorkingsetEditorAction(EditorActionType action, TypeDesignationWorkingSetType workingSetType,
68
            int registrationId, int typifiedNameId,
69
            UUID registrationUuid, UUID typifiedNameUuid,
69 70
            Component source, AbstractView sourceView) {
70 71
        super(action, null, source, sourceView);
71 72
        this.workingSetType = workingSetType;
72
        this.registrationId = registrationId;
73
        this.typifiedNameId = typifiedNameId;
73
        this.registrationUuid = registrationUuid;
74
        this.typifiedNameUuid = typifiedNameUuid;
74 75
        this.context = new Stack<>();
75
        this.context.push(new EditorActionContext(new TypedEntityReference<Registration>(Registration.class, registrationId), sourceView));
76
        this.context.push(new EditorActionContext(new TypedEntityReference<Registration>(Registration.class, registrationUuid), sourceView));
76 77
    }
77 78

  
78 79

  
......
86 87
    }
87 88

  
88 89
    /**
89
     * @return the registrationId
90
     * @return the registrationUuid
90 91
     */
91
    public int getRegistrationId() {
92
        return registrationId;
92
    public UUID getRegistrationUuid() {
93
        return registrationUuid;
93 94
    }
94 95

  
95
    public Integer getTypeDesignationWorkingsetId(){
96
        return getEntityId();
96
    public UUID getTypeDesignationWorkingsetUuid(){
97
        return getEntityUuid();
97 98
    }
98 99

  
99 100
    /**
......
104 105
    }
105 106

  
106 107
    /**
107
     * @return the typifiedNameId
108
     * @return the typifiedNameUuid
108 109
     */
109
    public int getTypifiedNameId() {
110
        return typifiedNameId;
110
    public UUID getTypifiedNameUuid() {
111
        return typifiedNameUuid;
111 112
    }
112 113

  
113 114

  
src/main/java/eu/etaxonomy/cdm/vaadin/event/registration/RegistrationWorkingsetAction.java
8 8
*/
9 9
package eu.etaxonomy.cdm.vaadin.event.registration;
10 10

  
11
import java.util.UUID;
12

  
11 13
/**
12 14
 * @author a.kohlbecker
13 15
 * @since Mar 3, 2017
......
16 18
public class RegistrationWorkingsetAction {
17 19

  
18 20
    private Action action;
19
    private Integer citationID = null;
21
    private UUID citationUuid = null;
20 22

  
21 23
    /**
22 24
     *
23 25
     * @param citationID the id of a {@link Reference} denoting a
24 26
     * complete registration working set.
25 27
     */
26
    public RegistrationWorkingsetAction(int citationID, Action action){
28
    public RegistrationWorkingsetAction(UUID citationUuid, Action action){
27 29
        this.action = action;
28
        this.citationID = citationID;
30
        this.citationUuid = citationUuid;
29 31
    }
30 32

  
31 33
    /**
......
36 38
    }
37 39

  
38 40
    /**
39
     * @return the registrationID
41
     * @return the citationUuid
40 42
     */
41
    public Integer getCitationID() {
42
        return citationID;
43
    public UUID getCitationUuid() {
44
        return citationUuid;
43 45
    }
44 46

  
45 47
    public boolean isStart() {
src/main/java/eu/etaxonomy/cdm/vaadin/model/EntityReference.java
8 8
*/
9 9
package eu.etaxonomy.cdm.vaadin.model;
10 10

  
11
import java.util.UUID;
12

  
11 13
import org.apache.commons.lang.builder.HashCodeBuilder;
12 14

  
13 15
public class EntityReference {
14
    int id;
16
    UUID uuid;
15 17
    String label;
16 18

  
17
    public EntityReference(int id, String label) {
18
        this.id = id;
19
    public EntityReference(UUID uuid, String label) {
20
        this.uuid = uuid;
19 21
        this.label = label;
20 22
    }
21 23

  
22
    public int getId() {
23
        return id;
24

  
25
    public UUID getUuid() {
26
        return uuid;
24 27
    }
25 28

  
26 29
    public String getLabel() {
......
34 37
    public int hashCode() {
35 38
        return new HashCodeBuilder(17, 31)
36 39
                .append(label)
37
                .append(id)
40
                .append(uuid)
38 41
                .toHashCode();
39 42
    }
40 43

  
......
45 48
    public boolean equals(Object obj) {
46 49
        try {
47 50
            EntityReference other = (EntityReference) obj;
48
            return id == other.id && label.equals(other.label);
51
            return uuid.equals(other.uuid) && label.equals(other.label);
49 52

  
50 53
        } catch (Exception e) {
51 54
            return false;
src/main/java/eu/etaxonomy/cdm/vaadin/model/TypedEntityReference.java
8 8
*/
9 9
package eu.etaxonomy.cdm.vaadin.model;
10 10

  
11
import java.util.UUID;
12

  
11 13
import org.apache.commons.lang.builder.HashCodeBuilder;
12 14

  
13 15
/**
......
18 20
public class TypedEntityReference<T> extends EntityReference {
19 21

  
20 22
    /**
21
     * @param id
23
     * @param uuid
22 24
     * @param label
23 25
     */
24
    public TypedEntityReference(Class<T> type, int id, String label) {
25
        super(id, label);
26
    public TypedEntityReference(Class<T> type, UUID uuid, String label) {
27
        super(uuid, label);
26 28
        this.type = type;
27 29
    }
28 30

  
29
    public TypedEntityReference(Class<T> type, int id) {
30
        super(id, null);
31
    public TypedEntityReference(Class<T> type, UUID uuid) {
32
        super(uuid, null);
31 33
        this.type = type;
32 34
    }
33 35

  
......
55 57
    @Override
56 58
    public int hashCode() {
57 59
        return new HashCodeBuilder(17, 31)
58
                .append(id)
60
                .append(uuid)
59 61
                .appendSuper(type.hashCode())
60 62
                .hashCode();
61 63
    }
......
68 70
    public boolean equals(Object obj) {
69 71
        try {
70 72
            TypedEntityReference other = (TypedEntityReference) obj;
71
            return id == other.id && type.equals(other.type);
73
            return uuid.equals(other.uuid) && type.equals(other.type);
72 74

  
73 75
        } catch (Exception e) {
74 76
            return false;
......
77 79

  
78 80
    @Override
79 81
    public String toString(){
80
        return type.getSimpleName() + "#" + id;
82
        return type.getSimpleName() + "#" + uuid;
81 83

  
82 84
    }
83 85

  
src/main/java/eu/etaxonomy/cdm/vaadin/model/registration/RegistrationWorkingSet.java
14 14
import java.util.List;
15 15
import java.util.Optional;
16 16
import java.util.Set;
17
import java.util.UUID;
17 18

  
18 19
import org.joda.time.DateTime;
19 20

  
......
33 34

  
34 35
    private List<RegistrationDTO> registrationDTOs = new ArrayList<>();
35 36

  
36
    private Integer citationId = null;
37
    private UUID citationUuid = null;
37 38

  
38 39
    private DateTime created = null;
39 40

  
......
43 44
     * Creates an empty working set
44 45
     */
45 46
    public RegistrationWorkingSet(Reference citation) {
46
        citationId = citation.getId();
47
        citationUuid = citation.getUuid();
47 48
        this.citationString= citation.getTitleCache();
48 49

  
49 50
    }
......
83 84
        }
84 85
        for(RegistrationDTO regDto : candidates){
85 86
                Reference citation = publicationUnit(regDto);
86
                if(citationId == null){
87
                    citationId = citation.getId();
87
                if(citationUuid == null){
88
                    citationUuid = citation.getUuid();
88 89
                    citationString = citation.getTitleCache();
89 90
                } else {
90
                    if(citation.getId() != citationId.intValue()){
91
                    if(!citation.getUuid().equals(citationUuid)){
91 92
                        problems.add("Removing Registration " + regDto.getSummary() + " from set since this refers to a different citationString.");
92 93
                        continue;
93 94
                    }
......
180 181
        return registrationDTOs;
181 182
    }
182 183

  
183
    public Optional<RegistrationDTO> getRegistrationDTO(int registrationId) {
184
        return registrationDTOs.stream().filter(r -> r.getId() == registrationId).findFirst();
184
    public Optional<RegistrationDTO> getRegistrationDTO(UUID registrationUuid) {
185
        return registrationDTOs.stream().filter(r -> r.getUuid().equals(registrationUuid) ).findFirst();
185 186
    }
186 187

  
187 188
    /**
188 189
     * @return the citationId
189 190
     */
190
    public Integer getCitationId() {
191
        return citationId;
191
    public UUID getCitationUuid() {
192
        return citationUuid;
192 193
    }
193 194

  
194 195
    /**
src/main/java/eu/etaxonomy/cdm/vaadin/security/PermissionDebugUtils.java
10 10

  
11 11
import java.io.Serializable;
12 12
import java.util.EnumSet;
13
import java.util.UUID;
13 14

  
14 15
import org.apache.log4j.Logger;
15 16
import org.springframework.context.annotation.Profile;
......
65 66
     }
66 67

  
67 68
    public static Button addGainPerEntityPermissionButton(AbstractComponentContainer toContainer, Class<? extends CdmBase> cdmType,
68
            Integer entitiyId, EnumSet<CRUD> crud, String property){
69
            UUID entitiyUuid, EnumSet<CRUD> crud, String property){
69 70

  
70 71
        PermissionDebugUtils pu = PermissionDebugUtils.fromSession();
71 72
        if(pu != null){
72
            Button button = pu.gainPerEntityPermissionButton(cdmType, entitiyId, crud, property);
73
            Button button = pu.gainPerEntityPermissionButton(cdmType, entitiyUuid, crud, property);
73 74
            if(button != null){
74 75
                toContainer.addComponent(button);
75 76
            }
......
78 79
        return null;
79 80
    }
80 81

  
81
    public Button gainPerEntityPermissionButton(Class<? extends CdmBase> cdmType, Integer entitiyId, EnumSet<CRUD> crud, String property){
82
    public Button gainPerEntityPermissionButton(Class<? extends CdmBase> cdmType, UUID entitiyUuid, EnumSet<CRUD> crud, String property){
82 83

  
83 84
       Button button = new Button(FontAwesome.BOLT);
84
       button.addClickListener(e -> UserHelper.fromSession().createAuthorityFor(UserHelper.fromSession().userName(), cdmType, entitiyId, crud, property));
85
       button.addClickListener(e -> UserHelper.fromSession().createAuthorityFor(UserHelper.fromSession().userName(), cdmType, entitiyUuid, crud, property));
85 86
       button.addStyleName(ValoTheme.BUTTON_DANGER);
86 87
       return button;
87 88

  
src/main/java/eu/etaxonomy/cdm/vaadin/security/UserHelper.java
9 9
package eu.etaxonomy.cdm.vaadin.security;
10 10

  
11 11
import java.util.EnumSet;
12
import java.util.UUID;
12 13

  
13 14
import com.vaadin.server.VaadinSession;
14 15

  
......
41 42

  
42 43
    boolean userHasPermission(Class<? extends CdmBase> cdmType, Integer entitiyId, Object ... args);
43 44

  
45
    boolean userHasPermission(Class<? extends CdmBase> cdmType, UUID entitiyUUID, Object ... args);
46

  
44 47
    boolean userHasPermission(Class<? extends CdmBase> cdmType, Object ... args);
45 48

  
46 49
    boolean userHasPermission(CdmBase entity, Object ... args);
......
80 83
     */
81 84
    public CdmAuthority createAuthorityFor(String username, Class<? extends CdmBase> cdmType, Integer entitiyId, EnumSet<CRUD> crud, String property);
82 85

  
86

  
87
    /**
88
    *
89
    * @param username
90
    * @param cdmType
91
    * @param entitiyUuid
92
    * @param crud
93
    * @param property
94
    * @return the newly created CdmAuthority only if a new CdmAuthority has been added to the user otherwise
95
    * <code>null</code> in case the operation failed of if the user was already granted with this authority.
96
    */
97
   public CdmAuthority createAuthorityFor(String username, Class<? extends CdmBase> cdmType, UUID entitiyUuid, EnumSet<CRUD> crud, String property);
98

  
99

  
83 100
    /**
84 101
     * @param cdmType
85 102
     * @param entitiyId
......
91 108

  
92 109
    /**
93 110
     * @param cdmType
111
     * @param entitiyUuid
112
     * @param crud
113
     * @return the newly created CdmAuthority only if a new CdmAuthority has been added to the user otherwise
114
     * <code>null</code> in case the operation failed of if the user was already granted with this authority.
115
     */
116
    public CdmAuthority createAuthorityForCurrentUser(Class<? extends CdmBase> cdmType, UUID entitiyUuid, EnumSet<CRUD> crud, String property);
117

  
118
    /**
119
     * @param cdmType
94 120
     * @param entitiyId
95 121
     * @param crud
96 122
     * @return the newly created CdmAuthority only if a new CdmAuthority has been added to the user otherwise
src/main/java/eu/etaxonomy/cdm/vaadin/util/converter/TypeDesignationSetManager.java
112 112
     */
113 113
    public TypeDesignationSetManager(TaxonName typifiedName) {
114 114
        this.typeDesignations = new ArrayList<>();
115
        this.typifiedNameRef = new EntityReference(typifiedName.getId(), typifiedName.getTitleCache());
115
        this.typifiedNameRef = new EntityReference(typifiedName.getUuid(), typifiedName.getTitleCache());
116 116
    }
117 117

  
118 118
    /**
......
155 155
            final VersionableEntity baseEntity = baseEntity(td);
156 156
            final TypedEntityReference<VersionableEntity> baseEntityReference = makeEntityReference(baseEntity);
157 157

  
158
            EntityReference typeDesignationEntityReference = new EntityReference(td.getId(), stringify(td));
158
            EntityReference typeDesignationEntityReference = new EntityReference(td.getUuid(), stringify(td));
159 159

  
160 160
            TypeDesignationWorkingSet typedesignationWorkingSet;
161 161
            if(!byBaseEntityByTypeStatus.containsKey(baseEntityReference)){
......
211 211
                label = ((FieldUnit)baseEntity).getTitleCache();
212 212
        }
213 213

  
214
        TypedEntityReference<VersionableEntity> baseEntityReference = new TypedEntityReference(baseEntity.getClass(), baseEntity.getId(), label);
214
        TypedEntityReference<VersionableEntity> baseEntityReference = new TypedEntityReference(baseEntity.getClass(), baseEntity.getUuid(), label);
215 215

  
216 216
        return baseEntityReference;
217 217
    }
......
394 394
            } else {
395 395
                // compare
396 396
                TaxonName otherTypifiedName = typeDesignation.getTypifiedNames().iterator().next();
397
                if(typifiedName.getId() != otherTypifiedName.getId()){
397
                if(!typifiedName.getUuid().equals(otherTypifiedName.getUuid())){
398 398
                  //TODO instead throw RegistrationValidationException()
399 399
                    problems.add("Multiple typifiedName in " + typeDesignation.toString());
400 400
                }
......
409 409
        if(typifiedName != null){
410 410
            // ON SUCCESS -------------------
411 411
            this.typifiedName = typifiedName;
412
            this.typifiedNameRef = new EntityReference(typifiedName.getId(), typifiedName.getTitleCache());
412
            this.typifiedNameRef = new EntityReference(typifiedName.getUuid(), typifiedName.getTitleCache());
413 413

  
414 414
        }
415 415
    }
......
446 446
     */
447 447
    public TypeDesignationBase findTypeDesignation(EntityReference typeDesignationRef) {
448 448
        for(TypeDesignationBase td : typeDesignations){
449
            if(td.getId() == typeDesignationRef.getId()){
449
            if(td.getUuid().equals(typeDesignationRef.getUuid())){
450 450
                return td;
451 451
            }
452 452
        }
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/NameTypeDesignationPopupEditor.java
145 145
                getViewEventBus().publish(this,
146 146
                    new TaxonNameEditorAction(
147 147
                            EditorActionType.EDIT,
148
                            typeNameField.getValue().getId(),
148
                            typeNameField.getValue().getUuid(),
149 149
                            typeNameField,
150 150
                            this)
151 151
                );
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

  
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationWorkingsetEditorPresenter.java
12 12
import java.util.EnumSet;
13 13
import java.util.HashSet;
14 14
import java.util.Set;
15
import java.util.UUID;
15 16

  
16 17
import org.springframework.beans.factory.annotation.Autowired;
17 18
import org.springframework.context.annotation.Scope;
......
125 126
            TypeDesignationWorkingsetEditorIdSet idset = (TypeDesignationWorkingsetEditorIdSet)identifier;
126 127

  
127 128
            if(idset.baseEntityRef != null){
128
                workingSetDto = specimenTypeDesignationWorkingSetService.loadDtoByIds(idset.registrationId, idset.baseEntityRef);
129
                workingSetDto = specimenTypeDesignationWorkingSetService.load(idset.registrationUuid, idset.baseEntityRef);
129 130
                if(workingSetDto.getFieldUnit() == null){
130 131
                    workingSetDto = specimenTypeDesignationWorkingSetService.fixMissingFieldUnit(workingSetDto);
131 132
                        // FIXME open Dialog to warn user about adding an empty fieldUnit to the typeDesignations
......
137 138
                rootEntities.add(workingSetDto.getOwner());
138 139
            } else {
139 140
                // create a new workingset, for a new fieldunit which is the base for the workingset
140
                workingSetDto = specimenTypeDesignationWorkingSetService.create(idset.registrationId, idset.publicationId, idset.typifiedNameId);
141
                workingSetDto = specimenTypeDesignationWorkingSetService.create(idset.registrationUuid, idset.publicationUuid, idset.typifiedNameUuid);
141 142
                // need to use load but put see #7214
142 143
                cache.load(workingSetDto.getOwner());
143 144
                rootEntities.add(workingSetDto.getOwner());
......
205 206
                row.collection.addClickListenerAddEntity(e -> doCollectionEditorAdd());
206 207
                row.collection.addClickListenerEditEntity(e -> {
207 208
                        if(row.collection.getValue() != null){
208
                            doCollectionEditorEdit(row.collection.getValue().getId());
209
                            doCollectionEditorEdit(row.collection.getValue().getUuid());
209 210
                        }
210 211
                    });
211 212

  
......
222 223
                row.mediaSpecimenReference.addClickListenerAddEntity(e -> doReferenceEditorAdd());
223 224
                row.mediaSpecimenReference.addClickListenerEditEntity(e -> {
224 225
                    if(row.mediaSpecimenReference.getValue() != null){
225
                        doReferenceEditorEdit(row.mediaSpecimenReference.getValue().getId());
226
                        doReferenceEditorEdit(row.mediaSpecimenReference.getValue().getUuid());
226 227
                    }
227 228
                });
228 229

  
......
312 313
        collectionPopupEditor.loadInEditor(null);
313 314
    }
314 315

  
315
    public void doCollectionEditorEdit(int collectionId) {
316
    public void doCollectionEditorEdit(UUID collectionUuid) {
316 317

  
317 318
        collectionPopupEditor = getNavigationManager().showInPopup(CollectionPopupEditor.class, getView());
318 319

  
319 320
        collectionPopupEditor.grantToCurrentUser(COLLECTION_EDITOR_CRUD);
320 321
        collectionPopupEditor.withDeleteButton(true);
321
        collectionPopupEditor.loadInEditor(collectionId);
322
        collectionPopupEditor.loadInEditor(collectionUuid);
322 323
    }
323 324

  
324 325

  
......
326 327
    public void onCollectionEvent(EntityChangeEvent event){
327 328

  
328 329
        Collection newCollection = getRepo().getCollectionService().load(
329
                event.getEntityId(), Arrays.asList(new String[]{"$.institute"})
330
                event.getEntityUuid(), Arrays.asList(new String[]{"$.institute"})
330 331
                );
331 332
        cache.load(newCollection);
332 333

  
......
346 347
        referencePopupEditor.loadInEditor(null);
347 348
    }
348 349

  
349
    public void doReferenceEditorEdit(int referenceId) {
350
    public void doReferenceEditorEdit(UUID referenceUuid) {
350 351

  
351 352
        referencePopupEditor = getNavigationManager().showInPopup(ReferencePopupEditor.class, getView());
352 353
        referencePopupEditor.withReferenceTypes(RegistrationUIDefaults.MEDIA_REFERENCE_TYPES);
353 354
        referencePopupEditor.grantToCurrentUser(COLLECTION_EDITOR_CRUD);
354 355
        referencePopupEditor.withDeleteButton(true);
355
        referencePopupEditor.loadInEditor(referenceId);
356
        referencePopupEditor.loadInEditor(referenceUuid);
356 357
    }
357 358

  
358 359
    @EventBusListenerMethod(filter = EntityChangeEventFilter.ReferenceFilter.class)
359 360
    public void onReferenceEvent(EntityChangeEvent event){
360 361

  
361
        Reference newRef = getRepo().getReferenceService().load(event.getEntityId(), Arrays.asList(new String[]{"$"}));
362
        Reference newRef = getRepo().getReferenceService().load(event.getEntityUuid(), Arrays.asList(new String[]{"$"}));
362 363
        cache.load(newRef);
363 364

  
364 365
        for( CollectionRowItemCollection row : collectionPopuEditorSourceRows) {
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNameEditorPresenter.java
13 13
import java.util.HashSet;
14 14
import java.util.List;
15 15
import java.util.Set;
16
import java.util.UUID;
16 17

  
17 18
import org.apache.log4j.Logger;
18 19
import org.hibernate.criterion.Restrictions;
......
135 136
     * {@inheritDoc}
136 137
     */
137 138
    @Override
138
    protected TaxonName loadCdmEntityById(Integer identifier) {
139
    protected TaxonName loadCdmEntity(UUID identifier) {
139 140

  
140 141
        List<String> initStrategy = Arrays.asList(new String []{
141 142

  
......
216 217
     * {@inheritDoc}
217 218
     */
218 219
    @Override
219
    protected void guaranteePerEntityCRUDPermissions(Integer identifier) {
220
    protected void guaranteePerEntityCRUDPermissions(UUID identifier) {
220 221
        if(crud != null){
221 222
            newAuthorityCreated = UserHelper.fromSession().createAuthorityForCurrentUser(TaxonName.class, identifier, crud, null);
222 223
        }
......
316 317
        referenceEditorPopup.grantToCurrentUser(EnumSet.of(CRUD.UPDATE, CRUD.DELETE));
317 318
        referenceEditorPopup.withDeleteButton(true);
318 319
        referenceEditorPopup.setBeanInstantiator(newReferenceInstantiator);
319
        referenceEditorPopup.loadInEditor(event.getEntityId());
320
        referenceEditorPopup.loadInEditor(event.getEntityUuid());
320 321
        if(newReferenceInstantiator != null){
321 322
            // this is a bit clumsy, we actually need to inject something like a view configurer
322 323
            // which can enable, disable fields
......
375 376
                .filter(
376 377
                        m -> !TaxonNamePopupEditorMode.NOMENCLATURALREFERENCE_SECTION_EDITING_ONLY.equals(m))
377 378
                .forEach(m -> basionymNamePopup.enableMode(m));
378
        basionymNamePopup.loadInEditor(event.getEntityId());
379
        basionymNamePopup.loadInEditor(event.getEntityUuid());
379 380
        basionymNamePopup.getBasionymToggle().setVisible(false);
380 381

  
381 382
    }
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNamePopupEditor.java
13 13
import java.util.HashMap;
14 14
import java.util.List;
15 15
import java.util.Map;
16
import java.util.UUID;
16 17

  
17 18
import org.apache.commons.lang3.BooleanUtils;
18 19
import org.apache.log4j.Level;
......
282 283
                getViewEventBus().publish(this,
283 284
                    new ReferenceEditorAction(
284 285
                            EditorActionType.EDIT,
285
                            nomReferenceCombobox.getValue().getId(),
286
                            nomReferenceCombobox.getValue().getUuid(),
286 287
                            nomReferenceCombobox,
287 288
                            this)
288 289
                );
......
318 319
        basionymsComboboxSelect.setEditActionListener(e -> {
319 320

  
320 321
            Object fieldValue = e.getSource().getValue();
321
            Integer beanId = null;
322
            UUID beanUuid = null;
322 323
            if(fieldValue != null){
323
                beanId = ((CdmBase)fieldValue).getId();
324
                beanUuid = ((CdmBase)fieldValue).getUuid();
324 325

  
325 326
            }
326
            getViewEventBus().publish(this, new TaxonNameEditorAction(e.getAction(), beanId, e.getSource(), this));
327
            getViewEventBus().publish(this, new TaxonNameEditorAction(e.getAction(), beanUuid, e.getSource(), this));
327 328
        });
328 329
        grid.setComponentAlignment(basionymsComboboxSelect, Alignment.TOP_RIGHT);
329 330
        row++;
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TypeDesignationWorkingsetEditorIdSet.java
8 8
*/
9 9
package eu.etaxonomy.cdm.vaadin.view.name;
10 10

  
11
import java.util.UUID;
12

  
11 13
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
12 14
import eu.etaxonomy.cdm.vaadin.model.TypedEntityReference;
13 15

  
14 16
public class TypeDesignationWorkingsetEditorIdSet {
15 17

  
16
    Integer registrationId;
18
    UUID registrationUuid;
17 19
    TypedEntityReference<IdentifiableEntity<?>> baseEntityRef;
18
    Integer publicationId;
19
    Integer typifiedNameId;
20
    UUID publicationUuid;
21
    UUID typifiedNameUuid;
20 22

  
21 23
    /**
22
     * @param registrationId
24
     * @param registrationUuid
23 25
     *            must be present
24
     * @param workingsetId
25
     *            can <code>null</code>. In this case the <code>publicationId</code>
26
     *            and and typifiedNameId must be set.
27
     *            <code>RegistrationAndWorkingsetId</code> refers to a not yet
28
     *            existing working set, which should be created by the code in
29
     *            case this makes sense.
30
     * @param publicationId
31
     *            Can <code>null</code> if the <code>workingsetId</code> is given.
32
     * @param typifiedNameId
26
     * @param baseEntityRef
27
     *
28
     * @param publicationUuid
29
     *            Can <code>null</code> if the <code>workingsetID</code> is given.
30
     * @param typifiedNameUuid
33 31
     *            Can <code>null</code> if the <code>workingsetId</code> is given
34 32
     */
35
    protected TypeDesignationWorkingsetEditorIdSet(Integer registrationId, TypedEntityReference<IdentifiableEntity<?>> baseEntityRef, Integer publicationId, Integer typifiedNameId) {
36
        this.registrationId = registrationId;
33
    protected TypeDesignationWorkingsetEditorIdSet(UUID registrationUuid, TypedEntityReference<IdentifiableEntity<?>> baseEntityRef,
34
            UUID publicationUuid, UUID typifiedNameUuid) {
35
        this.registrationUuid = registrationUuid;
37 36
        this.baseEntityRef = baseEntityRef;
38
        this.publicationId = publicationId;
39
        this.typifiedNameId = typifiedNameId;
40
        if(baseEntityRef == null && publicationId == null|| baseEntityRef == null && typifiedNameId == null){
37
        this.publicationUuid = publicationUuid;
38
        this.typifiedNameUuid = typifiedNameUuid;
39
        if(baseEntityRef == null && publicationUuid == null|| baseEntityRef == null && typifiedNameUuid == null){
41 40
            throw new NullPointerException("When workingsetId is null, publicationId and typifiedNameId must be non null.");
42 41
        }
43 42
    }
44 43

  
45
    public TypeDesignationWorkingsetEditorIdSet(Integer registrationId, TypedEntityReference<IdentifiableEntity<?>> baseEntityRef) {
46
        this(registrationId, baseEntityRef, null, null);
44
    public TypeDesignationWorkingsetEditorIdSet(UUID registrationUuid, TypedEntityReference<IdentifiableEntity<?>> baseEntityRef) {
45
        this(registrationUuid, baseEntityRef, null, null);
47 46
    }
48 47

  
49
    public TypeDesignationWorkingsetEditorIdSet(Integer registrationId, Integer publicationId, Integer typifiedNameId) {
50
        this(registrationId, null, publicationId, typifiedNameId);
48
    public TypeDesignationWorkingsetEditorIdSet(UUID registrationUuid, UUID publicationUuid, UUID typifiedNameUuid) {
49
        this(registrationUuid, null, publicationUuid, typifiedNameUuid);
51 50
    }
52 51
}
src/main/java/eu/etaxonomy/cdm/vaadin/view/occurrence/CollectionEditorPresenter.java
10 10

  
11 11
import java.util.Arrays;
12 12
import java.util.List;
13
import java.util.UUID;
13 14

  
14 15
import org.springframework.context.annotation.Scope;
15 16
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
......
43 44
     * {@inheritDoc}
44 45
     */
45 46
    @Override
46
    protected Collection loadCdmEntityById(Integer identifier) {
47
    protected Collection loadCdmEntity(UUID identifier) {
47 48

  
48 49
        List<String> initStrategy = Arrays.asList(new String []{
49 50

  
......
66 67
     * {@inheritDoc}
67 68
     */
68 69
    @Override
69
    protected void guaranteePerEntityCRUDPermissions(Integer identifier) {
70
    protected void guaranteePerEntityCRUDPermissions(UUID identifier) {
70 71
        if(crud != null){
71 72
            newAuthorityCreated = UserHelper.fromSession().createAuthorityForCurrentUser(Collection.class, identifier, crud, null);
72 73
        }
......
130 131

  
131 132
        collectionPopuEditor.grantToCurrentUser(this.crud);
132 133
        collectionPopuEditor.withDeleteButton(true);
133
        collectionPopuEditor.loadInEditor(event.getEntityId());
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)