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

klass.model.meta.domain.NamedProjectionAbstract 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 NamedProjectionAbstract 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(NamedProjection.class.getName());
	private static final RelationshipHashStrategy forrootProjection = new RootProjectionRhs();
	private static final RelationshipHashStrategy forpackageableElementSuperClass = new PackageableElementSuperClassRhs();
	private static final class RootProjectionRhs implements RelationshipHashStrategy
	{
		public boolean equalsForRelationship(Object _srcObject, Object _srcData, Object _targetData, Timestamp _asOfDate0, Timestamp _asOfDate1)
		{
			NamedProjectionData _castedSrcData = (NamedProjectionData) _srcData;
			RootProjectionData _castedTargetData = (RootProjectionData) _targetData;
			if (_castedSrcData.getProjectionId() == _castedTargetData.getId())
			{
				return true;
			}

			return false;
		}

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

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

	private static final class PackageableElementSuperClassRhs implements RelationshipHashStrategy
	{
		public boolean equalsForRelationship(Object _srcObject, Object _srcData, Object _targetData, Timestamp _asOfDate0, Timestamp _asOfDate1)
		{
			NamedProjectionData _castedSrcData = (NamedProjectionData) _srcData;
			PackageableElementData _castedTargetData = (PackageableElementData) _targetData;
			if (_castedSrcData.getName()!= null && _castedSrcData.getName().equals(_castedTargetData.getName()))
			{
				return true;
			}

			return false;
		}

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

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

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

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

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

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

	public NamedProjection zFindOriginal()
	{
		NamedProjectionData data = (NamedProjectionData) this.currentData;
		Operation op;
		op = NamedProjectionFinder.name().eq(data.getName());
		return NamedProjectionFinder.findOne(op);
	}

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

	private Logger getLogger()
	{
		return logger;
	}

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

	protected void zSetFromNamedProjectionData( NamedProjectionData data )
	{
		super.zSetData(data);
		this.persistenceState = PERSISTED_STATE;
	}

	public void setFromNamedProjectionData( NamedProjectionData data )
	{
		super.zSetData(data);
	}

	public void zWriteDataClassName(ObjectOutput out) throws IOException
	{
	}

	public final boolean isNameNull()
	{
		return ((NamedProjectionData) this.zSynchronizedGetData()).isNameNull();
	}

	public final String getName()
	{
		NamedProjectionData data = (NamedProjectionData) this.zSynchronizedGetData();
		return data.getName();
	}

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

	public boolean isProjectionIdNull()
	{
		return ((NamedProjectionData) this.zSynchronizedGetData()).isProjectionIdNull();
	}

	public long getProjectionId()
	{
		NamedProjectionData data = (NamedProjectionData) this.zSynchronizedGetData();
		return data.getProjectionId();
	}

	public void setProjectionId(long newValue)
	{
		zSetLong(NamedProjectionFinder.projectionId(), newValue, false, false ,false);
	}

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

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

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

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

	/**
	* Relationship Expression:
	this.projectionId = RootProjection.id
* @see RootProjection#getNamedProjection() reverse relationship RootProjection.getNamedProjection() * @return The root projection */ public RootProjection getRootProjection() { RootProjection _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); NamedProjectionData _data = (NamedProjectionData) _behavior.getCurrentDataForRead(this); MithraObjectPortal _portal = null; if (_behavior.isPersisted()) { { _portal = RootProjectionFinder.getMithraObjectPortal(); Object _related = _portal.getAsOneFromCache(this, _data, forrootProjection, null, null); if (!(_related instanceof NulledRelation)) _result = (RootProjection) _related; if (_related == null) { _op = RootProjectionFinder.id().eq(_data.getProjectionId()); } } } else if (_behavior.isDetached()) { { { Operation detachedOp = RootProjectionFinder.id().eq(_data.getProjectionId()); _result = RootProjectionFinder.zFindOneForRelationship(detachedOp); } } } else if (_behavior.isInMemory()) { _result = (RootProjection) _data.getRootProjection(); if (_result == null) { { _op = RootProjectionFinder.id().eq(_data.getProjectionId()); } } } if (_op != null) { _result = RootProjectionFinder.zFindOneForRelationship(_op); } return _result; } public void setRootProjection(RootProjection rootProjection) { RootProjection _rootProjection = (RootProjection) rootProjection; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); NamedProjectionData _data = (NamedProjectionData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { _data.setRootProjection(_rootProjection); if (_rootProjection == null) { this.setProjectionId(0); } else { this.setProjectionId(_rootProjection.getId()); } } else if (_behavior.isPersisted()) { _behavior.clearTempTransaction(this); if (_rootProjection == null) { this.setProjectionId(0); } else { this.setProjectionId( _rootProjection.getId()); } } else throw new RuntimeException("not implemented"); } /** * Relationship Expression:
	PackageableElement.name = this.name
* @see PackageableElement#getNamedProjectionSubClass() reverse relationship PackageableElement.getNamedProjectionSubClass() * @return The packageable element super class */ public PackageableElement getPackageableElementSuperClass() { PackageableElement _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); NamedProjectionData _data = (NamedProjectionData) _behavior.getCurrentDataForRead(this); MithraObjectPortal _portal = null; if (_behavior.isPersisted()) { { _portal = PackageableElementFinder.getMithraObjectPortal(); Object _related = _portal.getAsOneFromCache(this, _data, forpackageableElementSuperClass, null, null); if (!(_related instanceof NulledRelation)) _result = (PackageableElement) _related; if (_related == null) { _op = PackageableElementFinder.name().eq(_data.getName()); } } } else if (_behavior.isDetached()) { if (_data.getPackageableElementSuperClass() instanceof NulledRelation) { return null; } _result = (PackageableElement) _data.getPackageableElementSuperClass(); if (_result == null) { { Operation detachedOp = PackageableElementFinder.name().eq(_data.getName()); _result = PackageableElementFinder.zFindOneForRelationship(detachedOp); if(_result != null) { _result = _result.getDetachedCopy(); } } _data = (NamedProjectionData) _behavior.getCurrentDataForWrite(this); _data.setPackageableElementSuperClass(_result); } } else if (_behavior.isInMemory()) { _result = (PackageableElement) _data.getPackageableElementSuperClass(); if (_result == null) { { _op = PackageableElementFinder.name().eq(_data.getName()); } } } if (_op != null) { _result = PackageableElementFinder.zFindOneForRelationship(_op); } return _result; } public void setPackageableElementSuperClass(PackageableElement packageableElementSuperClass) { ((PackageableElement)packageableElementSuperClass).setNamedProjectionSubClass((NamedProjection)this); } public void zSetParentContainerpackageableElementSuperClass(PackageableElementAbstract parent) { TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); NamedProjectionData _data = (NamedProjectionData) _behavior.getCurrentDataForWrite(this); _behavior.clearTempTransaction(this); if (_behavior.isInMemory()) { _data.setPackageableElementSuperClass(parent); } } /** * Relationship Expression:
	ProjectionProjectionReference.projectionName = this.name
* @see ProjectionProjectionReference#getProjection() reverse relationship ProjectionProjectionReference.getProjection() * @return projection projection references */ public ProjectionProjectionReferenceList getProjectionProjectionReferences() { ProjectionProjectionReferenceList _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); NamedProjectionData _data = (NamedProjectionData) _behavior.getCurrentDataForRead(this); if (_behavior.isPersisted()) { { { _op = ProjectionProjectionReferenceFinder.projectionName().eq(_data.getName()); } } } else if (_behavior.isDetached()) { { { Operation detachedOp = ProjectionProjectionReferenceFinder.projectionName().eq(_data.getName()); _result = new ProjectionProjectionReferenceList(detachedOp); _result.zSetForRelationship(); } } } else if (_behavior.isInMemory()) { _result = (ProjectionProjectionReferenceList) _data.getProjectionProjectionReferences(); if (_result == null) { { _op = ProjectionProjectionReferenceFinder.projectionName().eq(_data.getName()); } } } if (_op != null) { _result = new ProjectionProjectionReferenceList(_op); _result.zSetForRelationship(); } return _result; } public void setProjectionProjectionReferences(ProjectionProjectionReferenceList projectionProjectionReferences) { ProjectionProjectionReferenceList _projectionProjectionReferences = (ProjectionProjectionReferenceList) projectionProjectionReferences; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); NamedProjectionData _data = (NamedProjectionData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { _data.setProjectionProjectionReferences(_projectionProjectionReferences); } else if (_behavior.isPersisted()) { _behavior.clearTempTransaction(this); } else throw new RuntimeException("not implemented"); } /** * Relationship Expression:
	Service.projectionName = this.name
* @see Service#getProjection() reverse relationship Service.getProjection() * @return services */ public ServiceList getServices() { ServiceList _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); NamedProjectionData _data = (NamedProjectionData) _behavior.getCurrentDataForRead(this); if (_behavior.isPersisted()) { { { _op = ServiceFinder.projectionName().eq(_data.getName()); } } } else if (_behavior.isDetached()) { { { Operation detachedOp = ServiceFinder.projectionName().eq(_data.getName()); _result = new ServiceList(detachedOp); _result.zSetForRelationship(); } } } else if (_behavior.isInMemory()) { _result = (ServiceList) _data.getServices(); if (_result == null) { { _op = ServiceFinder.projectionName().eq(_data.getName()); } } } if (_op != null) { _result = new ServiceList(_op); _result.zSetForRelationship(); } return _result; } public void setServices(ServiceList services) { ServiceList _services = (ServiceList) services; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); NamedProjectionData _data = (NamedProjectionData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { _data.setServices(_services); } else if (_behavior.isPersisted()) { _behavior.clearTempTransaction(this); } else throw new RuntimeException("not implemented"); } 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 NamedProjection zCascadeCopyThenInsert() throws MithraBusinessException { TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); NamedProjection original = (NamedProjection) _behavior.copyThenInsert(this); return original; } protected void cascadeDeleteImpl() throws MithraBusinessException { this.delete(); } public Cache zGetCache() { return NamedProjectionFinder.getMithraObjectPortal().getCache(); } public MithraObjectPortal zGetPortal() { return NamedProjectionFinder.getMithraObjectPortal(); } public NamedProjection getOriginalPersistentObject() { return this.zFindOriginal(); } protected boolean issueUpdatesForNonPrimaryKeys(TransactionalBehavior behavior, MithraDataObject data, MithraDataObject newData) { boolean changed = false; changed |= zUpdateLong(behavior, data, newData, NamedProjectionFinder.projectionId(), false); return changed; } protected boolean issueUpdatesForPrimaryKeys(TransactionalBehavior behavior, MithraDataObject data, MithraDataObject newData) { boolean changed = false; changed |= zUpdateString(behavior, data, newData, NamedProjectionFinder.name(), false); return changed; } public Object readResolve() throws ObjectStreamException { NamedProjectionAbstract result = (NamedProjectionAbstract) 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