3 * Copyright (C) 2015 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.vaadin
.util
;
12 import com
.vaadin
.server
.VaadinSession
;
14 import eu
.etaxonomy
.cdm
.vaadin
.session
.CdmDataChangeService
;
15 import eu
.etaxonomy
.cdm
.vaadin
.session
.SelectionService
;
22 public class CdmVaadinSessionUtilities
{
24 public static void setCurrentAttribute(String name
, Object value
) {
26 VaadinSession
.getCurrent().getLockInstance().lock();
27 VaadinSession
.getCurrent().setAttribute(name
, value
);
29 VaadinSession
.getCurrent().getLockInstance().unlock();
33 public static void initCdmDataChangeService() {
34 setCurrentAttribute(CdmDataChangeService
.KEY
, new CdmDataChangeService());
37 public static CdmDataChangeService
getCurrentCdmDataChangeService() {
38 return (CdmDataChangeService
) VaadinSession
.getCurrent().getAttribute(CdmDataChangeService
.KEY
);
41 public static void initSelectionService() {
42 setCurrentAttribute(SelectionService
.KEY
, new SelectionService());
45 public static SelectionService
getCurrentSelectionService() {
46 return (SelectionService
) VaadinSession
.getCurrent().getAttribute(SelectionService
.KEY
);