Java Code Examples for org.apache.wicket.Session#get()

The following examples show how to use org.apache.wicket.Session#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActionHandler.java    From JPPF with Apache License 2.0 6 votes vote down vote up
/**
 * Update the actions managed by this handler based ont he selected nodes.
 * @param treeNodes the selected nodes.
 */
public void selectionChanged(final List<DefaultMutableTreeNode> treeNodes) {
  if (debugEnabled) log.debug("selected nodes: {}", treeNodes);
  for (final String id: actionLinks.keySet()) {
    final AbstractActionLink link = actionLinks.get(id);
    final UpdatableAction action = actions.get(id);
    if (action != null) {
      final JPPFWebSession session = (JPPFWebSession) Session.get();
      action.setAuthorized(session.getRoles());
      action.setEnabled(treeNodes);
      if (link != null) link.setEnabled(action.isAuthorized() && action.isEnabled());
    } else {
      if (link != null) link.setEnabled(true);
    }
  }
}
 
Example 2
Source File: LockPanel.java    From ontopia with Apache License 2.0 6 votes vote down vote up
protected boolean acquireLock() {
  // create lock id and lock key
  OntopolySession session = (OntopolySession)Session.get();
  String lockerId = session.getLockerId(getRequest());
  LockManager.Lock lock = session.lock((Topic)getDefaultModelObject(), lockerId);
  this.lockedBy = lock.getLockedBy();
  this.lockedAt = new Date(lock.getLockTime()).toString();
  this.lockKey = lock.getLockKey();
  if (!lock.ownedBy(lockerId)) {
    this.lockedByOther = true;
    //! System.out.println("Got lock: false: " + lock);
    return false;
  } else {
    //! System.out.println("Got lock: true" + lock);
    return true;
  }
}
 
Example 3
Source File: MenuBarEventAdapter.java    From inception with Apache License 2.0 5 votes vote down vote up
@EventListener
public void onProjectDeleted(BeforeProjectRemovedEvent aEvent)
{
    if (Session.exists()) {
        Session session = Session.get();
        // 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);
        }
    }
}
 
Example 4
Source File: MavenArtifactNotifierSession.java    From artifact-listener with Apache License 2.0 4 votes vote down vote up
public static MavenArtifactNotifierSession get() {
	return (MavenArtifactNotifierSession) Session.get();
}
 
Example 5
Source File: NextServerSession.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
public static NextServerSession get() {
	return (NextServerSession) Session.get();
}
 
Example 6
Source File: CsrfTokenHandler.java    From projectforge-webapp with GNU General Public License v3.0 4 votes vote down vote up
/**
 * This parameter should be set as hidden field in every formular and should be tested on every submit action for preventing CSRF attacks.
 * @return the randomized cross site request forgery token.
 */
private String getCsrfSessionToken()
{
  final MySession session = (MySession) Session.get();
  return session.getCsrfToken();
}
 
Example 7
Source File: MySession.java    From projectforge-webapp with GNU General Public License v3.0 4 votes vote down vote up
public static MySession get()
{
  return (MySession) Session.get();
}
 
Example 8
Source File: CurationSession.java    From oodt with Apache License 2.0 4 votes vote down vote up
public static CurationSession get() {
  return (CurationSession) Session.get();
}
 
Example 9
Source File: FMBrowserSession.java    From oodt with Apache License 2.0 4 votes vote down vote up
public static FMBrowserSession get(){
  return (FMBrowserSession)Session.get();
}
 
Example 10
Source File: OrienteerWebSession.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
public static OrienteerWebSession get()
{
	return (OrienteerWebSession)Session.get();
}
 
Example 11
Source File: SyncopeConsoleSession.java    From syncope with Apache License 2.0 4 votes vote down vote up
public static SyncopeConsoleSession get() {
    return (SyncopeConsoleSession) Session.get();
}
 
Example 12
Source File: AjaxWizard.java    From syncope with Apache License 2.0 4 votes vote down vote up
ApplyFuture(final AjaxRequestTarget target) {
    this.target = target;
    this.application = Application.get();
    this.requestCycle = RequestCycle.get();
    this.session = Session.exists() ? Session.get() : null;
}
 
Example 13
Source File: SyncopeEnduserSession.java    From syncope with Apache License 2.0 4 votes vote down vote up
public static SyncopeEnduserSession get() {
    return (SyncopeEnduserSession) Session.get();
}
 
Example 14
Source File: TopologyWebSocketBehavior.java    From syncope with Apache License 2.0 4 votes vote down vote up
Checker(final String key, final Application application) {
    this.key = key;
    this.application = application;
    this.session = Session.exists() ? Session.get() : null;
}
 
Example 15
Source File: TopologyWebSocketBehavior.java    From syncope with Apache License 2.0 4 votes vote down vote up
ResCheck(final String key) {
    this.key = key;
    this.application = Application.get();
    this.session = Session.exists() ? Session.get() : null;
}
 
Example 16
Source File: TopologyWebSocketBehavior.java    From syncope with Apache License 2.0 4 votes vote down vote up
ConnCheck(final String key) {
    this.key = key;
    this.application = Application.get();
    this.session = Session.exists() ? Session.get() : null;
}
 
Example 17
Source File: OrientDbWebSession.java    From wicket-orientdb with Apache License 2.0 4 votes vote down vote up
public static OrientDbWebSession get()
{
	return (OrientDbWebSession)Session.get();
}
 
Example 18
Source File: UserPanel.java    From ontopia with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isVisible() {
  OntopolySession session = (OntopolySession)Session.get();
  return session.isAccessStrategyEnabled();     
}
 
Example 19
Source File: ApplicationSession.java    From webanno with Apache License 2.0 4 votes vote down vote up
/**
 * @return Current WebAnno web session
 */
public static ApplicationSession get()
{
    return (ApplicationSession) Session.get();
}
 
Example 20
Source File: JPPFWebSession.java    From JPPF with Apache License 2.0 2 votes vote down vote up
/**
 * Get the associated JPPF session obect.
 * @return a {@link JPPFWebSession} instance.
 */
public static JPPFWebSession get() {
  return (JPPFWebSession) Session.get();
}