Last change
on this file since 5503 was
5503,
checked in by Twan Goosen, 10 years ago
|
Implemented the admin page, which now has a drop down selector for a "collections space" (published/user) and the same table as the one on the "browse private collections" page
Refs #589
|
File size:
1.3 KB
|
Line | |
---|
1 | package eu.clarin.cmdi.virtualcollectionregistry.gui.table; |
---|
2 | |
---|
3 | import eu.clarin.cmdi.virtualcollectionregistry.QueryOptions; |
---|
4 | import eu.clarin.cmdi.virtualcollectionregistry.model.User; |
---|
5 | import eu.clarin.cmdi.virtualcollectionregistry.model.VirtualCollection; |
---|
6 | import org.apache.wicket.model.IModel; |
---|
7 | |
---|
8 | /** |
---|
9 | * Provider that dynamically switches between user or public collection spaces |
---|
10 | * on basis of a provided user model. |
---|
11 | * |
---|
12 | * Permission checking does not happen within this provider! |
---|
13 | * |
---|
14 | * @author twagoo |
---|
15 | */ |
---|
16 | public class AdminCollectionsProvider extends CollectionsProvider { |
---|
17 | |
---|
18 | private final IModel<User> userModel; |
---|
19 | |
---|
20 | public AdminCollectionsProvider(IModel<User> userModel) { |
---|
21 | this.userModel = userModel; |
---|
22 | } |
---|
23 | |
---|
24 | @Override |
---|
25 | protected void addSpaceFilter(QueryOptions.Filter filter) { |
---|
26 | User user = userModel.getObject(); |
---|
27 | if (user == null) { |
---|
28 | // select public collections |
---|
29 | filter.add(QueryOptions.Property.VC_STATE, |
---|
30 | QueryOptions.Relation.EQ, |
---|
31 | VirtualCollection.State.PUBLIC); |
---|
32 | |
---|
33 | } else { |
---|
34 | // select selected user collections |
---|
35 | filter.add(QueryOptions.Property.VC_OWNER, |
---|
36 | QueryOptions.Relation.EQ, |
---|
37 | user.getName()); |
---|
38 | |
---|
39 | } |
---|
40 | } |
---|
41 | |
---|
42 | @Override |
---|
43 | public void detach() { |
---|
44 | userModel.detach(); |
---|
45 | } |
---|
46 | |
---|
47 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.