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

klass.model.meta.domain.KlassAbstract 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 KlassAbstract 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(Klass.class.getName());
	private static final RelationshipHashStrategy forsuperClass = new SuperClassRhs();
	private static final RelationshipHashStrategy forclassifierSuperClass = new ClassifierSuperClassRhs();
	private static final class SuperClassRhs implements RelationshipHashStrategy
	{
		public boolean equalsForRelationship(Object _srcObject, Object _srcData, Object _targetData, Timestamp _asOfDate0, Timestamp _asOfDate1)
		{
			KlassData _castedSrcData = (KlassData) _srcData;
			KlassData _castedTargetData = (KlassData) _targetData;
			if (!_castedSrcData.isSuperClassNameNull() && _castedSrcData.getSuperClassName().equals(_castedTargetData.getName()))
			{
				return true;
			}

			return false;
		}

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

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

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

			return false;
		}

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

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

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

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

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

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

	public Klass zFindOriginal()
	{
		KlassData data = (KlassData) this.currentData;
		Operation op;
		op = KlassFinder.name().eq(data.getName());
		return KlassFinder.findOne(op);
	}

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

	private Logger getLogger()
	{
		return logger;
	}

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

	protected void zSetFromKlassData( KlassData data )
	{
		super.zSetData(data);
		this.persistenceState = PERSISTED_STATE;
	}

	public void setFromKlassData( KlassData data )
	{
		super.zSetData(data);
	}

	public void zWriteDataClassName(ObjectOutput out) throws IOException
	{
	}

	public boolean isAbstractClassNull()
	{
		return ((KlassData) this.zSynchronizedGetData()).isAbstractClassNull();
	}

	public boolean isAbstractClass()
	{
		KlassData data = (KlassData) this.zSynchronizedGetData();
		return data.isAbstractClass();
	}

	public void setAbstractClass(boolean newValue)
	{
		zSetBoolean(KlassFinder.abstractClass(), newValue, false, false ,false);
	}

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

	public final String getName()
	{
		KlassData data = (KlassData) 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(KlassFinder.name(), newValue, true, false );
		if (d == null) return;
		KlassData data = (KlassData) d;
		TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
		if (!_behavior.isPersisted())
		{
			ParameterizedPropertyList parameterizedProperties =
			(ParameterizedPropertyList ) data.getParameterizedProperties();
			if (parameterizedProperties != null)
			{
				parameterizedProperties.setOwningClassName(newValue);
			}
		}
	}

	public boolean isSuperClassNameNull()
	{
		return ((KlassData) this.zSynchronizedGetData()).isSuperClassNameNull();
	}

	public String getSuperClassName()
	{
		KlassData data = (KlassData) this.zSynchronizedGetData();
		return data.getSuperClassName();
	}

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

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

	public void zPersistDetachedRelationships(MithraDataObject _data)
	{
		KlassData _newData = (KlassData) _data;
		{
			ParameterizedPropertyList parameterizedProperties =
			(ParameterizedPropertyList) _newData.getParameterizedProperties();
			if (parameterizedProperties != null)
			{
				parameterizedProperties.copyDetachedValuesToOriginalOrInsertIfNewOrDeleteIfRemoved();
			}
		}
	}

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

		this.zSetTxPersistenceState(PersistenceState.DETACHED_DELETED);
	}

	public void zSetNonTxDetachedDeleted()
	{
		TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary();
		KlassData _newData = (KlassData) _behavior.getCurrentDataForRead(this);
		if (_newData.getParameterizedProperties() != null && !(_newData.getParameterizedProperties() instanceof NulledRelation))
		{
			((ParameterizedPropertyList)_newData.getParameterizedProperties()).zSetNonTxDetachedDeleted();
		}

		this.zSetNonTxPersistenceState(PersistenceState.DETACHED_DELETED);
	}

	/**
	* Relationship Expression:
	this.superClassName = Klass.name
* @see Klass#getSubClasses() reverse relationship Klass.getSubClasses() * @return The super class */ public Klass getSuperClass() { Klass _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForRead(this); MithraObjectPortal _portal = null; if (_behavior.isPersisted()) { if (!_data.isSuperClassNameNull()) { _portal = KlassFinder.getMithraObjectPortal(); Object _related = _portal.getAsOneFromCache(this, _data, forsuperClass, null, null); if (!(_related instanceof NulledRelation)) _result = (Klass) _related; if (_related == null) { _op = KlassFinder.name().eq(_data.getSuperClassName()); } } else { return null; } } else if (_behavior.isDetached()) { { if (!_data.isSuperClassNameNull()) { Operation detachedOp = KlassFinder.name().eq(_data.getSuperClassName()); _result = KlassFinder.zFindOneForRelationship(detachedOp); } } } else if (_behavior.isInMemory()) { _result = (Klass) _data.getSuperClass(); if (_result == null) { if (!_data.isSuperClassNameNull()) { _op = KlassFinder.name().eq(_data.getSuperClassName()); } } } if (_op != null) { _result = KlassFinder.zFindOneForRelationship(_op); } return _result; } public void setSuperClass(Klass superClass) { Klass _superClass = (Klass) superClass; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { _data.setSuperClass(_superClass); if (_superClass == null) { this.setSuperClassName(null); } else { this.setSuperClassName(_superClass.getName()); } } else if (_behavior.isPersisted()) { _behavior.clearTempTransaction(this); if (_superClass == null) { this.setSuperClassName(null); } else { this.setSuperClassName( _superClass.getName()); } } else throw new RuntimeException("not implemented"); } /** * Relationship Expression:
	this.name = AssociationEnd.owningClassName
* @see AssociationEnd#getOwningClass() reverse relationship AssociationEnd.getOwningClass() * @return association ends */ public AssociationEndList getAssociationEnds() { AssociationEndList _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForRead(this); if (_behavior.isPersisted()) { { { _op = AssociationEndFinder.owningClassName().eq(_data.getName()); } } } else if (_behavior.isDetached()) { { { Operation detachedOp = AssociationEndFinder.owningClassName().eq(_data.getName()); _result = new AssociationEndList(detachedOp); _result.zSetForRelationship(); } } } else if (_behavior.isInMemory()) { _result = (AssociationEndList) _data.getAssociationEnds(); if (_result == null) { { _op = AssociationEndFinder.owningClassName().eq(_data.getName()); } } } if (_op != null) { _result = new AssociationEndList(_op); _result.zSetForRelationship(); } return _result; } public void setAssociationEnds(AssociationEndList associationEnds) { AssociationEndList _associationEnds = (AssociationEndList) associationEnds; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { _data.setAssociationEnds(_associationEnds); } else if (_behavior.isPersisted()) { _behavior.clearTempTransaction(this); } else throw new RuntimeException("not implemented"); } /** * Relationship Expression:
	this.name = ParameterizedProperty.owningClassName
* Order By: ordinal asc. * @see ParameterizedProperty#getOwningClass() reverse relationship ParameterizedProperty.getOwningClass() * @return parameterized properties */ public ParameterizedPropertyList getParameterizedProperties() { ParameterizedPropertyList _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForRead(this); if (_behavior.isPersisted()) { { { _op = ParameterizedPropertyFinder.owningClassName().eq(_data.getName()); } } } else if (_behavior.isDetached()) { _result = (ParameterizedPropertyList) _data.getParameterizedProperties(); if (_result == null) { { Operation detachedOp = ParameterizedPropertyFinder.owningClassName().eq(_data.getName()); _result = new ParameterizedPropertyList(detachedOp); _result.zSetForRelationship(); if(_result != null) { _result = _result.getDetachedCopy(); } _result.zSetAddHandler(new ParameterizedPropertiesAddHandlerInMemory()); } _result.setOrderBy(ParameterizedPropertyFinder.ordinal().ascendingOrderBy()); _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); _data = (KlassData) _behavior.getCurrentDataForWrite(this); _data.setParameterizedProperties(_result); if (_result != null) _result.zSetParentContainerowningClass(this); } } else if (_behavior.isInMemory()) { _result = (ParameterizedPropertyList) _data.getParameterizedProperties(); if (_result == null) { _result = new ParameterizedPropertyList(); _result.zSetAddHandler(new ParameterizedPropertiesAddHandlerInMemory()); _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); _data = (KlassData) _behavior.getCurrentDataForWrite(this); _data.setParameterizedProperties(_result); } } if (_op != null) { _result = new ParameterizedPropertyList(_op); _result.zSetForRelationship(); _result.zSetRemoveHandler(DeleteOnRemoveHandler.getInstance()); _result.zSetAddHandler(new ParameterizedPropertiesAddHandlerPersisted()); _result.setOrderBy(ParameterizedPropertyFinder.ordinal().ascendingOrderBy()); } return _result; } public void setParameterizedProperties(ParameterizedPropertyList parameterizedProperties) { ParameterizedPropertyList _parameterizedProperties = (ParameterizedPropertyList) parameterizedProperties; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { if (_behavior.isDetached() && _parameterizedProperties != null) { _parameterizedProperties.zMakeDetached(ParameterizedPropertyFinder.owningClassName().eq(_data.getName()), _data.getParameterizedProperties()); } _data.setParameterizedProperties(_parameterizedProperties); if (_parameterizedProperties != null) { _parameterizedProperties.setOwningClassName(_data.getName()); _parameterizedProperties.zSetParentContainerowningClass(this); _parameterizedProperties.zSetAddHandler(new ParameterizedPropertiesAddHandlerInMemory()); } else if (_behavior.isDetached()) { throw new MithraBusinessException("to-many relationships cannot be set to null. Use the clear() method on the list instead."); } } else if (_behavior.isPersisted()) { _behavior.clearTempTransaction(this); _parameterizedProperties.zSetAddHandler(new ParameterizedPropertiesAddHandlerPersisted()); ParameterizedPropertyList parameterizedPropertiesToDelete = new ParameterizedPropertyList(); parameterizedPropertiesToDelete.addAll(this.getParameterizedProperties()); for(int i=0;i < _parameterizedProperties.size(); i++) { ParameterizedProperty item = _parameterizedProperties.getParameterizedPropertyAt(i); if (!parameterizedPropertiesToDelete.remove(item)) { item.setOwningClassName(_data.getName()); item.cascadeInsert(); } } parameterizedPropertiesToDelete.cascadeDeleteAll(); } else throw new RuntimeException("not implemented"); } public boolean isParameterizedPropertiesModifiedSinceDetachment() { TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForRead(this); ParameterizedPropertyList parameterizedProperties = (ParameterizedPropertyList) _data.getParameterizedProperties(); if( parameterizedProperties != null) { return parameterizedProperties.isModifiedSinceDetachment(); } return false; } /** * Relationship Expression:
	AssociationEnd.resultTypeName = this.name
* @see AssociationEnd#getResultType() reverse relationship AssociationEnd.getResultType() * @return association ends result type of */ public AssociationEndList getAssociationEndsResultTypeOf() { AssociationEndList _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForRead(this); if (_behavior.isPersisted()) { { { _op = AssociationEndFinder.resultTypeName().eq(_data.getName()); } } } else if (_behavior.isDetached()) { { { Operation detachedOp = AssociationEndFinder.resultTypeName().eq(_data.getName()); _result = new AssociationEndList(detachedOp); _result.zSetForRelationship(); } } } else if (_behavior.isInMemory()) { _result = (AssociationEndList) _data.getAssociationEndsResultTypeOf(); if (_result == null) { { _op = AssociationEndFinder.resultTypeName().eq(_data.getName()); } } } if (_op != null) { _result = new AssociationEndList(_op); _result.zSetForRelationship(); } return _result; } public void setAssociationEndsResultTypeOf(AssociationEndList associationEndsResultTypeOf) { AssociationEndList _associationEndsResultTypeOf = (AssociationEndList) associationEndsResultTypeOf; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { _data.setAssociationEndsResultTypeOf(_associationEndsResultTypeOf); } else if (_behavior.isPersisted()) { _behavior.clearTempTransaction(this); } else throw new RuntimeException("not implemented"); } /** * Relationship Expression:
	Classifier.name = this.name
* @see Classifier#getKlassSubClass() reverse relationship Classifier.getKlassSubClass() * @return The classifier super class */ public Classifier getClassifierSuperClass() { Classifier _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForRead(this); MithraObjectPortal _portal = null; if (_behavior.isPersisted()) { { _portal = ClassifierFinder.getMithraObjectPortal(); Object _related = _portal.getAsOneFromCache(this, _data, forclassifierSuperClass, null, null); if (!(_related instanceof NulledRelation)) _result = (Classifier) _related; if (_related == null) { _op = ClassifierFinder.name().eq(_data.getName()); } } } else if (_behavior.isDetached()) { if (_data.getClassifierSuperClass() instanceof NulledRelation) { return null; } _result = (Classifier) _data.getClassifierSuperClass(); if (_result == null) { { Operation detachedOp = ClassifierFinder.name().eq(_data.getName()); _result = ClassifierFinder.zFindOneForRelationship(detachedOp); if(_result != null) { _result = _result.getDetachedCopy(); } } _data = (KlassData) _behavior.getCurrentDataForWrite(this); _data.setClassifierSuperClass(_result); } } else if (_behavior.isInMemory()) { _result = (Classifier) _data.getClassifierSuperClass(); if (_result == null) { { _op = ClassifierFinder.name().eq(_data.getName()); } } } if (_op != null) { _result = ClassifierFinder.zFindOneForRelationship(_op); } return _result; } public void setClassifierSuperClass(Classifier classifierSuperClass) { ((Classifier)classifierSuperClass).setKlassSubClass((Klass)this); } public void zSetParentContainerclassifierSuperClass(ClassifierAbstract parent) { TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForWrite(this); _behavior.clearTempTransaction(this); if (_behavior.isInMemory()) { _data.setClassifierSuperClass(parent); } } /** * Relationship Expression:
	Klass.superClassName = this.name
* @see Klass#getSuperClass() reverse relationship Klass.getSuperClass() * @return sub classes */ public KlassList getSubClasses() { KlassList _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForRead(this); if (_behavior.isPersisted()) { { { _op = KlassFinder.superClassName().eq(_data.getName()); } } } else if (_behavior.isDetached()) { { { Operation detachedOp = KlassFinder.superClassName().eq(_data.getName()); _result = new KlassList(detachedOp); _result.zSetForRelationship(); } } } else if (_behavior.isInMemory()) { _result = (KlassList) _data.getSubClasses(); if (_result == null) { { _op = KlassFinder.superClassName().eq(_data.getName()); } } } if (_op != null) { _result = new KlassList(_op); _result.zSetForRelationship(); } return _result; } public void setSubClasses(KlassList subClasses) { KlassList _subClasses = (KlassList) subClasses; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { _data.setSubClasses(_subClasses); } else if (_behavior.isPersisted()) { _behavior.clearTempTransaction(this); } else throw new RuntimeException("not implemented"); } /** * Relationship Expression:
	MemberReferencePath.className = this.name
* @see MemberReferencePath#getKlass() reverse relationship MemberReferencePath.getKlass() * @return member reference paths */ public MemberReferencePathList getMemberReferencePaths() { MemberReferencePathList _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForRead(this); if (_behavior.isPersisted()) { { { _op = MemberReferencePathFinder.className().eq(_data.getName()); } } } else if (_behavior.isDetached()) { { { Operation detachedOp = MemberReferencePathFinder.className().eq(_data.getName()); _result = new MemberReferencePathList(detachedOp); _result.zSetForRelationship(); } } } else if (_behavior.isInMemory()) { _result = (MemberReferencePathList) _data.getMemberReferencePaths(); if (_result == null) { { _op = MemberReferencePathFinder.className().eq(_data.getName()); } } } if (_op != null) { _result = new MemberReferencePathList(_op); _result.zSetForRelationship(); } return _result; } public void setMemberReferencePaths(MemberReferencePathList memberReferencePaths) { MemberReferencePathList _memberReferencePaths = (MemberReferencePathList) memberReferencePaths; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { _data.setMemberReferencePaths(_memberReferencePaths); } else if (_behavior.isPersisted()) { _behavior.clearTempTransaction(this); } else throw new RuntimeException("not implemented"); } /** * Relationship Expression:
	ParameterizedProperty.resultTypeName = this.name
* @see ParameterizedProperty#getResultType() reverse relationship ParameterizedProperty.getResultType() * @return parameterized properties result type of */ public ParameterizedPropertyList getParameterizedPropertiesResultTypeOf() { ParameterizedPropertyList _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForRead(this); if (_behavior.isPersisted()) { { { _op = ParameterizedPropertyFinder.resultTypeName().eq(_data.getName()); } } } else if (_behavior.isDetached()) { { { Operation detachedOp = ParameterizedPropertyFinder.resultTypeName().eq(_data.getName()); _result = new ParameterizedPropertyList(detachedOp); _result.zSetForRelationship(); } } } else if (_behavior.isInMemory()) { _result = (ParameterizedPropertyList) _data.getParameterizedPropertiesResultTypeOf(); if (_result == null) { { _op = ParameterizedPropertyFinder.resultTypeName().eq(_data.getName()); } } } if (_op != null) { _result = new ParameterizedPropertyList(_op); _result.zSetForRelationship(); } return _result; } public void setParameterizedPropertiesResultTypeOf(ParameterizedPropertyList parameterizedPropertiesResultTypeOf) { ParameterizedPropertyList _parameterizedPropertiesResultTypeOf = (ParameterizedPropertyList) parameterizedPropertiesResultTypeOf; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { _data.setParameterizedPropertiesResultTypeOf(_parameterizedPropertiesResultTypeOf); } else if (_behavior.isPersisted()) { _behavior.clearTempTransaction(this); } else throw new RuntimeException("not implemented"); } /** * Relationship Expression:
	ServiceGroup.className = this.name
* @see ServiceGroup#getOwningClass() reverse relationship ServiceGroup.getOwningClass() * @return service groups */ public ServiceGroupList getServiceGroups() { ServiceGroupList _result = null; Operation _op = null; TransactionalBehavior _behavior = zGetTransactionalBehaviorForReadWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForRead(this); if (_behavior.isPersisted()) { { { _op = ServiceGroupFinder.className().eq(_data.getName()); } } } else if (_behavior.isDetached()) { { { Operation detachedOp = ServiceGroupFinder.className().eq(_data.getName()); _result = new ServiceGroupList(detachedOp); _result.zSetForRelationship(); } } } else if (_behavior.isInMemory()) { _result = (ServiceGroupList) _data.getServiceGroups(); if (_result == null) { { _op = ServiceGroupFinder.className().eq(_data.getName()); } } } if (_op != null) { _result = new ServiceGroupList(_op); _result.zSetForRelationship(); } return _result; } public void setServiceGroups(ServiceGroupList serviceGroups) { ServiceGroupList _serviceGroups = (ServiceGroupList) serviceGroups; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForWrite(this); if (_behavior.isInMemory()) { _data.setServiceGroups(_serviceGroups); } else if (_behavior.isPersisted()) { _behavior.clearTempTransaction(this); } else throw new RuntimeException("not implemented"); } protected void cascadeInsertImpl() throws MithraBusinessException { TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForWrite(this); ParameterizedPropertyList parameterizedProperties = (ParameterizedPropertyList) _data.getParameterizedProperties(); _behavior.insert(this); if (parameterizedProperties != null) { parameterizedProperties.cascadeInsertAll(); } } @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) { KlassFinder.KlassRelatedFinder parentFinder = (KlassFinder.KlassRelatedFinder) parentFinderGeneric; TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); KlassData _newData = (KlassData) _behavior.getCurrentDataForWrite(this); { ParameterizedPropertyList parameterizedProperties = (ParameterizedPropertyList) _newData.getParameterizedProperties(); RelatedFinder dependentFinder = parentFinder.parameterizedProperties(); DeepRelationshipUtility.zAddToNavigationStats(dependentFinder, parameterizedProperties != null, navigationStats); if (parameterizedProperties != null) { parameterizedProperties.zCascadeAddNavigatedRelationshipsStats(dependentFinder, navigationStats); } } return navigationStats; } @Override public Map< RelatedFinder, StatisticCounter > zAddNavigatedRelationshipsStatsForDelete(RelatedFinder parentFinder, Map< RelatedFinder, StatisticCounter > navigationStats) { DeepRelationshipUtility.zAddAllDependentNavigationsStatsForDelete(parentFinder, navigationStats); return navigationStats; } @Override public Klass zCascadeCopyThenInsert() throws MithraBusinessException { TransactionalBehavior _behavior = zGetTransactionalBehaviorForWriteWithWaitIfNecessary(); KlassData _data = (KlassData) _behavior.getCurrentDataForWrite(this); ParameterizedPropertyList parameterizedProperties = (ParameterizedPropertyList) _data.getParameterizedProperties(); Klass original = (Klass) _behavior.copyThenInsert(this); if (parameterizedProperties != null) { parameterizedProperties.zCascadeCopyThenInsertAll(); } return original; } protected void cascadeDeleteImpl() throws MithraBusinessException { this.getParameterizedProperties().cascadeDeleteAll(); this.delete(); } public Cache zGetCache() { return KlassFinder.getMithraObjectPortal().getCache(); } public MithraObjectPortal zGetPortal() { return KlassFinder.getMithraObjectPortal(); } public Klass getOriginalPersistentObject() { return this.zFindOriginal(); } protected boolean issueUpdatesForNonPrimaryKeys(TransactionalBehavior behavior, MithraDataObject data, MithraDataObject newData) { boolean changed = false; changed |= zUpdateBoolean(behavior, data, newData, KlassFinder.abstractClass(), false); changed |= zUpdateString(behavior, data, newData, KlassFinder.superClassName(), false); return changed; } protected boolean issueUpdatesForPrimaryKeys(TransactionalBehavior behavior, MithraDataObject data, MithraDataObject newData) { boolean changed = false; changed |= zUpdateString(behavior, data, newData, KlassFinder.name(), false); return changed; } public Object readResolve() throws ObjectStreamException { KlassAbstract result = (KlassAbstract) 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 ParameterizedPropertiesAddHandlerInMemory implements DependentRelationshipAddHandler { public void addRelatedObject(MithraTransactionalObject relatedObject) { ParameterizedProperty item = (ParameterizedProperty) relatedObject; item.setOwningClassName(getName()); item.zSetParentContainerowningClass(KlassAbstract.this); } } protected class ParameterizedPropertiesAddHandlerPersisted implements DependentRelationshipAddHandler { public void addRelatedObject(MithraTransactionalObject relatedObject) { ParameterizedProperty item = (ParameterizedProperty) relatedObject; item.setOwningClassName(getName()); item.cascadeInsert(); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy