Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.core.api
Class UnrestrictedSessionRunner

java.lang.Object
  extended by org.nuxeo.ecm.core.api.UnrestrictedSessionRunner
Direct Known Subclasses:
AbstractCommentManagerActionsBean.FollowTransitionUnrestricted, AddRightUnrestricted, ChangePermissionUnrestricted, DeleteDocumentUnrestricted, DocumentStoreSessionRunner, DomainsFinder, PublishActionsBean.ApproverWithoutRestriction, PublishUnrestricted, QueryRepositoryProbe.Runner, RemoveACLUnrestricted, RemoveRightsUnrestricted, RootSectionsFinder, StatsTaskRunner

public abstract class UnrestrictedSessionRunner
extends java.lang.Object

Helper class to run code with an unrestricted session.

The caller must implement the run() method, and call runUnrestricted().

Author:
Florent Guillaume

Field Summary
 boolean isUnrestricted
          True if a call to runUnrestricted() is in progress.
 
Constructor Summary
UnrestrictedSessionRunner(CoreSession session)
          Constructs a UnrestrictedSessionRunner given an existing session (which may or may not be already unrestricted).
UnrestrictedSessionRunner(java.lang.String repositoryName)
          Constructs a UnrestrictedSessionRunner given a repository name.
UnrestrictedSessionRunner(java.lang.String repositoryName, java.lang.String originatingUser)
          Constructs a UnrestrictedSessionRunner given a repository name and an originating user name.
 
Method Summary
 java.lang.String getOriginatingUsername()
           
abstract  void run()
          This method will be called by runUnrestricted() with session available as an unrestricted session.
 void runUnrestricted()
          Calls the run() method with an unrestricted session.
 void setOriginatingUsername(java.lang.String originatingUsername)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isUnrestricted

public boolean isUnrestricted
True if a call to runUnrestricted() is in progress.

Constructor Detail

UnrestrictedSessionRunner

public UnrestrictedSessionRunner(CoreSession session)
Constructs a UnrestrictedSessionRunner given an existing session (which may or may not be already unrestricted).

Originating user is taken on given session.

Parameters:
session - the available session

UnrestrictedSessionRunner

public UnrestrictedSessionRunner(java.lang.String repositoryName)
Constructs a UnrestrictedSessionRunner given a repository name.

Parameters:
repositoryName - the repository name

UnrestrictedSessionRunner

public UnrestrictedSessionRunner(java.lang.String repositoryName,
                                 java.lang.String originatingUser)
Constructs a UnrestrictedSessionRunner given a repository name and an originating user name.

Parameters:
repositoryName - the repository name
originatingUser - the user name behind the system user
Method Detail

getOriginatingUsername

public java.lang.String getOriginatingUsername()

setOriginatingUsername

public void setOriginatingUsername(java.lang.String originatingUsername)

runUnrestricted

public void runUnrestricted()
                     throws ClientException
Calls the run() method with an unrestricted session. During this call, isUnrestricted is set to true.

Throws:
ClientException

run

public abstract void run()
                  throws ClientException
This method will be called by runUnrestricted() with session available as an unrestricted session.

It can also be called directly in which case the session available will be the one passed to #UnrestrictedSessionRunner(CoreSession).

Throws:
ClientException

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.