Java Code Examples for com.gs.fw.common.mithra.finder.Operation#getResultObjectPortal()

The following examples show how to use com.gs.fw.common.mithra.finder.Operation#getResultObjectPortal() . 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: MithraRootTransaction.java    From reladomo with Apache License 2.0 6 votes vote down vote up
@Override
public void purgeUsingOperation(Operation op) throws MithraDatabaseException
{
    this.checkForActiveTransaction();
    MithraObjectPortal portal = op.getResultObjectPortal();
    if (portal.isIndependent())
    {
        TxOperationsForIndependentClass ops = getOrCreateIndependentOps(portal);
        ops.purgeUsingOperation(op);
    }
    else
    {
        this.dependentOperations.purgeUsingOperation(op);
    }
    if (this.immediateOperations || this.isCautious())
    {
        executeBufferedOperations();
    }
}
 
Example 2
Source File: MithraRootTransaction.java    From reladomo with Apache License 2.0 6 votes vote down vote up
@Override
public void deleteUsingOperation(Operation op) throws MithraDatabaseException
{
    this.checkForActiveTransaction();
    MithraObjectPortal portal = op.getResultObjectPortal();
    if (portal.isIndependent())
    {
        TxOperationsForIndependentClass ops = getOrCreateIndependentOps(portal);
        ops.deleteUsingOperation(op);
    }
    else
    {
        this.dependentOperations.deleteUsingOperation(op);
    }
    if (this.immediateOperations || this.isCautious())
    {
        executeBufferedOperations();
    }
}
 
Example 3
Source File: RemoteReloadResult.java    From reladomo with Apache License 2.0 6 votes vote down vote up
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
    this.readRemoteTransactionId(in);
    Operation op = (Operation) in.readObject();
    MithraObjectPortal mithraObjectPortal = op.getResultObjectPortal();
    int serverVersion = in.readInt();
    int localVersion = mithraObjectPortal.getFinder().getSerialVersionId();
    if (serverVersion != localVersion)
    {
        throw new IOException("version of the object "+mithraObjectPortal.getFinder().getClass().getName()+
                " does not match this version. Server version "+serverVersion+" local version "+localVersion);
    }
    mithraObjectPortal.getMithraObjectDeserializer().deserializeForReload(in);

    this.databaseIdentifierMap = readDatabaseIdentifierMap(in);
}
 
Example 4
Source File: AbstractTransactionalOperationBasedList.java    From reladomo with Apache License 2.0 6 votes vote down vote up
public void deleteAll(DelegatingList<E> delegatingList)
{
    Operation op = delegatingList.getOperation();
    verifyNonDatedList(op);
    boolean oneByOne = (op instanceof MappedOperation);
    if (!oneByOne)
    {
        UnifiedSet portals = new UnifiedSet(3);
        op.addDependentPortalsToSet(portals);
        MithraObjectPortal portal = op.getResultObjectPortal();
        oneByOne = portals.size() > 1 || portal.getSuperClassPortals() != null || portal.getJoinedSubClassPortals() != null;
    }
    TransactionalCommand command = null;
    if (oneByOne)
    {
        command = new DeleteAllOneByOneCommand(delegatingList);
    }
    else
    {
        command = new DeleteAllTransactionalCommand(delegatingList, this);
    }
    MithraManagerProvider.getMithraManager().executeTransactionalCommand(command);
}
 
Example 5
Source File: MithraRootTransaction.java    From reladomo with Apache License 2.0 5 votes vote down vote up
@Override
public int deleteBatchUsingOperation(Operation op, int batchSize) throws MithraDatabaseException
{
    this.checkForActiveTransaction();
    MithraObjectPortal portal = op.getResultObjectPortal();
    if (portal.isIndependent())
    {
        TxOperationsForIndependentClass ops = getOrCreateIndependentOps(portal);
        return ops.deleteBatchUsingOperation(op, batchSize);
    }
    else
    {
        return this.dependentOperations.deleteBatchUsingOperation(op, batchSize);
    }
}
 
