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

klass.model.meta.domain.PrimitivePropertyAbstract 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 PrimitivePropertyAbstract 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(PrimitiveProperty.class.getName());
	private static final RelationshipHashStrategy forminValidation = new MinValidationRhs();
	private static final RelationshipHashStrategy formaxValidation = new MaxValidationRhs();
	private static final RelationshipHashStrategy fordataTypePropertySuperClass = new DataTypePropertySuperClassRhs();
	private static final class MinValidationRhs implements RelationshipHashStrategy
	{
		public boolean equalsForRelationship(Object _srcObject, Object _srcData, Object _targetData, Timestamp _asOfDate0, Timestamp _asOfDate1)
		{
			PrimitivePropertyData _castedSrcData = (PrimitivePropertyData) _srcData;
			MinPropertyValidationData _castedTargetData = (MinPropertyValidationData) _targetData;
			if (_castedSrcData.getClassifierName()!= null && _castedSrcData.getClassifierName().equals(_castedTargetData.getClassifierName()) && _castedSrcData.getName()!= null && _castedSrcData.getName().equals(_castedTargetData.getPropertyName()))
			{
				return true;
			}

			return false;
		}

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

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

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

			return false;
		}

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

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

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

			return false;
		}

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

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

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

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

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

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

	public PrimitiveProperty zFindOriginal()
	{
		PrimitivePropertyData data = (PrimitivePropertyData) this.currentData;
		Operation op;
		op = PrimitivePropertyFinder.classifierName().eq(data.getClassifierName());
		op = op.and(PrimitivePropertyFinder.name().eq(data.getName()));
		return PrimitivePropertyFinder.findOne(op);
	}

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

	private Logger getLogger()
	{
		return logger;
	}

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

	protected void zSetFromPrimitivePropertyData( PrimitivePropertyData data )
	{
		super.zSetData(data);
		this.persistenceState = PERSISTED_STATE;
	}

	public void setFromPrimitivePropertyData( PrimitivePropertyData data )
	{
		super.zSetData(data);
	}

	public void zWriteDataClassName(ObjectOutput out) throws IOException
	{
	}

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

	public final String getClassifierName()
	{
		PrimitivePropertyData data = (PrimitivePropertyData) 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);
		MithraDataObject d = zSetString(PrimitivePropertyFinder.classifierName(), newValue, true, false );
		if (d == null) return;
		PrimitivePropertyData data = (PrimitivePropertyData) d;
		TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
		if (!_behavior.isPersisted())
		{
			MinPropertyValidation minValidation =
			(MinPropertyValidation ) data.getMinValidation();
			if (minValidation != null)
			{
				minValidation.setClassifierName(newValue);
			}

			MaxPropertyValidation maxValidation =
			(MaxPropertyValidation ) data.getMaxValidation();
			if (maxValidation != null)
			{
				maxValidation.setClassifierName(newValue);
			}
		}
	}

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

	public final String getName()
	{
		PrimitivePropertyData data = (PrimitivePropertyData) 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);
		MithraDataObject d = zSetString(PrimitivePropertyFinder.name(), newValue, true, false );
		if (d == null) return;
		PrimitivePropertyData data = (PrimitivePropertyData) d;
		TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
		if (!_behavior.isPersisted())
		{
			MinPropertyValidation minValidation =
			(MinPropertyValidation ) data.getMinValidation();
			if (minValidation != null)
			{
				minValidation.setPropertyName(newValue);
			}

			MaxPropertyValidation maxValidation =
			(MaxPropertyValidation ) data.getMaxValidation();
			if (maxValidation != null)
			{
				maxValidation.setPropertyName(newValue);
			}
		}
	}

	public boolean isPrimitiveTypeNull()
	{
		return ((PrimitivePropertyData) this.zSynchronizedGetData()).isPrimitiveTypeNull();
	}

	public String getPrimitiveType()
	{
		PrimitivePropertyData data = (PrimitivePropertyData) this.zSynchronizedGetData();
		return data.getPrimitiveType();
	}

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

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

	public void zPersistDetachedRelationships(MithraDataObject _data)
	{
		PrimitivePropertyData _newData = (PrimitivePropertyData) _data;
		if (_newData.getMinValidation() instanceof NulledRelation)
		{
			MinPropertyValidation minValidation =
			this.getMinValidation();
			if (minValidation != null)
			{
				minValidation.cascadeDelete();
			}
		}
		else
		{
			MinPropertyValidation minValidation =
			(MinPropertyValidation) _newData.getMinValidation();
			if (minValidation != null)
			{
				MinPropertyValidation _existing =
				this.getMinValidation();
				if (_existing == null)
				{
					minValidation.copyDetachedValuesToOriginalOrInsertIfNew();
				}
				else
				{
					_existing.zCopyAttributesFrom(minValidation.zGetTxDataForRead());
					_existing.zPersistDetachedRelationships(minValidation.zGetTxDataForRead());
				}
			}
		}

		if (_newData.getMaxValidation() instanceof NulledRelation)
		{
			MaxPropertyValidation maxValidation =
			this.getMaxValidation();
			if (maxValidation != null)
			{
				maxValidation.cascadeDelete();
			}
		}
		else
		{
			MaxPropertyValidation maxValidation =
			(MaxPropertyValidation) _newData.getMaxValidation();
			if (maxValidation != null)
			{
				MaxPropertyValidation _existing =
				this.getMaxValidation();
				if (_existing == null)
				{
					maxValidation.copyDetachedValuesToOriginalOrInsertIfNew();
				}
				else
				{
					_existing.zCopyAttributesFrom(maxValidation.zGetTxDataForRead());
					_existing.zPersistDetachedRelationships(maxValidation.zGetTxDataForRead());
				}
			}
		}
	}

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

		if (_newData.getMaxValidation() != null && !(_newData.getMaxValidation() instanceof NulledRelation))
		{
			((MaxPropertyValidation)_newData.getMaxValidation()).zSetTxDetachedDeleted();
		}

		this.zSetTxPersistenceState(PersistenceState.DETACHED_DELETED);
	}

	public void zSetNonTxDetachedDeleted()
	{
		TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
		PrimitivePropertyData _newData = (PrimitivePropertyData) _behavior.getCurrentDataForRead(this);
		if (_newData.getMinValidation() != null && !(_newData.getMinValidation() instanceof NulledRelation))
		{
			((MinPropertyValidation)_newData.getMinValidation()).zSetNonTxDetachedDeleted();
		}

		if (_newData.getMaxValidation() != null && !(_newData.getMaxValidation() instanceof NulledRelation))
		{
			((MaxPropertyValidation)_newData.getMaxValidation()).zSetNonTxDetachedDeleted();
		}

		this.zSetNonTxPersistenceState(PersistenceState.DETACHED_DELETED);
	}

	/**
	* Relationship Expression:
	this.classifierName = MinPropertyValidation.classifierName and this.name = MinPropertyValidation.propertyName
* @see MinPropertyValidation#getPrimitiveProperty() reverse relationship MinPropertyValidation.getPrimitiveProperty() * @return The min validation */ public MinPropertyValidation getMinValidation() { MinPropertyValidation _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); PrimitivePropertyData _data = (PrimitivePropertyData) _behavior.getCurrentDataForRead(this); MithraObjectPortal _portal = null; if (_behavior.isPersisted()) { { _portal = MinPropertyValidationFinder.getMithraObjectPortal(); Object _related = _portal.getAsOneFromCache(this, _data, forminValidation, null, null); if (!(_related instanceof NulledRelation)) _result = (MinPropertyValidation) _related; if (_related == null) { _op = new RelationshipMultiEqualityOperation(PrimitivePropertyFinder.minValidation().zGetRelationshipMultiExtractor(), this); } } } else if (_behavior.isDetached()) { if (_data.getMinValidation() instanceof NulledRelation) { return null; } _result = (MinPropertyValidation) _data.getMinValidation(); if (_result == null) { { Operation detachedOp = new RelationshipMultiEqualityOperation(PrimitivePropertyFinder.minValidation().zGetRelationshipMultiExtractor(), this); _result = MinPropertyValidationFinder.zFindOneForRelationship(detachedOp); if(_result != null) { _result = _result.getDetachedCopy(); } } _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); _data = (PrimitivePropertyData) _behavior.getCurrentDataForWrite(this); _data.setMinValidation(_result); if (_result != null) _result.zSetParentContainerprimitiveProperty(this); } } else if (_behavior.isInMemory()) { _result = (MinPropertyValidation) _data.getMinValidation(); } if (_op != null) { _result = MinPropertyValidationFinder.zFindOneForRelationship(_op); } return _result; } public void setMinValidation(MinPropertyValidation minValidation) { MinPropertyValidation _minValidation = (MinPropertyValidation) minValidation; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); PrimitivePropertyData _data = (PrimitivePropertyData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { Object _prev = _data.getMinValidation(); _data.setMinValidation(_minValidation); if (_minValidation != null) { _minValidation.setClassifierName(_data.getClassifierName()); _minValidation.setPropertyName(_data.getName()); _minValidation.zSetParentContainerprimitiveProperty(this); } else if (_behavior.isDetached()) { _data.setMinValidation(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); MinPropertyValidation _existing = this.getMinValidation(); if (_minValidation != _existing) { if (_existing != null) { _existing.cascadeDelete(); } if (_minValidation != null) { _minValidation.setClassifierName(_data.getClassifierName()); _minValidation.setPropertyName(_data.getName()); _minValidation.cascadeInsert(); } } } else throw new RuntimeException("not implemented"); } public boolean isMinValidationModifiedSinceDetachment() { TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); PrimitivePropertyData _data = (PrimitivePropertyData) _behavior.getCurrentDataForRead(this); if (_data.getMinValidation() instanceof NulledRelation) { MinPropertyValidation _existing = this.getOriginalPersistentObject().getMinValidation(); return _existing != null; } MinPropertyValidation minValidation = (MinPropertyValidation) _data.getMinValidation(); if( minValidation != null) { return minValidation.isModifiedSinceDetachment(); } return false; } /** * Relationship Expression:
	this.classifierName = MaxPropertyValidation.classifierName and this.name = MaxPropertyValidation.propertyName
* @see MaxPropertyValidation#getPrimitiveProperty() reverse relationship MaxPropertyValidation.getPrimitiveProperty() * @return The max validation */ public MaxPropertyValidation getMaxValidation() { MaxPropertyValidation _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); PrimitivePropertyData _data = (PrimitivePropertyData) _behavior.getCurrentDataForRead(this); MithraObjectPortal _portal = null; if (_behavior.isPersisted()) { { _portal = MaxPropertyValidationFinder.getMithraObjectPortal(); Object _related = _portal.getAsOneFromCache(this, _data, formaxValidation, null, null); if (!(_related instanceof NulledRelation)) _result = (MaxPropertyValidation) _related; if (_related == null) { _op = new RelationshipMultiEqualityOperation(PrimitivePropertyFinder.maxValidation().zGetRelationshipMultiExtractor(), this); } } } else if (_behavior.isDetached()) { if (_data.getMaxValidation() instanceof NulledRelation) { return null; } _result = (MaxPropertyValidation) _data.getMaxValidation(); if (_result == null) { { Operation detachedOp = new RelationshipMultiEqualityOperation(PrimitivePropertyFinder.maxValidation().zGetRelationshipMultiExtractor(), this); _result = MaxPropertyValidationFinder.zFindOneForRelationship(detachedOp); if(_result != null) { _result = _result.getDetachedCopy(); } } _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); _data = (PrimitivePropertyData) _behavior.getCurrentDataForWrite(this); _data.setMaxValidation(_result); if (_result != null) _result.zSetParentContainerprimitiveProperty(this); } } else if (_behavior.isInMemory()) { _result = (MaxPropertyValidation) _data.getMaxValidation(); } if (_op != null) { _result = MaxPropertyValidationFinder.zFindOneForRelationship(_op); } return _result; } public void setMaxValidation(MaxPropertyValidation maxValidation) { MaxPropertyValidation _maxValidation = (MaxPropertyValidation) maxValidation; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); PrimitivePropertyData _data = (PrimitivePropertyData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { Object _prev = _data.getMaxValidation(); _data.setMaxValidation(_maxValidation); if (_maxValidation != null) { _maxValidation.setClassifierName(_data.getClassifierName()); _maxValidation.setPropertyName(_data.getName()); _maxValidation.zSetParentContainerprimitiveProperty(this); } else if (_behavior.isDetached()) { _data.setMaxValidation(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); MaxPropertyValidation _existing = this.getMaxValidation(); if (_maxValidation != _existing) { if (_existing != null) { _existing.cascadeDelete(); } if (_maxValidation != null) { _maxValidation.setClassifierName(_data.getClassifierName()); _maxValidation.setPropertyName(_data.getName()); _maxValidation.cascadeInsert(); } } } else throw new RuntimeException("not implemented"); } public boolean isMaxValidationModifiedSinceDetachment() { TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); PrimitivePropertyData _data = (PrimitivePropertyData) _behavior.getCurrentDataForRead(this); if (_data.getMaxValidation() instanceof NulledRelation) { MaxPropertyValidation _existing = this.getOriginalPersistentObject().getMaxValidation(); return _existing != null; } MaxPropertyValidation maxValidation = (MaxPropertyValidation) _data.getMaxValidation(); if( maxValidation != null) { return maxValidation.isModifiedSinceDetachment(); } return false; } /** * Relationship Expression:
	(DataTypeProperty.classifierName = this.classifierName and DataTypeProperty.name = this.name )
* @see DataTypeProperty#getPrimitivePropertySubClass() reverse relationship DataTypeProperty.getPrimitivePropertySubClass() * @return The data type property super class */ public DataTypeProperty getDataTypePropertySuperClass() { DataTypeProperty _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); PrimitivePropertyData _data = (PrimitivePropertyData) _behavior.getCurrentDataForRead(this); MithraObjectPortal _portal = null; if (_behavior.isPersisted()) { { _portal = DataTypePropertyFinder.getMithraObjectPortal(); Object _related = _portal.getAsOneFromCache(this, _data, fordataTypePropertySuperClass, null, null); if (!(_related instanceof NulledRelation)) _result = (DataTypeProperty) _related; if (_related == null) { _op = new RelationshipMultiEqualityOperation(PrimitivePropertyFinder.dataTypePropertySuperClass().zGetRelationshipMultiExtractor(), this); } } } else if (_behavior.isDetached()) { if (_data.getDataTypePropertySuperClass() instanceof NulledRelation) { return null; } _result = (DataTypeProperty) _data.getDataTypePropertySuperClass(); if (_result == null) { { Operation detachedOp = new RelationshipMultiEqualityOperation(PrimitivePropertyFinder.dataTypePropertySuperClass().zGetRelationshipMultiExtractor(), this); _result = DataTypePropertyFinder.zFindOneForRelationship(detachedOp); if(_result != null) { _result = _result.getDetachedCopy(); } } _data = (PrimitivePropertyData) _behavior.getCurrentDataForWrite(this); _data.setDataTypePropertySuperClass(_result); } } else if (_behavior.isInMemory()) { _result = (DataTypeProperty) _data.getDataTypePropertySuperClass(); if (_result == null) { { _op = new RelationshipMultiEqualityOperation(PrimitivePropertyFinder.dataTypePropertySuperClass().zGetRelationshipMultiExtractor(), this); } } } if (_op != null) { _result = DataTypePropertyFinder.zFindOneForRelationship(_op); } return _result; } public void setDataTypePropertySuperClass(DataTypeProperty dataTypePropertySuperClass) { ((DataTypeProperty)dataTypePropertySuperClass).setPrimitivePropertySubClass((PrimitiveProperty)this); } public void zSetParentContainerdataTypePropertySuperClass(DataTypePropertyAbstract parent) { TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); PrimitivePropertyData _data = (PrimitivePropertyData) _behavior.getCurrentDataForWrite(this); _behavior.clearTempTransaction(this); if (_behavior.isInMemory()) { _data.setDataTypePropertySuperClass(parent); } } protected void cascadeInsertImpl() throws MithraBusinessException { TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); PrimitivePropertyData _data = (PrimitivePropertyData) _behavior.getCurrentDataForWrite(this); MinPropertyValidation minValidation = (MinPropertyValidation) _data.getMinValidation(); MaxPropertyValidation maxValidation = (MaxPropertyValidation) _data.getMaxValidation(); _behavior.insert(this); if (minValidation != null) { minValidation.cascadeInsert(); } if (maxValidation != null) { maxValidation.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) { PrimitivePropertyFinder.PrimitivePropertyRelatedFinder parentFinder = (PrimitivePropertyFinder.PrimitivePropertyRelatedFinder) parentFinderGeneric; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); PrimitivePropertyData _newData = (PrimitivePropertyData) _behavior.getCurrentDataForWrite(this); if (_newData.getMinValidation() instanceof NulledRelation) { RelatedFinder dependentFinder = parentFinder.minValidation(); DeepRelationshipUtility.zAddToNavigationStats(dependentFinder, true, navigationStats); DeepRelationshipUtility.zAddAllDependentNavigationsStatsForDelete(dependentFinder, navigationStats); } else { MinPropertyValidation minValidation = (MinPropertyValidation) _newData.getMinValidation(); RelatedFinder dependentFinder = parentFinder.minValidation(); DeepRelationshipUtility.zAddToNavigationStats(dependentFinder, minValidation != null, navigationStats); if (minValidation != null) { _behavior.addNavigatedRelationshipsStats(minValidation, dependentFinder, navigationStats); } } if (_newData.getMaxValidation() instanceof NulledRelation) { RelatedFinder dependentFinder = parentFinder.maxValidation(); DeepRelationshipUtility.zAddToNavigationStats(dependentFinder, true, navigationStats); DeepRelationshipUtility.zAddAllDependentNavigationsStatsForDelete(dependentFinder, navigationStats); } else { MaxPropertyValidation maxValidation = (MaxPropertyValidation) _newData.getMaxValidation(); RelatedFinder dependentFinder = parentFinder.maxValidation(); DeepRelationshipUtility.zAddToNavigationStats(dependentFinder, maxValidation != null, navigationStats); if (maxValidation != null) { _behavior.addNavigatedRelationshipsStats(maxValidation, dependentFinder, navigationStats); } } return navigationStats; } @Override public Map< RelatedFinder, StatisticCounter > zAddNavigatedRelationshipsStatsForDelete(RelatedFinder parentFinder, Map< RelatedFinder, StatisticCounter > navigationStats) { DeepRelationshipUtility.zAddAllDependentNavigationsStatsForDelete(parentFinder, navigationStats); return navigationStats; } @Override public PrimitiveProperty zCascadeCopyThenInsert() throws MithraBusinessException { TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); PrimitivePropertyData _data = (PrimitivePropertyData) _behavior.getCurrentDataForWrite(this); MinPropertyValidation minValidation = (MinPropertyValidation) _data.getMinValidation(); MaxPropertyValidation maxValidation = (MaxPropertyValidation) _data.getMaxValidation(); PrimitiveProperty original = (PrimitiveProperty) _behavior.copyThenInsert(this); if (minValidation != null) { minValidation.zCascadeCopyThenInsert(); } if (maxValidation != null) { maxValidation.zCascadeCopyThenInsert(); } return original; } protected void cascadeDeleteImpl() throws MithraBusinessException { { MinPropertyValidation related = this.getMinValidation(); if (related != null) related.cascadeDelete(); } { MaxPropertyValidation related = this.getMaxValidation(); if (related != null) related.cascadeDelete(); } this.delete(); } public Cache zGetCache() { return PrimitivePropertyFinder.getMithraObjectPortal().getCache(); } public MithraObjectPortal zGetPortal() { return PrimitivePropertyFinder.getMithraObjectPortal(); } public PrimitiveProperty getOriginalPersistentObject() { return this.zFindOriginal(); } protected boolean issueUpdatesForNonPrimaryKeys(TransactionalBehavior behavior, MithraDataObject data, MithraDataObject newData) { boolean changed = false; changed |= zUpdateString(behavior, data, newData, PrimitivePropertyFinder.primitiveType(), false); return changed; } protected boolean issueUpdatesForPrimaryKeys(TransactionalBehavior behavior, MithraDataObject data, MithraDataObject newData) { boolean changed = false; changed |= zUpdateString(behavior, data, newData, PrimitivePropertyFinder.classifierName(), false); changed |= zUpdateString(behavior, data, newData, PrimitivePropertyFinder.name(), false); return changed; } public Object readResolve() throws ObjectStreamException { PrimitivePropertyAbstract result = (PrimitivePropertyAbstract) 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 MinValidationAddHandlerInMemory implements DependentRelationshipAddHandler { public void addRelatedObject(MithraTransactionalObject relatedObject) { MinPropertyValidation item = (MinPropertyValidation) relatedObject; item.setClassifierName(getClassifierName()); item.setPropertyName(getName()); item.zSetParentContainerprimitiveProperty(PrimitivePropertyAbstract.this); } } protected class MinValidationAddHandlerPersisted implements DependentRelationshipAddHandler { public void addRelatedObject(MithraTransactionalObject relatedObject) { MinPropertyValidation item = (MinPropertyValidation) relatedObject; item.setClassifierName(getClassifierName()); item.setPropertyName(getName()); item.cascadeInsert(); } } protected class MaxValidationAddHandlerInMemory implements DependentRelationshipAddHandler { public void addRelatedObject(MithraTransactionalObject relatedObject) { MaxPropertyValidation item = (MaxPropertyValidation) relatedObject; item.setClassifierName(getClassifierName()); item.setPropertyName(getName()); item.zSetParentContainerprimitiveProperty(PrimitivePropertyAbstract.this); } } protected class MaxValidationAddHandlerPersisted implements DependentRelationshipAddHandler { public void addRelatedObject(MithraTransactionalObject relatedObject) { MaxPropertyValidation item = (MaxPropertyValidation) relatedObject; item.setClassifierName(getClassifierName()); item.setPropertyName(getName()); item.cascadeInsert(); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy