Project

General

Profile

Revision 4942e63b

ID4942e63bcc80909b3d2dc25bf7860fc475d85773
Parent fcf1cf06
Child 9a4a9149

Added by Andreas Kohlbecker over 2 years ago

introducing CdmEntityDecoraterDTO and refactoring presenters

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/model/CdmEntityDecoraterDTO.java
1
/**
2
* Copyright (C) 2018 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.vaadin.model;
10

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

  
14
import org.joda.time.DateTime;
15

  
16
import eu.etaxonomy.cdm.model.common.CdmBase;
17
import eu.etaxonomy.cdm.model.common.User;
18

  
19
/**
20
 * @author a.kohlbecker
21
 * @since Apr 23, 2018
22
 *
23
 */
24
public class CdmEntityDecoraterDTO<CDM extends CdmBase> implements Serializable {
25

  
26
    private static final long serialVersionUID = 1715911851453178727L;
27

  
28
    protected CDM entity;
29

  
30
    public CdmEntityDecoraterDTO(CDM entity){
31
        this.entity = entity;
32
    }
33

  
34
    public CDM cdmEntity(){
35
        return entity;
36
    }
37

  
38
    public void setCreated(DateTime created) {
39
        entity.setCreated(created);
40
    }
41

  
42
    public void setCreatedBy(User createdBy) {
43
        entity.setCreatedBy(createdBy);
44
    }
45

  
46
    public DateTime getCreated() {
47
        return entity.getCreated();
48
    }
49

  
50
    public User getCreatedBy() {
51
        return entity.getCreatedBy();
52
    }
53

  
54
    public int getId() {
55
        return entity.getId();
56
    }
57

  
58
    public void setId(int id) {
59
        entity.setId(id);
60
    }
61

  
62
    public UUID getUuid() {
63
        return entity.getUuid();
64
    }
65

  
66
    public void setUuid(UUID uuid) {
67
        entity.setUuid(uuid);
68
    }
69

  
70
}
src/main/java/eu/etaxonomy/vaadin/mvp/AbstractCdmDTOEditorPresenter.java
1
/**
2
* Copyright (C) 2017 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.vaadin.mvp;
10

  
11
import eu.etaxonomy.cdm.model.common.CdmBase;
12
import eu.etaxonomy.cdm.vaadin.model.CdmEntityDecoraterDTO;
13

  
14
/**
15
 * Provides generic save operations of modified cdm entities.
16
 *
17
 * @author a.kohlbecker
18
 * @since Apr 5, 2017
19
 *
20
 */
21
public abstract class AbstractCdmDTOEditorPresenter<DTO extends CdmEntityDecoraterDTO<CDM>, CDM extends CdmBase, V extends ApplicationView<?>> extends CdmEditorPresenterBase<DTO, CDM, V> {
22

  
23
    private static final long serialVersionUID = -6315824180341694825L;
24

  
25

  
26
    @Override
27
    protected CDM cdmEntity(DTO dto) {
28
        return dto.cdmEntity();
29
    }
30

  
31

  
32

  
33
}
src/main/java/eu/etaxonomy/vaadin/mvp/AbstractCdmEditorPresenter.java
8 8
*/
9 9
package eu.etaxonomy.vaadin.mvp;
10 10

  
11
import java.util.Collection;
12
import java.util.EnumSet;
13
import java.util.HashSet;
14
import java.util.UUID;
15

  
16
import org.apache.log4j.Logger;
17
import org.hibernate.HibernateException;
18

  
19
import eu.etaxonomy.cdm.api.service.IService;
20
import eu.etaxonomy.cdm.cache.CdmTransientEntityCacher;
21
import eu.etaxonomy.cdm.debug.PersistentContextAnalyzer;
22
import eu.etaxonomy.cdm.model.ICdmCacher;
23 11
import eu.etaxonomy.cdm.model.common.CdmBase;
24
import eu.etaxonomy.cdm.model.common.User;
25
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
26
import eu.etaxonomy.cdm.persistence.hibernate.permission.CdmAuthority;
27
import eu.etaxonomy.cdm.service.CdmStore;
28
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent;
29
import eu.etaxonomy.cdm.vaadin.permission.UserHelper;
30
import eu.etaxonomy.cdm.vaadin.view.name.CachingPresenter;
31
import eu.etaxonomy.vaadin.mvp.event.EditorPreSaveEvent;
32
import eu.etaxonomy.vaadin.mvp.event.EditorSaveEvent;
33 12

  
34 13
/**
35 14
 * Provides generic save operations of modified cdm entities.
......
38 17
 * @since Apr 5, 2017
39 18
 *
40 19
 */
