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

The following examples show how to use com.gs.fw.common.mithra.finder.RelatedFinder#getMithraObjectPortal() . 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: MithraConfigurationManager.java    From reladomo with Apache License 2.0 6 votes vote down vote up
public synchronized MithraObjectPortal initializeObject(List<String> mithraInitializationErrors)
{
    RelatedFinder relatedFinder = getRelatedFinder(className, mithraInitializationErrors);
    if (relatedFinder != null)
    {
        if (initialized)
        {
            return relatedFinder.getMithraObjectPortal();
        }
        MithraObjectDeserializer deserializer = instantiateDeserializer(className, mithraInitializationErrors);
        MithraPureObjectFactory factory = (MithraPureObjectFactory) deserializer;
        factory.setFactoryParameter(factoryParameter);

        deserializer.instantiateFullCache(this);
        MithraObjectPortal mithraObjectPortal = relatedFinder.getMithraObjectPortal();
        addToExportedConfigs(relatedFinder, MithraConfigurationManager.this);
        initialized = true;
        if (postInitializeHook != null)
        {
            postInitializeHook.callbackAfterInitialize(this.className, mithraObjectPortal, mithraInitializationErrors, false);
        }
        return mithraObjectPortal;
    }
    return null;
}
 
Example 2
Source File: OverlapFixer.java    From reladomo with Apache License 2.0 5 votes vote down vote up
private void addDelete(RelatedFinder finder, MithraDataObject mithraDatedObject)
{
    MithraObjectPortal portal = finder.getMithraObjectPortal();
    MithraTransactionalObject transactionalObject = new InTransactionDatedTransactionalObject(portal, null, mithraDatedObject, InTransactionDatedTransactionalObject.DELETED_STATE);
    if (this.deleteBatch == null)
    {
        this.deleteBatch = new BatchDeleteOperation(transactionalObject, Collections.EMPTY_LIST, portal, true);
    }
    else
    {
        this.deleteBatch.combineDelete(transactionalObject, portal);
    }
}
 
Example 3
Source File: OverlapFixer.java    From reladomo with Apache License 2.0 5 votes vote down vote up
private void addInsert(RelatedFinder finder, MithraDataObject newData)
{
    MithraObjectPortal portal = finder.getMithraObjectPortal();
    MithraTransactionalObject transactionalObject = new InTransactionDatedTransactionalObject(portal, null, newData, InTransactionDatedTransactionalObject.INSERTED_STATE);
    if (this.insertBatch == null)
    {
        this.insertBatch = new BatchInsertOperation(transactionalObject, Collections.EMPTY_LIST, portal);
    }
    else
    {
        this.insertBatch.combineInsert(transactionalObject, portal);
    }
}
 
Example 4
Source File: AbstractOperationBasedList.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public MithraDelegatedList registerForNotification(DelegatingList delegatingList, MithraApplicationNotificationListener listener)
{
    AbstractOperationBasedList result = copyIfDefault();
    Operation op = delegatingList.getOperation();
    Map databaseIdentifierMap = delegatingList.getMithraObjectPortal().extractDatabaseIdentifiers(op);
    Set keySet = databaseIdentifierMap.keySet();

    if (result.pkIndex == null)
    {
        Attribute[] primaryKeyAttributes = delegatingList.getMithraObjectPortal().getFinder().getPrimaryKeyAttributes();
        result.pkIndex = new FullUniqueIndex("OperationBasedListIndex", primaryKeyAttributes);
        int size = this.size(delegatingList);
        for (int i = 0; i < size; i++)
        {
            result.pkIndex.put(this.get(delegatingList, i));
        }
    }

    for (Iterator it = keySet.iterator(); it.hasNext();)
    {
        MithraDatabaseIdentifierExtractor.DatabaseIdentifierKey key =
                (MithraDatabaseIdentifierExtractor.DatabaseIdentifierKey) it.next();
        RelatedFinder finder = key.getFinder();
        MithraObjectPortal portal = finder.getMithraObjectPortal();
        if (portal == delegatingList.getOperation().getResultObjectPortal())
        {
            portal.registerForApplicationNotification((String) databaseIdentifierMap.get(key), listener, delegatingList, op);
        }
    }
    return result;
}
 
Example 5
Source File: MithraConfigurationManager.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public synchronized MithraObjectPortal initializeObject(List<String> mithraInitializationErrors)
{
    RelatedFinder relatedFinder = getRelatedFinder(this.className, mithraInitializationErrors);
    if (initialized)
    {
        return relatedFinder.getMithraObjectPortal();
    }
    addToExportedConfigs(relatedFinder, MithraConfigurationManager.this);
    String finderClassName = className + "Finder";
    Class finderClass;
    try
    {
        finderClass = Class.forName(finderClassName);
        Method method = getMethodByReflection(finderClass, "setTempConfig", new Class[]{TempObjectConfig.class});
        method.invoke(null, new Object[] { this});
        initialized = true;
        if (postInitializeHook != null)
        {
            postInitializeHook.callbackAfterInitialize(this.className, null, mithraInitializationErrors, false);
        }
    }
    catch (Exception e)
    {
        throw new MithraBusinessException("could not set temp object config", e);
    }
    return null;
}
 
Example 6
Source File: RemoteMithraObjectPersister.java    From reladomo with Apache License 2.0 5 votes vote down vote up
private void registerIdentifierMapForNotification(Map databaseIdentifierMap)
{
    Set keySet = databaseIdentifierMap.keySet();
    Iterator it = keySet.iterator();
    RelatedFinder finder;
    for (int i = 0; i < keySet.size(); i++)
    {
        MithraDatabaseIdentifierExtractor.DatabaseIdentifierKey key =
                (MithraDatabaseIdentifierExtractor.DatabaseIdentifierKey) it.next();

        finder = key.getFinder();
        MithraObjectPortal portal = finder.getMithraObjectPortal();
        portal.registerForNotification((String) databaseIdentifierMap.get(key));
    }
}
 