Example 6
Source File: TxOperations.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void deleteUsingOperation(Operation op) throws MithraDatabaseException
{
    this.operations.add(new DeleteUsingOperationOperation(op));
    MithraObjectPortal portal = op.getResultObjectPortal();
    updateCountHolders.add(portal.getPerClassUpdateCountHolder());
    this.portalsWithOperations.put(portal, DELETE_OP);
}
 
Example 7
Source File: TxOperations.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public int deleteBatchUsingOperation(Operation op, int batchSize)
{
    this.executeBufferedOperations();
    MithraObjectPortal portal = op.getResultObjectPortal();
    updateCountHolders.add(portal.getPerClassUpdateCountHolder());
    return op.getResultObjectPortal().getMithraObjectPersister().deleteBatchUsingOperation(op, batchSize);
}
 
Example 8
Source File: TxOperations.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void purgeUsingOperation(Operation op) throws MithraDatabaseException
{
    this.operations.add(new PurgeUsingOperationOperation(op));
    MithraObjectPortal portal = op.getResultObjectPortal();
    updateCountHolders.add(portal.getPerClassUpdateCountHolder());
    this.portalsWithOperations.put(portal, DELETE_OP);
}
 
Example 9
Source File: AbstractOperationBasedList.java    From reladomo with Apache License 2.0 5 votes vote down vote up
protected List resolveOperationInMemory(DelegatingList<E> delegatingList)
{
    synchronized (delegatingList)
    {
        if (!delegatingList.isBypassCache())
        {
            if (!this.isOperationResolved(delegatingList))
            {
                Operation originalOp = delegatingList.getOperation();
                MithraObjectPortal portal = originalOp.getResultObjectPortal();
                if (!portal.isCacheDisabled())
                {
                    CachedQuery resolved = portal.zFindInMemory(originalOp, delegatingList.getOrderBy());
                    delegatingList.zSetFastListOrCachedQuery(resolved);
                    if (resolved != null && originalOp != resolved.getOperation())
                    {
                        delegatingList.zSetOperation(resolved.getOperation());
                    }
                }
            }
            if (this.isOperationResolved(delegatingList))
            {
                return this.getResolved(delegatingList).getResult();
            }
        }
    }
    return null;
}
 
Example 10
Source File: SubQueryCache.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public CachedQuery resolveAndCacheSubQuery(Operation op, AnalyzedOperation analyzedOperation, OrderBy orderBy, QueryCache cache, boolean forRelationship)
{
    Operation toFind = op;
    if (analyzedOperation != null && analyzedOperation.isAnalyzedOperationDifferent())
    {
        toFind = analyzedOperation.getAnalyzedOperation();
    }
    CachedQuery result = null;
    for(int i=0;i<MAX_REFS;i++)
    {
        CachedQuery query = unwrap(hashTable[i]);
        if (query != null)
        {
            ShapeMatchResult shapeMatchResult = toFind.zShapeMatch(query.getOperation());
            List resolved = shapeMatchResult.resolve(cache);
            result = createAndCacheCachedQuery(op, analyzedOperation, orderBy, cache, forRelationship, resolved, query);
        }
    }
    if (result != null) return result;

    CachedQuery all = unwrap(allOperation);
    if (all != null && all.getOperation().getResultObjectPortal() == toFind.getResultObjectPortal() && toFind.zCanFilterInMemory())
    {
        result = createAndCacheCachedQuery(op, analyzedOperation, orderBy, cache, forRelationship,
                op.applyOperation(all.getResult()), all);
    }
    return result;
}
 
Example 11
Source File: DeleteAllTransactionalCommand.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
    Operation op = delegatingList.getOperation();
    MithraObjectPortal resultObjectPortal = op.getResultObjectPortal();
    resultObjectPortal.prepareForMassDelete(op, abstractTransactionalOperationBasedList.isForceImplicitJoin());
    tx.deleteUsingOperation(op);
    return null;
}
 
