Class PrivilegedCommitContribution

java.lang.Object
ch.tocco.nice2.persist.security.impl.PrivilegedCommitContribution
All Implemented Interfaces:
CommitInvokerContribution

@Component public class PrivilegedCommitContribution extends Object implements CommitInvokerContribution
This service makes sure that all transaction commits and rollbacks are executed in privileged mode. This is required e.g. for validating the entities before they're committed.
  • Constructor Details

    • PrivilegedCommitContribution

      public PrivilegedCommitContribution(SecurityManager securityManager)
  • Method Details

    • invokerForCommit

      public Invoker invokerForCommit()
      Specified by:
      invokerForCommit in interface CommitInvokerContribution
    • nestedInvokerForCommitListener

      public Invoker nestedInvokerForCommitListener()
      This invoker is used when committing a transaction. If the transaction is at that point privileged, we want the following commit listeners to run in privileged mode as well. Otherwise, we need to explicitly use a secured invoker, since the rest of the transaction logic is executed in privileged mode either way.
      Specified by:
      nestedInvokerForCommitListener in interface CommitInvokerContribution
      Returns:
      Either an empty invoker if currently privileged, secured invoker otherwise