Project

General

Profile

Download (2.45 KB) Statistics
| Branch: | Tag: | Revision:
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.taxeditor.ui.dialog.selection;
10

    
11
import java.util.UUID;
12

    
13
import org.eclipse.swt.widgets.Shell;
14

    
15
import eu.etaxonomy.cdm.api.service.IRightsService;
16
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
17
import eu.etaxonomy.cdm.model.media.Rights;
18
import eu.etaxonomy.taxeditor.model.MessagingUtils;
19
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
20
import eu.etaxonomy.taxeditor.store.CdmStore;
21

    
22
/**
23
 * @author k.luther
24
 * @date 15.02.2017
25
 *
26
 */
27
public class RightsSelectionDialog extends AbstractFilteredCdmResourceSelectionDialog<Rights> {
28

    
29

    
30
    public static Rights select(Shell shell, //ConversationHolder conversation,
31
            Rights rights){
32
        RightsSelectionDialog dialog = new RightsSelectionDialog(shell, //conversation,
33
                "Choose Rights", false, RightsSelectionDialog.class.getCanonicalName(), rights);
34
        return getSelectionFromDialog(dialog);
35
    }
36

    
37
    /**
38
     * <p>Constructor for FilteredDerivedUnitSelectionDialog.</p>
39
     */
40
    protected RightsSelectionDialog(Shell shell, //ConversationHolder conversation,
41
            String title,
42
            boolean multi, String settings, Rights rights) {
43
        super(shell, //conversation,
44
                title, multi, settings, rights);
45
    }
46

    
47
    /**
48
     * {@inheritDoc}
49
     */
50
    @Override
51
    protected Rights getPersistentObject(UUID uuid) {
52
        Object object = CdmStore.getService(IRightsService.class).load(uuid);
53

    
54
        Rights rights= (Rights) HibernateProxyHelper.deproxy(object);
55

    
56
        if(rights != null){
57
            return rights;
58
        }
59
        MessagingUtils.error(this.getClass(), "Selected element is not rights", null);
60
        return null;
61
    }
62

    
63
    /**
64
     * {@inheritDoc}
65
     */
66
    @Override
67
    protected String[] getNewWizardText() {
68
        return null;
69
    }
70

    
71
    /**
72
     * {@inheritDoc}
73
     */
74
    @Override
75
    protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
76
        // TODO Auto-generated method stub
77
        return null;
78
    }
79

    
80
    /**
81
     * {@inheritDoc}
82
     */
83
    @Override
84
    protected void callService(String pattern) {
85
        model = CdmStore.getService(IRightsService.class).getUuidAndLabelText(limitOfInitialElements,pattern);
86
    }
87

    
88
}
(34-34/46)