klass.model.meta.domain.ProjectionWithAssociationEndAbstract 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 ProjectionWithAssociationEndAbstract 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(ProjectionWithAssociationEnd.class.getName());
private static final RelationshipHashStrategy forassociationEnd = new AssociationEndRhs();
private static final RelationshipHashStrategy forprojectionReferencePropertySubClass = new ProjectionReferencePropertySubClassRhs();
private static final RelationshipHashStrategy forprojectionProjectionReferenceSubClass = new ProjectionProjectionReferenceSubClassRhs();
private static final RelationshipHashStrategy forprojectionElementSuperClass = new ProjectionElementSuperClassRhs();
private static final class AssociationEndRhs implements RelationshipHashStrategy
{
public boolean equalsForRelationship(Object _srcObject, Object _srcData, Object _targetData, Timestamp _asOfDate0, Timestamp _asOfDate1)
{
ProjectionWithAssociationEndData _castedSrcData = (ProjectionWithAssociationEndData) _srcData;
AssociationEndData _castedTargetData = (AssociationEndData) _targetData;
if (_castedSrcData.getAssociationEndClass()!= null && _castedSrcData.getAssociationEndClass().equals(_castedTargetData.getOwningClassName()) && _castedSrcData.getAssociationEndName()!= null && _castedSrcData.getAssociationEndName().equals(_castedTargetData.getName()))
{
return true;
}
return false;
}
public int computeHashCodeFromRelated(Object _srcObject, Object _srcData)
{
ProjectionWithAssociationEndData _castedSrcData = (ProjectionWithAssociationEndData) _srcData;
return HashUtil.combineHashes(HashUtil.hash(_castedSrcData.getAssociationEndClass()),HashUtil.hash(_castedSrcData.getAssociationEndName()));
}
public int computeOffHeapHashCodeFromRelated(Object _srcObject, Object _srcData)
{
ProjectionWithAssociationEndData _castedSrcData = (ProjectionWithAssociationEndData) _srcData;
return HashUtil.combineHashes(HashUtil.offHeapHash(_castedSrcData.getAssociationEndClass()),HashUtil.offHeapHash(_castedSrcData.getAssociationEndName()));
}
}
private static final class ProjectionReferencePropertySubClassRhs implements RelationshipHashStrategy
{
public boolean equalsForRelationship(Object _srcObject, Object _srcData, Object _targetData, Timestamp _asOfDate0, Timestamp _asOfDate1)
{
ProjectionWithAssociationEndData _castedSrcData = (ProjectionWithAssociationEndData) _srcData;
ProjectionReferencePropertyData _castedTargetData = (ProjectionReferencePropertyData) _targetData;
if (_castedSrcData.getId() == _castedTargetData.getId())
{
return true;
}
return false;
}
public int computeHashCodeFromRelated(Object _srcObject, Object _srcData)
{
ProjectionWithAssociationEndData _castedSrcData = (ProjectionWithAssociationEndData) _srcData;
return HashUtil.hash(_castedSrcData.getId());
}
public int computeOffHeapHashCodeFromRelated(Object _srcObject, Object _srcData)
{
return computeHashCodeFromRelated(_srcObject, _srcData);
}
}
private static final class ProjectionProjectionReferenceSubClassRhs implements RelationshipHashStrategy
{
public boolean equalsForRelationship(Object _srcObject, Object _srcData, Object _targetData, Timestamp _asOfDate0, Timestamp _asOfDate1)
{
ProjectionWithAssociationEndData _castedSrcData = (ProjectionWithAssociationEndData) _srcData;
ProjectionProjectionReferenceData _castedTargetData = (ProjectionProjectionReferenceData) _targetData;
if (_castedSrcData.getId() == _castedTargetData.getId())
{
return true;
}
return false;
}
public int computeHashCodeFromRelated(Object _srcObject, Object _srcData)
{
ProjectionWithAssociationEndData _castedSrcData = (ProjectionWithAssociationEndData) _srcData;
return HashUtil.hash(_castedSrcData.getId());
}
public int computeOffHeapHashCodeFromRelated(Object _srcObject, Object _srcData)
{
return computeHashCodeFromRelated(_srcObject, _srcData);
}
}
private static final class ProjectionElementSuperClassRhs implements RelationshipHashStrategy
{
public boolean equalsForRelationship(Object _srcObject, Object _srcData, Object _targetData, Timestamp _asOfDate0, Timestamp _asOfDate1)
{
ProjectionWithAssociationEndData _castedSrcData = (ProjectionWithAssociationEndData) _srcData;
ProjectionElementData _castedTargetData = (ProjectionElementData) _targetData;
if (_castedSrcData.getId() == _castedTargetData.getId())
{
return true;
}
return false;
}
public int computeHashCodeFromRelated(Object _srcObject, Object _srcData)
{
ProjectionWithAssociationEndData _castedSrcData = (ProjectionWithAssociationEndData) _srcData;
return HashUtil.hash(_castedSrcData.getId());
}
public int computeOffHeapHashCodeFromRelated(Object _srcObject, Object _srcData)
{
return computeHashCodeFromRelated(_srcObject, _srcData);
}
}
public ProjectionWithAssociationEndAbstract()
{
this.persistenceState = MEMORY_STATE;
}
public ProjectionWithAssociationEnd getDetachedCopy() throws MithraBusinessException
{
return (ProjectionWithAssociationEnd) super.getDetachedCopy();
}
public ProjectionWithAssociationEnd getNonPersistentCopy() throws MithraBusinessException
{
ProjectionWithAssociationEnd result = (ProjectionWithAssociationEnd) super.getNonPersistentCopy();
result.persistenceState = MEMORY_STATE;
return result;
}
public ProjectionWithAssociationEnd copyDetachedValuesToOriginalOrInsertIfNew()
{
return (ProjectionWithAssociationEnd) this.zCopyDetachedValuesToOriginalOrInsertIfNew();
}
public ProjectionWithAssociationEnd zFindOriginal()
{
ProjectionWithAssociationEndData data = (ProjectionWithAssociationEndData) this.currentData;
Operation op;
op = ProjectionWithAssociationEndFinder.id().eq(data.getId());
return ProjectionWithAssociationEndFinder.findOne(op);
}
public boolean isModifiedSinceDetachmentByDependentRelationships()
{
if(this.isModifiedSinceDetachment()) return true;
if(isProjectionReferencePropertySubClassModifiedSinceDetachment()) return true;
if(isProjectionProjectionReferenceSubClassModifiedSinceDetachment()) return true;
return false;
}
private Logger getLogger()
{
return logger;
}
public MithraDataObject zAllocateData()
{
return new ProjectionWithAssociationEndData();
}
protected void zSetFromProjectionWithAssociationEndData( ProjectionWithAssociationEndData data )
{
super.zSetData(data);
this.persistenceState = PERSISTED_STATE;
}
public void setFromProjectionWithAssociationEndData( ProjectionWithAssociationEndData data )
{
super.zSetData(data);
}
public void zWriteDataClassName(ObjectOutput out) throws IOException
{
}
public boolean isAssociationEndClassNull()
{
return ((ProjectionWithAssociationEndData) this.zSynchronizedGetData()).isAssociationEndClassNull();
}
public String getAssociationEndClass()
{
ProjectionWithAssociationEndData data = (ProjectionWithAssociationEndData) this.zSynchronizedGetData();
return data.getAssociationEndClass();
}
public void setAssociationEndClass(String newValue)
{
if (newValue != null && newValue.length() > 256)
throw new MithraBusinessException("Attribute 'associationEndClass' cannot exceed maximum length of 256: " + newValue);
zSetString(ProjectionWithAssociationEndFinder.associationEndClass(), newValue, false, false );
}
public boolean isAssociationEndNameNull()
{
return ((ProjectionWithAssociationEndData) this.zSynchronizedGetData()).isAssociationEndNameNull();
}
public String getAssociationEndName()
{
ProjectionWithAssociationEndData data = (ProjectionWithAssociationEndData) this.zSynchronizedGetData();
return data.getAssociationEndName();
}
public void setAssociationEndName(String newValue)
{
if (newValue != null && newValue.length() > 256)
throw new MithraBusinessException("Attribute 'associationEndName' cannot exceed maximum length of 256: " + newValue);
zSetString(ProjectionWithAssociationEndFinder.associationEndName(), newValue, false, false );
}
public final boolean isIdNull()
{
return ((ProjectionWithAssociationEndData) this.zSynchronizedGetData()).isIdNull();
}
public final long getId()
{
ProjectionWithAssociationEndData data = (ProjectionWithAssociationEndData) this.zSynchronizedGetData();
return data.getId();
}
public void setId(long newValue)
{
MithraDataObject d = zSetLong(ProjectionWithAssociationEndFinder.id(), newValue, true, false ,false);
if (d == null) return;
ProjectionWithAssociationEndData data = (ProjectionWithAssociationEndData) d;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
if (!_behavior.isPersisted())
{
ProjectionReferenceProperty projectionReferencePropertySubClass =
(ProjectionReferenceProperty ) data.getProjectionReferencePropertySubClass();
if (projectionReferencePropertySubClass != null)
{
projectionReferencePropertySubClass.setId(newValue);
}
ProjectionProjectionReference projectionProjectionReferenceSubClass =
(ProjectionProjectionReference ) data.getProjectionProjectionReferenceSubClass();
if (projectionProjectionReferenceSubClass != null)
{
projectionProjectionReferenceSubClass.setId(newValue);
}
}
}
protected void issuePrimitiveNullSetters(TransactionalBehavior behavior, MithraDataObject data)
{
}
public void zPersistDetachedRelationships(MithraDataObject _data)
{
ProjectionWithAssociationEndData _newData = (ProjectionWithAssociationEndData) _data;
if (_newData.getProjectionReferencePropertySubClass() instanceof NulledRelation)
{
ProjectionReferenceProperty projectionReferencePropertySubClass =
this.getProjectionReferencePropertySubClass();
if (projectionReferencePropertySubClass != null)
{
projectionReferencePropertySubClass.cascadeDelete();
}
}
else
{
ProjectionReferenceProperty projectionReferencePropertySubClass =
(ProjectionReferenceProperty) _newData.getProjectionReferencePropertySubClass();
if (projectionReferencePropertySubClass != null)
{
ProjectionReferenceProperty _existing =
this.getProjectionReferencePropertySubClass();
if (_existing == null)
{
projectionReferencePropertySubClass.copyDetachedValuesToOriginalOrInsertIfNew();
}
else
{
_existing.zCopyAttributesFrom(projectionReferencePropertySubClass.zGetTxDataForRead());
_existing.zPersistDetachedRelationships(projectionReferencePropertySubClass.zGetTxDataForRead());
}
}
}
if (_newData.getProjectionProjectionReferenceSubClass() instanceof NulledRelation)
{
ProjectionProjectionReference projectionProjectionReferenceSubClass =
this.getProjectionProjectionReferenceSubClass();
if (projectionProjectionReferenceSubClass != null)
{
projectionProjectionReferenceSubClass.cascadeDelete();
}
}
else
{
ProjectionProjectionReference projectionProjectionReferenceSubClass =
(ProjectionProjectionReference) _newData.getProjectionProjectionReferenceSubClass();
if (projectionProjectionReferenceSubClass != null)
{
ProjectionProjectionReference _existing =
this.getProjectionProjectionReferenceSubClass();
if (_existing == null)
{
projectionProjectionReferenceSubClass.copyDetachedValuesToOriginalOrInsertIfNew();
}
else
{
_existing.zCopyAttributesFrom(projectionProjectionReferenceSubClass.zGetTxDataForRead());
_existing.zPersistDetachedRelationships(projectionProjectionReferenceSubClass.zGetTxDataForRead());
}
}
}
}
public void zSetTxDetachedDeleted()
{
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
if (_behavior.isDetached() && _behavior.isDeleted()) return;
ProjectionWithAssociationEndData _newData = (ProjectionWithAssociationEndData) _behavior.getCurrentDataForRead(this);
if (_newData.getProjectionReferencePropertySubClass() != null && !(_newData.getProjectionReferencePropertySubClass() instanceof NulledRelation))
{
((ProjectionReferenceProperty)_newData.getProjectionReferencePropertySubClass()).zSetTxDetachedDeleted();
}
if (_newData.getProjectionProjectionReferenceSubClass() != null && !(_newData.getProjectionProjectionReferenceSubClass() instanceof NulledRelation))
{
((ProjectionProjectionReference)_newData.getProjectionProjectionReferenceSubClass()).zSetTxDetachedDeleted();
}
this.zSetTxPersistenceState(PersistenceState.DETACHED_DELETED);
}
public void zSetNonTxDetachedDeleted()
{
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
ProjectionWithAssociationEndData _newData = (ProjectionWithAssociationEndData) _behavior.getCurrentDataForRead(this);
if (_newData.getProjectionReferencePropertySubClass() != null && !(_newData.getProjectionReferencePropertySubClass() instanceof NulledRelation))
{
((ProjectionReferenceProperty)_newData.getProjectionReferencePropertySubClass()).zSetNonTxDetachedDeleted();
}
if (_newData.getProjectionProjectionReferenceSubClass() != null && !(_newData.getProjectionProjectionReferenceSubClass() instanceof NulledRelation))
{
((ProjectionProjectionReference)_newData.getProjectionProjectionReferenceSubClass()).zSetNonTxDetachedDeleted();
}
this.zSetNonTxPersistenceState(PersistenceState.DETACHED_DELETED);
}
/**
* Relationship Expression:
this.associationEndClass = AssociationEnd.owningClassName and this.associationEndName = AssociationEnd.name
* @see AssociationEnd#getProjectionsWithAssociationEnd() reverse relationship AssociationEnd.getProjectionsWithAssociationEnd()
* @return The association end
*/
public AssociationEnd getAssociationEnd()
{
AssociationEnd _result = null;
Operation _op = null;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary();
ProjectionWithAssociationEndData _data = (ProjectionWithAssociationEndData) _behavior.getCurrentDataForRead(this);
MithraObjectPortal _portal = null;
if (_behavior.isPersisted())
{
{
_portal = AssociationEndFinder.getMithraObjectPortal();
Object _related = _portal.getAsOneFromCache(this, _data, forassociationEnd, null, null);
if (!(_related instanceof NulledRelation)) _result = (AssociationEnd) _related;
if (_related == null)
{
_op = new RelationshipMultiEqualityOperation(ProjectionWithAssociationEndFinder.associationEnd().zGetRelationshipMultiExtractor(), this);
}
}
}
else if (_behavior.isDetached())
{
{
{
Operation detachedOp = new RelationshipMultiEqualityOperation(ProjectionWithAssociationEndFinder.associationEnd().zGetRelationshipMultiExtractor(), this);
_result = AssociationEndFinder.zFindOneForRelationship(detachedOp);
}
}
}
else if (_behavior.isInMemory())
{
_result = (AssociationEnd) _data.getAssociationEnd();
if (_result == null)
{
{
_op = new RelationshipMultiEqualityOperation(ProjectionWithAssociationEndFinder.associationEnd().zGetRelationshipMultiExtractor(), this);
}
}
}
if (_op != null)
{
_result = AssociationEndFinder.zFindOneForRelationship(_op);
}
return _result;
}
public void setAssociationEnd(AssociationEnd associationEnd)
{
AssociationEnd _associationEnd = (AssociationEnd) associationEnd;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
ProjectionWithAssociationEndData _data = (ProjectionWithAssociationEndData) _behavior.getCurrentDataForWrite(this);
if (_behavior.isInMemory())
{
_data.setAssociationEnd(_associationEnd);
if (_associationEnd == null)
{
this.setAssociationEndClass(null);
this.setAssociationEndName(null);
}
else
{
this.setAssociationEndClass(_associationEnd.getOwningClassName());
this.setAssociationEndName(_associationEnd.getName());
}
}
else if (_behavior.isPersisted())
{
_behavior.clearTempTransaction(this);
if (_associationEnd == null)
{
this.setAssociationEndClass(null);
this.setAssociationEndName(null);
}
else
{
this.setAssociationEndClass(
_associationEnd.getOwningClassName());
this.setAssociationEndName(
_associationEnd.getName());
}
}
else throw new RuntimeException("not implemented");
}
/**
* Relationship Expression:
this.id = ProjectionReferenceProperty.id
* @see ProjectionReferenceProperty#getProjectionWithAssociationEndSuperClass() reverse relationship ProjectionReferenceProperty.getProjectionWithAssociationEndSuperClass()
* @return The projection reference property sub class
*/
public ProjectionReferenceProperty getProjectionReferencePropertySubClass()
{
ProjectionReferenceProperty _result = null;
Operation _op = null;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary();
ProjectionWithAssociationEndData _data = (ProjectionWithAssociationEndData) _behavior.getCurrentDataForRead(this);
MithraObjectPortal _portal = null;
if (_behavior.isPersisted())
{
{
_portal = ProjectionReferencePropertyFinder.getMithraObjectPortal();
Object _related = _portal.getAsOneFromCache(this, _data, forprojectionReferencePropertySubClass, null, null);
if (!(_related instanceof NulledRelation)) _result = (ProjectionReferenceProperty) _related;
if (_related == null)
{
_op = ProjectionReferencePropertyFinder.id().eq(_data.getId());
}
}
}
else if (_behavior.isDetached())
{
if (_data.getProjectionReferencePropertySubClass() instanceof NulledRelation)
{
return null;
}
_result = (ProjectionReferenceProperty) _data.getProjectionReferencePropertySubClass();
if (_result == null)
{
{
Operation detachedOp = ProjectionReferencePropertyFinder.id().eq(_data.getId());
_result = ProjectionReferencePropertyFinder.zFindOneForRelationship(detachedOp);
if(_result != null)
{
_result = _result.getDetachedCopy();
}
}
_behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
_data = (ProjectionWithAssociationEndData) _behavior.getCurrentDataForWrite(this);
_data.setProjectionReferencePropertySubClass(_result);
if (_result != null) _result.zSetParentContainerprojectionWithAssociationEndSuperClass(this);
}
}
else if (_behavior.isInMemory())
{
_result = (ProjectionReferenceProperty) _data.getProjectionReferencePropertySubClass();
}
if (_op != null)
{
_result = ProjectionReferencePropertyFinder.zFindOneForRelationship(_op);
}
return _result;
}
public void setProjectionReferencePropertySubClass(ProjectionReferenceProperty projectionReferencePropertySubClass)
{
ProjectionReferenceProperty _projectionReferencePropertySubClass = (ProjectionReferenceProperty) projectionReferencePropertySubClass;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
ProjectionWithAssociationEndData _data = (ProjectionWithAssociationEndData) _behavior.getCurrentDataForWrite(this);
if (_behavior.isInMemory())
{
Object _prev = _data.getProjectionReferencePropertySubClass();
_data.setProjectionReferencePropertySubClass(_projectionReferencePropertySubClass);
if (_projectionReferencePropertySubClass != null)
{
_projectionReferencePropertySubClass.setId(_data.getId());
_projectionReferencePropertySubClass.zSetParentContainerprojectionWithAssociationEndSuperClass(this);
}
else if (_behavior.isDetached())
{
_data.setProjectionReferencePropertySubClass(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);
ProjectionReferenceProperty _existing = this.getProjectionReferencePropertySubClass();
if (_projectionReferencePropertySubClass != _existing)
{
if (_existing != null)
{
_existing.cascadeDelete();
}
if (_projectionReferencePropertySubClass != null)
{
_projectionReferencePropertySubClass.setId(_data.getId());
_projectionReferencePropertySubClass.cascadeInsert();
}
}
}
else throw new RuntimeException("not implemented");
}
public boolean isProjectionReferencePropertySubClassModifiedSinceDetachment()
{
TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary();
ProjectionWithAssociationEndData _data = (ProjectionWithAssociationEndData) _behavior.getCurrentDataForRead(this);
if (_data.getProjectionReferencePropertySubClass() instanceof NulledRelation)
{
ProjectionReferenceProperty _existing = this.getOriginalPersistentObject().getProjectionReferencePropertySubClass();
return _existing != null;
}
ProjectionReferenceProperty projectionReferencePropertySubClass =
(ProjectionReferenceProperty) _data.getProjectionReferencePropertySubClass();
if( projectionReferencePropertySubClass != null)
{
return projectionReferencePropertySubClass.isModifiedSinceDetachment();
}
return false;
}
/**
* Relationship Expression:
this.id = ProjectionProjectionReference.id
* @see ProjectionProjectionReference#getProjectionWithAssociationEndSuperClass() reverse relationship ProjectionProjectionReference.getProjectionWithAssociationEndSuperClass()
* @return The projection projection reference sub class
*/
public ProjectionProjectionReference getProjectionProjectionReferenceSubClass()
{
ProjectionProjectionReference _result = null;
Operation _op = null;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary();
ProjectionWithAssociationEndData _data = (ProjectionWithAssociationEndData) _behavior.getCurrentDataForRead(this);
MithraObjectPortal _portal = null;
if (_behavior.isPersisted())
{
{
_portal = ProjectionProjectionReferenceFinder.getMithraObjectPortal();
Object _related = _portal.getAsOneFromCache(this, _data, forprojectionProjectionReferenceSubClass, null, null);
if (!(_related instanceof NulledRelation)) _result = (ProjectionProjectionReference) _related;
if (_related == null)
{
_op = ProjectionProjectionReferenceFinder.id().eq(_data.getId());
}
}
}
else if (_behavior.isDetached())
{
if (_data.getProjectionProjectionReferenceSubClass() instanceof NulledRelation)
{
return null;
}
_result = (ProjectionProjectionReference) _data.getProjectionProjectionReferenceSubClass();
if (_result == null)
{
{
Operation detachedOp = ProjectionProjectionReferenceFinder.id().eq(_data.getId());
_result = ProjectionProjectionReferenceFinder.zFindOneForRelationship(detachedOp);
if(_result != null)
{
_result = _result.getDetachedCopy();
}
}
_behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
_data = (ProjectionWithAssociationEndData) _behavior.getCurrentDataForWrite(this);
_data.setProjectionProjectionReferenceSubClass(_result);
if (_result != null) _result.zSetParentContainerprojectionWithAssociationEndSuperClass(this);
}
}
else if (_behavior.isInMemory())
{
_result = (ProjectionProjectionReference) _data.getProjectionProjectionReferenceSubClass();
}
if (_op != null)
{
_result = ProjectionProjectionReferenceFinder.zFindOneForRelationship(_op);
}
return _result;
}
public void setProjectionProjectionReferenceSubClass(ProjectionProjectionReference projectionProjectionReferenceSubClass)
{
ProjectionProjectionReference _projectionProjectionReferenceSubClass = (ProjectionProjectionReference) projectionProjectionReferenceSubClass;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
ProjectionWithAssociationEndData _data = (ProjectionWithAssociationEndData) _behavior.getCurrentDataForWrite(this);
if (_behavior.isInMemory())
{
Object _prev = _data.getProjectionProjectionReferenceSubClass();
_data.setProjectionProjectionReferenceSubClass(_projectionProjectionReferenceSubClass);
if (_projectionProjectionReferenceSubClass != null)
{
_projectionProjectionReferenceSubClass.setId(_data.getId());
_projectionProjectionReferenceSubClass.zSetParentContainerprojectionWithAssociationEndSuperClass(this);
}
else if (_behavior.isDetached())
{
_data.setProjectionProjectionReferenceSubClass(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);
ProjectionProjectionReference _existing = this.getProjectionProjectionReferenceSubClass();
if (_projectionProjectionReferenceSubClass != _existing)
{
if (_existing != null)
{
_existing.cascadeDelete();
}
if (_projectionProjectionReferenceSubClass != null)
{
_projectionProjectionReferenceSubClass.setId(_data.getId());
_projectionProjectionReferenceSubClass.cascadeInsert();
}
}
}
else throw new RuntimeException("not implemented");
}
public boolean isProjectionProjectionReferenceSubClassModifiedSinceDetachment()
{
TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary();
ProjectionWithAssociationEndData _data = (ProjectionWithAssociationEndData) _behavior.getCurrentDataForRead(this);
if (_data.getProjectionProjectionReferenceSubClass() instanceof NulledRelation)
{
ProjectionProjectionReference _existing = this.getOriginalPersistentObject().getProjectionProjectionReferenceSubClass();
return _existing != null;
}
ProjectionProjectionReference projectionProjectionReferenceSubClass =
(ProjectionProjectionReference) _data.getProjectionProjectionReferenceSubClass();
if( projectionProjectionReferenceSubClass != null)
{
return projectionProjectionReferenceSubClass.isModifiedSinceDetachment();
}
return false;
}
/**
* Relationship Expression:
ProjectionElement.id = this.id
* @see ProjectionElement#getProjectionWithAssociationEndSubClass() reverse relationship ProjectionElement.getProjectionWithAssociationEndSubClass()
* @return The projection element super class
*/
public ProjectionElement getProjectionElementSuperClass()
{
ProjectionElement _result = null;
Operation _op = null;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary();
ProjectionWithAssociationEndData _data = (ProjectionWithAssociationEndData) _behavior.getCurrentDataForRead(this);
MithraObjectPortal _portal = null;
if (_behavior.isPersisted())
{
{
_portal = ProjectionElementFinder.getMithraObjectPortal();
Object _related = _portal.getAsOneFromCache(this, _data, forprojectionElementSuperClass, null, null);
if (!(_related instanceof NulledRelation)) _result = (ProjectionElement) _related;
if (_related == null)
{
_op = ProjectionElementFinder.id().eq(_data.getId());
}
}
}
else if (_behavior.isDetached())
{
if (_data.getProjectionElementSuperClass() instanceof NulledRelation)
{
return null;
}
_result = (ProjectionElement) _data.getProjectionElementSuperClass();
if (_result == null)
{
{
Operation detachedOp = ProjectionElementFinder.id().eq(_data.getId());
_result = ProjectionElementFinder.zFindOneForRelationship(detachedOp);
if(_result != null)
{
_result = _result.getDetachedCopy();
}
}
_data = (ProjectionWithAssociationEndData) _behavior.getCurrentDataForWrite(this);
_data.setProjectionElementSuperClass(_result);
}
}
else if (_behavior.isInMemory())
{
_result = (ProjectionElement) _data.getProjectionElementSuperClass();
if (_result == null)
{
{
_op = ProjectionElementFinder.id().eq(_data.getId());
}
}
}
if (_op != null)
{
_result = ProjectionElementFinder.zFindOneForRelationship(_op);
}
return _result;
}
public void setProjectionElementSuperClass(ProjectionElement projectionElementSuperClass)
{
((ProjectionElement)projectionElementSuperClass).setProjectionWithAssociationEndSubClass((ProjectionWithAssociationEnd)this);
}
public void zSetParentContainerprojectionElementSuperClass(ProjectionElementAbstract parent)
{
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
ProjectionWithAssociationEndData _data = (ProjectionWithAssociationEndData) _behavior.getCurrentDataForWrite(this);
_behavior.clearTempTransaction(this);
if (_behavior.isInMemory())
{
_data.setProjectionElementSuperClass(parent);
}
}
protected void cascadeInsertImpl() throws MithraBusinessException
{
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
ProjectionWithAssociationEndData _data = (ProjectionWithAssociationEndData) _behavior.getCurrentDataForWrite(this);
ProjectionReferenceProperty projectionReferencePropertySubClass =
(ProjectionReferenceProperty) _data.getProjectionReferencePropertySubClass();
ProjectionProjectionReference projectionProjectionReferenceSubClass =
(ProjectionProjectionReference) _data.getProjectionProjectionReferenceSubClass();
_behavior.insert(this);
if (projectionReferencePropertySubClass != null)
{
projectionReferencePropertySubClass.cascadeInsert();
}
if (projectionProjectionReferenceSubClass != null)
{
projectionProjectionReferenceSubClass.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)
{
ProjectionWithAssociationEndFinder.ProjectionWithAssociationEndRelatedFinder parentFinder = (ProjectionWithAssociationEndFinder.ProjectionWithAssociationEndRelatedFinder) parentFinderGeneric;
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
ProjectionWithAssociationEndData _newData = (ProjectionWithAssociationEndData) _behavior.getCurrentDataForWrite(this);
if (_newData.getProjectionReferencePropertySubClass() instanceof NulledRelation)
{
RelatedFinder dependentFinder = parentFinder.projectionReferencePropertySubClass();
DeepRelationshipUtility.zAddToNavigationStats(dependentFinder, true, navigationStats);
DeepRelationshipUtility.zAddAllDependentNavigationsStatsForDelete(dependentFinder, navigationStats);
}
else
{
ProjectionReferenceProperty projectionReferencePropertySubClass =
(ProjectionReferenceProperty) _newData.getProjectionReferencePropertySubClass();
RelatedFinder dependentFinder = parentFinder.projectionReferencePropertySubClass();
DeepRelationshipUtility.zAddToNavigationStats(dependentFinder, projectionReferencePropertySubClass != null, navigationStats);
if (projectionReferencePropertySubClass != null)
{
_behavior.addNavigatedRelationshipsStats(projectionReferencePropertySubClass, dependentFinder, navigationStats);
}
}
if (_newData.getProjectionProjectionReferenceSubClass() instanceof NulledRelation)
{
RelatedFinder dependentFinder = parentFinder.projectionProjectionReferenceSubClass();
DeepRelationshipUtility.zAddToNavigationStats(dependentFinder, true, navigationStats);
DeepRelationshipUtility.zAddAllDependentNavigationsStatsForDelete(dependentFinder, navigationStats);
}
else
{
ProjectionProjectionReference projectionProjectionReferenceSubClass =
(ProjectionProjectionReference) _newData.getProjectionProjectionReferenceSubClass();
RelatedFinder dependentFinder = parentFinder.projectionProjectionReferenceSubClass();
DeepRelationshipUtility.zAddToNavigationStats(dependentFinder, projectionProjectionReferenceSubClass != null, navigationStats);
if (projectionProjectionReferenceSubClass != null)
{
_behavior.addNavigatedRelationshipsStats(projectionProjectionReferenceSubClass, dependentFinder, navigationStats);
}
}
return navigationStats;
}
@Override
public Map< RelatedFinder, StatisticCounter > zAddNavigatedRelationshipsStatsForDelete(RelatedFinder parentFinder, Map< RelatedFinder, StatisticCounter > navigationStats)
{
DeepRelationshipUtility.zAddAllDependentNavigationsStatsForDelete(parentFinder, navigationStats);
return navigationStats;
}
@Override
public ProjectionWithAssociationEnd zCascadeCopyThenInsert() throws MithraBusinessException
{
TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
ProjectionWithAssociationEndData _data = (ProjectionWithAssociationEndData) _behavior.getCurrentDataForWrite(this);
ProjectionReferenceProperty projectionReferencePropertySubClass =
(ProjectionReferenceProperty) _data.getProjectionReferencePropertySubClass();
ProjectionProjectionReference projectionProjectionReferenceSubClass =
(ProjectionProjectionReference) _data.getProjectionProjectionReferenceSubClass();
ProjectionWithAssociationEnd original = (ProjectionWithAssociationEnd) _behavior.copyThenInsert(this);
if (projectionReferencePropertySubClass != null)
{
projectionReferencePropertySubClass.zCascadeCopyThenInsert();
}
if (projectionProjectionReferenceSubClass != null)
{
projectionProjectionReferenceSubClass.zCascadeCopyThenInsert();
}
return original;
}
protected void cascadeDeleteImpl() throws MithraBusinessException
{
{
ProjectionReferenceProperty related = this.getProjectionReferencePropertySubClass();
if (related != null)
related.cascadeDelete();
}
{
ProjectionProjectionReference related = this.getProjectionProjectionReferenceSubClass();
if (related != null)
related.cascadeDelete();
}
this.delete();
}
public Cache zGetCache()
{
return ProjectionWithAssociationEndFinder.getMithraObjectPortal().getCache();
}
public MithraObjectPortal zGetPortal()
{
return ProjectionWithAssociationEndFinder.getMithraObjectPortal();
}
public ProjectionWithAssociationEnd getOriginalPersistentObject()
{
return this.zFindOriginal();
}
protected boolean issueUpdatesForNonPrimaryKeys(TransactionalBehavior behavior, MithraDataObject data, MithraDataObject newData)
{
boolean changed = false;
changed |= zUpdateString(behavior, data, newData, ProjectionWithAssociationEndFinder.associationEndClass(), false);
changed |= zUpdateString(behavior, data, newData, ProjectionWithAssociationEndFinder.associationEndName(), false);
return changed;
}
protected boolean issueUpdatesForPrimaryKeys(TransactionalBehavior behavior, MithraDataObject data, MithraDataObject newData)
{
boolean changed = false;
changed |= zUpdateLong(behavior, data, newData, ProjectionWithAssociationEndFinder.id(), false);
return changed;
}
public Object readResolve() throws ObjectStreamException
{
ProjectionWithAssociationEndAbstract result = (ProjectionWithAssociationEndAbstract) 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 ProjectionReferencePropertySubClassAddHandlerInMemory implements DependentRelationshipAddHandler
{
public void addRelatedObject(MithraTransactionalObject relatedObject)
{
ProjectionReferenceProperty item = (ProjectionReferenceProperty) relatedObject;
item.setId(getId());
item.zSetParentContainerprojectionWithAssociationEndSuperClass(ProjectionWithAssociationEndAbstract.this);
}
}
protected class ProjectionReferencePropertySubClassAddHandlerPersisted implements DependentRelationshipAddHandler
{
public void addRelatedObject(MithraTransactionalObject relatedObject)
{
ProjectionReferenceProperty item = (ProjectionReferenceProperty) relatedObject;
item.setId(getId());
item.cascadeInsert();
}
}
protected class ProjectionProjectionReferenceSubClassAddHandlerInMemory implements DependentRelationshipAddHandler
{
public void addRelatedObject(MithraTransactionalObject relatedObject)
{
ProjectionProjectionReference item = (ProjectionProjectionReference) relatedObject;
item.setId(getId());
item.zSetParentContainerprojectionWithAssociationEndSuperClass(ProjectionWithAssociationEndAbstract.this);
}
}
protected class ProjectionProjectionReferenceSubClassAddHandlerPersisted implements DependentRelationshipAddHandler
{
public void addRelatedObject(MithraTransactionalObject relatedObject)
{
ProjectionProjectionReference item = (ProjectionProjectionReference) relatedObject;
item.setId(getId());
item.cascadeInsert();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy