klass.model.meta.domain.BinaryCriteriaAbstract Maven / Gradle / Ivy
The newest version!
package klass.model.meta.domain;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.*;
import java.io.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.gs.fw.common.mithra.*;
import com.gs.fw.common.mithra.attribute.*;
import com.gs.fw.common.mithra.util.*;
import com.gs.fw.common.mithra.notification.*;
import com.gs.fw.common.mithra.notification.listener.*;
import com.gs.fw.common.mithra.list.cursor.Cursor;
import com.gs.fw.common.mithra.bulkloader.*;
import com.gs.fw.common.mithra.*;
import com.gs.fw.common.mithra.behavior.*;
import com.gs.fw.common.mithra.cache.Cache;
import com.gs.fw.common.mithra.extractor.*;
import com.gs.fw.common.mithra.finder.*;
import com.gs.fw.common.mithra.list.*;
import com.gs.fw.common.mithra.behavior.state.PersistenceState;
import com.gs.fw.common.mithra.attribute.update.*;
import com.gs.fw.common.mithra.transaction.MithraObjectPersister;
import java.util.Arrays;
import java.util.HashSet;
/**
* This file was automatically generated using Mithra 18.0.0. Please do not modify it.
* Add custom logic to its subclass instead.
*/
// Generated from templates/transactional/Abstract.jsp
public abstract class BinaryCriteriaAbstract extends com.gs.fw.common.mithra.superclassimpl.MithraTransactionalObjectImpl
{
private static byte MEMORY_STATE = PersistenceState.IN_MEMORY;
private static byte PERSISTED_STATE = PersistenceState.PERSISTED;
private static final Logger logger = LoggerFactory.getLogger(BinaryCriteria.class.getName());
private static final RelationshipHashStrategy forleft = new LeftRhs();
private static final RelationshipHashStrategy forright = new RightRhs();
private static final RelationshipHashStrategy forandCriteriaSubClass = new AndCriteriaSubClassRhs();
private static final RelationshipHashStrategy fororCriteriaSubClass = new OrCriteriaSubClassRhs();
private static final RelationshipHashStrategy forcriteriaSuperClass = new CriteriaSuperClassRhs();
private static final class LeftRhs implements RelationshipHashStrategy
{
public boolean equalsForRelationship(Object _srcObject, Object _srcData, Object _targetData, Timestamp _asOfDate0, Timestamp _asOfDate1)
{
BinaryCriteriaData _castedSrcData = (BinaryCriteriaData) _srcData;
CriteriaData _castedTargetData = (CriteriaData) _targetData;
if (_castedSrcData.getLeftId() == _castedTargetData.getId())
{
return true;
}
return false;
}
public int computeHashCodeFromRelated(Object _srcObject, Object _srcData)
{
BinaryCriteriaData _castedSrcData = (BinaryCriteriaData) _srcData;
return HashUtil.hash(_castedSrcData.getLeftId());
}
public int computeOffHeapHashCodeFromRelated(Object _srcObject, Object _srcData)
{
return computeHashCodeFromRelated(_srcObject, _srcData);
}
}
private static final class RightRhs implements RelationshipHashStrategy
{
public boolean equalsForRelationship(Object _srcObject, Object _srcData, Object _targetData, Timestamp _asOfDate0, Timestamp _asOfDate1)
{
BinaryCriteriaData _castedSrcData = (BinaryCriteriaData) _srcData;
CriteriaData _castedTargetData = (CriteriaData) _targetData;
if (_castedSrcData.getRightId() == _castedTargetData.getId())
{
return true;
}
return false;
}
public int computeHashCodeFromRelated(Object _srcObject, Object _srcData)
{
BinaryCriteriaData _castedSrcData = (BinaryCriteriaData) _srcData;
return HashUtil.hash(_castedSrcData.getRightId());
}
public int computeOffHeapHashCodeFromRelated(Object _srcObject, Object _srcData)
{
return computeHashCodeFromRelated(_srcObject, _srcData);
}
}
private static final class AndCriteriaSubClassRhs implements RelationshipHashStrategy
{
public boolean equalsForRelationship(Object _srcObject, Object _srcData, Object _targetData, Timestamp _asOfDate0, Timestamp _asOfDate1)
{
BinaryCriteriaData _castedSrcData = (BinaryCriteriaData) _srcData;
AndCriteriaData _castedTargetData = (AndCriteriaData) _targetData;
if (_castedSrcData.getId() == _castedTargetData.getId())
{
return true;
}
return false;
}
public int computeHashCodeFromRelated(Object _srcObject, Object _srcData)
{
BinaryCriteriaData _castedSrcData = (BinaryCriteriaData) _srcData;
return HashUtil.hash(_castedSrcData.getId());
}
public int computeOffHeapHashCodeFromRelated(Object _srcObject, Object _srcData)
{
return computeHashCodeFromRelated(_srcObject, _srcData);
}
}
private static final class OrCriteriaSubClassRhs implements RelationshipHashStrategy
{
public boolean equalsForRelationship(Object _srcObject, Object _srcData, Object _targetData, Timestamp _asOfDate0, Timestamp _asOfDate1)
{
BinaryCriteriaData _castedSrcData = (BinaryCriteriaData) _srcData;
OrCriteriaData _castedTargetData = (OrCriteriaData) _targetData;
if (_castedSrcData.getId() == _castedTargetData.getId())
{
return true;
}
return false;
}
public int computeHashCodeFromRelated(Object _srcObject, Object _srcData)
{
BinaryCriteriaData _castedSrcData = (BinaryCriteriaData) _srcData;
return HashUtil.hash(_castedSrcData.getId());
}
public int computeOffHeapHashCodeFromRelated(Object _srcObject, Object _srcData)
{
return computeHashCodeFromRelated(_srcObject, _srcData);
}
}
private static final class CriteriaSuperClassRhs implements RelationshipHashStrategy
{
public boolean equalsForRelationship(Object _srcObject, Object _srcData, Object _targetData, Timestamp _asOfDate0, Timestamp _asOfDate1)
{
BinaryCriteriaData _castedSrcData = (BinaryCriteriaData) _srcData;
CriteriaData _castedTargetData = (CriteriaData) _targetData;
if (_castedSrcData.getId() == _castedTargetData.getId())
{
return true;
}
return false;
}
public int computeHashCodeFromRelated(Object _srcObject, Object _srcData)
{
BinaryCriteriaData _castedSrcData = (BinaryCriteriaData) _srcData;
return HashUtil.hash(_castedSrcData.getId());
}
public int computeOffHeapHashCodeFromRelated(Object _srcObject, Object _srcData)
{
return computeHashCodeFromRelated(_srcObject, _srcData);
}
}
public BinaryCriteriaAbstract()
{
this.persistenceState = MEMORY_STATE;
}
public BinaryCriteria getDetachedCopy() throws MithraBusinessException
{
return (BinaryCriteria) super.getDetachedCopy();
}
public BinaryCriteria getNonPersistentCopy() throws MithraBusinessException
{
BinaryCriteria result = (BinaryCriteria) super.getNonPersistentCopy();
result.persistenceState = MEMORY_STATE;
return result;
}
public BinaryCriteria copyDetachedValuesToOriginalOrInsertIfNew()
{
return (BinaryCriteria) this.zCopyDetachedValuesToOriginalOrInsertIfNew();
}
public BinaryCriteria zFindOriginal()
{
BinaryCriteriaData data = (BinaryCriteriaData) this.currentData;
Operation op;
op = BinaryCriteriaFinder.id().eq(data.getId());
return BinaryCriteriaFinder.findOne(op);
}
public boolean isModifiedSinceDetachmentByDependentRelationships()
{
if(this.isModifiedSinceDetachment()) return true;
if(isAndCriteriaSubClassModifiedSinceDetachment()) return true;
if(isOrCriteriaSubClassModifiedSinceDetachment()) return true;
return false;
}
private Logger getLogger()
{
return logger;
}
public MithraDataObject zAllocateData()
{
return new BinaryCriteriaData();
}
protected void zSetFromBinaryCriteriaData( BinaryCriteriaData data )
{
super.zSetData(data);
this.persistenceState = PERSISTED_STATE;
}
public void setFromBinaryCriteriaData( BinaryCriteriaData data )
{
super.zSetData(data);
}
public void zWriteDataClassName(ObjectOutput out) throws IOException
{
}
public final boolean isIdNull()
{
return ((BinaryCriteriaData) this.zSynchronizedGetData()).isIdNull();
}
public final long getId()
{
BinaryCriteriaData data = (BinaryCriteriaData) this.zSynchronizedGetData();
return data.getId();
}
public void setId(long newValue)
{
MithraDataObject d = zSetLong(BinaryCriteriaFinder.id(), newValue, true, false ,false);
if (d == null) return;
BinaryCriteriaData data = (BinaryCriteriaData) d;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
if (!_behavior.isPersisted())
{
AndCriteria andCriteriaSubClass =
(AndCriteria ) data.getAndCriteriaSubClass();
if (andCriteriaSubClass != null)
{
andCriteriaSubClass.setId(newValue);
}
OrCriteria orCriteriaSubClass =
(OrCriteria ) data.getOrCriteriaSubClass();
if (orCriteriaSubClass != null)
{
orCriteriaSubClass.setId(newValue);
}
}
}
public boolean isLeftIdNull()
{
return ((BinaryCriteriaData) this.zSynchronizedGetData()).isLeftIdNull();
}
public long getLeftId()
{
BinaryCriteriaData data = (BinaryCriteriaData) this.zSynchronizedGetData();
return data.getLeftId();
}
public void setLeftId(long newValue)
{
zSetLong(BinaryCriteriaFinder.leftId(), newValue, false, false ,false);
}
public boolean isRightIdNull()
{
return ((BinaryCriteriaData) this.zSynchronizedGetData()).isRightIdNull();
}
public long getRightId()
{
BinaryCriteriaData data = (BinaryCriteriaData) this.zSynchronizedGetData();
return data.getRightId();
}
public void setRightId(long newValue)
{
zSetLong(BinaryCriteriaFinder.rightId(), newValue, false, false ,false);
}
protected void issuePrimitiveNullSetters(TransactionalBehavior behavior, MithraDataObject data)
{
}
public void zPersistDetachedRelationships(MithraDataObject _data)
{
BinaryCriteriaData _newData = (BinaryCriteriaData) _data;
if (_newData.getAndCriteriaSubClass() instanceof NulledRelation)
{
AndCriteria andCriteriaSubClass =
this.getAndCriteriaSubClass();
if (andCriteriaSubClass != null)
{
andCriteriaSubClass.cascadeDelete();
}
}
else
{
AndCriteria andCriteriaSubClass =
(AndCriteria) _newData.getAndCriteriaSubClass();
if (andCriteriaSubClass != null)
{
AndCriteria _existing =
this.getAndCriteriaSubClass();
if (_existing == null)
{
andCriteriaSubClass.copyDetachedValuesToOriginalOrInsertIfNew();
}
else
{
_existing.zCopyAttributesFrom(andCriteriaSubClass.zGetTxDataForRead());
_existing.zPersistDetachedRelationships(andCriteriaSubClass.zGetTxDataForRead());
}
}
}
if (_newData.getOrCriteriaSubClass() instanceof NulledRelation)
{
OrCriteria orCriteriaSubClass =
this.getOrCriteriaSubClass();
if (orCriteriaSubClass != null)
{
orCriteriaSubClass.cascadeDelete();
}
}
else
{
OrCriteria orCriteriaSubClass =
(OrCriteria) _newData.getOrCriteriaSubClass();
if (orCriteriaSubClass != null)
{
OrCriteria _existing =
this.getOrCriteriaSubClass();
if (_existing == null)
{
orCriteriaSubClass.copyDetachedValuesToOriginalOrInsertIfNew();
}
else
{
_existing.zCopyAttributesFrom(orCriteriaSubClass.zGetTxDataForRead());
_existing.zPersistDetachedRelationships(orCriteriaSubClass.zGetTxDataForRead());
}
}
}
}
public void zSetTxDetachedDeleted()
{
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
if (_behavior.isDetached() && _behavior.isDeleted()) return;
BinaryCriteriaData _newData = (BinaryCriteriaData) _behavior.getCurrentDataForRead(this);
if (_newData.getAndCriteriaSubClass() != null && !(_newData.getAndCriteriaSubClass() instanceof NulledRelation))
{
((AndCriteria)_newData.getAndCriteriaSubClass()).zSetTxDetachedDeleted();
}
if (_newData.getOrCriteriaSubClass() != null && !(_newData.getOrCriteriaSubClass() instanceof NulledRelation))
{
((OrCriteria)_newData.getOrCriteriaSubClass()).zSetTxDetachedDeleted();
}
this.zSetTxPersistenceState(PersistenceState.DETACHED_DELETED);
}
public void zSetNonTxDetachedDeleted()
{
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
BinaryCriteriaData _newData = (BinaryCriteriaData) _behavior.getCurrentDataForRead(this);
if (_newData.getAndCriteriaSubClass() != null && !(_newData.getAndCriteriaSubClass() instanceof NulledRelation))
{
((AndCriteria)_newData.getAndCriteriaSubClass()).zSetNonTxDetachedDeleted();
}
if (_newData.getOrCriteriaSubClass() != null && !(_newData.getOrCriteriaSubClass() instanceof NulledRelation))
{
((OrCriteria)_newData.getOrCriteriaSubClass()).zSetNonTxDetachedDeleted();
}
this.zSetNonTxPersistenceState(PersistenceState.DETACHED_DELETED);
}
/**
* Relationship Expression:
this.leftId = Criteria.id
* @see Criteria#getOwnerOfLeftCriteria() reverse relationship Criteria.getOwnerOfLeftCriteria()
* @return The left
*/
public Criteria getLeft()
{
Criteria _result = null;
Operation _op = null;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary();
BinaryCriteriaData _data = (BinaryCriteriaData) _behavior.getCurrentDataForRead(this);
MithraObjectPortal _portal = null;
if (_behavior.isPersisted())
{
{
_portal = CriteriaFinder.getMithraObjectPortal();
Object _related = _portal.getAsOneFromCache(this, _data, forleft, null, null);
if (!(_related instanceof NulledRelation)) _result = (Criteria) _related;
if (_related == null)
{
_op = CriteriaFinder.id().eq(_data.getLeftId());
}
}
}
else if (_behavior.isDetached())
{
{
{
Operation detachedOp = CriteriaFinder.id().eq(_data.getLeftId());
_result = CriteriaFinder.zFindOneForRelationship(detachedOp);
}
}
}
else if (_behavior.isInMemory())
{
_result = (Criteria) _data.getLeft();
if (_result == null)
{
{
_op = CriteriaFinder.id().eq(_data.getLeftId());
}
}
}
if (_op != null)
{
_result = CriteriaFinder.zFindOneForRelationship(_op);
}
return _result;
}
public void setLeft(Criteria left)
{
Criteria _left = (Criteria) left;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
BinaryCriteriaData _data = (BinaryCriteriaData) _behavior.getCurrentDataForWrite(this);
if (_behavior.isInMemory())
{
_data.setLeft(_left);
if (_left == null)
{
this.setLeftId(0);
}
else
{
this.setLeftId(_left.getId());
}
}
else if (_behavior.isPersisted())
{
_behavior.clearTempTransaction(this);
if (_left == null)
{
this.setLeftId(0);
}
else
{
this.setLeftId(
_left.getId());
}
}
else throw new RuntimeException("not implemented");
}
/**
* Relationship Expression:
this.rightId = Criteria.id
* @see Criteria#getOwnerOfRightCriteria() reverse relationship Criteria.getOwnerOfRightCriteria()
* @return The right
*/
public Criteria getRight()
{
Criteria _result = null;
Operation _op = null;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary();
BinaryCriteriaData _data = (BinaryCriteriaData) _behavior.getCurrentDataForRead(this);
MithraObjectPortal _portal = null;
if (_behavior.isPersisted())
{
{
_portal = CriteriaFinder.getMithraObjectPortal();
Object _related = _portal.getAsOneFromCache(this, _data, forright, null, null);
if (!(_related instanceof NulledRelation)) _result = (Criteria) _related;
if (_related == null)
{
_op = CriteriaFinder.id().eq(_data.getRightId());
}
}
}
else if (_behavior.isDetached())
{
{
{
Operation detachedOp = CriteriaFinder.id().eq(_data.getRightId());
_result = CriteriaFinder.zFindOneForRelationship(detachedOp);
}
}
}
else if (_behavior.isInMemory())
{
_result = (Criteria) _data.getRight();
if (_result == null)
{
{
_op = CriteriaFinder.id().eq(_data.getRightId());
}
}
}
if (_op != null)
{
_result = CriteriaFinder.zFindOneForRelationship(_op);
}
return _result;
}
public void setRight(Criteria right)
{
Criteria _right = (Criteria) right;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
BinaryCriteriaData _data = (BinaryCriteriaData) _behavior.getCurrentDataForWrite(this);
if (_behavior.isInMemory())
{
_data.setRight(_right);
if (_right == null)
{
this.setRightId(0);
}
else
{
this.setRightId(_right.getId());
}
}
else if (_behavior.isPersisted())
{
_behavior.clearTempTransaction(this);
if (_right == null)
{
this.setRightId(0);
}
else
{
this.setRightId(
_right.getId());
}
}
else throw new RuntimeException("not implemented");
}
/**
* Relationship Expression:
this.id = AndCriteria.id
* @see AndCriteria#getBinaryCriteriaSuperClass() reverse relationship AndCriteria.getBinaryCriteriaSuperClass()
* @return The and criteria sub class
*/
public AndCriteria getAndCriteriaSubClass()
{
AndCriteria _result = null;
Operation _op = null;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary();
BinaryCriteriaData _data = (BinaryCriteriaData) _behavior.getCurrentDataForRead(this);
MithraObjectPortal _portal = null;
if (_behavior.isPersisted())
{
{
_portal = AndCriteriaFinder.getMithraObjectPortal();
Object _related = _portal.getAsOneFromCache(this, _data, forandCriteriaSubClass, null, null);
if (!(_related instanceof NulledRelation)) _result = (AndCriteria) _related;
if (_related == null)
{
_op = AndCriteriaFinder.id().eq(_data.getId());
}
}
}
else if (_behavior.isDetached())
{
if (_data.getAndCriteriaSubClass() instanceof NulledRelation)
{
return null;
}
_result = (AndCriteria) _data.getAndCriteriaSubClass();
if (_result == null)
{
{
Operation detachedOp = AndCriteriaFinder.id().eq(_data.getId());
_result = AndCriteriaFinder.zFindOneForRelationship(detachedOp);
if(_result != null)
{
_result = _result.getDetachedCopy();
}
}
_behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
_data = (BinaryCriteriaData) _behavior.getCurrentDataForWrite(this);
_data.setAndCriteriaSubClass(_result);
if (_result != null) _result.zSetParentContainerbinaryCriteriaSuperClass(this);
}
}
else if (_behavior.isInMemory())
{
_result = (AndCriteria) _data.getAndCriteriaSubClass();
}
if (_op != null)
{
_result = AndCriteriaFinder.zFindOneForRelationship(_op);
}
return _result;
}
public void setAndCriteriaSubClass(AndCriteria andCriteriaSubClass)
{
AndCriteria _andCriteriaSubClass = (AndCriteria) andCriteriaSubClass;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
BinaryCriteriaData _data = (BinaryCriteriaData) _behavior.getCurrentDataForWrite(this);
if (_behavior.isInMemory())
{
Object _prev = _data.getAndCriteriaSubClass();
_data.setAndCriteriaSubClass(_andCriteriaSubClass);
if (_andCriteriaSubClass != null)
{
_andCriteriaSubClass.setId(_data.getId());
_andCriteriaSubClass.zSetParentContainerbinaryCriteriaSuperClass(this);
}
else if (_behavior.isDetached())
{
_data.setAndCriteriaSubClass(NulledRelation.create(_prev));
if (_prev != null && !(_prev instanceof NulledRelation)
&& (!((MithraTransactionalObject)_prev).isInMemoryAndNotInserted() || ((MithraTransactionalObject)_prev).zIsDetached()))
{
((MithraTransactionalObject)_prev).delete();
}
}
}
else if (_behavior.isPersisted())
{
_behavior.clearTempTransaction(this);
AndCriteria _existing = this.getAndCriteriaSubClass();
if (_andCriteriaSubClass != _existing)
{
if (_existing != null)
{
_existing.cascadeDelete();
}
if (_andCriteriaSubClass != null)
{
_andCriteriaSubClass.setId(_data.getId());
_andCriteriaSubClass.cascadeInsert();
}
}
}
else throw new RuntimeException("not implemented");
}
public boolean isAndCriteriaSubClassModifiedSinceDetachment()
{
TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary();
BinaryCriteriaData _data = (BinaryCriteriaData) _behavior.getCurrentDataForRead(this);
if (_data.getAndCriteriaSubClass() instanceof NulledRelation)
{
AndCriteria _existing = this.getOriginalPersistentObject().getAndCriteriaSubClass();
return _existing != null;
}
AndCriteria andCriteriaSubClass =
(AndCriteria) _data.getAndCriteriaSubClass();
if( andCriteriaSubClass != null)
{
return andCriteriaSubClass.isModifiedSinceDetachment();
}
return false;
}
/**
* Relationship Expression:
this.id = OrCriteria.id
* @see OrCriteria#getBinaryCriteriaSuperClass() reverse relationship OrCriteria.getBinaryCriteriaSuperClass()
* @return The or criteria sub class
*/
public OrCriteria getOrCriteriaSubClass()
{
OrCriteria _result = null;
Operation _op = null;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary();
BinaryCriteriaData _data = (BinaryCriteriaData) _behavior.getCurrentDataForRead(this);
MithraObjectPortal _portal = null;
if (_behavior.isPersisted())
{
{
_portal = OrCriteriaFinder.getMithraObjectPortal();
Object _related = _portal.getAsOneFromCache(this, _data, fororCriteriaSubClass, null, null);
if (!(_related instanceof NulledRelation)) _result = (OrCriteria) _related;
if (_related == null)
{
_op = OrCriteriaFinder.id().eq(_data.getId());
}
}
}
else if (_behavior.isDetached())
{
if (_data.getOrCriteriaSubClass() instanceof NulledRelation)
{
return null;
}
_result = (OrCriteria) _data.getOrCriteriaSubClass();
if (_result == null)
{
{
Operation detachedOp = OrCriteriaFinder.id().eq(_data.getId());
_result = OrCriteriaFinder.zFindOneForRelationship(detachedOp);
if(_result != null)
{
_result = _result.getDetachedCopy();
}
}
_behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
_data = (BinaryCriteriaData) _behavior.getCurrentDataForWrite(this);
_data.setOrCriteriaSubClass(_result);
if (_result != null) _result.zSetParentContainerbinaryCriteriaSuperClass(this);
}
}
else if (_behavior.isInMemory())
{
_result = (OrCriteria) _data.getOrCriteriaSubClass();
}
if (_op != null)
{
_result = OrCriteriaFinder.zFindOneForRelationship(_op);
}
return _result;
}
public void setOrCriteriaSubClass(OrCriteria orCriteriaSubClass)
{
OrCriteria _orCriteriaSubClass = (OrCriteria) orCriteriaSubClass;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
BinaryCriteriaData _data = (BinaryCriteriaData) _behavior.getCurrentDataForWrite(this);
if (_behavior.isInMemory())
{
Object _prev = _data.getOrCriteriaSubClass();
_data.setOrCriteriaSubClass(_orCriteriaSubClass);
if (_orCriteriaSubClass != null)
{
_orCriteriaSubClass.setId(_data.getId());
_orCriteriaSubClass.zSetParentContainerbinaryCriteriaSuperClass(this);
}
else if (_behavior.isDetached())
{
_data.setOrCriteriaSubClass(NulledRelation.create(_prev));
if (_prev != null && !(_prev instanceof NulledRelation)
&& (!((MithraTransactionalObject)_prev).isInMemoryAndNotInserted() || ((MithraTransactionalObject)_prev).zIsDetached()))
{
((MithraTransactionalObject)_prev).delete();
}
}
}
else if (_behavior.isPersisted())
{
_behavior.clearTempTransaction(this);
OrCriteria _existing = this.getOrCriteriaSubClass();
if (_orCriteriaSubClass != _existing)
{
if (_existing != null)
{
_existing.cascadeDelete();
}
if (_orCriteriaSubClass != null)
{
_orCriteriaSubClass.setId(_data.getId());
_orCriteriaSubClass.cascadeInsert();
}
}
}
else throw new RuntimeException("not implemented");
}
public boolean isOrCriteriaSubClassModifiedSinceDetachment()
{
TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary();
BinaryCriteriaData _data = (BinaryCriteriaData) _behavior.getCurrentDataForRead(this);
if (_data.getOrCriteriaSubClass() instanceof NulledRelation)
{
OrCriteria _existing = this.getOriginalPersistentObject().getOrCriteriaSubClass();
return _existing != null;
}
OrCriteria orCriteriaSubClass =
(OrCriteria) _data.getOrCriteriaSubClass();
if( orCriteriaSubClass != null)
{
return orCriteriaSubClass.isModifiedSinceDetachment();
}
return false;
}
/**
* Relationship Expression:
Criteria.id = this.id
* @see Criteria#getBinaryCriteriaSubClass() reverse relationship Criteria.getBinaryCriteriaSubClass()
* @return The criteria super class
*/
public Criteria getCriteriaSuperClass()
{
Criteria _result = null;
Operation _op = null;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary();
BinaryCriteriaData _data = (BinaryCriteriaData) _behavior.getCurrentDataForRead(this);
MithraObjectPortal _portal = null;
if (_behavior.isPersisted())
{
{
_portal = CriteriaFinder.getMithraObjectPortal();
Object _related = _portal.getAsOneFromCache(this, _data, forcriteriaSuperClass, null, null);
if (!(_related instanceof NulledRelation)) _result = (Criteria) _related;
if (_related == null)
{
_op = CriteriaFinder.id().eq(_data.getId());
}
}
}
else if (_behavior.isDetached())
{
if (_data.getCriteriaSuperClass() instanceof NulledRelation)
{
return null;
}
_result = (Criteria) _data.getCriteriaSuperClass();
if (_result == null)
{
{
Operation detachedOp = CriteriaFinder.id().eq(_data.getId());
_result = CriteriaFinder.zFindOneForRelationship(detachedOp);
if(_result != null)
{
_result = _result.getDetachedCopy();
}
}
_data = (BinaryCriteriaData) _behavior.getCurrentDataForWrite(this);
_data.setCriteriaSuperClass(_result);
}
}
else if (_behavior.isInMemory())
{
_result = (Criteria) _data.getCriteriaSuperClass();
if (_result == null)
{
{
_op = CriteriaFinder.id().eq(_data.getId());
}
}
}
if (_op != null)
{
_result = CriteriaFinder.zFindOneForRelationship(_op);
}
return _result;
}
public void setCriteriaSuperClass(Criteria criteriaSuperClass)
{
((Criteria)criteriaSuperClass).setBinaryCriteriaSubClass((BinaryCriteria)this);
}
public void zSetParentContainercriteriaSuperClass(CriteriaAbstract parent)
{
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
BinaryCriteriaData _data = (BinaryCriteriaData) _behavior.getCurrentDataForWrite(this);
_behavior.clearTempTransaction(this);
if (_behavior.isInMemory())
{
_data.setCriteriaSuperClass(parent);
}
}
protected void cascadeInsertImpl() throws MithraBusinessException
{
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
BinaryCriteriaData _data = (BinaryCriteriaData) _behavior.getCurrentDataForWrite(this);
AndCriteria andCriteriaSubClass =
(AndCriteria) _data.getAndCriteriaSubClass();
OrCriteria orCriteriaSubClass =
(OrCriteria) _data.getOrCriteriaSubClass();
_behavior.insert(this);
if (andCriteriaSubClass != null)
{
andCriteriaSubClass.cascadeInsert();
}
if (orCriteriaSubClass != null)
{
orCriteriaSubClass.cascadeInsert();
}
}
@Override
public Map< RelatedFinder, StatisticCounter > zAddNavigatedRelationshipsStats(RelatedFinder finder, Map< RelatedFinder, StatisticCounter > navigationStats)
{
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
_behavior.addNavigatedRelationshipsStats(this, finder, navigationStats);
return navigationStats;
}
@Override
public Map< RelatedFinder, StatisticCounter > zAddNavigatedRelationshipsStatsForUpdate(RelatedFinder parentFinderGeneric, Map< RelatedFinder, StatisticCounter > navigationStats)
{
BinaryCriteriaFinder.BinaryCriteriaRelatedFinder parentFinder = (BinaryCriteriaFinder.BinaryCriteriaRelatedFinder) parentFinderGeneric;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
BinaryCriteriaData _newData = (BinaryCriteriaData) _behavior.getCurrentDataForWrite(this);
if (_newData.getAndCriteriaSubClass() instanceof NulledRelation)
{
RelatedFinder dependentFinder = parentFinder.andCriteriaSubClass();
DeepRelationshipUtility.zAddToNavigationStats(dependentFinder, true, navigationStats);
DeepRelationshipUtility.zAddAllDependentNavigationsStatsForDelete(dependentFinder, navigationStats);
}
else
{
AndCriteria andCriteriaSubClass =
(AndCriteria) _newData.getAndCriteriaSubClass();
RelatedFinder dependentFinder = parentFinder.andCriteriaSubClass();
DeepRelationshipUtility.zAddToNavigationStats(dependentFinder, andCriteriaSubClass != null, navigationStats);
if (andCriteriaSubClass != null)
{
_behavior.addNavigatedRelationshipsStats(andCriteriaSubClass, dependentFinder, navigationStats);
}
}
if (_newData.getOrCriteriaSubClass() instanceof NulledRelation)
{
RelatedFinder dependentFinder = parentFinder.orCriteriaSubClass();
DeepRelationshipUtility.zAddToNavigationStats(dependentFinder, true, navigationStats);
DeepRelationshipUtility.zAddAllDependentNavigationsStatsForDelete(dependentFinder, navigationStats);
}
else
{
OrCriteria orCriteriaSubClass =
(OrCriteria) _newData.getOrCriteriaSubClass();
RelatedFinder dependentFinder = parentFinder.orCriteriaSubClass();
DeepRelationshipUtility.zAddToNavigationStats(dependentFinder, orCriteriaSubClass != null, navigationStats);
if (orCriteriaSubClass != null)
{
_behavior.addNavigatedRelationshipsStats(orCriteriaSubClass, dependentFinder, navigationStats);
}
}
return navigationStats;
}
@Override
public Map< RelatedFinder, StatisticCounter > zAddNavigatedRelationshipsStatsForDelete(RelatedFinder parentFinder, Map< RelatedFinder, StatisticCounter > navigationStats)
{
DeepRelationshipUtility.zAddAllDependentNavigationsStatsForDelete(parentFinder, navigationStats);
return navigationStats;
}
@Override
public BinaryCriteria zCascadeCopyThenInsert() throws MithraBusinessException
{
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
BinaryCriteriaData _data = (BinaryCriteriaData) _behavior.getCurrentDataForWrite(this);
AndCriteria andCriteriaSubClass =
(AndCriteria) _data.getAndCriteriaSubClass();
OrCriteria orCriteriaSubClass =
(OrCriteria) _data.getOrCriteriaSubClass();
BinaryCriteria original = (BinaryCriteria) _behavior.copyThenInsert(this);
if (andCriteriaSubClass != null)
{
andCriteriaSubClass.zCascadeCopyThenInsert();
}
if (orCriteriaSubClass != null)
{
orCriteriaSubClass.zCascadeCopyThenInsert();
}
return original;
}
protected void cascadeDeleteImpl() throws MithraBusinessException
{
{
AndCriteria related = this.getAndCriteriaSubClass();
if (related != null)
related.cascadeDelete();
}
{
OrCriteria related = this.getOrCriteriaSubClass();
if (related != null)
related.cascadeDelete();
}
this.delete();
}
public Cache zGetCache()
{
return BinaryCriteriaFinder.getMithraObjectPortal().getCache();
}
public MithraObjectPortal zGetPortal()
{
return BinaryCriteriaFinder.getMithraObjectPortal();
}
public BinaryCriteria getOriginalPersistentObject()
{
return this.zFindOriginal();
}
protected boolean issueUpdatesForNonPrimaryKeys(TransactionalBehavior behavior, MithraDataObject data, MithraDataObject newData)
{
boolean changed = false;
changed |= zUpdateLong(behavior, data, newData, BinaryCriteriaFinder.leftId(), false);
changed |= zUpdateLong(behavior, data, newData, BinaryCriteriaFinder.rightId(), false);
return changed;
}
protected boolean issueUpdatesForPrimaryKeys(TransactionalBehavior behavior, MithraDataObject data, MithraDataObject newData)
{
boolean changed = false;
changed |= zUpdateLong(behavior, data, newData, BinaryCriteriaFinder.id(), false);
return changed;
}
public Object readResolve() throws ObjectStreamException
{
BinaryCriteriaAbstract result = (BinaryCriteriaAbstract) super.readResolve();
if (result.persistenceState == PersistenceState.PERSISTED)
{
result.persistenceState = PERSISTED_STATE;
}
else if (result.persistenceState == PersistenceState.IN_MEMORY)
{
result.persistenceState = MEMORY_STATE;
}
return result;
}
protected static void zConfigNonTx()
{
MEMORY_STATE = PersistenceState.IN_MEMORY_NON_TRANSACTIONAL;
PERSISTED_STATE = PersistenceState.PERSISTED_NON_TRANSACTIONAL;
}
protected static void zConfigFullTx()
{
MEMORY_STATE = PersistenceState.IN_MEMORY;
PERSISTED_STATE = PersistenceState.PERSISTED;
}
protected class AndCriteriaSubClassAddHandlerInMemory implements DependentRelationshipAddHandler
{
public void addRelatedObject(MithraTransactionalObject relatedObject)
{
AndCriteria item = (AndCriteria) relatedObject;
item.setId(getId());
item.zSetParentContainerbinaryCriteriaSuperClass(BinaryCriteriaAbstract.this);
}
}
protected class AndCriteriaSubClassAddHandlerPersisted implements DependentRelationshipAddHandler
{
public void addRelatedObject(MithraTransactionalObject relatedObject)
{
AndCriteria item = (AndCriteria) relatedObject;
item.setId(getId());
item.cascadeInsert();
}
}
protected class OrCriteriaSubClassAddHandlerInMemory implements DependentRelationshipAddHandler
{
public void addRelatedObject(MithraTransactionalObject relatedObject)
{
OrCriteria item = (OrCriteria) relatedObject;
item.setId(getId());
item.zSetParentContainerbinaryCriteriaSuperClass(BinaryCriteriaAbstract.this);
}
}
protected class OrCriteriaSubClassAddHandlerPersisted implements DependentRelationshipAddHandler
{
public void addRelatedObject(MithraTransactionalObject relatedObject)
{
OrCriteria item = (OrCriteria) relatedObject;
item.setId(getId());
item.cascadeInsert();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy