Java Code Examples for com.gs.fw.common.mithra.MithraTransaction#registerSynchronization()

The following examples show how to use com.gs.fw.common.mithra.MithraTransaction#registerSynchronization() . 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: DeleteAllInBatchesForNonOperationListCommand.java    From reladomo with Apache License 2.0 6 votes vote down vote up
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
    tx.registerSynchronization(this);
    end = currentStart + batchSize[0];
    if (end > toBeDeleted.size()) end = toBeDeleted.size();
    List subList = toBeDeleted.subList(currentStart, end);
    for (int i = 0; i < subList.size(); i++)
    {
        ((MithraTransactionalObject) subList.get(i)).zPrepareForDelete();
    }
    for(int i=0;i < subList.size();i++)
    {
        ((MithraTransactionalObject)subList.get(i)).delete();
    }
    return subList.size();
}
 
Example 2
Source File: DeleteAllOneByOneInBatchesCommand.java    From reladomo with Apache License 2.0 6 votes vote down vote up
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
    tx.registerSynchronization(this);
    int end = batchSize[0];
    if (end > toBeDeleted.size()) end = toBeDeleted.size();
    List subList = toBeDeleted.subList(0, end);
    for (int i = 0; i < subList.size(); i++)
    {
        ((MithraTransactionalObject) subList.get(i)).zPrepareForDelete();
    }
    for(int i=0;i < subList.size();i++)
    {
        ((MithraTransactionalObject)subList.get(i)).delete();
    }
    return subList.size();
}
 
Example 3
Source File: DeleteAllInBatchesTransactionalCommand.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
    tx.registerSynchronization(this);
    Operation op = delegatingList.getOperation();
    prepareCache(op);
    int deletedRows = tx.deleteBatchUsingOperation(op, batchSize[0]);
    return Integer.valueOf(deletedRows);
}
 
Example 4
Source File: SerializedList.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public T getWrapped()
{
    if (this.wrapped == null && this.deserializer != null)
    {
        MithraTransaction tx = MithraManagerProvider.getMithraManager().getCurrentTransaction();
        if (tx != null)
        {
            tx.registerSynchronization(new Synchronization()
            {
                @Override
                public void beforeCompletion()
                {
                    //do nothing
                }

                @Override
                public void afterCompletion(int status)
                {
                    if (status != Status.STATUS_COMMITTED && status != Status.STATUS_COMMITTING)
                    {
                        wrapped = null;
                    }

                }
            });
        }
        this.wrapped = (T) deserializer.getDeserializationResultAsList();
    }
    return wrapped;
}
 
Example 5
Source File: Serialized.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public T getWrapped()
{
    if (this.wrapped == null && this.deserializer != null)
    {
        MithraTransaction tx = MithraManagerProvider.getMithraManager().getCurrentTransaction();
        if (tx != null)
        {
            tx.registerSynchronization(new Synchronization()
            {
                @Override
                public void beforeCompletion()
                {
                    //do nothing
                }

                @Override
                public void afterCompletion(int status)
                {
                    if (status != Status.STATUS_COMMITTED && status != Status.STATUS_COMMITTING)
                    {
                        wrapped = null;
                    }

                }
            });
        }
        this.wrapped = deserializer.getDeserializationResultAsObject();
    }
    return wrapped;
}