Package org.jboss.forge.addon.resource.transaction

Examples of org.jboss.forge.addon.resource.transaction.ResourceTransaction


   }

   @Override
   public Result execute(UIExecutionContext shellContext) throws Exception
   {
      ResourceTransaction transaction = resourceFactory.getTransaction();
      if (!transaction.isStarted())
      {
         return Results.fail("Resource Transaction is not started");
      }
      transaction.commit();
      return Results.success("Resource Transaction was committed");
   }
View Full Code Here


   }

   @Override
   public Result execute(UIExecutionContext shellContext) throws Exception
   {
      ResourceTransaction transaction = resourceFactory.getTransaction();
      if (!transaction.isStarted())
      {
         return Results.fail("Resource Transaction is not started");
      }
      transaction.rollback();
      return Results.success("Resource Transaction was rolled back");
   }
View Full Code Here

   }

   @Override
   public Result execute(UIExecutionContext shellContext) throws Exception
   {
      ResourceTransaction transaction = resourceFactory.getTransaction();

      if (transaction.isStarted())
      {
         if (trackChangesSettings.isTrackChanges() && !trackChangesSettings.isInForeignTransaction())
            transaction.rollback();
         else
            return Results.fail("Resource Transaction is already started");
      }
      if (timeout.getValue() != null)
      {
         transaction.setTransactionTimeout(timeout.getValue());
      }
      transaction.begin();
      return Results.success("Resource Transaction started");
   }
View Full Code Here

   }

   @Override
   public void preCommandExecuted(UICommand command, UIExecutionContext context)
   {
      ResourceTransaction transaction = factory.getTransaction();
      if (!transaction.isStarted())
      {
         otherTransactionListener.disable();
         transaction.begin();
         otherTransactionListener.enable();
      }
   }
View Full Code Here

   }

   @Override
   public void postCommandExecuted(UICommand command, UIExecutionContext context, Result result)
   {
      ResourceTransaction transaction = factory.getTransaction();
      if (!otherTransactionListener.isInForeignTransaction())
      {
         if (result instanceof Failed)
         {
            if (transaction.isStarted())
            {
               transaction.rollback();
            }
         }
         else
         {
            if (transaction.isStarted())
            {
               transaction.commit();
            }

            List<ResourceEvent> events = new ArrayList<>(aggregator.getResourceEvents());
            aggregator.clear();
            Collections.sort(events, new Comparator<ResourceEvent>()
View Full Code Here

   }

   @Override
   public void postCommandFailure(UICommand command, UIExecutionContext context, Throwable failure)
   {
      ResourceTransaction transaction = factory.getTransaction();
      if (transaction.isStarted())
      {
         transaction.rollback();
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.resource.transaction.ResourceTransaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.