Example 12
Source File: PurgeAllTransactionalCommand.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public Object executeTransaction(MithraTransaction tx) throws Throwable
{
    Operation op = delegatingList.getOperation();
    MithraObjectPortal resultObjectPortal = op.getResultObjectPortal();
    resultObjectPortal.prepareForMassPurge(op, this.abstractTransactionalOperationBasedList.isForceImplicitJoin());
    tx.purgeUsingOperation(op);
    return null;
}
 
Example 13
Source File: AbstractTransactionalOperationBasedList.java    From reladomo with Apache License 2.0 5 votes vote down vote up
private boolean isComplexOperation(DelegatingList<E> delegatingList)
{
    Operation op = delegatingList.getOperation();
    boolean oneByOne = (op instanceof MappedOperation);
    if (!oneByOne)
    {
        UnifiedSet portals = new UnifiedSet(3);
        op.addDependentPortalsToSet(portals);
        MithraObjectPortal portal = op.getResultObjectPortal();
        oneByOne = portals.size() > 1 || portal.getSuperClassPortals() != null || portal.getJoinedSubClassPortals() != null;
    }
    return oneByOne;
}
 
Example 14
Source File: MithraDatabaseIdentifierExtractor.java    From reladomo with Apache License 2.0 4 votes vote down vote up
public Map extractDatabaseIdentifierMap(Operation op)
{
    this.databaseIdentifierMap = new UnifiedMap();
    registerOperations(op);
    this.processSourceAttributeEqualities();
    int count = this.getSourceAttributeValueCount();

    for(int i = 0; i < count; i++)
    {
        MithraObjectPortal emptyKeyPortal;
        MapperStackImpl emptyKey = MapperStackImpl.EMPTY_MAPPER_STACK_IMPL;
        SourceOperation sourceOperation = this.getSourceOperation(emptyKey);
        if(sourceOperation == null)
        {
            emptyKeyPortal = op.getResultObjectPortal();
            createDatabaseIdentifier(emptyKeyPortal);
        }
        else
        {
            emptyKeyPortal = sourceOperation.getAttribute().getOwnerPortal();
            createDatabaseIdentifier(emptyKey, emptyKeyPortal, i);
        }

        if(mapperStackToJoinClauseMap != null)
        {

            for(Iterator it = mapperStackToJoinClauseMap.keySet().iterator(); it.hasNext();)
            {
                MapperStackImpl key = (MapperStackImpl)it.next();
                if(key.getMapperStack().size() > 0)
                {
                    SourceOperation relatedSourceOperation = this.getSourceOperation(key);
                    MithraObjectPortal portal = key.getLastMapper().getFromPortal();
                    if(relatedSourceOperation == null)
                    {
                          createDatabaseIdentifier(portal);
                    }
                    else
                    {
                         createDatabaseIdentifier(key, portal, i);
                    }
                }
            }
        }
    }
    return databaseIdentifierMap;
}
 
Example 15
Source File: DeleteAllInBatchesTransactionalCommand.java    From reladomo with Apache License 2.0 4 votes vote down vote up
protected void prepareCache(Operation op)
{
    MithraObjectPortal resultObjectPortal = op.getResultObjectPortal();
    resultObjectPortal.prepareForMassDelete(op, abstractTransactionalOperationBasedList.isForceImplicitJoin());
}
 
Example 16
Source File: PurgeAllInBatchesTransactionalCommand.java    From reladomo with Apache License 2.0 4 votes vote down vote up
protected void prepareCache(Operation op)
{
    MithraObjectPortal resultObjectPortal = op.getResultObjectPortal();
    resultObjectPortal.prepareForMassPurge(op, this.abstractTransactionalOperationBasedList.isForceImplicitJoin());
}
 
Example 17
Source File: PurgeUsingOperationOperation.java    From reladomo with Apache License 2.0 4 votes vote down vote up
public PurgeUsingOperationOperation(Operation op)
{
    super(null, op.getResultObjectPortal());
    this.op = op;
}
 
Example 18
Source File: DeleteUsingOperationOperation.java    From reladomo with Apache License 2.0 4 votes vote down vote up
public DeleteUsingOperationOperation(Operation op)
{
    super(null, op.getResultObjectPortal());
    this.op = op;
}