Example 7
Source File: RemoteAggregateResult.java    From reladomo with Apache License 2.0 5 votes vote down vote up
public void registerForNotification()
{
    Map databaseIdentifierMap = this.getDatabaseIdentifierMap();

    Set keySet = databaseIdentifierMap.keySet();
    for(Iterator it = keySet.iterator(); it.hasNext();)
    {
        MithraDatabaseIdentifierExtractor.DatabaseIdentifierKey key =
                (MithraDatabaseIdentifierExtractor.DatabaseIdentifierKey)it.next();

        RelatedFinder finder = key.getFinder();
        MithraObjectPortal portal = finder.getMithraObjectPortal();
        portal.registerForNotification((String)databaseIdentifierMap.get(key));
    }
}
 
Example 8
Source File: MithraRemoteResult.java    From reladomo with Apache License 2.0 5 votes vote down vote up
protected void registerForNotification(Map databaseIdentifierMap)
{
    Set keySet = databaseIdentifierMap.keySet();
    RelatedFinder finder = null;
    for(Iterator it = keySet.iterator(); it.hasNext();)
    {
        MithraDatabaseIdentifierExtractor.DatabaseIdentifierKey key =
                (MithraDatabaseIdentifierExtractor.DatabaseIdentifierKey)it.next();

        finder = key.getFinder();
        MithraObjectPortal portal = finder.getMithraObjectPortal();
        portal.registerForNotification((String)databaseIdentifierMap.get(key));
    }
}
 
Example 9
Source File: MithraConfigurationManager.java    From reladomo with Apache License 2.0 4 votes vote down vote up
public synchronized MithraObjectPortal initializeObject(List<String> mithraInitializationErrors)
{
    RelatedFinder relatedFinder = getRelatedFinder(className, mithraInitializationErrors);
    if (relatedFinder != null)
    {
        if (initialized)
        {
            return relatedFinder.getMithraObjectPortal();
        }
        if (remoteSerialId != relatedFinder.getSerialVersionId())
        {
            mithraInitializationErrors.add("serial version between server and client does not match for class " + className
                    +" server version: " + remoteSerialId + " local version: " + relatedFinder.getSerialVersionId());
        }
        else
        {
            MithraObjectDeserializer deserializer = null;
            if (isPure)
            {
                deserializer = instantiateDeserializer(className, mithraInitializationErrors);
                MithraPureObjectFactory factory = (MithraPureObjectFactory) deserializer;
                factory.setFactoryParameter(factoryParameter);
            }
            else
            {
                MithraDatabaseObject databaseObject = instantiateDatabaseObject(className, mithraInitializationErrors);
                deserializer = (MithraObjectDeserializer) databaseObject;
            }
            if (fullCache)
            {
                deserializer.instantiateFullCache(this);
            }
            else
            {
                deserializer.instantiatePartialCache(this);
            }
            MithraObjectPortal portal = relatedFinder.getMithraObjectPortal();
            addToExportedConfigs(relatedFinder, MithraConfigurationManager.this);
            initialized = true;
            if (postInitializeHook != null)
            {
                postInitializeHook.callbackAfterInitialize(this.className, portal, mithraInitializationErrors, true);
            }
            return portal;
        }
    }
    return null;
}
 
Example 10
Source File: MithraConfigurationManager.java    From reladomo with Apache License 2.0 4 votes vote down vote up
public synchronized MithraObjectPortal initializeObject(List<String> mithraInitializationErrors)
{
    RelatedFinder relatedFinder = getRelatedFinder(className, mithraInitializationErrors);
    if (relatedFinder != null)
    {
        if (initialized)
        {
            return relatedFinder.getMithraObjectPortal();
        }
        if (remoteSerialId != relatedFinder.getSerialVersionId())
        {
            mithraInitializationErrors.add("serial version between server and client does not match for class " + className
                    +" server version: " + remoteSerialId + " local version: " + relatedFinder.getSerialVersionId());
        }
        else
        {
            MithraObjectDeserializer deserializer = null;
            if (isPure)
            {
                deserializer = instantiateDeserializer(className, mithraInitializationErrors);
                MithraPureObjectFactory factory = (MithraPureObjectFactory) deserializer;
                factory.setFactoryParameter(factoryParameter);
            }
            else
            {
                MithraDatabaseObject databaseObject = instantiateDatabaseObject(className, mithraInitializationErrors);
                deserializer = (MithraObjectDeserializer) databaseObject;
            }
            deserializer.instantiateFullCache(this);
            MithraObjectPortal portal = relatedFinder.getMithraObjectPortal();
            addToExportedConfigs(relatedFinder, MithraConfigurationManager.this);
            initialized = true;
            if (postInitializeHook != null)
            {
                postInitializeHook.callbackAfterInitialize(this.className, portal, mithraInitializationErrors, true);
            }
            return portal;
        }
    }
    return null;
}
 
Example 11
Source File: RemoteExtractListDatabaseIdentifiersResult.java    From reladomo with Apache License 2.0 4 votes vote down vote up
public void run()
{
    RelatedFinder finder = this.instantiateRelatedFinder(finderClassname);
    MithraObjectPortal portal = finder.getMithraObjectPortal();
    databaseIdentifierMap = portal.extractDatabaseIdentifiers(sourceAttributeValueSet);
}