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

klass.model.meta.domain.ParameterAbstract 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 ParameterAbstract extends com.gs.fw.common.mithra.superclassimpl.MithraTransactionalObjectImpl
implements
NamedElement
{
	private static byte MEMORY_STATE = PersistenceState.IN_MEMORY;
	private static byte PERSISTED_STATE = PersistenceState.PERSISTED;
	private static final Logger logger = LoggerFactory.getLogger(Parameter.class.getName());
	private static final RelationshipHashStrategy forenumerationParameterSubClass = new EnumerationParameterSubClassRhs();
	private static final RelationshipHashStrategy forprimitiveParameterSubClass = new PrimitiveParameterSubClassRhs();
	private static final class EnumerationParameterSubClassRhs implements RelationshipHashStrategy
	{
		public boolean equalsForRelationship(Object _srcObject, Object _srcData, Object _targetData, Timestamp _asOfDate0, Timestamp _asOfDate1)
		{
			ParameterData _castedSrcData = (ParameterData) _srcData;
			EnumerationParameterData _castedTargetData = (EnumerationParameterData) _targetData;
			if (_castedSrcData.getId() == _castedTargetData.getId())
			{
				return true;
			}

			return false;
		}

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

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

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

			return false;
		}

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

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

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

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

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

	public void insert() throws MithraBusinessException
	{
		TransactionalBehavior behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
		this.checkAndGeneratePrimaryKeys();
		behavior.insert(this);
	}

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

	public Parameter zFindOriginal()
	{
		ParameterData data = (ParameterData) this.currentData;
		Operation op;
		op = ParameterFinder.id().eq(data.getId());
		return ParameterFinder.findOne(op);
	}

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

	private Logger getLogger()
	{
		return logger;
	}

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

	protected void zSetFromParameterData( ParameterData data )
	{
		super.zSetData(data);
		this.persistenceState = PERSISTED_STATE;
	}

	public void setFromParameterData( ParameterData data )
	{
		super.zSetData(data);
	}

	public void zWriteDataClassName(ObjectOutput out) throws IOException
	{
	}

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

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

	public void setId(long newValue)
	{
		MithraDataObject d = zSetLong(ParameterFinder.id(), newValue, true, false ,false);
		if (d == null) return;
		ParameterData data = (ParameterData) d;
		TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
		if (!_behavior.isPersisted())
		{
			EnumerationParameter enumerationParameterSubClass =
			(EnumerationParameter ) data.getEnumerationParameterSubClass();
			if (enumerationParameterSubClass != null)
			{
				enumerationParameterSubClass.setId(newValue);
			}

			PrimitiveParameter primitiveParameterSubClass =
			(PrimitiveParameter ) data.getPrimitiveParameterSubClass();
			if (primitiveParameterSubClass != null)
			{
				primitiveParameterSubClass.setId(newValue);
			}
		}
	}

	public boolean isMultiplicityNull()
	{
		return ((ParameterData) this.zSynchronizedGetData()).isMultiplicityNull();
	}

	public String getMultiplicity()
	{
		ParameterData data = (ParameterData) this.zSynchronizedGetData();
		return data.getMultiplicity();
	}

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

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

	public String getName()
	{
		ParameterData data = (ParameterData) 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(ParameterFinder.name(), newValue, false, false );
	}

	public boolean isOrdinalNull()
	{
		return ((ParameterData) this.zSynchronizedGetData()).isOrdinalNull();
	}

	public int getOrdinal()
	{
		ParameterData data = (ParameterData) this.zSynchronizedGetData();
		return data.getOrdinal();
	}

	public void setOrdinal(int newValue)
	{
		zSetInteger(ParameterFinder.ordinal(), newValue, false, false ,false);
	}

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

	public void zPersistDetachedRelationships(MithraDataObject _data)
	{
		ParameterData _newData = (ParameterData) _data;
		if (_newData.getEnumerationParameterSubClass() instanceof NulledRelation)
		{
			EnumerationParameter enumerationParameterSubClass =
			this.getEnumerationParameterSubClass();
			if (enumerationParameterSubClass != null)
			{
				enumerationParameterSubClass.cascadeDelete();
			}
		}
		else
		{
			EnumerationParameter enumerationParameterSubClass =
			(EnumerationParameter) _newData.getEnumerationParameterSubClass();
			if (enumerationParameterSubClass != null)
			{
				EnumerationParameter _existing =
				this.getEnumerationParameterSubClass();
				if (_existing == null)
				{
					enumerationParameterSubClass.copyDetachedValuesToOriginalOrInsertIfNew();
				}
				else
				{
					_existing.zCopyAttributesFrom(enumerationParameterSubClass.zGetTxDataForRead());
					_existing.zPersistDetachedRelationships(enumerationParameterSubClass.zGetTxDataForRead());
				}
			}
		}

		if (_newData.getPrimitiveParameterSubClass() instanceof NulledRelation)
		{
			PrimitiveParameter primitiveParameterSubClass =
			this.getPrimitiveParameterSubClass();
			if (primitiveParameterSubClass != null)
			{
				primitiveParameterSubClass.cascadeDelete();
			}
		}
		else
		{
			PrimitiveParameter primitiveParameterSubClass =
			(PrimitiveParameter) _newData.getPrimitiveParameterSubClass();
			if (primitiveParameterSubClass != null)
			{
				PrimitiveParameter _existing =
				this.getPrimitiveParameterSubClass();
				if (_existing == null)
				{
					primitiveParameterSubClass.copyDetachedValuesToOriginalOrInsertIfNew();
				}
				else
				{
					_existing.zCopyAttributesFrom(primitiveParameterSubClass.zGetTxDataForRead());
					_existing.zPersistDetachedRelationships(primitiveParameterSubClass.zGetTxDataForRead());
				}
			}
		}
	}

	public void zSetTxDetachedDeleted()
	{
		TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
		if (_behavior.isDetached() && _behavior.isDeleted()) return;
		ParameterData _newData = (ParameterData) _behavior.getCurrentDataForRead(this);
		if (_newData.getEnumerationParameterSubClass() != null && !(_newData.getEnumerationParameterSubClass() instanceof NulledRelation))
		{
			((EnumerationParameter)_newData.getEnumerationParameterSubClass()).zSetTxDetachedDeleted();
		}

		if (_newData.getPrimitiveParameterSubClass() != null && !(_newData.getPrimitiveParameterSubClass() instanceof NulledRelation))
		{
			((PrimitiveParameter)_newData.getPrimitiveParameterSubClass()).zSetTxDetachedDeleted();
		}

		this.zSetTxPersistenceState(PersistenceState.DETACHED_DELETED);
	}

	public void zSetNonTxDetachedDeleted()
	{
		TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
		ParameterData _newData = (ParameterData) _behavior.getCurrentDataForRead(this);
		if (_newData.getEnumerationParameterSubClass() != null && !(_newData.getEnumerationParameterSubClass() instanceof NulledRelation))
		{
			((EnumerationParameter)_newData.getEnumerationParameterSubClass()).zSetNonTxDetachedDeleted();
		}

		if (_newData.getPrimitiveParameterSubClass() != null && !(_newData.getPrimitiveParameterSubClass() instanceof NulledRelation))
		{
			((PrimitiveParameter)_newData.getPrimitiveParameterSubClass()).zSetNonTxDetachedDeleted();
		}

		this.zSetNonTxPersistenceState(PersistenceState.DETACHED_DELETED);
	}

	/**
	* Relationship Expression:
	this.id = EnumerationParameter.id
* @see EnumerationParameter#getParameterSuperClass() reverse relationship EnumerationParameter.getParameterSuperClass() * @return The enumeration parameter sub class */ public EnumerationParameter getEnumerationParameterSubClass() { EnumerationParameter _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); ParameterData _data = (ParameterData) _behavior.getCurrentDataForRead(this); MithraObjectPortal _portal = null; if (_behavior.isPersisted()) { { _portal = EnumerationParameterFinder.getMithraObjectPortal(); Object _related = _portal.getAsOneFromCache(this, _data, forenumerationParameterSubClass, null, null); if (!(_related instanceof NulledRelation)) _result = (EnumerationParameter) _related; if (_related == null) { _op = EnumerationParameterFinder.id().eq(_data.getId()); } } } else if (_behavior.isDetached()) { if (_data.getEnumerationParameterSubClass() instanceof NulledRelation) { return null; } _result = (EnumerationParameter) _data.getEnumerationParameterSubClass(); if (_result == null) { { Operation detachedOp = EnumerationParameterFinder.id().eq(_data.getId()); _result = EnumerationParameterFinder.zFindOneForRelationship(detachedOp); if(_result != null) { _result = _result.getDetachedCopy(); } } _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); _data = (ParameterData) _behavior.getCurrentDataForWrite(this); _data.setEnumerationParameterSubClass(_result); if (_result != null) _result.zSetParentContainerparameterSuperClass(this); } } else if (_behavior.isInMemory()) { _result = (EnumerationParameter) _data.getEnumerationParameterSubClass(); } if (_op != null) { _result = EnumerationParameterFinder.zFindOneForRelationship(_op); } return _result; } public void setEnumerationParameterSubClass(EnumerationParameter enumerationParameterSubClass) { EnumerationParameter _enumerationParameterSubClass = (EnumerationParameter) enumerationParameterSubClass; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); ParameterData _data = (ParameterData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { Object _prev = _data.getEnumerationParameterSubClass(); _data.setEnumerationParameterSubClass(_enumerationParameterSubClass); if (_enumerationParameterSubClass != null) { _enumerationParameterSubClass.setId(_data.getId()); _enumerationParameterSubClass.zSetParentContainerparameterSuperClass(this); } else if (_behavior.isDetached()) { _data.setEnumerationParameterSubClass(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); EnumerationParameter _existing = this.getEnumerationParameterSubClass(); if (_enumerationParameterSubClass != _existing) { if (_existing != null) { _existing.cascadeDelete(); } if (_enumerationParameterSubClass != null) { _enumerationParameterSubClass.setId(_data.getId()); _enumerationParameterSubClass.cascadeInsert(); } } } else throw new RuntimeException("not implemented"); } public boolean isEnumerationParameterSubClassModifiedSinceDetachment() { TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); ParameterData _data = (ParameterData) _behavior.getCurrentDataForRead(this); if (_data.getEnumerationParameterSubClass() instanceof NulledRelation) { EnumerationParameter _existing = this.getOriginalPersistentObject().getEnumerationParameterSubClass(); return _existing != null; } EnumerationParameter enumerationParameterSubClass = (EnumerationParameter) _data.getEnumerationParameterSubClass(); if( enumerationParameterSubClass != null) { return enumerationParameterSubClass.isModifiedSinceDetachment(); } return false; } /** * Relationship Expression:
	this.id = PrimitiveParameter.id
* @see PrimitiveParameter#getParameterSuperClass() reverse relationship PrimitiveParameter.getParameterSuperClass() * @return The primitive parameter sub class */ public PrimitiveParameter getPrimitiveParameterSubClass() { PrimitiveParameter _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); ParameterData _data = (ParameterData) _behavior.getCurrentDataForRead(this); MithraObjectPortal _portal = null; if (_behavior.isPersisted()) { { _portal = PrimitiveParameterFinder.getMithraObjectPortal(); Object _related = _portal.getAsOneFromCache(this, _data, forprimitiveParameterSubClass, null, null); if (!(_related instanceof NulledRelation)) _result = (PrimitiveParameter) _related; if (_related == null) { _op = PrimitiveParameterFinder.id().eq(_data.getId()); } } } else if (_behavior.isDetached()) { if (_data.getPrimitiveParameterSubClass() instanceof NulledRelation) { return null; } _result = (PrimitiveParameter) _data.getPrimitiveParameterSubClass(); if (_result == null) { { Operation detachedOp = PrimitiveParameterFinder.id().eq(_data.getId()); _result = PrimitiveParameterFinder.zFindOneForRelationship(detachedOp); if(_result != null) { _result = _result.getDetachedCopy(); } } _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); _data = (ParameterData) _behavior.getCurrentDataForWrite(this); _data.setPrimitiveParameterSubClass(_result); if (_result != null) _result.zSetParentContainerparameterSuperClass(this); } } else if (_behavior.isInMemory()) { _result = (PrimitiveParameter) _data.getPrimitiveParameterSubClass(); } if (_op != null) { _result = PrimitiveParameterFinder.zFindOneForRelationship(_op); } return _result; } public void setPrimitiveParameterSubClass(PrimitiveParameter primitiveParameterSubClass) { PrimitiveParameter _primitiveParameterSubClass = (PrimitiveParameter) primitiveParameterSubClass; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); ParameterData _data = (ParameterData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { Object _prev = _data.getPrimitiveParameterSubClass(); _data.setPrimitiveParameterSubClass(_primitiveParameterSubClass); if (_primitiveParameterSubClass != null) { _primitiveParameterSubClass.setId(_data.getId()); _primitiveParameterSubClass.zSetParentContainerparameterSuperClass(this); } else if (_behavior.isDetached()) { _data.setPrimitiveParameterSubClass(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); PrimitiveParameter _existing = this.getPrimitiveParameterSubClass(); if (_primitiveParameterSubClass != _existing) { if (_existing != null) { _existing.cascadeDelete(); } if (_primitiveParameterSubClass != null) { _primitiveParameterSubClass.setId(_data.getId()); _primitiveParameterSubClass.cascadeInsert(); } } } else throw new RuntimeException("not implemented"); } public boolean isPrimitiveParameterSubClassModifiedSinceDetachment() { TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); ParameterData _data = (ParameterData) _behavior.getCurrentDataForRead(this); if (_data.getPrimitiveParameterSubClass() instanceof NulledRelation) { PrimitiveParameter _existing = this.getOriginalPersistentObject().getPrimitiveParameterSubClass(); return _existing != null; } PrimitiveParameter primitiveParameterSubClass = (PrimitiveParameter) _data.getPrimitiveParameterSubClass(); if( primitiveParameterSubClass != null) { return primitiveParameterSubClass.isModifiedSinceDetachment(); } return false; } /** * Relationship Expression:
	UrlParameter.parameterId = this.id
* @see UrlParameter#getParameter() reverse relationship UrlParameter.getParameter() * @return The url parameter */ public UrlParameter getUrlParameter() { UrlParameter _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); ParameterData _data = (ParameterData) _behavior.getCurrentDataForRead(this); if (_behavior.isPersisted()) { { { _op = UrlParameterFinder.parameterId().eq(_data.getId()); } } } else if (_behavior.isDetached()) { { { Operation detachedOp = UrlParameterFinder.parameterId().eq(_data.getId()); _result = UrlParameterFinder.zFindOneForRelationship(detachedOp); } } } else if (_behavior.isInMemory()) { _result = (UrlParameter) _data.getUrlParameter(); if (_result == null) { { _op = UrlParameterFinder.parameterId().eq(_data.getId()); } } } if (_op != null) { _result = UrlParameterFinder.zFindOneForRelationship(_op); } return _result; } public void setUrlParameter(UrlParameter urlParameter) { UrlParameter _urlParameter = (UrlParameter) urlParameter; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); ParameterData _data = (ParameterData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { _data.setUrlParameter(_urlParameter); if (_urlParameter == null) { this.setId(0); } else { this.setId(_urlParameter.getParameterId()); } } else if (_behavior.isPersisted()) { _behavior.clearTempTransaction(this); if (_urlParameter == null) { this.setId(0); } else { this.setId( _urlParameter.getParameterId()); } } else throw new RuntimeException("not implemented"); } /** * Relationship Expression:
	VariableReference.parameterId = this.id
* @see VariableReference#getParameter() reverse relationship VariableReference.getParameter() * @return variable references */ public VariableReferenceList getVariableReferences() { VariableReferenceList _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); ParameterData _data = (ParameterData) _behavior.getCurrentDataForRead(this); if (_behavior.isPersisted()) { { { _op = VariableReferenceFinder.parameterId().eq(_data.getId()); } } } else if (_behavior.isDetached()) { { { Operation detachedOp = VariableReferenceFinder.parameterId().eq(_data.getId()); _result = new VariableReferenceList(detachedOp); _result.zSetForRelationship(); } } } else if (_behavior.isInMemory()) { _result = (VariableReferenceList) _data.getVariableReferences(); if (_result == null) { { _op = VariableReferenceFinder.parameterId().eq(_data.getId()); } } } if (_op != null) { _result = new VariableReferenceList(_op); _result.zSetForRelationship(); } return _result; } public void setVariableReferences(VariableReferenceList variableReferences) { VariableReferenceList _variableReferences = (VariableReferenceList) variableReferences; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); ParameterData _data = (ParameterData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { _data.setVariableReferences(_variableReferences); } else if (_behavior.isPersisted()) { _behavior.clearTempTransaction(this); } else throw new RuntimeException("not implemented"); } protected void cascadeInsertImpl() throws MithraBusinessException { TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); this.checkAndGeneratePrimaryKeys(); ParameterData _data = (ParameterData) _behavior.getCurrentDataForWrite(this); EnumerationParameter enumerationParameterSubClass = (EnumerationParameter) _data.getEnumerationParameterSubClass(); PrimitiveParameter primitiveParameterSubClass = (PrimitiveParameter) _data.getPrimitiveParameterSubClass(); _behavior.insert(this); if (enumerationParameterSubClass != null) { enumerationParameterSubClass.cascadeInsert(); } if (primitiveParameterSubClass != null) { primitiveParameterSubClass.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) { ParameterFinder.ParameterRelatedFinder parentFinder = (ParameterFinder.ParameterRelatedFinder) parentFinderGeneric; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); ParameterData _newData = (ParameterData) _behavior.getCurrentDataForWrite(this); if (_newData.getEnumerationParameterSubClass() instanceof NulledRelation) { RelatedFinder dependentFinder = parentFinder.enumerationParameterSubClass(); DeepRelationshipUtility.zAddToNavigationStats(dependentFinder, true, navigationStats); DeepRelationshipUtility.zAddAllDependentNavigationsStatsForDelete(dependentFinder, navigationStats); } else { EnumerationParameter enumerationParameterSubClass = (EnumerationParameter) _newData.getEnumerationParameterSubClass(); RelatedFinder dependentFinder = parentFinder.enumerationParameterSubClass(); DeepRelationshipUtility.zAddToNavigationStats(dependentFinder, enumerationParameterSubClass != null, navigationStats); if (enumerationParameterSubClass != null) { _behavior.addNavigatedRelationshipsStats(enumerationParameterSubClass, dependentFinder, navigationStats); } } if (_newData.getPrimitiveParameterSubClass() instanceof NulledRelation) { RelatedFinder dependentFinder = parentFinder.primitiveParameterSubClass(); DeepRelationshipUtility.zAddToNavigationStats(dependentFinder, true, navigationStats); DeepRelationshipUtility.zAddAllDependentNavigationsStatsForDelete(dependentFinder, navigationStats); } else { PrimitiveParameter primitiveParameterSubClass = (PrimitiveParameter) _newData.getPrimitiveParameterSubClass(); RelatedFinder dependentFinder = parentFinder.primitiveParameterSubClass(); DeepRelationshipUtility.zAddToNavigationStats(dependentFinder, primitiveParameterSubClass != null, navigationStats); if (primitiveParameterSubClass != null) { _behavior.addNavigatedRelationshipsStats(primitiveParameterSubClass, dependentFinder, navigationStats); } } return navigationStats; } @Override public Map< RelatedFinder, StatisticCounter > zAddNavigatedRelationshipsStatsForDelete(RelatedFinder parentFinder, Map< RelatedFinder, StatisticCounter > navigationStats) { DeepRelationshipUtility.zAddAllDependentNavigationsStatsForDelete(parentFinder, navigationStats); return navigationStats; } @Override public Parameter zCascadeCopyThenInsert() throws MithraBusinessException { TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); this.checkAndGeneratePrimaryKeys(); ParameterData _data = (ParameterData) _behavior.getCurrentDataForWrite(this); EnumerationParameter enumerationParameterSubClass = (EnumerationParameter) _data.getEnumerationParameterSubClass(); PrimitiveParameter primitiveParameterSubClass = (PrimitiveParameter) _data.getPrimitiveParameterSubClass(); Parameter original = (Parameter) _behavior.copyThenInsert(this); if (enumerationParameterSubClass != null) { enumerationParameterSubClass.zCascadeCopyThenInsert(); } if (primitiveParameterSubClass != null) { primitiveParameterSubClass.zCascadeCopyThenInsert(); } return original; } protected void cascadeDeleteImpl() throws MithraBusinessException { { EnumerationParameter related = this.getEnumerationParameterSubClass(); if (related != null) related.cascadeDelete(); } { PrimitiveParameter related = this.getPrimitiveParameterSubClass(); if (related != null) related.cascadeDelete(); } this.delete(); } public Cache zGetCache() { return ParameterFinder.getMithraObjectPortal().getCache(); } public MithraObjectPortal zGetPortal() { return ParameterFinder.getMithraObjectPortal(); } public Parameter getOriginalPersistentObject() { return this.zFindOriginal(); } protected boolean issueUpdatesForNonPrimaryKeys(TransactionalBehavior behavior, MithraDataObject data, MithraDataObject newData) { boolean changed = false; changed |= zUpdateString(behavior, data, newData, ParameterFinder.multiplicity(), false); changed |= zUpdateString(behavior, data, newData, ParameterFinder.name(), false); changed |= zUpdateInteger(behavior, data, newData, ParameterFinder.ordinal(), false); return changed; } protected boolean issueUpdatesForPrimaryKeys(TransactionalBehavior behavior, MithraDataObject data, MithraDataObject newData) { boolean changed = false; changed |= zUpdateLong(behavior, data, newData, ParameterFinder.id(), false); return changed; } public long generateAndSetId() { long nextValue =(long) this.generateId(); this.setId(nextValue); return nextValue; } public boolean zGetIsIdSet() { TransactionalBehavior behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); ParameterData data = (ParameterData) behavior.getCurrentDataForRead(this); return data.zGetIsIdSet(); } protected long generateId() { Object sourceAttribute = null; ParameterFinder.getMithraObjectPortal().getCache(); SimulatedSequencePrimaryKeyGenerator primaryKeyGenerator = MithraPrimaryKeyGenerator.getInstance().getSimulatedSequencePrimaryKeyGeneratorForNoSourceAttribute("Parameter", "io.liftwizard.reladomo.simseq.ObjectSequenceObjectFactory",sourceAttribute); return (long)primaryKeyGenerator.getNextId(sourceAttribute); } private void checkAndGeneratePrimaryKeys() { TransactionalBehavior behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); ParameterData data = (ParameterData) behavior.getCurrentDataForWrite(this); if (!data.zGetIsIdSet()) { data.setId(generateId()); EnumerationParameter enumerationParameterSubClass = (EnumerationParameter ) data.getEnumerationParameterSubClass(); if (enumerationParameterSubClass != null) { enumerationParameterSubClass.setId(data.getId()); } PrimitiveParameter primitiveParameterSubClass = (PrimitiveParameter ) data.getPrimitiveParameterSubClass(); if (primitiveParameterSubClass != null) { primitiveParameterSubClass.setId(data.getId()); } UrlParameter urlParameter = (UrlParameter ) data.getUrlParameter(); if (urlParameter != null) { urlParameter.setParameterId(data.getId()); } } } public Object readResolve() throws ObjectStreamException { ParameterAbstract result = (ParameterAbstract) 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 EnumerationParameterSubClassAddHandlerInMemory implements DependentRelationshipAddHandler { public void addRelatedObject(MithraTransactionalObject relatedObject) { EnumerationParameter item = (EnumerationParameter) relatedObject; item.setId(getId()); item.zSetParentContainerparameterSuperClass(ParameterAbstract.this); } } protected class EnumerationParameterSubClassAddHandlerPersisted implements DependentRelationshipAddHandler { public void addRelatedObject(MithraTransactionalObject relatedObject) { EnumerationParameter item = (EnumerationParameter) relatedObject; item.setId(getId()); item.cascadeInsert(); } } protected class PrimitiveParameterSubClassAddHandlerInMemory implements DependentRelationshipAddHandler { public void addRelatedObject(MithraTransactionalObject relatedObject) { PrimitiveParameter item = (PrimitiveParameter) relatedObject; item.setId(getId()); item.zSetParentContainerparameterSuperClass(ParameterAbstract.this); } } protected class PrimitiveParameterSubClassAddHandlerPersisted implements DependentRelationshipAddHandler { public void addRelatedObject(MithraTransactionalObject relatedObject) { PrimitiveParameter item = (PrimitiveParameter) relatedObject; item.setId(getId()); item.cascadeInsert(); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy