All Downloads are FREE. Search and download functionalities are using the official Maven repository.

klass.model.meta.domain.RootProjectionAbstract 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 RootProjectionAbstract 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(RootProjection.class.getName());
	private static final RelationshipHashStrategy forclassifier = new ClassifierRhs();
	private static final RelationshipHashStrategy forprojectionElementSuperClass = new ProjectionElementSuperClassRhs();
	private static final class ClassifierRhs implements RelationshipHashStrategy
	{
		public boolean equalsForRelationship(Object _srcObject, Object _srcData, Object _targetData, Timestamp _asOfDate0, Timestamp _asOfDate1)
		{
			RootProjectionData _castedSrcData = (RootProjectionData) _srcData;
			ClassifierData _castedTargetData = (ClassifierData) _targetData;
			if (_castedSrcData.getClassifierName()!= null && _castedSrcData.getClassifierName().equals(_castedTargetData.getName()))
			{
				return true;
			}

			return false;
		}

		public int computeHashCodeFromRelated(Object _srcObject, Object _srcData)
		{
			RootProjectionData _castedSrcData = (RootProjectionData) _srcData;
			return HashUtil.hash(_castedSrcData.getClassifierName());
		}

		public int computeOffHeapHashCodeFromRelated(Object _srcObject, Object _srcData)
		{
			RootProjectionData _castedSrcData = (RootProjectionData) _srcData;
			return HashUtil.offHeapHash(_castedSrcData.getClassifierName());
		}
	}

	private static final class ProjectionElementSuperClassRhs implements RelationshipHashStrategy
	{
		public boolean equalsForRelationship(Object _srcObject, Object _srcData, Object _targetData, Timestamp _asOfDate0, Timestamp _asOfDate1)
		{
			RootProjectionData _castedSrcData = (RootProjectionData) _srcData;
			ProjectionElementData _castedTargetData = (ProjectionElementData) _targetData;
			if (_castedSrcData.getId() == _castedTargetData.getId())
			{
				return true;
			}

			return false;
		}

		public int computeHashCodeFromRelated(Object _srcObject, Object _srcData)
		{
			RootProjectionData _castedSrcData = (RootProjectionData) _srcData;
			return HashUtil.hash(_castedSrcData.getId());
		}

		public int computeOffHeapHashCodeFromRelated(Object _srcObject, Object _srcData)
		{
			return computeHashCodeFromRelated(_srcObject, _srcData);
		}
	}

	public RootProjectionAbstract()
	{
		this.persistenceState = MEMORY_STATE;
	}

	public RootProjection getDetachedCopy() throws MithraBusinessException
	{
		return (RootProjection) super.getDetachedCopy();
	}

	public RootProjection getNonPersistentCopy() throws MithraBusinessException
	{
		RootProjection result = (RootProjection) super.getNonPersistentCopy();
		result.persistenceState = MEMORY_STATE;
		return result;
	}

	public RootProjection copyDetachedValuesToOriginalOrInsertIfNew()
	{
		return (RootProjection) this.zCopyDetachedValuesToOriginalOrInsertIfNew();
	}

	public RootProjection zFindOriginal()
	{
		RootProjectionData data = (RootProjectionData) this.currentData;
		Operation op;
		op = RootProjectionFinder.id().eq(data.getId());
		return RootProjectionFinder.findOne(op);
	}

	public boolean isModifiedSinceDetachmentByDependentRelationships()
	{
		if(this.isModifiedSinceDetachment()) return true;
		return false;
	}

	private Logger getLogger()
	{
		return logger;
	}

	public MithraDataObject zAllocateData()
	{
		return new RootProjectionData();
	}

	protected void zSetFromRootProjectionData( RootProjectionData data )
	{
		super.zSetData(data);
		this.persistenceState = PERSISTED_STATE;
	}

	public void setFromRootProjectionData( RootProjectionData data )
	{
		super.zSetData(data);
	}

	public void zWriteDataClassName(ObjectOutput out) throws IOException
	{
	}

	public boolean isClassifierNameNull()
	{
		return ((RootProjectionData) this.zSynchronizedGetData()).isClassifierNameNull();
	}

	public String getClassifierName()
	{
		RootProjectionData data = (RootProjectionData) this.zSynchronizedGetData();
		return data.getClassifierName();
	}

	public void setClassifierName(String newValue)
	{
		if (newValue != null && newValue.length() > 256)
		throw new MithraBusinessException("Attribute 'classifierName' cannot exceed maximum length of 256: " + newValue);
		zSetString(RootProjectionFinder.classifierName(), newValue, false, false );
	}

	public final boolean isIdNull()
	{
		return ((RootProjectionData) this.zSynchronizedGetData()).isIdNull();
	}

	public final long getId()
	{
		RootProjectionData data = (RootProjectionData) this.zSynchronizedGetData();
		return data.getId();
	}

	public void setId(long newValue)
	{
		zSetLong(RootProjectionFinder.id(), newValue, true, false ,false);
	}

	protected void issuePrimitiveNullSetters(TransactionalBehavior behavior, MithraDataObject data)
	{
	}

	public void zPersistDetachedRelationships(MithraDataObject _data)
	{
		RootProjectionData _newData = (RootProjectionData) _data;
	}

	public void zSetTxDetachedDeleted()
	{
		TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
		if (_behavior.isDetached() && _behavior.isDeleted()) return;
		RootProjectionData _newData = (RootProjectionData) _behavior.getCurrentDataForRead(this);
		this.zSetTxPersistenceState(PersistenceState.DETACHED_DELETED);
	}

	public void zSetNonTxDetachedDeleted()
	{
		TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
		RootProjectionData _newData = (RootProjectionData) _behavior.getCurrentDataForRead(this);
		this.zSetNonTxPersistenceState(PersistenceState.DETACHED_DELETED);
	}

	/**
	* Relationship Expression:
	this.classifierName = Classifier.name
* @see Classifier#getProjections() reverse relationship Classifier.getProjections() * @return The classifier */ public Classifier getClassifier() { Classifier _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); RootProjectionData _data = (RootProjectionData) _behavior.getCurrentDataForRead(this); MithraObjectPortal _portal = null; if (_behavior.isPersisted()) { { _portal = ClassifierFinder.getMithraObjectPortal(); Object _related = _portal.getAsOneFromCache(this, _data, forclassifier, null, null); if (!(_related instanceof NulledRelation)) _result = (Classifier) _related; if (_related == null) { _op = ClassifierFinder.name().eq(_data.getClassifierName()); } } } else if (_behavior.isDetached()) { { { Operation detachedOp = ClassifierFinder.name().eq(_data.getClassifierName()); _result = ClassifierFinder.zFindOneForRelationship(detachedOp); } } } else if (_behavior.isInMemory()) { _result = (Classifier) _data.getClassifier(); if (_result == null) { { _op = ClassifierFinder.name().eq(_data.getClassifierName()); } } } if (_op != null) { _result = ClassifierFinder.zFindOneForRelationship(_op); } return _result; } public void setClassifier(Classifier classifier) { Classifier _classifier = (Classifier) classifier; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); RootProjectionData _data = (RootProjectionData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { _data.setClassifier(_classifier); if (_classifier == null) { this.setClassifierName(null); } else { this.setClassifierName(_classifier.getName()); } } else if (_behavior.isPersisted()) { _behavior.clearTempTransaction(this); if (_classifier == null) { this.setClassifierName(null); } else { this.setClassifierName( _classifier.getName()); } } else throw new RuntimeException("not implemented"); } /** * Relationship Expression:
	NamedProjection.projectionId = this.id
* @see NamedProjection#getRootProjection() reverse relationship NamedProjection.getRootProjection() * @return The named projection */ public NamedProjection getNamedProjection() { NamedProjection _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); RootProjectionData _data = (RootProjectionData) _behavior.getCurrentDataForRead(this); if (_behavior.isPersisted()) { { { _op = NamedProjectionFinder.projectionId().eq(_data.getId()); } } } else if (_behavior.isDetached()) { { { Operation detachedOp = NamedProjectionFinder.projectionId().eq(_data.getId()); _result = NamedProjectionFinder.zFindOneForRelationship(detachedOp); } } } else if (_behavior.isInMemory()) { _result = (NamedProjection) _data.getNamedProjection(); if (_result == null) { { _op = NamedProjectionFinder.projectionId().eq(_data.getId()); } } } if (_op != null) { _result = NamedProjectionFinder.zFindOneForRelationship(_op); } return _result; } public void setNamedProjection(NamedProjection namedProjection) { NamedProjection _namedProjection = (NamedProjection) namedProjection; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); RootProjectionData _data = (RootProjectionData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { _data.setNamedProjection(_namedProjection); if (_namedProjection == null) { this.setId(0); } else { this.setId(_namedProjection.getProjectionId()); } } else if (_behavior.isPersisted()) { _behavior.clearTempTransaction(this); if (_namedProjection == null) { this.setId(0); } else { this.setId( _namedProjection.getProjectionId()); } } else throw new RuntimeException("not implemented"); } /** * Relationship Expression:
	ProjectionElement.id = this.id
* @see ProjectionElement#getRootProjectionSubClass() reverse relationship ProjectionElement.getRootProjectionSubClass() * @return The projection element super class */ public ProjectionElement getProjectionElementSuperClass() { ProjectionElement _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); RootProjectionData _data = (RootProjectionData) _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 = (RootProjectionData) _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).setRootProjectionSubClass((RootProjection)this); } public void zSetParentContainerprojectionElementSuperClass(ProjectionElementAbstract parent) { TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); RootProjectionData _data = (RootProjectionData) _behavior.getCurrentDataForWrite(this); _behavior.clearTempTransaction(this); if (_behavior.isInMemory()) { _data.setProjectionElementSuperClass(parent); } } protected void cascadeInsertImpl() throws MithraBusinessException { TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); _behavior.insert(this); } @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) { return navigationStats; } @Override public Map< RelatedFinder, StatisticCounter > zAddNavigatedRelationshipsStatsForDelete(RelatedFinder parentFinder, Map< RelatedFinder, StatisticCounter > navigationStats) { return navigationStats; } @Override public RootProjection zCascadeCopyThenInsert() throws MithraBusinessException { TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); RootProjection original = (RootProjection) _behavior.copyThenInsert(this); return original; } protected void cascadeDeleteImpl() throws MithraBusinessException { this.delete(); } public Cache zGetCache() { return RootProjectionFinder.getMithraObjectPortal().getCache(); } public MithraObjectPortal zGetPortal() { return RootProjectionFinder.getMithraObjectPortal(); } public RootProjection getOriginalPersistentObject() { return this.zFindOriginal(); } protected boolean issueUpdatesForNonPrimaryKeys(TransactionalBehavior behavior, MithraDataObject data, MithraDataObject newData) { boolean changed = false; changed |= zUpdateString(behavior, data, newData, RootProjectionFinder.classifierName(), false); return changed; } protected boolean issueUpdatesForPrimaryKeys(TransactionalBehavior behavior, MithraDataObject data, MithraDataObject newData) { boolean changed = false; changed |= zUpdateLong(behavior, data, newData, RootProjectionFinder.id(), false); return changed; } public Object readResolve() throws ObjectStreamException { RootProjectionAbstract result = (RootProjectionAbstract) 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; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy