Adds rollback methods to applicable model classes.
434644
def add_rollback_methods():
        
        # Modified Page.save_revision method.
        def page_rollback(instance, revision_id, user=None, submitted_for_moderation=False, approved_go_live_at=None, changed=True):
            old_revision    = instance.revisions.get(pk=revision_id)
            new_revision    = instance.revisions.create(
                content_json                = old_revision.content_json,
                user                        = user,
                submitted_for_moderation    = submitted_for_moderation,
                approved_go_live_at         = approved_go_live_at
            )

            update_fields = []

            instance.latest_revision_created_at = new_revision.created_at
            update_fields.append('latest_revision_created_at')

            if changed:
                instance.has_unpublished_changes = True
                update_fields.append('has_unpublished_changes')

            if update_fields:
                instance.save(update_fields=update_fields)

            logger.info(
                "Page edited: \"%s\" id=%d revision_id=%d",
                instance.title,
                instance.id,
                new_revision.id
            )

            if submitted_for_moderation:
                logger.info(
                    "Page submitted for moderation: \"%s\" id=%d revision_id=%d",
                    instance.title,
                    instance.id,
                    new_revision.id
                )

            return new_revision

        Page = apps.get_model('wagtailcore', 'Page')
        Page.add_to_class('rollback', page_rollback)
360860
public static void rollbackQuietly(EntityManager entityManager) {
        if (entityManager.getTransaction().isActive()/* && entityManager.getTransaction().getRollbackOnly()*/) {
            try {
                entityManager.getTransaction().rollback();
            } catch (Exception e) {
                logger.error(e.getMessage(), e);
            }
        }
    }
1295395
public static void rollback()
   {
      try {
         if (userTransaction.getStatus() != Status.STATUS_NO_TRANSACTION) {
            userTransaction.rollback();
         }
         else {
            LOGGER.warn("Request to rollback transaction when none was in started.");
         }
      }
      catch (Exception e) {
         LOGGER.warn("Transaction rollback failed.", e);
      }
   }
925521
public function rollBack () {
        $this->transaction_level--;

        if(!$this->nestable() || $this->transaction_level == 0) {
            parent::rollBack();
        } else {
            $this->exec("ROLLBACK TO SAVEPOINT LEVEL{$this->transaction_level}");
        }
    }
120916
public static function rollbackMigrations() {
    $migration = \Drupal::service('plugin.manager.migration')->createInstance('gxp_offerings_import');
    $executable = new MigrateExecutable($migration, new MigrateMessage());
    $executable->rollback();
    $migration->setStatus(\Drupal\migrate\Plugin\MigrationInterface::STATUS_IDLE);
  }
1197966
public function rollback()
    {
        parent::rollback();
        foreach ($this->getOriginalAll() as $collection) {
            if ($collection instanceof EmbedCollection) {
                $collection->rollback();
            }
        }
        return $this;
    }
943087
def rollback(self, transaction = None):
        """"""
        if not self.in_transaction:
            raise NotInTransaction
        for collection, store in self.stores.items():
            store.rollback()
            indexes = self.indexes[collection]
            indexes_to_rebuild = []
            for key, index in indexes.items():
                try:
                    index.rollback()
                except NotInTransaction:
                    # this index is "dirty" and needs to be rebuilt
                    # (probably it has been created within a transaction)
                    indexes_to_rebuild.append(key)
            if indexes_to_rebuild:
                self.rebuild_indexes(collection, indexes_to_rebuild)
        self.in_transaction = False
1296584
def rollback(self):
        """"""
        if self._transaction_nesting_level == 0:
            raise DBALConnectionError.no_active_transaction()

        self.ensure_connected()
        if self._transaction_nesting_level == 1:
            self._transaction_nesting_level = 0
            self._driver.rollback()
            self._is_rollback_only = False
            if not self._auto_commit:
                self.begin_transaction()
        elif self._nest_transactions_with_savepoints:
            self.rollback_savepoint(self._get_nested_transaction_savepoint_name())
            self._transaction_nesting_level -= 1
        else:
            self._is_rollback_only = True
            self._transaction_nesting_level -= 1
187687
public void rollbackSetRollbackAndThrowException(List objects)
    {
        log.info("rollbackSetRollbackAndThrowException method was called");
        storeObjects(objects);
        getSessionContext().setRollbackOnly();
        /*
        seems that some appServer expect that all used resources will be closed before
        the JTA-TXManager does call Synchronization#beforeCompletion(), so we have
        to cleanup used resources. This could be done by call abort on odmg-api
        */
        getImplementation().currentTransaction().abort();
        // to notify the client about the failure we throw an exception
        // if we don't throw such an exception the client don't get notified
        // about the failure
        throw new EJBException("## Testing of rollback behaviour - rollbackSetRollbackAndThrowException ##");
    }
44889
void rollback() {
        if (publishedFullRegistry == null) {
            return;
        }
        writeLock.lock();
        try {
            publishedFullRegistry.readLock.lock();
            try {
                clear(true);
                copy(publishedFullRegistry, this);
                modified = false;
            } finally {
                publishedFullRegistry.readLock.unlock();
            }
        } finally {
            writeLock.unlock();
        }
    }
1064155
public function rollback()
    {
        $this->attributes->rollback();
        $this->hasOneEmbeds->rollback();
        $this->hasManyEmbeds->rollback();
        $this->doDirtyCheck();
        return $this;
    }
710219
def ready(self):
        
        self.add_rollback_panels()
        self.add_rollback_methods()
        super(WagtailRollbacksAppConfig, self).ready()
56383
@Override
    public void rollbackStatements() {
        if (log.isDebugEnabled()) {
            log.debug(String.format("Received transaction rollback: '%s':%n",
                    endpointConfiguration.getServerConfiguration().getDatabaseName()));
        }

        if(!endpointConfiguration.isAutoTransactionHandling()){
            handleMessageAndCheckResponse(JdbcMessage.rollbackTransaction());
        }
    }
601960
private void setupRecordCallbackMethods(final RecordMethodCache recordMethod, final Class<?> recordClass) {

        for(Method method : recordClass.getMethods()) {
            method.setAccessible(true);

            if(annoReader.hasAnnotation(method, XlsPreLoad.class)) {
                recordMethod.preLoadMethods.add(method);

            } else if(annoReader.hasAnnotation(method, XlsPostLoad.class)) {
                recordMethod.postLoadMethods.add(method);

            } else if(annoReader.hasAnnotation(method, XlsPreSave.class)) {
                recordMethod.preSaveMethods.add(method);

            } else if(annoReader.hasAnnotation(method, XlsPostSave.class)) {
                recordMethod.postSaveMethods.add(method);

            }

        }

    }
1097371
protected void validateModelClass(Object model) {
        final Set<ConstraintViolation<Object>> violations = validator.validate(model);

        // in case of an invalid model, we throw a ConstraintViolationException, containing the violations:
        if (!violations.isEmpty()) {
            throw new ConstraintViolationException(
                    new HashSet<>(violations));
        }
    }
1208254
public function rollback()
    {
        for ($i = count($this->completedOperations) - 1; $i >= 0; --$i) {
            $this->completedOperations[$i]->rollback();
        }

        $this->completedOperations = array();
    }
247318
@Deprecated
    @Override
    @SuppressWarnings("deprecation")
    protected void rollbackRuntime(OperationContext context, ModelNode operation, ModelNode model, List<ServiceController<?>> controllers) {
        revertReload(context);
    }