41
public abstract class AbstractCdmEditorPresenter<DTO extends CdmBase, V extends ApplicationView<?>> extends AbstractEditorPresenter<DTO, V>
42
    implements CachingPresenter {
43

  
44
    private static final long serialVersionUID = 2218185546277084261L;
45

  
46
    private static final Logger logger = Logger.getLogger(AbstractCdmEditorPresenter.class);
47

  
48
    /**
49
     * if not null, this CRUD set is to be used to create a CdmAuthoritiy for the base entity which will be
50
     * granted to the current use as long this grant is not assigned yet.
51
     */
52
    protected EnumSet<CRUD> crud = null;
53

  
54

  
55
    private ICdmCacher cache;
56

  
57
    private java.util.Collection<CdmBase> rootEntities = new HashSet<>();
20
public abstract class AbstractCdmEditorPresenter<CDM extends CdmBase, V extends ApplicationView<?>> extends CdmEditorPresenterBase<CDM, CDM, V> {
58 21

  
59
    public AbstractCdmEditorPresenter() {
60
        super();
61
        logger.trace(this._toString() + " constructor");
62
    }
63

  
64
    CdmStore<DTO, IService<DTO>> store ;
65

  
66
    protected CdmAuthority newAuthorityCreated;
67

  
68
    protected CdmStore<DTO, IService<DTO>> getStore() {
69
        if(store == null){
70
            store = new CdmStore<>(getRepo(), getService());
71
        }
72
        return store;
73
    }
22
    private static final long serialVersionUID = -6315824180341694825L;
74 23

  
75 24
    @Override
76
    protected DTO loadBeanById(Object identifier) {
77

  
78
        DTO cdmEntitiy;
79
        if(identifier != null) {
80
            UUID uuidIdentifier = (UUID)identifier;
81
            // CdmAuthority is needed before the bean is loaded into the session.
82
            // otherwise adding the authority to the user would cause a flush
83
            cdmEntitiy = loadCdmEntity(uuidIdentifier);
84
            guaranteePerEntityCRUDPermissions(cdmEntitiy);
85
        } else {
86
            cdmEntitiy = loadCdmEntity(null);
87
            if(cdmEntitiy != null){
88
                guaranteePerEntityCRUDPermissions(cdmEntitiy);
89
            }
90
        }
91
        cache = new CdmTransientEntityCacher(this);
92
        // need to use load but put see #7214
93
        cdmEntitiy = cache.load(cdmEntitiy);
94
        addRootEntity(cdmEntitiy);
95

  
25
    protected CDM createDTODecorator(CDM cdmEntitiy) {
96 26
        return cdmEntitiy;
97 27
    }
98 28

  
99
    /**
100
     * @param cdmEntitiy
101
     */
102
    @Override
103
    protected void adaptToUserPermission(DTO cdmEntitiy) {
104
        UserHelper userHelper = UserHelper.fromSession();
105
        boolean canDelte = userHelper.userHasPermission(cdmEntitiy, CRUD.DELETE);
106
        boolean canEdit = userHelper.userHasPermission(cdmEntitiy, CRUD.UPDATE);
107

  
108
        User user = userHelper.user();
109

  
110
        if(AbstractCdmPopupEditor.class.isAssignableFrom(getView().getClass())){
111
            AbstractCdmPopupEditor popupView = ((AbstractCdmPopupEditor)getView());
112

  
113
            if(!canEdit){
114
                popupView.setReadOnly(true); // never reset true to false here!
115
                logger.debug("setting editor to readonly");
116
            }
117
            if(!canDelte){
118
                popupView.withDeleteButton(false);
119
                logger.debug("removing delete button");
120
            }
121
        }
122

  
123
    }
124

  
125
    /**
126
     * @param identifier
127
     * @return
128
     */
129
    protected abstract DTO loadCdmEntity(UUID uuid);
130

  
131
    /**
132
     * Grant per entity CdmAuthority to the current user <b>for the bean which is not yet loaded</b>
133
     * into the editor. The <code>CRUD</code> to be granted are stored in the <code>crud</code> field.
134
     */
135
    protected abstract void guaranteePerEntityCRUDPermissions(UUID identifier);
136

  
137
    /**
138
     * Grant per entity CdmAuthority to the current user for the bean which is loaded
139
     * into the editor. The <code>CRUD</code> to be granted are stored in the <code>crud</code> field.
140
     */
141
     protected abstract void guaranteePerEntityCRUDPermissions(DTO bean);
142

  
143
    /**
144
     * @return
145
     */
146
    protected abstract IService<DTO> getService();
147

  
148
    @SuppressWarnings("unchecked")
149
    @Override
150
    // @EventBusListenerMethod // already annotated at super class
151
    public void onEditorPreSaveEvent(EditorPreSaveEvent preSaveEvent){
152

  
153
        if(!isFromOwnView(preSaveEvent)){
154
            return;
155
        }
156
        super.onEditorPreSaveEvent(preSaveEvent);
157
    }
158

  
159
    @SuppressWarnings("unchecked")
160
    @Override
161
    // @EventBusListenerMethod // already annotated at super class
162
    public void onEditorSaveEvent(EditorSaveEvent<DTO> saveEvent){
163

  
164
        if(!isFromOwnView(saveEvent)){
165
            return;
166
        }
167

  
168
        // the bean is now updated with the changes made by the user
169
        DTO bean = saveEvent.getBean();
170

  
171
        if(logger.isTraceEnabled()){
172
            PersistentContextAnalyzer pca = new PersistentContextAnalyzer(bean);
173
            pca.printEntityGraph(System.err);
174
            pca.printCopyEntities(System.err);
175
        }
176
        bean = handleTransientProperties(bean);
177

  
178
        if(logger.isTraceEnabled()){
179
            PersistentContextAnalyzer pca = new PersistentContextAnalyzer(bean);
180
            pca.printEntityGraph(System.err);
181
            pca.printCopyEntities(System.err);
182
        }
183
        try {
184
            EntityChangeEvent changeEvent = getStore().saveBean(bean, (AbstractView) getView());
185

  
186
            if(changeEvent != null){
187
                viewEventBus.publish(this, changeEvent);
188
            }
189
        } catch (HibernateException e){
190
            if(newAuthorityCreated != null){
191
                UserHelper.fromSession().removeAuthorityForCurrentUser(newAuthorityCreated);
192
            }
193
            throw e;
194
        }
195
    }
196

  
197
    /**
198
     * EditorPresenters for beans with transient properties should overwrite this method to
199
     * update the beanItem with the changes made to the transient properties.
200
     * <p>
201
     * This is necessary because Vaadin MethodProperties are readonly when no setter is
202
     * available. This can be the case with transient properties. Automatic updating
203
     * of the property during the fieldGroup commit does not work in this case.
204
     *
205
     * @deprecated editors should operate on DTOs instead, remove this method if unused.
206
     */
207
    @Deprecated
208
    protected DTO handleTransientProperties(DTO bean) {
209
        // no need to handle transient properties in the generic case
210
        return bean;
211
    }
212

  
213
//    @Override
214
//    protected DTO prepareAsFieldGroupDataSource(DTO bean){
215
//        DTO mergedBean = getStore().mergedBean(bean);
216
//        // DTO mergedBean = bean;
217
//        return mergedBean;
218
//    }
219

  
220
    /**
221
     * If the bean is contained in the session it is being updated by
222
     * doing an evict and merge. The fieldGroup is updated with the merged bean.
223
     *
224
     * @param bean
225
     *
226
     * @return The bean merged to the session or original bean in case a merge was not necessary.
227
     */
228
    private DTO mergedBean(DTO bean) {
229
        DTO mergedBean = getStore().mergedBean(bean);
230
        ((AbstractPopupEditor<DTO, AbstractCdmEditorPresenter<DTO, V>>)getView()).updateItemDataSource(mergedBean);
231
        return mergedBean;
232

  
233
    }
234

  
235 29
    @Override
236
    protected
237
    final void saveBean(DTO bean){
238
        // blank implementation, since this is not needed in this or any sub class
239
        // see onEditorSaveEvent() instead
30
    protected CDM cdmEntity(CDM dto) {
31
        return dto;
240 32
    }
241 33

  
242
    @Override
243
    protected void deleteBean(DTO bean){
244
        EntityChangeEvent changeEvent = getStore().deleteBean(bean, (AbstractView) getView());
245
        if(changeEvent != null){
246
            viewEventBus.publish(this, changeEvent);
247
        }
248

  
249
    }
250

  
251
    /**
252
     * @param crud
253
     */
254
    public void setGrantsForCurrentUser(EnumSet<CRUD> crud) {
255
        this.crud = crud;
256

  
257
    }
258

  
259
    /**
260
     * {@inheritDoc}
261
     */
262
    @Override
263
    public ICdmCacher getCache() {
264
        return cache;
265
    }
266

  
267
    /**
268
     * {@inheritDoc}
269
     */
270
    @Override
271
    public void addRootEntity(CdmBase entity) {
272
        rootEntities.add(entity);
273
    }
274

  
275

  
276
    /**
277
     * {@inheritDoc}
278
     */
279
    @Override
280
    public Collection<CdmBase> getRootEntities() {
281
        return rootEntities;
282
    }
283

  
284

  
285
}
34
}
src/main/java/eu/etaxonomy/vaadin/mvp/CdmEditorPresenterBase.java
1
/**
2
* Copyright (C) 2017 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.vaadin.mvp;
10

  
11
import java.util.Collection;
12
import java.util.EnumSet;
13
import java.util.HashSet;
14
import java.util.UUID;
15

  
16
import org.apache.log4j.Logger;
17
import org.hibernate.HibernateException;
18

  
19
import eu.etaxonomy.cdm.api.service.IService;
20
import eu.etaxonomy.cdm.cache.CdmTransientEntityCacher;
21
import eu.etaxonomy.cdm.debug.PersistentContextAnalyzer;
22
import eu.etaxonomy.cdm.model.ICdmCacher;
23
import eu.etaxonomy.cdm.model.common.CdmBase;
24
import eu.etaxonomy.cdm.model.common.User;
25
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
26
import eu.etaxonomy.cdm.persistence.hibernate.permission.CdmAuthority;
27
import eu.etaxonomy.cdm.service.CdmStore;
28
import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent;
29
import eu.etaxonomy.cdm.vaadin.permission.UserHelper;
30
import eu.etaxonomy.cdm.vaadin.view.name.CachingPresenter;
31
import eu.etaxonomy.vaadin.mvp.event.EditorPreSaveEvent;
32
import eu.etaxonomy.vaadin.mvp.event.EditorSaveEvent;
33

  
34
/**
35
 * Provides generic save operations of modified cdm entities.
36
 *
37
 * @author a.kohlbecker
38
 * @since Apr 5, 2017
39
 *
40
 */
41
public abstract class CdmEditorPresenterBase<DTO, CDM extends CdmBase, V extends ApplicationView<?>> extends AbstractEditorPresenter<DTO, V>
42
    implements CachingPresenter {
43

  
44
    private static final long serialVersionUID = 2218185546277084261L;
45

  
46
    private static final Logger logger = Logger.getLogger(CdmEditorPresenterBase.class);
47

  
48
    /**
49
     * if not null, this CRUD set is to be used to create a CdmAuthoritiy for the base entity which will be
50
     * granted to the current use as long this grant is not assigned yet.
51
     */
52
    protected EnumSet<CRUD> crud = null;
53

  
54

  
55
    private ICdmCacher cache;
56

  
57
    private java.util.Collection<CdmBase> rootEntities = new HashSet<>();
58

  
59
    public CdmEditorPresenterBase() {
60
        super();
61
        logger.trace(this._toString() + " constructor");
62
    }
63

  
64
    CdmStore<CDM, IService<CDM>> store ;
65

  
66
    protected CdmAuthority newAuthorityCreated;
67

  
68
    protected CdmStore<CDM, IService<CDM>> getStore() {
69
        if(store == null){
70
            store = new CdmStore<>(getRepo(), getService());
71
        }
72
        return store;
73
    }
74

  
75
    @Override
76
    protected DTO loadBeanById(Object identifier) {
77

  
78
        CDM cdmEntitiy;
79
        if(identifier != null) {
80
            UUID uuidIdentifier = (UUID)identifier;
81
            // CdmAuthority is needed before the bean is loaded into the session.
82
            // otherwise adding the authority to the user would cause a flush
83
            cdmEntitiy = loadCdmEntity(uuidIdentifier);
84
            guaranteePerEntityCRUDPermissions(cdmEntitiy);
85
        } else {
86
            cdmEntitiy = loadCdmEntity(null);
87
            if(cdmEntitiy != null){
88
                guaranteePerEntityCRUDPermissions(cdmEntitiy);
89
            }
90
        }
91
        cache = new CdmTransientEntityCacher(this);
92
        // need to use load but put see #7214
93
        cdmEntitiy = cache.load(cdmEntitiy);
94
        addRootEntity(cdmEntitiy);
95

  
96
        DTO dto = createDTODecorator(cdmEntitiy);
97

  
98
        return dto;
99
    }
100

  
101
    /**
102
     * @param cdmEntitiy
103
     * @return
104
     */
105
    protected abstract DTO createDTODecorator(CDM cdmEntitiy);
106

  
107
    /**
108
     * @param cdmEntitiy
109
     */
110
    @Override
111
    protected void adaptToUserPermission(DTO dto) {
112

  
113
        CDM cdmEntitiy = cdmEntity(dto);
114

  
115
        UserHelper userHelper = UserHelper.fromSession();
116
        boolean canDelte = userHelper.userHasPermission(cdmEntitiy, CRUD.DELETE);
117
        boolean canEdit = userHelper.userHasPermission(cdmEntitiy, CRUD.UPDATE);
118

  
119
        User user = userHelper.user();
120

  
121
        if(AbstractCdmPopupEditor.class.isAssignableFrom(getView().getClass())){
122
            AbstractCdmPopupEditor popupView = ((AbstractCdmPopupEditor)getView());
123

  
124
            if(!canEdit){
125
                popupView.setReadOnly(true); // never reset true to false here!
126
                logger.debug("setting editor to readonly");
127
            }
128
            if(!canDelte){
129
                popupView.withDeleteButton(false);
130
                logger.debug("removing delete button");
131
            }
132
        }
133

  
134
    }
135

  
136
    /**
137
     * @param dto
138
     * @return
139
     */
140
    protected abstract CDM cdmEntity(DTO dto);
141

  
142
    /**
143
     * @param identifier
144
     * @return
145
     */
146
    protected abstract CDM loadCdmEntity(UUID uuid);
147

  
148
    /**
149
     * Grant per entity CdmAuthority to the current user <b>for the bean which is not yet loaded</b>
150
     * into the editor. The <code>CRUD</code> to be granted are stored in the <code>crud</code> field.
151
     */
152
    protected abstract void guaranteePerEntityCRUDPermissions(UUID identifier);
153

  
154
    /**
155
     * Grant per entity CdmAuthority to the current user for the bean which is loaded
156
     * into the editor. The <code>CRUD</code> to be granted are stored in the <code>crud</code> field.
157
     */
158
     protected abstract void guaranteePerEntityCRUDPermissions(CDM bean);
159

  
160
    /**
161
     * @return
162
     */
163
    protected abstract IService<CDM> getService();
164

  
165
    @SuppressWarnings("unchecked")
166
    @Override
167
    // @EventBusListenerMethod // already annotated at super class
168
    public void onEditorPreSaveEvent(EditorPreSaveEvent preSaveEvent){
169

  
170
        if(!isFromOwnView(preSaveEvent)){
171
            return;
172
        }
173
        super.onEditorPreSaveEvent(preSaveEvent);
174
    }
175

  
176
    @SuppressWarnings("unchecked")
177
    @Override
178
    // @EventBusListenerMethod // already annotated at super class
179
    public void onEditorSaveEvent(EditorSaveEvent<DTO> saveEvent){
180

  
181
        if(!isFromOwnView(saveEvent)){
182
            return;
183
        }
184

  
185
        // the bean is now updated with the changes made by the user
186
        DTO dto = saveEvent.getBean();
187
        CDM cdmEntity = cdmEntity(dto);
188

  
189
        if(logger.isTraceEnabled()){
190
            PersistentContextAnalyzer pca = new PersistentContextAnalyzer(cdmEntity);
191
            pca.printEntityGraph(System.err);
192
            pca.printCopyEntities(System.err);
193
        }
194
        dto = handleTransientProperties(dto);
195

  
196
        if(logger.isTraceEnabled()){
197
            PersistentContextAnalyzer pca = new PersistentContextAnalyzer(cdmEntity);
198
            pca.printEntityGraph(System.err);
199
            pca.printCopyEntities(System.err);
200
        }
201
        try {
202
            EntityChangeEvent changeEvent = getStore().saveBean(cdmEntity, (AbstractView) getView());
203

  
204
            if(changeEvent != null){
205
                viewEventBus.publish(this, changeEvent);
206
            }
207
        } catch (HibernateException e){
208
            if(newAuthorityCreated != null){
209
                UserHelper.fromSession().removeAuthorityForCurrentUser(newAuthorityCreated);
210
            }
211
            throw e;
212
        }
213
    }
214

  
215
    /**
216
     * EditorPresenters for beans with transient properties should overwrite this method to
217
     * update the beanItem with the changes made to the transient properties.
218
     * <p>
219
     * This is necessary because Vaadin MethodProperties are readonly when no setter is
220
     * available. This can be the case with transient properties. Automatic updating
221
     * of the property during the fieldGroup commit does not work in this case.
222
     *
223
     * @deprecated editors should operate on DTOs instead, remove this method if unused.
224
     */
225
    @Deprecated
226
    protected DTO handleTransientProperties(DTO bean) {
227
        // no need to handle transient properties in the generic case
228
        return bean;
229
    }
230

  
231
//    @Override
232
//    protected DTO prepareAsFieldGroupDataSource(DTO bean){
233
//        DTO mergedBean = getStore().mergedBean(bean);
234
//        // DTO mergedBean = bean;
235
//        return mergedBean;
236
//    }
237

  
238
//    /**
239
//     * If the bean is contained in the session it is being updated by
240
//     * doing an evict and merge. The fieldGroup is updated with the merged bean.
241
//     *
242
//     * @param bean
243
//     *
244
//     * @return The bean merged to the session or original bean in case a merge was not necessary.
245
//     */
246
//    private DTO mergedBean(DTO bean) {
247
//        DTO mergedBean = getStore().mergedBean(bean);
248
//        ((AbstractPopupEditor<DTO, AbstractCdmEditorPresenter<DTO, V>>)getView()).updateItemDataSource(mergedBean);
249
//        return mergedBean;
250
//
251
//    }
252

  
253
    @Override
254
    protected
255
    final void saveBean(DTO bean){
256
        // blank implementation, since this is not needed in this or any sub class
257
        // see onEditorSaveEvent() instead
258
    }
259

  
260
    @Override
261
    protected void deleteBean(DTO bean){
262
        CDM cdmEntity = cdmEntity(bean);
263
        EntityChangeEvent changeEvent = getStore().deleteBean(cdmEntity, (AbstractView) getView());
264
        if(changeEvent != null){
265
            viewEventBus.publish(this, changeEvent);
266
        }
267

  
268
    }
269

  
270
    /**
271
     * @param crud
272
     */
273
    public void setGrantsForCurrentUser(EnumSet<CRUD> crud) {
274
        this.crud = crud;
275

  
276
    }
277

  
278
    /**
279
     * {@inheritDoc}
280
     */
281
    @Override
282
    public ICdmCacher getCache() {
283
        return cache;
284
    }
285

  
286
    /**
287
     * {@inheritDoc}
288
     */
289
    @Override
290
    public void addRootEntity(CdmBase entity) {
291
        rootEntities.add(entity);
292
    }
293

  
294

  
295
    /**
296
     * {@inheritDoc}
297
     */
298
    @Override
299
    public Collection<CdmBase> getRootEntities() {
300
        return rootEntities;
301
    }
302

  
303

  
304
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)