Java Code Examples for com.gs.fw.common.mithra.finder.RelatedFinder#findMany()

The following examples show how to use com.gs.fw.common.mithra.finder.RelatedFinder#findMany() . 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: DelegatingList.java    From reladomo with Apache License 2.0 6 votes vote down vote up
protected List intersection(DelegatingList other)
{
    RelatedFinder finder = this.getMithraObjectPortal().getFinder();
    if (other.isOperationBased() && this.isOperationBased())
    {
        return finder.findMany(new AndOperation(this.getOperation(), other.getOperation()));
    }
    else
    {
        List result = finder.constructEmptyList();
        result.addAll(this);
        result.retainAll(other);
        return result;
    }

}
 
Example 2
Source File: MithraObjectGraphExtractor.java    From reladomo with Apache License 2.0 6 votes vote down vote up
private Map<Pair<RelatedFinder, Object>, List<MithraDataObject>> extractData(ExecutorService executor)
{
    ExtractResult result = new ExtractResult();
    for (Operation operation : operations)
    {
        RelatedFinder finder = operation.getResultObjectPortal().getFinder();
        MithraList mithraList = finder.findMany(this.milestoneStrategy.addAsOfOperations(operation));
        if (mithraList.notEmpty())
        {
            FullUniqueIndex pkIndex = createDatelessIndex(mithraList);
            ExtractResult operationResult = new ExtractResult();
            UnifiedSetWithHashingStrategy<RelatedFinder> toManyRelationships = UnifiedSetWithHashingStrategy.newSet(HashingStrategies.identityStrategy());
            this.traverserQueue.add(new RelationshipTraverser(mithraList, pkIndex, operationResult, toManyRelationships, executor, finder.getMithraObjectPortal().getBusinessClassName()));
            while (!this.traverserQueue.isEmpty())
            {
                this.traverserQueue.poll().traverse();
            }
            result.merge(operationResult);
        }
    }
    return result.getDataObjectsByFinderAndSource();
}
 
Example 3
Source File: TestSubQueryCache.java    From reladomo with Apache License 2.0 6 votes vote down vote up
public void testAllWithMax()
{
    if (!OrderFinder.getMithraObjectPortal().isFullyCached())
    {
        Operation op = OrderFinder.all();
        Operation subOp = OrderFinder.userId().eq(2);
        RelatedFinder finderInstance = OrderFinder.getFinderInstance();
        MithraList many = finderInstance.findMany(op);
        many.setMaxObjectsToRetrieve(1);
        assertTrue(!many.isEmpty());

        int retrievalCount = this.getRetrievalCount();
        List subList = finderInstance.findMany(subOp);
        int subSize = subList.size();
        assertTrue(subSize > 0);
        assertEquals(retrievalCount + 1, this.getRetrievalCount());

        assertEquals(subSize, finderInstance.findManyBypassCache(subOp).size());
    }
}
 
Example 4
Source File: TestSubQueryCache.java    From reladomo with Apache License 2.0 5 votes vote down vote up
private void assertNotSubQuery(Operation op, Operation subOp, RelatedFinder finderInstance)
{
    List many = finderInstance.findMany(op);
    assertTrue(!many.isEmpty());

    int retrievalCount = this.getRetrievalCount();
    List subList = finderInstance.findMany(subOp);
    int subSize = subList.size();
    assertTrue(subSize > 0);
    if (!OrderFinder.getMithraObjectPortal().isFullyCached())
    {
        assertEquals(retrievalCount + 1, this.getRetrievalCount());
    }
}
 
Example 5
Source File: TestSubQueryCache.java    From reladomo with Apache License 2.0 5 votes vote down vote up
private void assertSubQuery(Operation op, Operation subOp, RelatedFinder finderInstance)
{
    List many = finderInstance.findMany(op);
    assertTrue(!many.isEmpty());

    int retrievalCount = this.getRetrievalCount();
    List subList = finderInstance.findMany(subOp);
    int subSize = subList.size();
    assertTrue(subSize > 0);
    assertEquals(retrievalCount, this.getRetrievalCount());

    assertEquals(subSize, finderInstance.findManyBypassCache(subOp).size());
}
 
Example 6
Source File: QualifiedByOperationLoadContext.java    From reladomo with Apache License 2.0 4 votes vote down vote up
@Override
public List getKeyHoldersForQualifiedDependents(Operation operation, RelatedFinder finder)
{
    return finder.findMany(operation);
}