Project

General

Profile

« Previous | Next » 

Revision 37f70555

Added by Andreas Kohlbecker almost 6 years ago

ref #7550 moving the actual CdmUserHelper to cdmlib and making it available in cdm-vaadin by extending the UserHelper class and interface hierarchy

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/permission/VaadinUserHelper.java
10 10

  
11 11
import com.vaadin.server.VaadinSession;
12 12

  
13
import eu.etaxonomy.cdm.api.utility.UserHelper;
14

  
13 15
/**
14
 * Abstract UserHelper which auto registers in the VaadinSession.
16
 * VaadinUserHelper interface. Implementations should use the {@link #VADDIN_SESSION_KEY} to auto registers
17
 * in the VaadinSession.
15 18
 *
16 19
 * @author a.kohlbecker
17 20
 * @since May 23, 2017
18 21
 *
19 22
 */
20
public abstract class VaadinUserHelper implements UserHelper {
23
public interface VaadinUserHelper extends UserHelper {
24

  
25
    public static final String VADDIN_SESSION_KEY = "USER_HELPER";
21 26

  
22
    public VaadinUserHelper() {
23
        VaadinSession.getCurrent().setAttribute(VADDIN_SESSION_KEY, this);
27
    /**
28
     * Static accessor method to obtain the auto-registered VaadinUserHelper-Bean from the
29
     * VaadinSession.
30
     *
31
     * @return
32
     */
33
    public static VaadinUserHelper fromSession() {
34
       return (VaadinUserHelper)VaadinSession.getCurrent().getAttribute(VADDIN_SESSION_KEY);
24 35
    }
25 36

  
37
    // ---- methods special to the registration ------------
38

  
39
    public boolean userIsRegistrationCurator();
40

  
41

  
26 42
}

Also available in: Unified diff