/** * Gets the object from the {@link MetaDataEntry}. * * @return the object from the {@link MetaDataEntry}. */ public T get() { return getSession().getMetaData(key); }
/** * @param session * the current web session * @return the authentication data. May be {@code null}. */ public static BrowserId getBrowserId(final Session session) { Args.notNull(session, "session"); BrowserId browserId = session.getMetaData(KEY); return browserId; }
public static InterceptData get() { if (Session.exists()) { return Session.get().getMetaData(key); } return null; }
public static InterceptData get() { if (Session.exists()) { return Session.get().getMetaData(key); } return null; }
private String getProjectDescription() { Project project = Session.get().getMetaData(SessionMetaData.CURRENT_PROJECT); if (project != null) { return project.getDescription(); } else { return "Please select a project."; } } }
public KnowledgeBasePage() { super(); LOG.debug("Setting up page without parameters"); Project project = Session.get().getMetaData(SessionMetaData.CURRENT_PROJECT); if (project == null) { abort(); } commonInit(project); }
public KnowledgeBasePage() { super(); LOG.debug("Setting up page without parameters"); Project project = Session.get().getMetaData(SessionMetaData.CURRENT_PROJECT); if (project == null) { abort(); } commonInit(project); }
public CurationPage() { super(); LOG.debug("Setting up curation page without parameters"); commonInit(); Map<String, StringValue> fragmentParameters = Session.get() .getMetaData(SessionMetaData.LOGIN_URL_FRAGMENT_PARAMS); if (fragmentParameters != null) { // Clear the URL fragment parameters - we only use them once! Session.get().setMetaData(SessionMetaData.LOGIN_URL_FRAGMENT_PARAMS, null); StringValue project = fragmentParameters.get(PAGE_PARAM_PROJECT_ID); StringValue document = fragmentParameters.get(PAGE_PARAM_DOCUMENT_ID); StringValue focus = fragmentParameters.get(PAGE_PARAM_FOCUS); handleParameters(null, project, document, focus, false); } }
public AnnotationPage() { super(); LOG.debug("Setting up annotation page without parameters"); commonInit(); Map<String, StringValue> fragmentParameters = Session.get() .getMetaData(SessionMetaData.LOGIN_URL_FRAGMENT_PARAMS); if (fragmentParameters != null) { // Clear the URL fragment parameters - we only use them once! Session.get().setMetaData(SessionMetaData.LOGIN_URL_FRAGMENT_PARAMS, null); StringValue project = fragmentParameters.get(PAGE_PARAM_PROJECT_ID); StringValue document = fragmentParameters.get(PAGE_PARAM_DOCUMENT_ID); StringValue focus = fragmentParameters.get(PAGE_PARAM_FOCUS); handleParameters(null, project, document, focus, false); } }
public CurationPage() { super(); LOG.debug("Setting up curation page without parameters"); commonInit(); Map<String, StringValue> fragmentParameters = Session.get() .getMetaData(SessionMetaData.LOGIN_URL_FRAGMENT_PARAMS); if (fragmentParameters != null) { // Clear the URL fragment parameters - we only use them once! Session.get().setMetaData(SessionMetaData.LOGIN_URL_FRAGMENT_PARAMS, null); StringValue project = fragmentParameters.get(PAGE_PARAM_PROJECT_ID); StringValue document = fragmentParameters.get(PAGE_PARAM_DOCUMENT_ID); StringValue focus = fragmentParameters.get(PAGE_PARAM_FOCUS); handleParameters(null, project, document, focus, false); } }
@Override public boolean applies() { Project sessionProject = Session.get().getMetaData(SessionMetaData.CURRENT_PROJECT); if (sessionProject == null) { return false; } // The project object stored in the session is detached from the persistence context and // cannot be used immediately in DB interactions. Fetch a fresh copy from the DB. Project project = projectService.getProject(sessionProject.getId()); return !externalSearchService.listDocumentRepositories(project).isEmpty(); }
@Override public boolean applies() { Project sessionProject = Session.get().getMetaData(SessionMetaData.CURRENT_PROJECT); if (sessionProject == null) { return false; } // The project object stored in the session is detached from the persistence context and // cannot be used immediately in DB interactions. Fetch a fresh copy from the DB. Project project = projectService.getProject(sessionProject.getId()); return !externalSearchService.listDocumentRepositories(project).isEmpty(); }
@EventListener public void onProjectDeleted(BeforeProjectRemovedEvent aEvent) { Session session = Session.get(); if (session != null) { // If the currently selected project is deleted, clear it from the session. Project project = session.getMetaData(SessionMetaData.CURRENT_PROJECT); if (project != null && Objects.equals(aEvent.getProject().getId(), project.getId())) { session.setMetaData(SessionMetaData.CURRENT_PROJECT, null); } } } }
@EventListener public void onProjectDeleted(BeforeProjectRemovedEvent aEvent) { Session session = Session.get(); if (session != null) { // If the currently selected project is deleted, clear it from the session. Project project = session.getMetaData(SessionMetaData.CURRENT_PROJECT); if (project != null && Objects.equals(aEvent.getProject().getId(), project.getId())) { session.setMetaData(SessionMetaData.CURRENT_PROJECT, null); } } } }
/** * Look up project in session but get fresh info from the DB in case the session object is * stale (e.g. if the title/description has changed). */ private Project getProject() { Project project = Session.get().getMetaData(SessionMetaData.CURRENT_PROJECT); if (project == null) { return null; } else { return projectService.getProject(project.getId()); } }
/** * Look up project in session but get fresh info from the DB in case the session object is * stale (e.g. if the title/description has changed). */ private Project getProject() { Project project = Session.get().getMetaData(SessionMetaData.CURRENT_PROJECT); if (project == null) { return null; } else { return projectService.getProject(project.getId()); } }
public CurrentProjectDashlet(String aId) { super(aId); add(new Label("name", LambdaModel.of(() -> PropertyModel .of(Session.get().getMetaData(SessionMetaData.CURRENT_PROJECT), "name")))); add(new Label("description", LambdaModel.of(this::getProjectDescription))); }
@Override public ICrypt newCrypt() { Session session = Session.get(); session.bind(); // retrieve or generate encryption key from session String key = session.getMetaData(KEY); if (key == null) { // generate new key key = session.getId() + "." + UUID.randomUUID().toString(); session.setMetaData(KEY, key); } // build the crypt based on session key ICrypt crypt = createCrypt(); crypt.setKey(key); return crypt; }
public static TreeResourceSet get() { TreeResourceSet set = Session.get().getMetaData(KEY); if (set == null) { set = new TreeResourceSet(); Session.get().setMetaData(KEY, set); } return set; } }
public MenuBar(String aId) { super(aId); add(new LambdaStatelessLink("homeLink", () -> setResponsePage(getApplication().getHomePage()))); add(new LambdaStatelessLink("dashboardLink", () -> setResponsePage(ProjectDashboardPage.class)) .add(visibleWhen(() -> Session.get().getMetaData(SessionMetaData.CURRENT_PROJECT) != null))); add(new LambdaStatelessLink("projectsLink", () -> setResponsePage(ProjectsOverviewPage.class)) .add(visibleWhen(() -> userRepository.getCurrentUser() != null))); add(new LambdaStatelessLink("adminLink", () -> setResponsePage(AdminDashboardPage.class)) .add(visibleWhen(this::adminAreaAccessRequired))); }