<?xml version="1.0" encoding="utf-8"?>
<!--
 *	CFGenKb
 *
 *	Copyright (c) 2014-2017 Mark Sobkow
 *	
 *	This program is available as free software under the GNU GPL v 2.0, or
 *	under a commercial license from Mark Sobkow.  For commercial licensing
 *	details, please contact msobkow@sasktel.net.
 *	
 *	Under the terms of the GPL:
 *	
 *		This program is free software: you can redistribute it and/or modify
 *		it under the terms of the GNU General Public License as published by
 *		the Free Software Foundation, either version 2.0 of the License, or
 *		(at your option) any later version.
 *	  
 *		This program is distributed in the hope that it will be useful,
 *		but WITHOUT ANY WARRANTY; without even the implied warranty of
 *		MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *		GNU General Public License for more details.
 *	  
 *		You should have received a copy of the GNU General Public License
 *		along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *-->
<MSSBam
		xmlns="uri://msscodefactory/mssbam"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xmlns:xs="http://www.w3.org/2001/XMLSchema"
		xsi:schemaLocation="uri://msscodefactory/mssbam file:../bin/xsd/mssbam-2.9.xsd"
		Name="CFGenKb"
		Revision="2.10"
		Description="CFGenKb"
		ProjectRoot="net.sourceforge.MSSCodeFactory.CFCore.2.10" >
	<Tld Name="org" >
		<TopDomain Name="apache" >
			<License Name="ApacheV2"
					Description="Apache Version 2 License">
Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
.
    http://www.apache.org/licenses/LICENSE-2.0
.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.</License>
		</TopDomain>
		<TopDomain Name="gnu" >
			<License Name="GplV2"
					Description="GNU GPL v2+ License">
This project is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
.
This project is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this project.  If not, see http://www.gnu.org/licenses/.</License>
			<License Name="GplV3"
					Description="GNU GPL v3+ License">
This project is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This project is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this project.  If not, see http://www.gnu.org/licenses/.</License>
			<License Name="LGplV2"
					Description="GNU Lesser/Library GPL v2+ License">
This project is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
.
This project is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser Public License for more details.
.
You should have received a copy of the GNU Lesser Public License
along with this project.  If not, see http://www.gnu.org/licenses/.</License>
			<License Name="LGplV3"
					Description="GNU Lesser/Library GPL v3+ License">
This project is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This project is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser Public License for more details.
.
You should have received a copy of the GNU Lesser Public License
along with this project.  If not, see http://www.gnu.org/licenses/.</License>
		</TopDomain>
	</Tld>
	<Tld Name="net" >
		<TopDomain Name="sourceforge" >
			<TopProject Name="MSSCodeFactory" >
				<SubProject Name="CFCore" >
					<MajorVersion Name="2" >
						<MinorVersion Name="10" >
<SchemaDef Name="CFGenKb"
		DbName="GenKb210"
		Description=""
		DefaultLicense="org.apache.ApacheV2"
		ExtendCFCore="false"
		CopyrightHolder="Mark Sobkow"
		CopyrightPeriod="2014-2017"
		AuthorEMail="msobkow@sasktel.net"
		ProjectURL="http://msscodefactory.sourceforge.net/"
		PublishURI="http://msscodefactory.sourceforge.net/model-2.9/net-sourceforge-MSSCodeFactory-CFCore-2-10-CFGenKb.xml" >

	<SchemaRef Name="CFSecurity"
			RefModelName="net-sourceforge-MSSCodeFactory-CFSecurity-2-10-CFSecurity"
			IncludeRoot="net.sourceforge.MSSCodeFactory.CFSecurity.2.10.CFSecurity" />

	<Id16Gen Name="DefClassIdGen"
			IsNullable="false"
			DefaultVisibility="true"
			MinValue="0"
			MaxValue="32767"
			InitValue="0"
			NullValue="0"
			Slice="1001"
			BlockSize="1" />

	<Id32Gen Name="GelInstructionIdGen"
			IsNullable="false"
			DefaultVisibility="true"
			MinValue="0"
			InitValue="0"
			NullValue="0"
			Dispenser="Tenant"
			Slice="1004"
			BlockSize="1" />

	<Id32Gen Name="GenItemIdGen"
			IsNullable="false"
			DefaultVisibility="true"
			MinValue="0"
			MaxValue="2147483647"
			InitValue="0"
			NullValue="0"
			Dispenser="Tenant"
			Slice="1003"
			BlockSize="1" />

	<StringType Name="GenItemNameType"
			IsNullable="false"
			DefaultVisibility="true"
			MaxLen="127"
			ShowLines="1"
			InitValue="" />

	<Id64Gen Name="RuleCartIdGen"
			IsNullable="false"
			DefaultVisibility="true"
			MinValue="0"
			InitValue="0"
			NullValue="0"
			Dispenser="Tenant"
			Slice="1002"
			BlockSize="1" />

	<Id16Gen Name="RuleTypeIdGen"
			IsNullable="false"
			DefaultVisibility="true"
			MinValue="0"
			MaxValue="32767"
			InitValue="0"
			NullValue="0"
			Slice="1005"
			BlockSize="1" />

	<Id16Gen Name="ToolIdGen"
			IsNullable="false"
			DefaultVisibility="true"
			MinValue="0"
			MaxValue="32767"
			InitValue="0"
			NullValue="0"
			Slice="1006"
			BlockSize="1" />

	<Id16Gen Name="ToolSetIdGen"
			IsNullable="false"
			DefaultVisibility="true"
			MinValue="0"
			MaxValue="32767"
			InitValue="0"
			NullValue="0"
			Slice="1007"
			BlockSize="1" />

	<Table Name="DefClass"
			TableClassCode="DCL"
			DbName="kbdefclass"
			Label="Definition Class"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LookupIndex="DefClassName"
			LoaderBehaviour="Insert"
			SecScope="None" >
		<TableCol Name="Id"
				IsNullable="false"
				DefaultVisibility="true"
				GenerateId="true"
				DataType="DefClassIdGen" />
		<StringCol Name="Name"
				DbName="safe_name"
				IsNullable="false"
				DefaultVisibility="true"
				MaxLen="32"
				ShowLines="1"
				InitValue="" />
		<TableCol Name="BaseId"
				Label="Base Id"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="DefClassIdGen" />
		<PrimaryIndex Name="DefClassIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="kbdefclass_id"
				Suffix="IdIdx" >
			<IndexCol Name="Id" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<Index Name="DefClassName"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="kbdefclass_name"
				Suffix="NameIdx" >
			<IndexCol Name="Name" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="DefClassBaseIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="kbdefclass_base"
				Suffix="BaseIdx" >
			<IndexCol Name="BaseId" IsAscending="true" DefaultVisibility="true" />
		</Index>
	</Table>

	<Table Name="GelInstruction"
			TableClassCode="GINS"
			DbName="gelinst"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="GelInstId"
				Label="GEL Instruction Id"
				IsNullable="false"
				DefaultVisibility="true"
				GenerateId="true"
				DataType="GelInstructionIdGen" />
		<TableCol Name="CallerId"
				Label="Caller Id"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<TableCol Name="PrevTenantId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="PrevCartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				GenerateId="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="PrevId"
				Label="Previous GEL Instruction Id"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<TableCol Name="NextTenantId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="NextCartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				GenerateId="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="NextId"
				Label="Next GEL Instruction Id"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<TextCol Name="SourceText"
				Label="Gel Source Text"
				IsNullable="false"
				DefaultVisibility="true"
				MaxLen="2000000"
				ShowLines="10"
				InitValue="" />
		<PrimaryIndex Name="GelInstructionIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="gelinst_pidx"
				Suffix="PIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelInstId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<Index Name="GelInstructionTenantIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelinst_xtenant"
				Suffix="TenantIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="GelInstructionCartridgeIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelinst_xcartridge"
				Suffix="CartridgeIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="GelInstructionCallerIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelinst_xcaller"
				Suffix="CallerIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CallerId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="GelInstructionPrevIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelinst_xprev"
				Suffix="PrevIdx" >
			<IndexCol Name="PrevTenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="PrevCartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="PrevId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="GelInstructionNextIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelinst_xnext"
				Suffix="NextIdx" >
			<IndexCol Name="NextTenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="NextCartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="NextId" IsAscending="true" DefaultVisibility="true" />
		</Index>

		<JavaObjInterface>
	public String expand( MssCFGenContext genContext );</JavaObjInterface>

		<JavaObjImport>
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFEngine;
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFGenContext;</JavaObjImport>

		<JavaObjImplementation>
	public String expand( MssCFGenContext genContext ) {
		throw new RuntimeException( &quot;$SchemaName$GelInstructionObj.expand() Must be overloaded by specializing instruction implementation&quot; );
	}
</JavaObjImplementation>

		<JavaEditObjImport>
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFEngine;
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFGenContext;</JavaEditObjImport>

		<JavaEditObjImplementation>
	public String expand( MssCFGenContext genContext ) {
		throw new RuntimeException( &quot;$SchemaName$GelInextructionEditObj.expand() You are not allowed to expand an object while it is being edited&quot; );
	}
</JavaEditObjImplementation>
	</Table>

	<Table Name="GelIterator"
			TableClassCode="GITR"
			DbName="geliter"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="GelInstId"
				Label="GEL Instruction Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<TableCol Name="IteratorName"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="ExpandBefore"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="ExpandFirst"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="ExpandEach"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="ExpandLast"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="ExpandLone"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="ExpandEmpty"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="ExpandAfter"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<PrimaryIndex Name="GelIteratorIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="geliter_pidx"
				Suffix="PIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelInstId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<Index Name="ExpandBeforeIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="geliter_xbefore"
				Suffix="BeforeIdx" >
			<IndexCol Name="ExpandBefore" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ExpandFirstIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="geliter_xfirst"
				Suffix="FirstIdx" >
			<IndexCol Name="ExpandFirst" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ExpandEachIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="geliter_xeach"
				Suffix="EachIdx" >
			<IndexCol Name="ExpandEach" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ExpandLastIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="geliter_xlast"
				Suffix="LastIdx" >
			<IndexCol Name="ExpandLast" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ExpandLoneIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="geliter_xlone"
				Suffix="LoneIdx" >
			<IndexCol Name="ExpandLone" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ExpandEmptyIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="geliter_xempty"
				Suffix="EmptyIdx" >
			<IndexCol Name="ExpandEmpty" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<SuperClassRelation Name="SuperClass"
				DbName="geliter_super"
				Suffix="SuperClass"
				FromIndex="GelIteratorIdIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GelInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</SuperClassRelation>

		<JavaObjImport>
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.*;</JavaObjImport>

		<JavaObjImplementation>
	public String expand( MssCFGenContext genContext ) {
		String					itemExpansion = null;
		ICFLibAnyObj			detailDef = null;
		MssCFGenContext			detailContext = null;
		int						idx;
		int						numItems = 0;
		List&lt;ICFLibAnyObj&gt;		detailList;

		I$SchemaName$GenItemObj		itemBefore = null;
		I$SchemaName$GenItemObj		itemAfter = null;
		I$SchemaName$GenItemObj		itemEmpty = null;

		I$SchemaName$GenItemObj		itemRule = null;

		String					failedBefore = null;
		String					failedFirst = null;
		String					failedEach = null;
		String					failedLast = null;
		String					failedAfter = null;
		String					failedLone = null;
		String					failedEmpty = null;

		String					expansion = null;
		MssCFGenContext			subContext = null;

		final String S_ProcName = &quot;$SchemaName$GelIteratorObj.expand() &quot;;

		String				iteratorName = getRequiredIteratorName();
		String				bodyBefore = getOptionalExpandBefore();
		String				bodyFirst = getOptionalExpandFirst();
		String				bodyEach = getRequiredExpandEach();
		String				bodyLast = getOptionalExpandLast();
		String				bodyAfter = getOptionalExpandAfter();
		String				bodyLone = getOptionalExpandLone();
		String				bodyEmpty = getOptionalExpandEmpty();

		MssCFEngine genEngine = genContext.getGenEngine();
		
		I$SchemaName$GenItemObj genItem = genEngine.findContextItem(genContext, iteratorName );
		if( genItem == null ) {
			genEngine.getLog().message( &quot;Could not find iterator \&quot;&quot;
				+ iteratorName
				+ &quot;\&quot; attempting to expand \&quot;&quot;
				+ &quot;$$&quot; + getRequiredSourceText() + &quot;$$\&quot;&quot; );
			return( null );
		}

		if( ! ( genItem instanceof MssCFGenIteratorObj ) ) {
			genEngine.getLog().message( &quot;Context item \&quot;&quot;
				+ iteratorName
				+ &quot;\&quot; must be a MssCFGenIteratorObj, not a &quot;
				+ genItem.getClass().getPackage().getName() + &quot;.&quot; + genItem.getClass().getName()
				+ &quot;.  \&quot;&quot;
				+ &quot;$$&quot; + getRequiredSourceText() + &quot;$$&quot;
				+ &quot;\&quot; is invalid&quot; );
			return( null );
		}
		
		MssCFGenIteratorObj	iterator = (MssCFGenIteratorObj)genItem;
		
		String detailClassName;
		if (iterator.getDetailClass() != null) {
			detailClassName = iterator.getDetailClass().getRequiredName();
		}
		else {
			detailClassName = genEngine.getAnyClassName();
		}

		iteratorName = iterator.getRequiredName();

		if( ( iteratorName == null ) || ( 0 == iteratorName.length() ) ) {
			throw new RuntimeException( S_ProcName +  &quot;Iterator is not properly named&quot; );
		}

		if( ( detailClassName == null ) || ( 0 == detailClassName.length() ) ) {
			throw new RuntimeException( S_ProcName +  &quot;Iterator must specify a detail class name&quot; );
		}

	//	Create a sub-context for locating the iterators

		subContext = genEngine.getGenContextFactory().newGenContext( genContext, detailClassName, null );
		subContext.setPrevContext( genContext );

		if( bodyBefore != null ) {
			failedBefore = &quot;$$&quot; + bodyBefore + &quot;$$&quot;;
			itemBefore = genEngine.findContextItem( genContext, bodyBefore );
			if( itemBefore == null ) {
				genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
					+ iteratorName
					+ &quot;\&quot; &quot;
					+ MssCFGelCompiler._ITERATOR_BEFORE
					+ &quot; \&quot;&quot;
					+ bodyBefore
					+ &quot;\&quot;&quot; );
			}
		}

		if( bodyAfter != null ) {
			failedAfter = &quot;$$&quot; + bodyAfter + &quot;$$&quot;;
			itemAfter = genEngine.findContextItem( genContext, bodyAfter );
			if( itemAfter == null ) {
				genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
					+ iteratorName
					+ &quot;\&quot; &quot;
					+ MssCFGelCompiler._ITERATOR_AFTER
					+ &quot; \&quot;&quot;
					+ bodyAfter
					+ &quot;\&quot;&quot; );
			}
		}

		if( bodyEmpty != null ) {
			failedEmpty = &quot;$$&quot; + bodyEmpty + &quot;$$&quot;;
			if( ! bodyEmpty.equals( MssCFGelCompiler._ITERATOR_EMPTY ) ) {
				itemEmpty = genEngine.findContextItem( genContext, bodyEmpty );
				if( itemEmpty == null ) {
					genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
						+ iteratorName
						+ &quot;\&quot; &quot;
						+ MssCFGelCompiler._ITERATOR_EMPTY
						+ &quot; \&quot;&quot;
						+ bodyEmpty
						+ &quot;\&quot;&quot; );
				}
			}
		}

		if( bodyFirst != null ) {
			failedFirst = &quot;$$&quot; + bodyFirst + &quot;$$&quot;;
		}

		if( bodyEach != null ) {
			failedEach = &quot;$$&quot; + bodyEach + &quot;$$&quot;;
		}

		if( bodyLast != null ) {
			failedLast = &quot;$$&quot; + bodyLast + &quot;$$&quot;;
		}

		if( bodyLone != null ) {
			failedLone = &quot;$$&quot; + bodyLone + &quot;$$&quot;;
		}

	//	compile the iteration.  If we got a null iteration back, something
	//	went wrong and we treat the expansion as being in error.

		detailList = iterator.getDetailList( genContext );
		if( detailList == null ) {
			genEngine.getLog().message( &quot;Could not get &quot;
				+ iteratorName
				+ &quot; detail object iteration.  \&quot;&quot;
				+ &quot;$$&quot; + getRequiredSourceText() + &quot;$$&quot;
				+ &quot;\&quot; is invalid&quot; );
			return( null );
		}

	//	Prepare to perform the expansions

		expansion = &quot;&quot;;

	//	If a BEFORE item is provided, we always expand it using the CURRENT
	//	context, not a sub-context.

		if( bodyBefore != null ) {
			if( itemBefore != null ) {
				itemExpansion = genContext.expandItemBody( itemBefore );
				if( itemExpansion != null ) {
					expansion = expansion + itemExpansion;
				}
				else {
					expansion = expansion + failedBefore;
				}
			}
			else {
				expansion = expansion + failedBefore;
			}
		}

	//	How we perform the expansion depends on what iterator limbs
	//	have been specified and on the number of items to process.

		numItems = detailList.size();

		//	If the detail set is empty, expand EMPTY if it&apos;s provided

		if( numItems == 0 ) {
			if( bodyEmpty != null ) {
				if( itemEmpty != null ) {
					itemExpansion = genContext.expandItemBody( itemEmpty );
					if( itemExpansion != null ) {
						expansion = expansion + itemExpansion;
					}
					else {
						expansion = expansion + failedEmpty;
					}
				}
				else if( ! bodyEmpty.equals( MssCFGelCompiler._ITERATOR_EMPTY ) ) {
					expansion = expansion + failedEmpty;
				}
			}
			else {
				genEngine.getLog().message( &quot;Expansion of iterator \&quot;&quot; + iteratorName + &quot;\&quot; returned an empty set&quot; );
			}
		}

	//	If the detail set has one item, preferentially expand one of
	//	LONE, LAST, FIRST, or EACH limb

		else if( numItems == 1 ) {

			detailDef = detailList.get(0);
			detailContext = genEngine.getGenContextFactory().newGenContext( genContext,
				detailDef.getGenDefName(),
				detailDef );
			detailContext.setPrevContext( genContext );

			if( bodyLone != null ) {
				itemRule = genEngine.findContextItem( detailContext, bodyLone );
				if( itemRule != null ) {
					itemExpansion = detailContext.expandItemBody( itemRule );
					if( itemExpansion != null ) {
						expansion = expansion + itemExpansion;
					}
					else {
						expansion = expansion + failedLone;
					}
				}
				else {
					genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
						+ iteratorName
						+ &quot;\&quot; &quot;
						+ MssCFGelCompiler._ITERATOR_LONE
						+ &quot; \&quot;&quot;
						+ bodyLone
						+ &quot;\&quot;&quot; );
					expansion = expansion + failedLone;
				}
			}
			else if( bodyFirst != null ) {
				itemRule = genEngine.findContextItem( detailContext, bodyFirst );
				if( itemRule != null ) {
					itemExpansion = detailContext.expandItemBody( itemRule );
					if( itemExpansion != null ) {
						expansion = expansion + itemExpansion;
					}
					else {
						expansion = expansion + failedFirst;
					}
				}
				else {
					genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
						+ iteratorName
						+ &quot;\&quot; &quot;
						+ MssCFGelCompiler._ITERATOR_FIRST
						+ &quot; \&quot;&quot;
						+ bodyFirst
						+ &quot;\&quot;&quot; );
					expansion = expansion + failedFirst;
				}
			}
			else if( bodyLast != null ) {
				itemRule = genEngine.findContextItem( detailContext, bodyLast );
				if( itemRule != null ) {
					itemExpansion = detailContext.expandItemBody( itemRule );
					if( itemExpansion != null ) {
						expansion = expansion + itemExpansion;
					}
					else {
						expansion = expansion + failedLast;
					}
				}
				else {
					genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
						+ iteratorName
						+ &quot;\&quot; &quot;
						+ MssCFGelCompiler._ITERATOR_LAST
						+ &quot; \&quot;&quot;
						+ bodyLast
						+ &quot;\&quot;&quot; );
					expansion = expansion + failedLast;
				}
			}
			else {
				itemRule = genEngine.findContextItem( detailContext, bodyEach );
				if( itemRule != null ) {
					itemExpansion = detailContext.expandItemBody( itemRule );
					if( itemExpansion != null ) {
						expansion = expansion + itemExpansion;
					}
					else {
						expansion = expansion + failedEach;
					}
				}
				else {
					genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
						+ iteratorName
						+ &quot;\&quot; &quot;
						+ MssCFGelCompiler._ITERATOR_EACH
						+ &quot; \&quot;&quot;
						+ bodyEach
						+ &quot;\&quot;&quot; );
					expansion = expansion + failedEach;
				}
			}
		}
		else {

	//	If the detail set has n items:

	//		The first item is expanded by FIRST or EACH

			detailDef = detailList.get(0);
			detailContext = genEngine.getGenContextFactory().newGenContext( genContext,
				detailDef.getGenDefName(),
				detailDef );
			detailContext.setPrevContext( genContext );

			if( bodyFirst != null ) {
				itemRule = genEngine.findContextItem( detailContext, bodyFirst );
				if( itemRule != null ) {
					itemExpansion = detailContext.expandItemBody( itemRule );
					if( itemExpansion != null ) {
						expansion = expansion + itemExpansion;
					}
					else {
						expansion = expansion + failedFirst;
					}
				}
				else {
					genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
						+ iteratorName
						+ &quot;\&quot; &quot;
						+ MssCFGelCompiler._ITERATOR_FIRST
						+ &quot; \&quot;&quot;
						+ bodyFirst
						+ &quot;\&quot;&quot; );
					expansion = expansion + failedFirst;
				}
			}
			else {
				itemRule = genEngine.findContextItem( detailContext, bodyEach );
				if( itemRule != null ) {
					itemExpansion = detailContext.expandItemBody( itemRule );
					if( itemExpansion != null ) {
						expansion = expansion + itemExpansion;
					}
					else {
						expansion = expansion + failedEach;
					}
				}
				else {
					genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
						+ iteratorName
						+ &quot;\&quot; &quot;
						+ MssCFGelCompiler._ITERATOR_EACH
						+ &quot; \&quot;&quot;
						+ bodyEach
						+ &quot;\&quot;&quot; );
					expansion = expansion + failedEach;
				}
			}

	//		The middle items are always expanded by EACH

			for( idx = 1; idx &lt; numItems - 1; idx ++ ) {

				detailDef = detailList.get( idx );
				detailContext = genEngine.getGenContextFactory().newGenContext( genContext,
					detailDef.getGenDefName(),
					detailDef );
				detailContext.setPrevContext( genContext );

				itemRule = genEngine.findContextItem( detailContext, bodyEach );
				if( itemRule != null ) {
					itemExpansion = detailContext.expandItemBody( itemRule );
					if( itemExpansion != null ) {
						expansion = expansion + itemExpansion;
					}
					else {
						expansion = expansion + failedEach;
					}
				}
				else {
					genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
						+ iteratorName
						+ &quot;\&quot; &quot;
						+ MssCFGelCompiler._ITERATOR_EACH
						+ &quot; \&quot;&quot;
						+ bodyEach
						+ &quot;\&quot;&quot; );
					expansion = expansion + failedEach;
				}
			}

	//		The last item is expanded by LAST or EACH

			detailDef = detailList.get( numItems - 1 );
			detailContext = genEngine.getGenContextFactory().newGenContext( genContext,
				detailDef.getGenDefName(),
				detailDef );
			detailContext.setPrevContext( genContext );

			if( bodyLast != null ) {
				itemRule = genEngine.findContextItem( detailContext, bodyLast );
				if( itemRule != null ) {
					itemExpansion = detailContext.expandItemBody( itemRule );
					if( itemExpansion != null ) {
						expansion = expansion + itemExpansion;
					}
					else {
						expansion = expansion + failedLast;
					}
				}
				else {
					genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
						+ iteratorName
						+ &quot;\&quot; &quot;
						+ MssCFGelCompiler._ITERATOR_LAST
						+ &quot; \&quot;&quot;
						+ bodyLast
						+ &quot;\&quot;&quot; );
					expansion = expansion + failedLast;
				}
			}
			else {
				itemRule = genEngine.findContextItem( detailContext, bodyEach );
				if( itemRule != null ) {
					itemExpansion = detailContext.expandItemBody( itemRule );
					if( itemExpansion != null ) {
						expansion = expansion + itemExpansion;
					}
					else {
						expansion = expansion + failedEach;
					}
				}
				else {
					genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
						+ iteratorName
						+ &quot;\&quot; &quot;
						+ MssCFGelCompiler._ITERATOR_EACH
						+ &quot; \&quot;&quot;
						+ bodyEach
						+ &quot;\&quot;&quot; );
					expansion = expansion + failedEach;
				}
			}
		}

	//	If an AFTER item is provided, we always expand it using the CURRENT
	//	context, not a sub-context.

		if( bodyAfter != null ) {
			if( itemAfter != null ) {
				itemExpansion = genContext.expandItemBody( itemAfter );
				if( itemExpansion != null ) {
					expansion = expansion + itemExpansion;
				}
				else {
					expansion = expansion + failedAfter;
				}
			}
			else {
				expansion = expansion + failedAfter;
			}
		}

	//	Return the cumulative results of the expansion

		return( expansion );
	}
</JavaObjImplementation>
	</Table>

	<Table Name="GelSpread"
			TableClassCode="GSPR"
			DbName="gelspred"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="GelInstId"
				Label="GEL Instruction Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<TableCol Name="IteratorName"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="ExpandBetween"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="ExpandBefore"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="ExpandFirst"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="ExpandEach"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="ExpandLast"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="ExpandLone"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="ExpandEmpty"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="ExpandAfter"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<PrimaryIndex Name="GelSpreadIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="gelspred_pidx"
				Suffix="PIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelInstId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<Index Name="ExpandBetweenIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelspred_xbetween"
				Suffix="BetweenIdx" >
			<IndexCol Name="ExpandBetween" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ExpandBeforeIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelspred_xbefore"
				Suffix="BeforeIdx" >
			<IndexCol Name="ExpandBefore" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ExpandFirstIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelspred_xfirst"
				Suffix="FirstIdx" >
			<IndexCol Name="ExpandFirst" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ExpandEachIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelspred_xeach"
				Suffix="EachIdx" >
			<IndexCol Name="ExpandEach" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ExpandLastIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelspred_xlast"
				Suffix="LastIdx" >
			<IndexCol Name="ExpandLast" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ExpandLoneIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelspred_xlone"
				Suffix="LoneIdx" >
			<IndexCol Name="ExpandLone" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ExpandEmptyIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelspred_xempty"
				Suffix="EmptyIdx" >
			<IndexCol Name="ExpandEmpty" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<SuperClassRelation Name="SuperClass"
				DbName="gelspred_super"
				Suffix="SuperClass"
				FromIndex="GelSpreadIdIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GelInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</SuperClassRelation>

		<JavaObjImport>
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.*;</JavaObjImport>

		<JavaObjImplementation>
	public String expand( MssCFGenContext genContext ) {
		String					itemExpansion = null;
		ICFLibAnyObj			detailDef = null;
		MssCFGenContext			detailContext = null;
		int						idx;
		int						numItems = 0;
		int						totalItems = 0;
		List&lt;ICFLibAnyObj&gt;		detailList;

		ICFGenKbGenItemObj		itemBetween = null;
		ICFGenKbGenItemObj		itemBefore = null;
		ICFGenKbGenItemObj		itemAfter = null;
		ICFGenKbGenItemObj		itemEmpty = null;

		ICFGenKbGenItemObj		itemRule = null;

		String					failedBetween = null;
		String					failedBefore = null;
		String					failedFirst = null;
		String					failedEach = null;
		String					failedLast = null;
		String					failedAfter = null;
		String					failedLone = null;
		String					failedEmpty = null;

		String					expansion = null;
		MssCFGenContext			subContext = null;

		final String S_ProcName = &quot;CFGenKbGelSpreadObj.expand() &quot;;

		String				iteratorName = getRequiredIteratorName();
		String				bodyBetween = getOptionalExpandBetween();
		String				bodyBefore = getOptionalExpandBefore();
		String				bodyFirst = getOptionalExpandFirst();
		String				bodyEach = getRequiredExpandEach();
		String				bodyLast = getOptionalExpandLast();
		String				bodyAfter = getOptionalExpandAfter();
		String				bodyLone = getOptionalExpandLone();
		String				bodyEmpty = getOptionalExpandEmpty();

		MssCFEngine genEngine = genContext.getGenEngine();
		
		ICFGenKbGenItemObj genItem = genEngine.findContextItem(genContext, iteratorName );
		if( genItem == null ) {
			genEngine.getLog().message( &quot;Could not find iterator \&quot;&quot;
				+ iteratorName
				+ &quot;\&quot; attempting to expand \&quot;&quot;
				+ &quot;$&quot; + getRequiredSourceText() + &quot;$\&quot;&quot; );
			return( null );
		}

		if( ! ( genItem instanceof MssCFGenIteratorObj ) ) {
			genEngine.getLog().message( &quot;Context item \&quot;&quot;
				+ iteratorName
				+ &quot;\&quot; must be a MssCFGenIteratorObj, not a &quot;
				+ genItem.getClass().getPackage().getName() + &quot;.&quot; + genItem.getClass().getName()
				+ &quot;.  \&quot;&quot;
				+ &quot;$&quot; + getRequiredSourceText() + &quot;$&quot;
				+ &quot;\&quot; is invalid&quot; );
			return( null );
		}
		
		MssCFGenIteratorObj	iterator = (MssCFGenIteratorObj)genItem;
		
		String detailClassName;
		if (iterator.getDetailClass() != null) {
			detailClassName = iterator.getDetailClass().getRequiredName();
		}
		else {
			detailClassName = genEngine.getAnyClassName();
		}

		iteratorName = iterator.getRequiredName();

		if( ( iteratorName == null ) || ( 0 == iteratorName.length() ) ) {
			throw new RuntimeException( S_ProcName +  &quot;Iterator is not properly named&quot; );
		}

		if( ( detailClassName == null ) || ( 0 == detailClassName.length() ) ) {
			throw new RuntimeException( S_ProcName +  &quot;Iterator must specify a detail class name&quot; );
		}

		subContext = genEngine.getGenContextFactory().newGenContext( genContext, detailClassName, null );
		subContext.setPrevContext( genContext );

		if( bodyBetween != null ) {
			failedBetween = &quot;$&quot; + bodyBetween + &quot;$&quot;;
			itemBetween = genEngine.findContextItem( genContext, bodyBetween );
			if( itemBetween == null ) {
				genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
					+ iteratorName
					+ &quot;\&quot; &quot;
					+ MssCFGelCompiler._SPREAD_BETWEEN
					+ &quot; \&quot;&quot;
					+ bodyBetween
					+ &quot;\&quot;&quot; );
			}
		}

		if( bodyBefore != null ) {
			failedBefore = &quot;$&quot; + bodyBefore + &quot;$&quot;;
			itemBefore = genEngine.findContextItem( genContext, bodyBefore );
			if( itemBefore == null ) {
				genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
					+ iteratorName
					+ &quot;\&quot; &quot;
					+ MssCFGelCompiler._ITERATOR_BEFORE
					+ &quot; \&quot;&quot;
					+ bodyBefore
					+ &quot;\&quot;&quot; );
			}
		}

		if( bodyAfter != null ) {
			failedAfter = &quot;$&quot; + bodyAfter + &quot;$&quot;;
			itemAfter = genEngine.findContextItem( genContext, bodyAfter );
			if( itemAfter == null ) {
				genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
					+ iteratorName
					+ &quot;\&quot; &quot;
					+ MssCFGelCompiler._ITERATOR_AFTER
					+ &quot; \&quot;&quot;
					+ bodyAfter
					+ &quot;\&quot;&quot; );
			}
		}

		if( bodyEmpty != null ) {
			failedEmpty = &quot;$&quot; + bodyEmpty + &quot;$&quot;;
			if( ! bodyEmpty.equals( MssCFGelCompiler._ITERATOR_EMPTY ) ) {
				itemEmpty = genEngine.findContextItem( genContext, bodyEmpty );
				if( itemEmpty == null ) {
					genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
						+ iteratorName
						+ &quot;\&quot; &quot;
						+ MssCFGelCompiler._ITERATOR_EMPTY
						+ &quot; \&quot;&quot;
						+ bodyEmpty
						+ &quot;\&quot;&quot; );
				}
			}
		}

		if( bodyFirst != null ) {
			failedFirst = &quot;$&quot; + bodyFirst + &quot;$&quot;;
		}

		if( bodyEach != null ) {
			failedEach = &quot;$&quot; + bodyEach + &quot;$&quot;;
		}

		if( bodyLast != null ) {
			failedLast = &quot;$&quot; + bodyLast + &quot;$&quot;;
		}

		if( bodyLone != null ) {
			failedLone = &quot;$&quot; + bodyLone + &quot;$&quot;;
		}

		detailList = iterator.getDetailList( genContext );
		if( detailList == null ) {
			genEngine.getLog().message( &quot;Could not get &quot;
				+ iteratorName
				+ &quot; detail object iteration.  \&quot;&quot;
				+ &quot;$&quot; + getRequiredSourceText() + &quot;$&quot;
				+ &quot;\&quot; is invalid&quot; );
			return( null );
		}

		expansion = &quot;&quot;;

		totalItems = detailList.size();

		if( totalItems &lt;= 0 ) {
			if( bodyEmpty != null ) {
				if( itemEmpty != null ) {
					itemExpansion = genContext.expandItemBody( itemEmpty );
					if( itemExpansion != null ) {
						expansion = expansion + itemExpansion;
					}
					else {
						expansion = expansion + failedEmpty;
					}
				}
				else if( ! bodyEmpty.equals( MssCFGelCompiler._ITERATOR_EMPTY ) ) {
					expansion = expansion + failedEmpty;
				}
			}
			else {
				genEngine.getLog().message( &quot;Expansion of iterator \&quot;&quot; + iteratorName + &quot;\&quot; returned an empty set&quot; );
			}
		}
		else {

			numItems = totalItems;
			while( numItems &gt; 0 ) {
	
				if( bodyBefore != null ) {
					if( itemBefore != null ) {
						itemExpansion = genContext.expandItemBody( itemBefore );
						if( itemExpansion != null ) {
							expansion = expansion + itemExpansion;
						}
						else {
							expansion = expansion + failedBefore;
						}
					}
					else {
						expansion = expansion + failedBefore;
					}
				}
		
				if( numItems == 1 ) {
		
					detailDef = detailList.get(0);
					detailContext = genEngine.getGenContextFactory().newGenContext( genContext,
						detailDef.getGenDefName(),
						detailDef );
					detailContext.setPrevContext( genContext );
		
					if( bodyLone != null ) {
						itemRule = genEngine.findContextItem( detailContext, bodyLone );
						if( itemRule != null ) {
							itemExpansion = detailContext.expandItemBody( itemRule );
							if( itemExpansion != null ) {
								expansion = expansion + itemExpansion;
							}
							else {
								expansion = expansion + failedLone;
							}
						}
						else {
							genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
								+ iteratorName
								+ &quot;\&quot; &quot;
								+ MssCFGelCompiler._ITERATOR_LONE
								+ &quot; \&quot;&quot;
								+ bodyLone
								+ &quot;\&quot;&quot; );
							expansion = expansion + failedLone;
						}
					}
					else if( bodyFirst != null ) {
						itemRule = genEngine.findContextItem( detailContext, bodyFirst );
						if( itemRule != null ) {
							itemExpansion = detailContext.expandItemBody( itemRule );
							if( itemExpansion != null ) {
								expansion = expansion + itemExpansion;
							}
							else {
								expansion = expansion + failedFirst;
							}
						}
						else {
							genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
								+ iteratorName
								+ &quot;\&quot; &quot;
								+ MssCFGelCompiler._ITERATOR_FIRST
								+ &quot; \&quot;&quot;
								+ bodyFirst
								+ &quot;\&quot;&quot; );
							expansion = expansion + failedFirst;
						}
					}
					else if( bodyLast != null ) {
						itemRule = genEngine.findContextItem( detailContext, bodyLast );
						if( itemRule != null ) {
							itemExpansion = detailContext.expandItemBody( itemRule );
							if( itemExpansion != null ) {
								expansion = expansion + itemExpansion;
							}
							else {
								expansion = expansion + failedLast;
							}
						}
						else {
							genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
								+ iteratorName
								+ &quot;\&quot; &quot;
								+ MssCFGelCompiler._ITERATOR_LAST
								+ &quot; \&quot;&quot;
								+ bodyLast
								+ &quot;\&quot;&quot; );
							expansion = expansion + failedLast;
						}
					}
					else {
						itemRule = genEngine.findContextItem( detailContext, bodyEach );
						if( itemRule != null ) {
							itemExpansion = detailContext.expandItemBody( itemRule );
							if( itemExpansion != null ) {
								expansion = expansion + itemExpansion;
							}
							else {
								expansion = expansion + failedEach;
							}
						}
						else {
							genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
								+ iteratorName
								+ &quot;\&quot; &quot;
								+ MssCFGelCompiler._ITERATOR_EACH
								+ &quot; \&quot;&quot;
								+ bodyEach
								+ &quot;\&quot;&quot; );
							expansion = expansion + failedEach;
						}
					}
				}
				else {
		
					detailDef = detailList.get(0);
					detailContext = genEngine.getGenContextFactory().newGenContext( genContext,
						detailDef.getGenDefName(),
						detailDef );
					detailContext.setPrevContext( genContext );
		
					if( bodyFirst != null ) {
						itemRule = genEngine.findContextItem( detailContext, bodyFirst );
						if( itemRule != null ) {
							itemExpansion = detailContext.expandItemBody( itemRule );
							if( itemExpansion != null ) {
								expansion = expansion + itemExpansion;
							}
							else {
								expansion = expansion + failedFirst;
							}
						}
						else {
							genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
								+ iteratorName
								+ &quot;\&quot; &quot;
								+ MssCFGelCompiler._ITERATOR_FIRST
								+ &quot; \&quot;&quot;
								+ bodyFirst
								+ &quot;\&quot;&quot; );
							expansion = expansion + failedFirst;
						}
					}
					else {
						itemRule = genEngine.findContextItem( detailContext, bodyEach );
						if( itemRule != null ) {
							itemExpansion = detailContext.expandItemBody( itemRule );
							if( itemExpansion != null ) {
								expansion = expansion + itemExpansion;
							}
							else {
								expansion = expansion + failedEach;
							}
						}
						else {
							genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
								+ iteratorName
								+ &quot;\&quot; &quot;
								+ MssCFGelCompiler._ITERATOR_EACH
								+ &quot; \&quot;&quot;
								+ bodyEach
								+ &quot;\&quot;&quot; );
							expansion = expansion + failedEach;
						}
					}
		
					for( idx = 1; idx &lt; numItems - 1; idx ++ ) {
		
						detailDef = detailList.get( idx );
						detailContext = genEngine.getGenContextFactory().newGenContext( genContext,
							detailDef.getGenDefName(),
							detailDef );
						detailContext.setPrevContext( genContext );
		
						itemRule = genEngine.findContextItem( detailContext, bodyEach );
						if( itemRule != null ) {
							itemExpansion = detailContext.expandItemBody( itemRule );
							if( itemExpansion != null ) {
								expansion = expansion + itemExpansion;
							}
							else {
								expansion = expansion + failedEach;
							}
						}
						else {
							genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
								+ iteratorName
								+ &quot;\&quot; &quot;
								+ MssCFGelCompiler._ITERATOR_EACH
								+ &quot; \&quot;&quot;
								+ bodyEach
								+ &quot;\&quot;&quot; );
							expansion = expansion + failedEach;
						}
					}
		
					detailDef = detailList.get( numItems - 1 );
					detailContext = genEngine.getGenContextFactory().newGenContext( genContext,
						detailDef.getGenDefName(),
						detailDef );
					detailContext.setPrevContext( genContext );
		
					if( bodyLast != null ) {
						itemRule = genEngine.findContextItem( detailContext, bodyLast );
						if( itemRule != null ) {
							itemExpansion = detailContext.expandItemBody( itemRule );
							if( itemExpansion != null ) {
								expansion = expansion + itemExpansion;
							}
							else {
								expansion = expansion + failedLast;
							}
						}
						else {
							genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
								+ iteratorName
								+ &quot;\&quot; &quot;
								+ MssCFGelCompiler._ITERATOR_LAST
								+ &quot; \&quot;&quot;
								+ bodyLast
								+ &quot;\&quot;&quot; );
							expansion = expansion + failedLast;
						}
					}
					else {
						itemRule = genEngine.findContextItem( detailContext, bodyEach );
						if( itemRule != null ) {
							itemExpansion = detailContext.expandItemBody( itemRule );
							if( itemExpansion != null ) {
								expansion = expansion + itemExpansion;
							}
							else {
								expansion = expansion + failedEach;
							}
						}
						else {
							genEngine.getLog().message( &quot;Could not find expansion item for iterator \&quot;&quot;
								+ iteratorName
								+ &quot;\&quot; &quot;
								+ MssCFGelCompiler._ITERATOR_EACH
								+ &quot; \&quot;&quot;
								+ bodyEach
								+ &quot;\&quot;&quot; );
							expansion = expansion + failedEach;
						}
					}
				}
		
				if( bodyAfter != null ) {
					if( itemAfter != null ) {
						itemExpansion = genContext.expandItemBody( itemAfter );
						if( itemExpansion != null ) {
							expansion = expansion + itemExpansion;
						}
						else {
							expansion = expansion + failedAfter;
						}
					}
					else {
						expansion = expansion + failedAfter;
					}
				}
			
				numItems --;
			
				if( numItems &gt; 0 ) {
					if( bodyBetween != null ) {
						if( itemBetween != null ) {
							itemExpansion = genContext.expandItemBody( itemBetween );
							if( itemExpansion != null ) {
								expansion = expansion + itemExpansion;
							}
							else {
								expansion = expansion + failedBetween;
							}
						}
						else {
							expansion = expansion + failedBetween;
						}
					}
				}
			}
		}

		return( expansion );
	}
</JavaObjImplementation>
	</Table>

	<Table Name="GelPop"
			TableClassCode="GPOP"
			DbName="gelpop"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="GelInstId"
				Label="GEL Instruction Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<TableCol Name="GoalTypeName"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="RemainderTenantId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="RemainderCartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				GenerateId="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="RemainderInstId"
				Label="Remainder Instruction Id"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<PrimaryIndex Name="GelPopIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="gelpop_pidx"
				Suffix="PIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelInstId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<Index Name="GelPopRemainderInstIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelpop_xremainder"
				Suffix="RemainderIdx" >
			<IndexCol Name="RemainderTenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="RemainderCartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="RemainderInstId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<SuperClassRelation Name="SuperClass"
				DbName="gelpop_super"
				Suffix="SuperClass"
				FromIndex="GelPopIdIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GelInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</SuperClassRelation>

		<JavaObjImport>
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFEngine;
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFGenContext;</JavaObjImport>

		<JavaObjImplementation>
	public $SchemaName$GelPopObj( I$SchemaName$GelInstructionObj invokingInstruction ) {
		super( invokingInstruction.getSchema() );
	}

	public String expand( MssCFGenContext genContext ) {
		throw new RuntimeException( &quot;$SchemaName$GelPopObj.expand() must be specialized by the pop implementation&quot; );
	}
</JavaObjImplementation>
	</Table>

	<Table Name="GelPrefixLine"
			TableClassCode="GPFX"
			DbName="gelprefix"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="GelInstId"
				Label="GEL Instruction Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<TableCol Name="PrefixName"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="RemainderTenantId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="RemainderCartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				GenerateId="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="RemainderInstId"
				Label="Remainder Instruction Id"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<PrimaryIndex Name="GelPrefixLineIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="gelprefix_pidx"
				Suffix="PIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelInstId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<Index Name="GelPrefixLineRemainderInstIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelprefix_xremainder"
				Suffix="RemainderIdx" >
			<IndexCol Name="RemainderTenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="RemainderCartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="RemainderInstId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<SuperClassRelation Name="SuperClass"
				DbName="gelprefix_super"
				Suffix="SuperClass"
				FromIndex="GelPrefixLineIdIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GelInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</SuperClassRelation>

		<JavaObjImport>
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.*;</JavaObjImport>

		<JavaObjImplementation>
	public String expand( MssCFGenContext genContext ) {
		final String S_ProcName = &quot;$SchemaName$GelPrefixLineObj.expand() &quot;;

		String prefixName = getRequiredPrefixName();
		if( ( prefixName == null ) || ( prefixName.length() == 0 ) ) {
			throw new RuntimeException( S_ProcName + &quot;Required PrefixName was not specified&quot; );
		}
		
		String prefixStrValue;
		I$SchemaName$GenItemObj prefixItem = genContext.getGenEngine().findContextItem(genContext, prefixName );
		if( prefixItem == null ) {
			throw new RuntimeException( S_ProcName + &quot;Could not resolve prefix \&quot;&quot; + prefixName + &quot;\&quot;, $&quot; + getRequiredSourceText() + &quot;$ is invalid&quot; );
		}
		
		if( prefixItem instanceof MssCFGenFileObj ) {
			prefixStrValue = ((MssCFGenFileObj)prefixItem).expandBody( genContext );
		}
		else if( prefixItem instanceof MssCFGenRuleObj ) {
			prefixStrValue = ((MssCFGenRuleObj)prefixItem).expandBody( genContext );
		}
		else if (prefixItem instanceof MssCFGenTruncObj)
		{
			prefixStrValue = ((MssCFGenTruncObj)prefixItem).expandBody( genContext );
		}
		else if (prefixItem instanceof MssCFGenBindObj)
		{
			prefixStrValue = ((MssCFGenBindObj)prefixItem).expandBody( genContext );
		}
		else if( prefixItem instanceof MssCFGenReferenceObj ) {
			throw new RuntimeException(S_ProcName + &quot;Cannot expand reference &quot; + prefixItem.getRequiredName() + &quot; directly&quot;);
		}
		else if( prefixItem instanceof MssCFGenIteratorObj ) {
			prefixStrValue = ((MssCFGenIteratorObj)prefixItem).expandBody( genContext );
		}
		else {
			throw new RuntimeException( S_ProcName +  &quot;Unsupported generation item class&quot; );
		}
		
		if( prefixStrValue == null ) {
			prefixStrValue = &quot;$$&quot; + prefixName + &quot;$$&quot;;
		}

		I$SchemaName$GelInstructionObj remainder = getOptionalChildrenRemainder();
		if( remainder == null ) {
			throw new RuntimeException( S_ProcName + &quot;Remainder of macro was not properly compiled&quot; );
		}

		String body = remainder.expand( genContext );
		if (body == null) {
			body = &quot;$$&quot; + remainder.getRequiredSourceText() + &quot;$$&quot;;
		}

		String retval = prefixStrValue + body.replace(&quot;\n&quot;, &quot;\n&quot; + prefixStrValue );

		return( retval );
	}
</JavaObjImplementation>
	</Table>

	<Table Name="GelReference"
			TableClassCode="GREF"
			DbName="gelrefer"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="GelInstId"
				Label="GEL Instruction Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<TableCol Name="ReferenceName"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="RemainderTenantId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="RemainderCartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				GenerateId="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="RemainderInstId"
				Label="Remainder Instruction Id"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<PrimaryIndex Name="GelReferenceIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="gelrefer_pidx"
				Suffix="PIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelInstId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<Index Name="GelReferenceRemainderInstIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelrefer_xremainder"
				Suffix="RemainderIdx" >
			<IndexCol Name="RemainderTenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="RemainderCartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="RemainderInstId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<SuperClassRelation Name="SuperClass"
				DbName="gelrefer_super"
				Suffix="SuperClass"
				FromIndex="GelReferenceIdIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GelInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</SuperClassRelation>

		<JavaObjImport>
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.*;</JavaObjImport>

		<JavaObjImplementation>
	public String expand( MssCFGenContext genContext ) {
		String retval;
		final String S_ProcName = &quot;$SchemaName$GelReference.expand() &quot;;
		String referenceName = getRequiredReferenceName();
		
		I$SchemaName$GenItemObj genItem = genContext.getGenEngine().findContextItem(genContext, referenceName );
		if( genItem == null ) {
			genContext.getGenEngine().getLog().message( &quot;Could not resolve reference method \&quot;&quot;
				+ referenceName
				+ &quot;\&quot;. \&quot;&quot;
				+ &quot;$$&quot; + getRequiredSourceText() + &quot;$$&quot;
				+ &quot;\&quot; is invalid&quot; );
			return( null );
		}

		if( ! ( genItem instanceof MssCFGenReferenceObj ) ) {
			genContext.getGenEngine().getLog().message( &quot;Resolution of reference method \&quot;&quot;
				+ referenceName
				+ &quot;\&quot; returned a &quot;
				+ genItem.getClass().getPackage().getName() + &quot;.&quot; + genItem.getClass().getName()
				+ &quot;, not a MssCFGenReferenceObj. \&quot;&quot;
				+ &quot;$$&quot; + getRequiredSourceText() + &quot;$$&quot;
				+ &quot;\&quot; is invalid&quot; );
			return( null );
		}

		MssCFGenReferenceObj reference = (MssCFGenReferenceObj)genItem;
		
		ICFLibAnyObj refDef = reference.dereference( genContext );
		if( refDef == null ) {
			genContext.getGenEngine().getLog().message( &quot;Resolution of reference \&quot;&quot;
				+ referenceName
				+ &quot;\&quot; returned null. \&quot;&quot;
				+ &quot;$$&quot; + getRequiredSourceText() + &quot;$$&quot;
				+ &quot;\&quot; is invalid&quot; );
			return( null );
		}

		MssCFGenContext refContext = genContext.buildRefContext( refDef );
		if( refContext == null ) {
			throw new RuntimeException( S_ProcName +  &quot;buildRefContext() failed&quot; );
		}

		I$SchemaName$GelInstructionObj remainder = getOptionalChildrenRemainder();
		
		String expansion;
		if( remainder == null ) {
			expansion = &quot;&quot;;
		}
		else {
			expansion = remainder.expand( refContext );
		}
		
		return( expansion );
	}
</JavaObjImplementation>
	</Table>

	<Table Name="GelSequence"
			TableClassCode="GSEQ"
			DbName="gelsequence"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="GelInstId"
				Label="GEL Instruction Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<TableCol Name="FirstInstTenantId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="FirstInstCartridgeId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="FirstInstId"
				Label="First Instruction in the chain"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<TableCol Name="LastInstTenantId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="LastInstCartridgeId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="LastInstId"
				Label="Last Instruction in the chain"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<PrimaryIndex Name="GelSequenceIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="gelsequence_pidx"
				Suffix="PIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelInstId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<Index Name="GelSequenceFirstInstIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelsequence_xfirst"
				Suffix="FirstInstIdx" >
			<IndexCol Name="FirstInstTenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="FirstInstCartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="FirstInstId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="GelSequenceLastInstIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelsequence_xlast"
				Suffix="LastInstIdx" >
			<IndexCol Name="LastInstTenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="LastInstCartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="LastInstId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<SuperClassRelation Name="SuperClass"
				DbName="gelsequence_super"
				Suffix="SuperClass"
				FromIndex="GelSequenceIdIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GelInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</SuperClassRelation>

		<JavaObjImport>
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFEngine;
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFGenContext;</JavaObjImport>

		<JavaObjImplementation>
	public String expand( MssCFGenContext genContext ) {
		List&lt;I$SchemaName$GelInstructionObj&gt; instructions = genContext.getGenEngine().getGelInstructionTableObj().readGelInstructionByPrevIdx( getRequiredTenantId(), getRequiredCartridgeId(), null );
		if( instructions == null ) {
			return( null );
		}
		 
		String expansion = &quot;&quot;;
		String subExpansion;

		I$SchemaName$GelInstructionObj nextInstruction = getOptionalLookupFirstInst();
		while( nextInstruction != null ) {
			subExpansion = nextInstruction.expand( genContext );
			if( subExpansion == null ) {
				subExpansion = &quot;$$&quot; + nextInstruction.getRequiredSourceText() + &quot;$$&quot;;
			}
			
			expansion = expansion + subExpansion;
			
			nextInstruction = nextInstruction.getOptionalLookupNext();
		}

		return( expansion );
	}
</JavaObjImplementation>
	</Table>

	<Table Name="GelSwitch"
			TableClassCode="GSWT"
			DbName="gelswitch"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="GelInstId"
				Label="GEL Instruction Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<TableCol Name="ValueExpansion"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="NilExpansion"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="EmptyExpansion"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="DefaultExpansion"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<PrimaryIndex Name="GelSwitchIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="gelswitch_pidx"
				Suffix="PIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelInstId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<SuperClassRelation Name="SuperClass"
				DbName="gelswitch_super"
				Suffix="SuperClass"
				FromIndex="GelSwitchIdIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GelInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</SuperClassRelation>

		<JavaObjImport>
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.*;</JavaObjImport>

		<JavaObjImplementation>
	public String expand( MssCFGenContext genContext ) {
		final String S_ProcName = &quot;$SchemaName$GelSwitchObj.expand() &quot;;
		
		String valueExpansion = getRequiredValueExpansion();
		if( ( valueExpansion == null ) || ( valueExpansion.length() == 0 ) ) {
			throw new RuntimeException( S_ProcName + &quot;ValueExpansion was not properly set&quot; );
		}
		
		I$SchemaName$GenItemObj valueItem = genContext.getGenEngine().findContextItem(genContext, valueExpansion );
		if( valueItem == null ) {
			throw new RuntimeException( S_ProcName + &quot;Could not resolve Value expansion \&quot;&quot; + valueExpansion + &quot;\&quot;&quot; );
		}
		
		String valueStrValue;
		if( valueItem instanceof MssCFGenFileObj ) {
			valueStrValue = ((MssCFGenFileObj)valueItem).expandBody( genContext );
		}
		else if( valueItem instanceof MssCFGenRuleObj ) {
			valueStrValue = ((MssCFGenRuleObj)valueItem).expandBody( genContext );
		}
		else if (valueItem instanceof MssCFGenTruncObj) {
			valueStrValue = ((MssCFGenTruncObj)valueItem).expandBody( genContext );
		}
		else if (valueItem instanceof MssCFGenBindObj) {
			valueStrValue = ((MssCFGenBindObj)valueItem).expandBody( genContext );
		}
		else if( valueItem instanceof MssCFGenReferenceObj ) {
			throw new RuntimeException(S_ProcName + &quot;Cannot expand reference &quot; + valueItem.getRequiredName() + &quot; directly&quot;);
		}
		else if( valueItem instanceof MssCFGenIteratorObj ) {
			valueStrValue = ((MssCFGenIteratorObj)valueItem).expandBody( genContext );
		}
		else {
			throw new RuntimeException( S_ProcName +  &quot;Unsupported generation item class&quot; );
		}

		//	If null was returned, invoke either the nil or default macro
		//	and return the result

		String retval;
		if( valueStrValue == null ) {
			
			String effectiveExpansion = getOptionalNilExpansion();
			if( ( effectiveExpansion == null ) || ( effectiveExpansion.length() == 0 ) ) {
				effectiveExpansion = getRequiredDefaultExpansion();
				if( ( effectiveExpansion == null ) || ( effectiveExpansion.length() == 0 ) ) {
					throw new RuntimeException( S_ProcName + &quot;Neither NilExpansion nor DefaultExpansion were compiled properly&quot; );
				}
			}

			I$SchemaName$GenItemObj genItem = genContext.getGenEngine().findContextItem(genContext, effectiveExpansion );
			if( genItem == null ) {
				throw new RuntimeException( S_ProcName + &quot;Could not resolve expansion \&quot;&quot; + effectiveExpansion + &quot;\&quot;&quot; );
			}
			
			if( genItem instanceof MssCFGenFileObj ) {
				retval = ((MssCFGenFileObj)genItem).expandBody( genContext );
			}
			else if( genItem instanceof MssCFGenRuleObj ) {
				retval = ((MssCFGenRuleObj)genItem).expandBody( genContext );
			}
			else if (genItem instanceof MssCFGenTruncObj) {
				retval = ((MssCFGenTruncObj)genItem).expandBody( genContext );
			}
			else if (genItem instanceof MssCFGenBindObj) {
				retval = ((MssCFGenBindObj)genItem).expandBody( genContext );
			}
			else if( genItem instanceof MssCFGenReferenceObj ) {
				throw new RuntimeException(S_ProcName + &quot;Cannot expand reference &quot; + genItem.getRequiredName() + &quot; directly&quot;);
			}
			else if( genItem instanceof MssCFGenIteratorObj ) {
				retval = ((MssCFGenIteratorObj)genItem).expandBody( genContext );
			}
			else {
				throw new RuntimeException( S_ProcName +  &quot;Unsupported generation item class&quot; );
			}
		}
		else if( valueStrValue.length() == 0 ) {
			
			String effectiveExpansion = getOptionalEmptyExpansion();
			if( ( effectiveExpansion == null ) || ( effectiveExpansion.length() == 0 ) ) {
				effectiveExpansion = getRequiredDefaultExpansion();
				if( ( effectiveExpansion == null ) || ( effectiveExpansion.length() == 0 ) ) {
					throw new RuntimeException( S_ProcName + &quot;Neither EmptyExpansion nor DefaultExpansion were compiled properly&quot; );
				}
			}

			I$SchemaName$GenItemObj genItem = genContext.getGenEngine().findContextItem(genContext, effectiveExpansion );
			if( genItem == null ) {
				throw new RuntimeException( S_ProcName + &quot;Could not resolve expansion \&quot;&quot; + effectiveExpansion + &quot;\&quot;&quot; );
			}
			
			if( genItem instanceof MssCFGenFileObj ) {
				retval = ((MssCFGenFileObj)genItem).expandBody( genContext );
			}
			else if( genItem instanceof MssCFGenRuleObj ) {
				retval = ((MssCFGenRuleObj)genItem).expandBody( genContext );
			}
			else if (genItem instanceof MssCFGenTruncObj) {
				retval = ((MssCFGenTruncObj)genItem).expandBody( genContext );
			}
			else if (genItem instanceof MssCFGenBindObj) {
				retval = ((MssCFGenBindObj)genItem).expandBody( genContext );
			}
			else if( genItem instanceof MssCFGenReferenceObj ) {
				throw new RuntimeException(S_ProcName + &quot;Cannot expand reference &quot; + genItem.getRequiredName() + &quot; directly&quot;);
			}
			else if( genItem instanceof MssCFGenIteratorObj ) {
				retval = ((MssCFGenIteratorObj)genItem).expandBody( genContext );
			}
			else {
				throw new RuntimeException( S_ProcName +  &quot;Unsupported generation item class&quot; );
			}
		}
		else {
			String effectiveExpansion;
			I$SchemaName$GelSwitchLimbObj switchLimb = genContext.getGenEngine().getGelSwitchLimbTableObj().readGelSwitchLimbByPIdx( getRequiredTenantId(), getRequiredCartridgeId(), getRequiredGelInstId(), valueStrValue );
			if( switchLimb != null ) {
				effectiveExpansion = switchLimb.getRequiredLimbExpansion();
				if( ( effectiveExpansion == null ) || ( effectiveExpansion.length() == 0 ) ) {
					throw new RuntimeException( S_ProcName + &quot;Switch limb for &quot; + valueStrValue + &quot; nas a null or empty LimbExpansion&quot; );
				}
			}
			else {
				effectiveExpansion = getRequiredDefaultExpansion();
				if( ( effectiveExpansion == null ) || ( effectiveExpansion.length() == 0 ) ) {
					throw new RuntimeException( S_ProcName + &quot;Switch nas a null or empty DefaultExpansion&quot; );
				}
			}

			I$SchemaName$GenItemObj genItem = genContext.getGenEngine().findContextItem(genContext, effectiveExpansion );
			if( genItem == null ) {
				throw new RuntimeException( S_ProcName + &quot;Could not resolve expansion \&quot;&quot; + effectiveExpansion + &quot;\&quot;&quot; );
			}
			
			if( genItem instanceof MssCFGenFileObj ) {
				retval = ((MssCFGenFileObj)genItem).expandBody( genContext );
			}
			else if( genItem instanceof MssCFGenRuleObj ) {
				retval = ((MssCFGenRuleObj)genItem).expandBody( genContext );
			}
			else if (genItem instanceof MssCFGenTruncObj) {
				retval = ((MssCFGenTruncObj)genItem).expandBody( genContext );
			}
			else if (genItem instanceof MssCFGenBindObj) {
				retval = ((MssCFGenBindObj)genItem).expandBody( genContext );
			}
			else if( genItem instanceof MssCFGenReferenceObj ) {
				throw new RuntimeException(S_ProcName + &quot;Cannot expand reference &quot; + genItem.getRequiredName() + &quot; directly&quot;);
			}
			else if( genItem instanceof MssCFGenIteratorObj ) {
				retval = ((MssCFGenIteratorObj)genItem).expandBody( genContext );
			}
			else {
				throw new RuntimeException( S_ProcName +  &quot;Unsupported generation item class&quot; );
			}
		}

		if( retval == null ) {
			retval = &quot;$$&quot; + getRequiredSourceText() + &quot;$$&quot;;
		}

		return( retval );
	}
</JavaObjImplementation>
	</Table>

	<Table Name="GelSwitchLimb"
			TableClassCode="GLIM"
			DbName="gellimb"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="GelInstId"
				Label="GEL Instruction Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<TableCol Name="LimbName"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="LimbExpansion"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<PrimaryIndex Name="GelSwitchLimbIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="gellimb_pidx"
				Suffix="PIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelInstId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="LimbName" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<Index Name="GelSwitchLimbTenantIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gellimb_xtenant"
				Suffix="TenantIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="GelSwitchLimbSwitchIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gellimb_xswitch"
				Suffix="SwitchIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelInstId" IsAscending="true" DefaultVisibility="true" />
		</Index>
	</Table>

	<Table Name="GenItem"
			TableClassCode="ITM"
			DbName="kbgenitem"
			Label="Generation Item"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="ItemId"
				Label="Item Id"
				IsNullable="false"
				DefaultVisibility="true"
				GenerateId="true"
				DataType="GenItemIdGen" />
		<TableCol Name="RuleTypeId"
				Label="Rule Type Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleTypeIdGen" />
		<TableCol Name="Name"
				DbName="safe_name"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="ToolSetId"
				Label="Tool Set Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="ToolSetIdGen" />
		<TableCol Name="ScopeDefId"
				Label="Scope Definition Id"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="DefClassIdGen" />
		<TableCol Name="GenDefId"
				Label="Generation Definition Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="DefClassIdGen" />
		<TableCol Name="GelExecutableTenantId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="GelExecutableCartridgeId"
				Label="Cartridge Id"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="GelExecutableId"
				Label="GEL Executable Id"
				IsNullable="true"
				DefaultVisibility="true"
				DbName="gelexec_id"
				DataType="GelInstructionIdGen" />
		<TableCol Name="ProbeTenantId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="ProbeCartridgeId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="ProbeGenItemId"
				Label="Item Id"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GenItemIdGen" />
		<PrimaryIndex Name="GenItemIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="kbgenitem_id"
				Suffix="ItemIdIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="ItemId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<Index Name="GenItemTenantIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="kbgenitem_tentx"
				Suffix="TenantIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="GenItemCartIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="kbgenitem_cartx"
				Suffix="CartIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="GenItemRuleTypeIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="kbgenitem_rtyp"
				Suffix="RuleTypeIdx" >
			<IndexCol Name="RuleTypeId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="GenItemToolSetIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="kbgenitem_tset"
				Suffix="ToolSetIdx" >
			<IndexCol Name="ToolSetId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="GenItemScopeIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="kbgenitem_scpx"
				Suffix="ScopeIdx" >
			<IndexCol Name="ScopeDefId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="GenItemGenDefIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="kbgenitem_gdef"
				Suffix="GenDefIdx" >
			<IndexCol Name="GenDefId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="GenItemAlt"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="kbgenitem_alt"
				Suffix="AltIdx" >
			<IndexCol Name="Name" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="ToolSetId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="ScopeDefId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GenDefId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="GenItemGelExecutableIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="kbgenitem_xgexec"
				Suffix="GelExecIdx" >
			<IndexCol Name="GelExecutableTenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelExecutableCartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelExecutableId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="GenItemProbeIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				Suffix="ProbeIdx" >
			<IndexCol Name="ProbeTenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="ProbeCartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="ProbeGenItemId" IsAscending="true" DefaultVisibility="true" />
		</Index>
	</Table>

	<Table Name="GenIterator"
			TableClassCode="ITR"
			DbName="kbgeniter"
			Label="Generation Iterator"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Insert"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="ItemId"
				Label="Item Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemIdGen" />
		<PrimaryIndex Name="GenIteratorIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="kbgeniter_id"
				Suffix="IdIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="ItemId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<SuperClassRelation Name="SuperClass"
				DbName="kbgeniter_super"
				Suffix="SuperClass"
				FromIndex="GenIteratorIdIdx"
				ToIndex="GenItem.GenItemIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="ItemId" ToCol="ItemId" DefaultVisibility="true" />
		</SuperClassRelation>
	</Table>

	<Table Name="GenReference"
			TableClassCode="REF"
			DbName="kbgenref"
			Label="Generation Reference"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Insert"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="ItemId"
				Label="Item Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemIdGen" />
		<PrimaryIndex Name="GenReferenceIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="kbgenref_id"
				Suffix="IdIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="ItemId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<SuperClassRelation Name="SuperClass"
				DbName="kbgenref_super"
				Suffix="SuperClass"
				FromIndex="GenReferenceIdIdx"
				ToIndex="GenItem.GenItemIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="ItemId" ToCol="ItemId" DefaultVisibility="true" />
		</SuperClassRelation>
	</Table>

	<Table Name="GenRule"
			TableClassCode="RUL"
			DbName="kbgenrule"
			Label="Generation Rule"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="ItemId"
				Label="Item Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemIdGen" />
		<StringCol Name="Body"
				IsNullable="false"
				DefaultVisibility="true"
				MaxLen="2000"
				ShowLines="1"
				InitValue="" />
		<TableCol Name="BodyTenantId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="BodyCartridgeId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="BodyGelId"
				IsNullable="true"
				DefaultVisibility="true"
				DbName="body_gelid"
				DataType="GelInstructionIdGen" />
		<PrimaryIndex Name="GenRuleIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="kbgenrule_id"
				Suffix="IdIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="ItemId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<Index Name="BodyIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="genrule_gelbodyidx"
				Suffix="BodyIdx" >
			<IndexCol Name="BodyTenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="BodyCartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="BodyGelId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<SuperClassRelation Name="SuperClass"
				DbName="srcbundle_super"
				Suffix="SuperClass"
				FromIndex="GenRuleIdIdx"
				ToIndex="GenItem.GenItemIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="ItemId" ToCol="ItemId" DefaultVisibility="true" />
		</SuperClassRelation>

		<JavaObjImport>
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFEngine;
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFGelCompiler;
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFGenContext;</JavaObjImport>

		<JavaObjImplementation>
	public static I$SchemaName$GelExecutableObj getBodyBin( MssCFGelCompiler gelCompiler, I$SchemaName$GenRuleObj genRule ) {
		final String S_ProcName = &quot;$SchemaName$GenRuleObj.getBodyBin() &quot;;
		I$SchemaName$GelExecutableObj bin = genRule.getOptionalComponentsBodyGel();
		if( bin == null ) {
			String source = genRule.getRequiredBody();
			bin = gelCompiler.compileExecutable( genRule, source );
			if( bin == null ) {
				throw new RuntimeException( S_ProcName + &quot;Could not compile Body GEL executable from source \&quot;&quot; + source + &quot;\&quot;&quot; );
			}

			I$SchemaName$GenRuleEditObj editRule = genRule.getEditAsGenRule();
			if( editRule != null ) {
				editRule.setOptionalComponentsBodyGel( bin );
			}
			else {
				editRule = (I$SchemaName$GenRuleEditObj)genRule.beginEdit();
				editRule.setOptionalComponentsBodyGel( bin );
				editRule.update();
				editRule.endEdit();
			}
		}
		return( bin );
	}
</JavaObjImplementation>
	</Table>

	<Table Name="GenTrunc"
			TableClassCode="TRC"
			DbName="kbgentrunc"
			Label="Generation Truncation"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="ItemId"
				Label="Item Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemIdGen" />
		<Int32Col Name="TruncateAt"
				Label="Truncate At"
				IsNullable="false"
				DefaultVisibility="true"
				MinValue="0"
				MaxValue="2147483647"
				InitValue="0" />
		<PrimaryIndex Name="GenTruncIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="kbgentrunc_id"
				Suffix="IdIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="ItemId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<SuperClassRelation Name="SuperClass"
				DbName="kbgentrunc_super"
				Suffix="SuperClass"
				FromIndex="GenTruncIdIdx"
				ToIndex="GenRule.GenRuleIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="ItemId" ToCol="ItemId" DefaultVisibility="true" />
		</SuperClassRelation>
	</Table>

	<Table Name="RuleCart"
			TableClassCode="RCT"
			DbName="kbrulecart"
			Label="Rule Cartridge"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LookupIndex="RuleCartName"
			LoaderBehaviour="Replace"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="Id"
				IsNullable="false"
				DefaultVisibility="true"
				GenerateId="true"
				DataType="RuleCartIdGen" />
		<StringCol Name="Name"
				DbName="safe_name"
				IsNullable="false"
				DefaultVisibility="true"
				MaxLen="127"
				ShowLines="1"
				InitValue="" />
		<StringCol Name="Descr"
				Label="Description"
				IsNullable="true"
				DefaultVisibility="true"
				MaxLen="255"
				ShowLines="1" />
		<StringCol Name="RevisionString"
				Label="Revision String"
				IsNullable="true"
				DefaultVisibility="true"
				MaxLen="255"
				ShowLines="1" />
		<PrimaryIndex Name="RuleCartIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="kbrulecart_idx"
				Suffix="IdIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="Id" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<Index Name="RuleCartTenant"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="kbrulecart_xtenant"
				Suffix="TenantIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="RuleCartName"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="kbrulecart_uxname"
				Suffix="NameIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="Name" IsAscending="true" DefaultVisibility="true" />
		</Index>
	</Table>

	<Table Name="RuleType"
			TableClassCode="RTP"
			DbName="kbruletype"
			Label="Rule Type"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LookupIndex="RuleTypeName"
			LoaderBehaviour="Insert"
			SecScope="None" >
		<TableCol Name="Id"
				IsNullable="false"
				DefaultVisibility="true"
				GenerateId="true"
				DataType="RuleTypeIdGen" />
		<StringCol Name="Name"
				DbName="safe_name"
				IsNullable="false"
				DefaultVisibility="true"
				MaxLen="32"
				ShowLines="1"
				InitValue="" />
		<PrimaryIndex Name="RuleTypeIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="kbruletype_xid"
				Suffix="IdIdx" >
			<IndexCol Name="Id" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<Index Name="RuleTypeName"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="kbruletype_xname"
				Suffix="NameIdx" >
			<IndexCol Name="Name" IsAscending="true" DefaultVisibility="true" />
		</Index>
	</Table>

	<Table Name="Tool"
			TableClassCode="TOL"
			DbName="kbtool"
			Label="Tool"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LookupIndex="ToolName"
			LoaderBehaviour="Insert"
			SecScope="None" >
		<TableCol Name="Id"
				IsNullable="false"
				DefaultVisibility="true"
				GenerateId="true"
				DataType="ToolIdGen" />
		<StringCol Name="Name"
				DbName="safe_name"
				IsNullable="false"
				DefaultVisibility="true"
				MaxLen="32"
				ShowLines="1"
				InitValue="" />
		<TableCol Name="ReplacesId"
				Label="Replaces Tool Id"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="ToolIdGen" />
		<BoolCol Name="IsSupported"
				Label="Is Supported"
				IsNullable="false"
				DefaultVisibility="true" />
		<PrimaryIndex Name="ToolIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="kbtool_xid"
				Suffix="IdIdx" >
			<IndexCol Name="Id" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<Index Name="ToolName"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="kbtool_xname"
				Suffix="NameIdx" >
			<IndexCol Name="Name" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ToolReplacesIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="kbtool_xreplaces"
				Suffix="ReplacesIdx" >
			<IndexCol Name="ReplacesId" IsAscending="true" DefaultVisibility="true" />
		</Index>
	</Table>

	<Table Name="ToolSet"
			TableClassCode="TLS"
			DbName="kbtoolset"
			Label="Tool Set"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LookupIndex="ToolSetName"
			LoaderBehaviour="Insert"
			SecScope="None" >
		<TableCol Name="Id"
				IsNullable="false"
				DefaultVisibility="true"
				GenerateId="true"
				DataType="ToolSetIdGen" />
		<StringCol Name="Name"
				DbName="safe_name"
				IsNullable="false"
				DefaultVisibility="true"
				MaxLen="511"
				ShowLines="1"
				InitValue="" />
		<StringCol Name="Descr"
				Label="Description"
				IsNullable="true"
				DefaultVisibility="true"
				MaxLen="255"
				ShowLines="1" />
		<StringCol Name="RevisionString"
				Label="Revision String"
				IsNullable="true"
				DefaultVisibility="true"
				MaxLen="255"
				ShowLines="1" />
		<BoolCol Name="IsSupported"
				Label="Is Supported"
				IsNullable="false"
				DefaultVisibility="true" />
		<BoolCol Name="Generate"
				IsNullable="false"
				DefaultVisibility="true" />
		<TableCol Name="ToolId0"
				Label="Tool Id 0"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="ToolIdGen" />
		<TableCol Name="ToolId1"
				Label="Tool Id 1"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="ToolIdGen" />
		<TableCol Name="ToolId2"
				Label="Tool Id 2"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="ToolIdGen" />
		<TableCol Name="ToolId3"
				Label="Tool Id 3"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="ToolIdGen" />
		<TableCol Name="ToolId4"
				Label="Tool Id 4"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="ToolIdGen" />
		<TableCol Name="ToolId5"
				Label="Tool Id 5"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="ToolIdGen" />
		<TableCol Name="ToolId6"
				Label="Tool Id 6"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="ToolIdGen" />
		<TableCol Name="ToolId7"
				Label="Tool Id 7"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="ToolIdGen" />
		<PrimaryIndex Name="ToolSetIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="kbtoolset_xid"
				Suffix="IdIdx" >
			<IndexCol Name="Id" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<Index Name="ToolSetName"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="kbtoolset_xname"
				Suffix="NameIdx" >
			<IndexCol Name="Name" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ToolSetTool0Idx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="kbtoolset_xt0"
				Suffix="Tool0Idx" >
			<IndexCol Name="ToolId0" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ToolSetTool1Idx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="kbtoolset_xt1"
				Suffix="Tool1Idx" >
			<IndexCol Name="ToolId1" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ToolSetTool2Idx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="kbtoolset_xt2"
				Suffix="Tool2Idx" >
			<IndexCol Name="ToolId2" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ToolSetTool3Idx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="kbtoolset_xt3"
				Suffix="Tool3Idx" >
			<IndexCol Name="ToolId3" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ToolSetTool4Idx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="kbtoolset_xt4"
				Suffix="Tool4Idx" >
			<IndexCol Name="ToolId4" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ToolSetTool5Idx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="kbtoolset_xt5"
				Suffix="Tool5Idx" >
			<IndexCol Name="ToolId5" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ToolSetTool6Idx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="kbtoolset_xt6"
				Suffix="Tool6Idx" >
			<IndexCol Name="ToolId6" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ToolSetTool7Idx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="kbtoolset_xt7"
				Suffix="Tool7Idx" >
			<IndexCol Name="ToolId7" IsAscending="true" DefaultVisibility="true" />
		</Index>
	</Table>

	<Table Name="GelBoilerplate"
			TableClassCode="GBLR"
			DbName="gelboiler"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="GelInstId"
				Label="GEL Instruction Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<PrimaryIndex Name="GelBoilerplateIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="gelboiler_pidx"
				Suffix="PIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelInstId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<SuperClassRelation Name="SuperClass"
				DbName="gelboiler_super"
				Suffix="SuperClass"
				FromIndex="GelBoilerplateIdIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GelInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</SuperClassRelation>

		<JavaObjImport>
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFEngine;
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFGenContext;</JavaObjImport>

		<JavaObjImplementation>
	public String expand( MssCFGenContext genContext ) {
		String expansion = getRequiredSourceText();
		return( expansion );
	}
</JavaObjImplementation>
	</Table>

	<Table Name="GelBuiltin"
			TableClassCode="GBLT"
			DbName="gelbuiltin"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="GelInstId"
				Label="GEL Instruction Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<PrimaryIndex Name="GelBuiltinIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="gelbuiltin_pidx"
				Suffix="PIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelInstId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<SuperClassRelation Name="SuperClass"
				DbName="gelbuiltin_super"
				Suffix="SuperClass"
				FromIndex="GelBuiltinIdIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GelInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</SuperClassRelation>

		<JavaObjImport>
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFEngine;
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFGenContext;</JavaObjImport>

		<JavaObjImplementation>
	public $SchemaName$GelBuiltinObj( I$SchemaName$GelInstructionObj invokingInstruction ) {
		super( invokingInstruction.getSchema() );
	}

	public String expand( MssCFGenContext genContext ) {
		throw new RuntimeException( &quot;$SchemaName$GelBuiltinObj.expand() must be specialized by the builtin implementation&quot; );
	}
</JavaObjImplementation>
	</Table>

	<Table Name="GelConstrain"
			TableClassCode="GCON"
			DbName="gelconstrain"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="GelInstId"
				Label="GEL Instruction Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<Int64Col Name="HardConstraint"
				IsNullable="true"
				DefaultVisibility="true" />
		<TableCol Name="ConstrainingName"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<TableCol Name="RemainderTenantId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="RemainderCartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				GenerateId="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="RemainderInstId"
				Label="Remainder Instruction Id"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<PrimaryIndex Name="GelConstrainIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="gelconstrain_pidx"
				Suffix="PIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelInstId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<Index Name="GelConstrainRemainderInstIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelconstrain_xremainder"
				Suffix="RemainderIdx" >
			<IndexCol Name="RemainderTenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="RemainderCartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="RemainderInstId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<SuperClassRelation Name="SuperClass"
				DbName="gelconstrain_super"
				Suffix="SuperClass"
				FromIndex="GelConstrainIdIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GelInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</SuperClassRelation>

		<JavaObjImport>
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFEngine;
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFGenContext;</JavaObjImport>

		<JavaObjImplementation>
	public $SchemaName$GelConstrainObj( I$SchemaName$GelInstructionObj invokingInstruction ) {
		super( invokingInstruction.getSchema() );
	}

	public String expand( MssCFGenContext genContext ) {
		throw new RuntimeException( &quot;$SchemaName$GelConstrainObj.expand() Implemention must be overriden by constraint specialization&quot;);
	}
</JavaObjImplementation>
	</Table>

	<Table Name="GelCounter"
			TableClassCode="GCNT"
			DbName="gelcounter"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="GelInstId"
				Label="GEL Instruction Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<TableCol Name="CounterName"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<PrimaryIndex Name="GelCounterIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="gelcounter_pidx"
				Suffix="PIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelInstId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<SuperClassRelation Name="SuperClass"
				DbName="gelcounter_super"
				Suffix="SuperClass"
				FromIndex="GelCounterIdIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GelInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</SuperClassRelation>

		<JavaObjImport>
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFEngine;
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFGenContext;</JavaObjImport>

		<JavaObjImplementation>
	public $SchemaName$GelCounterObj( I$SchemaName$GelInstructionObj invokingInstruction ) {
		super( invokingInstruction.getSchema() );
	}

	public String expand( MssCFGenContext genContext ) {
		throw new RuntimeException( &quot;$SchemaName$GelCounterObj.expand() Implemention must be overriden by counter specialization&quot;);
	}
</JavaObjImplementation>
	</Table>

	<Table Name="GelExecutable"
			TableClassCode="GEXE"
			DbName="gelexec"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="GelInstId"
				Label="GEL Instruction Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<TableCol Name="GenItemId"
				Label="Source Generation Item Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemIdGen" />
		<PrimaryIndex Name="GelExecutableIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="gelexec_pidx"
				Suffix="PIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelInstId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<Index Name="GelExecutableGenItemIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelexec_xgenitem"
				Suffix="GenItemIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GenItemId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<SuperClassRelation Name="SuperClass"
				DbName="gelexec_super"
				Suffix="SuperClass"
				FromIndex="GelExecutableIdIdx"
				ToIndex="GelSequence.GelSequenceIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GelInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</SuperClassRelation>

		<JavaObjImport>
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFEngine;
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFGenContext;</JavaObjImport>

		<JavaObjImplementation>
	public String expand( MssCFGenContext genContext ) {
		List&lt;I$SchemaName$GelInstructionObj&gt; instructions = genContext.getGenEngine().getGelInstructionTableObj().readGelInstructionByPrevIdx( getRequiredTenantId(), getRequiredCartridgeId(), null );
		if( instructions == null ) {
			return( null );
		}
		 
		String expansion = &quot;&quot;;
		String subExpansion;

		I$SchemaName$GelInstructionObj nextInstruction = getOptionalLookupFirstInst();
		while( nextInstruction != null ) {
			subExpansion = nextInstruction.expand( genContext );
			if( subExpansion == null ) {
				subExpansion = &quot;$$&quot; + nextInstruction.getRequiredSourceText() + &quot;$$&quot;;
			}
			
			expansion = expansion + subExpansion;
			
			nextInstruction = nextInstruction.getOptionalLookupNext();
		}

		return( expansion );
	}
</JavaObjImplementation>
	</Table>

	<Table Name="GelExpansion"
			TableClassCode="GEXP"
			DbName="gelexpansion"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="GelInstId"
				Label="GEL Instruction Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<TableCol Name="MacroName"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<PrimaryIndex Name="GelExpansionIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="gelexpansion_pidx"
				Suffix="PIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelInstId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<SuperClassRelation Name="SuperClass"
				DbName="gelexpansion_super"
				Suffix="SuperClass"
				FromIndex="GelExpansionIdIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GelInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</SuperClassRelation>

		<JavaObjImport>
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.*;</JavaObjImport>

		<JavaObjImplementation>
	public String expand( MssCFGenContext genContext ) {
		String retval;
		final String S_ProcName = &quot;$SchemaName$GelExpansion.expand() &quot;;
		I$SchemaName$GenItemObj genItem = genContext.getGenEngine().findContextItem(genContext, getRequiredMacroName() );
		if( genItem != null ) {
			if( genItem instanceof MssCFGenFileObj ) {
				retval = ((MssCFGenFileObj)genItem).expandBody( genContext );
			}
			else if( genItem instanceof MssCFGenRuleObj ) {
				retval = ((MssCFGenRuleObj)genItem).expandBody( genContext );
			}
			else if (genItem instanceof MssCFGenTruncObj)
			{
				retval = ((MssCFGenTruncObj)genItem).expandBody( genContext );
			}
			else if (genItem instanceof MssCFGenBindObj)
			{
				retval = ((MssCFGenBindObj)genItem).expandBody( genContext );
			}
			else if( genItem instanceof MssCFGenReferenceObj ) {
				throw new RuntimeException(S_ProcName + &quot;Cannot expand reference &quot; + genItem.getRequiredName() + &quot; directly&quot;);
			}
			else if( genItem instanceof MssCFGenIteratorObj ) {
				retval = ((MssCFGenIteratorObj)genItem).expandBody( genContext );
			}
			else {
				throw new RuntimeException( S_ProcName +  &quot;Unsupported generation item class&quot; );
			}
		}
		else {
			retval = &quot;$$&quot; + getRequiredMacroName() + &quot;$$&quot;;
		}
		return( retval );
	}
</JavaObjImplementation>
	</Table>

	<Table Name="GelFormat"
			TableClassCode="GFMT"
			DbName="gelfmt"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="GelInstId"
				Label="GEL Instruction Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<TableCol Name="FormatName"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemNameType" />
		<StringCol Name="JavaFormat"
				IsNullable="false"
				DefaultVisibility="true"
				MaxLen="511"
				ShowLines="1"
				InitValue="" />
		<PrimaryIndex Name="GelFormatIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="gelfmt_pidx"
				Suffix="PIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelInstId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<SuperClassRelation Name="SuperClass"
				DbName="gelfmt_super"
				Suffix="SuperClass"
				FromIndex="GelFormatIdIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GelInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</SuperClassRelation>

		<JavaObjImport>
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFEngine;
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFGenBindObj;
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFGenContext;</JavaObjImport>

		<JavaObjImplementation>
	public String expand( MssCFGenContext genContext ) {
		final String S_ProcName = &quot;expand&quot;;

		MssCFEngine genEngine = genContext.getGenEngine();

		String formatName = getRequiredFormatName();
		
		I$SchemaName$GenItemObj genItem = genEngine.findContextItem(genContext, formatName );
		if( genItem == null ) {
			genEngine.getLog().message( &quot;Could not find binding \&quot;&quot;
				+ formatName
				+ &quot;\&quot; attempting to expand \&quot;&quot;
				+ &quot;$$&quot; + getRequiredSourceText() + &quot;$$\&quot;&quot; );
			return( null );
		}

		if( ! ( genItem instanceof MssCFGenBindObj ) ) {
			throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException( getClass(),
				S_ProcName, &quot;genItem&quot;, genItem, &quot;MssCFGenBindObj&quot; );
		}
		
		MssCFGenBindObj genBind = (MssCFGenBindObj)genItem;
		
		Object value = genBind.getValueObject( genContext );
		String javaFormat = getRequiredJavaFormat();
		StringBuilder builder = new StringBuilder();
		Formatter formatter = new Formatter( builder, Locale.CANADA );
		formatter.format( javaFormat, value );
		String ret = builder.toString();
		
		return( ret );
	}
</JavaObjImplementation>
	</Table>

	<Table Name="GelModifier"
			TableClassCode="GMOD"
			DbName="gelmodifier"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="GelInstId"
				Label="GEL Instruction Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<TableCol Name="RemainderTenantId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="RemainderCartridgeId"
				Label="Source Generation Item Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				GenerateId="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="RemainderInstId"
				Label="Remainder Instruction Id"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="GelInstructionIdGen" />
		<PrimaryIndex Name="GelModifierIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="gelmodifier_pidx"
				Suffix="PIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="GelInstId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<Index Name="GelModifierRemainderInstIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="gelmodifier_xremainder"
				Suffix="RemainderIdx" >
			<IndexCol Name="RemainderTenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="RemainderCartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="RemainderInstId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<SuperClassRelation Name="SuperClass"
				DbName="gelmodifier_super"
				Suffix="SuperClass"
				FromIndex="GelModifierIdIdx"
				ToIndex="GelSequence.GelSequenceIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GelInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</SuperClassRelation>

		<JavaObjImport>
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFEngine;
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFGenContext;</JavaObjImport>

		<JavaObjImplementation>
	public $SchemaName$GelModifierObj( I$SchemaName$GelInstructionObj invokingInstruction ) {
		super( invokingInstruction.getSchema() );
	}

	public String expand( MssCFGenContext genContext ) {
		List&lt;I$SchemaName$GelInstructionObj&gt; instructions = genContext.getGenEngine().getGelInstructionTableObj().readGelInstructionByPrevIdx( getRequiredTenantId(), getRequiredCartridgeId(), null );
		if( instructions == null ) {
			return( null );
		}
		 
		String expansion = &quot;&quot;;
		String subExpansion;

		I$SchemaName$GelInstructionObj nextInstruction = getOptionalLookupFirstInst();
		while( nextInstruction != null ) {
			subExpansion = nextInstruction.expand( genContext );
			if( subExpansion == null ) {
				subExpansion = &quot;$$&quot; + nextInstruction.getRequiredSourceText() + &quot;$$&quot;;
			}
			
			expansion = expansion + subExpansion;
			
			nextInstruction = nextInstruction.getOptionalLookupNext();
		}

		return( expansion );
	}
</JavaObjImplementation>
	</Table>

	<Table Name="GenBind"
			TableClassCode="BND"
			DbName="kbgenbind"
			Label="Generation Binding"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Insert"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="ItemId"
				Label="Item Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemIdGen" />
		<PrimaryIndex Name="GenBindIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="kbgbind_xid"
				Suffix="IdIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="ItemId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<SuperClassRelation Name="SuperClass"
				DbName="kbgbind_super"
				Suffix="SuperClass"
				FromIndex="GenBindIdIdx"
				ToIndex="GenItem.GenItemIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="ItemId" ToCol="ItemId" DefaultVisibility="true" />
		</SuperClassRelation>
	</Table>

	<Table Name="GenFile"
			TableClassCode="FIL"
			DbName="kbgenfile"
			Label="Generation File"
			DefaultVisibility="true"
			IsInstantiable="true"
			HasHistory="false"
			HasAuditColumns="false"
			LoaderBehaviour="Update"
			SecScope="Tenant" >
		<TableCol Name="TenantId"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="CartridgeId"
				Label="Cartridge Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="ItemId"
				Label="Item Id"
				IsNullable="false"
				DefaultVisibility="true"
				DataType="GenItemIdGen" />
		<StringCol Name="SourceBundle"
				ShortName="SrcBndl"
				Label="Source Bundle"
				IsNullable="true"
				DefaultVisibility="true"
				MaxLen="254"
				ShowLines="1"
				InitValue="" />
		<TableCol Name="SourceBundleTenantId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="SourceBundleCartridgeId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="SourceBundleGelId"
				IsNullable="true"
				DefaultVisibility="true"
				DbName="srcbundle_gelid"
				DataType="GelInstructionIdGen" />
		<StringCol Name="BasePackageName"
				Label="Base Package Name"
				IsNullable="true"
				DefaultVisibility="true"
				MaxLen="254"
				ShowLines="1"
				InitValue="" />
		<TableCol Name="BasePackageTenantId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="BasePackageCartridgeId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="BasePackageGelId"
				IsNullable="true"
				DefaultVisibility="true"
				DbName="basepkg_gelid"
				DataType="GelInstructionIdGen" />
		<StringCol Name="SubPackageName"
				Label="Sub Package Name"
				IsNullable="true"
				DefaultVisibility="true"
				MaxLen="254"
				ShowLines="1"
				InitValue="" />
		<TableCol Name="SubPackageTenantId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="SubPackageCartridgeId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="SubPackageGelId"
				IsNullable="true"
				DefaultVisibility="true"
				DbName="subpkg_gelid"
				DataType="GelInstructionIdGen" />
		<StringCol Name="ExpansionClassName"
				Label="Expansion Class Name"
				IsNullable="true"
				DefaultVisibility="true"
				MaxLen="254"
				ShowLines="1"
				InitValue="" />
		<TableCol Name="ExpansionClassNameTenantId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="ExpansionClassNameCartridgeId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="ExpansionClassNameGelId"
				IsNullable="true"
				DefaultVisibility="true"
				DbName="expclsnm_gelid"
				DataType="GelInstructionIdGen" />
		<StringCol Name="ExpansionKeyName"
				Label="Expansion Key Name"
				IsNullable="true"
				DefaultVisibility="true"
				MaxLen="254"
				ShowLines="1"
				InitValue="" />
		<TableCol Name="ExpansionKeyNameTenantId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="ExpansionKeyNameCartridgeId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="ExpansionKeyNameGelId"
				IsNullable="true"
				DefaultVisibility="true"
				DbName="expkeynm_gelid"
				DataType="GelInstructionIdGen" />
		<StringCol Name="ExpansionFileName"
				Label="Expansion File Name"
				IsNullable="true"
				DefaultVisibility="true"
				MaxLen="254"
				ShowLines="1"
				InitValue="" />
		<TableCol Name="ExpansionFileNameTenantId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="TenantIdGen" />
		<TableCol Name="ExpansionFileNameCartridgeId"
				IsNullable="true"
				DefaultVisibility="true"
				DataType="RuleCartIdGen" />
		<TableCol Name="ExpansionFileNameGelId"
				IsNullable="true"
				DefaultVisibility="true"
				DbName="expfilenm_gelid"
				DataType="GelInstructionIdGen" />
		<PrimaryIndex Name="GenFileIdIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="true"
				DbName="kbgenfile_id"
				Suffix="IdIdx" >
			<IndexCol Name="TenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="CartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="ItemId" IsAscending="true" DefaultVisibility="true" />
		</PrimaryIndex>
		<Index Name="SourceBundleIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="genfile_srcbdlidx"
				Suffix="XSrcBundle" >
			<IndexCol Name="SourceBundleTenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="SourceBundleCartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="SourceBundleGelId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="BasePackageIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="basepkg_gelidx"
				Suffix="XBasePkg" >
			<IndexCol Name="BasePackageTenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="BasePackageCartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="BasePackageGelId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="SubPackageIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="subpkg_gelidx"
				Suffix="XSubPkg" >
			<IndexCol Name="SubPackageTenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="SubPackageCartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="SubPackageGelId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ExpansionClassNameIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="expclsnm_gelidx"
				Suffix="XExpClsName" >
			<IndexCol Name="ExpansionClassNameTenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="ExpansionClassNameCartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="ExpansionClassNameGelId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ExpansionKeyNameIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="expkeynm_gelidx"
				Suffix="XExpKeyName" >
			<IndexCol Name="ExpansionKeyNameTenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="ExpansionKeyNameCartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="ExpansionKeyNameGelId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<Index Name="ExpansionFileNameIdx"
				DefaultVisibility="true"
				IsDbMapped="true"
				IsUnique="false"
				DbName="expfilenm_gelidx"
				Suffix="XExpFileName" >
			<IndexCol Name="ExpansionFileNameTenantId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="ExpansionFileNameCartridgeId" IsAscending="true" DefaultVisibility="true" />
			<IndexCol Name="ExpansionFileNameGelId" IsAscending="true" DefaultVisibility="true" />
		</Index>
		<SuperClassRelation Name="SuperClass"
				DbName="expfilenm_super"
				Suffix="SuperClass"
				FromIndex="GenFileIdIdx"
				ToIndex="GenRule.GenRuleIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="ItemId" ToCol="ItemId" DefaultVisibility="true" />
		</SuperClassRelation>

		<JavaObjImport>
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFEngine;
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFGelCompiler;
import net.sourceforge.msscodefactory.cfcore.v2_9.MssCF.MssCFGenContext;</JavaObjImport>

		<JavaObjImplementation>
	public static I$SchemaName$GelExecutableObj getSrcBundleBin( MssCFGelCompiler gelCompiler, I$SchemaName$GenFileObj genFile ) {
		final String S_ProcName = &quot;$SchemaName$GenFileObj.getSrcBundleBin() &quot;;
		I$SchemaName$GelExecutableObj bin = genFile.getOptionalComponentsSrcBundleGel();
		if( bin == null ) {
			String source = genFile.getOptionalSourceBundle();
			bin = gelCompiler.compileExecutable( genFile, source );
			if( bin == null ) {
				throw new RuntimeException( S_ProcName + &quot;Could not compile SrcBundle GEL executable from source \&quot;&quot; + source + &quot;\&quot;&quot; );
			}

			I$SchemaName$GenFileEditObj editFile = genFile.getEditAsGenFile();
			if( editFile != null ) {
				editFile.setOptionalComponentsSrcBundleGel( bin );
			}
			else {
				editFile = (I$SchemaName$GenFileEditObj)genFile.beginEdit();
				editFile.setOptionalComponentsSrcBundleGel( bin );
				editFile.update();
				editFile.endEdit();
			}
		}
		return( bin );
	}
	
	public static I$SchemaName$GelExecutableObj getBasePackageBin( MssCFGelCompiler gelCompiler, I$SchemaName$GenFileObj genFile ) {
		final String S_ProcName = &quot;$SchemaName$GenFileObj.getBasePackageBin() &quot;;
		I$SchemaName$GelExecutableObj bin = genFile.getOptionalComponentsBasePackageGel();
		if( bin == null ) {
			String source = genFile.getOptionalBasePackageName();
			bin = gelCompiler.compileExecutable( genFile, source );
			if( bin == null ) {
				throw new RuntimeException( S_ProcName + &quot;Could not compile BasePackage GEL executable from source \&quot;&quot; + source + &quot;\&quot;&quot; );
			}

			I$SchemaName$GenFileEditObj editFile = genFile.getEditAsGenFile();
			if( editFile != null ) {
				editFile.setOptionalComponentsBasePackageGel( bin );
			}
			else {
				editFile = (I$SchemaName$GenFileEditObj)genFile.beginEdit();
				editFile.setOptionalComponentsBasePackageGel( bin );
				editFile.update();
				editFile.endEdit();
			}
		}
		return( bin );
	}
	
	public static I$SchemaName$GelExecutableObj getSubPackageBin( MssCFGelCompiler gelCompiler, I$SchemaName$GenFileObj genFile ) {
		final String S_ProcName = &quot;$SchemaName$GenFileObj.getSubPackageBin() &quot;;
		I$SchemaName$GelExecutableObj bin = genFile.getOptionalComponentsSubPackageGel();
		if( bin == null ) {
			String source = genFile.getOptionalSubPackageName();
			bin = gelCompiler.compileExecutable( genFile, source );
			if( bin == null ) {
				throw new RuntimeException( S_ProcName + &quot;Could not compile SubPackage GEL executable from source \&quot;&quot; + source + &quot;\&quot;&quot; );
			}

			I$SchemaName$GenFileEditObj editFile = genFile.getEditAsGenFile();
			if( editFile != null ) {
				editFile.setOptionalComponentsSubPackageGel( bin );
			}
			else {
				editFile = (I$SchemaName$GenFileEditObj)genFile.beginEdit();
				editFile.setOptionalComponentsSubPackageGel( bin );
				editFile.update();
				editFile.endEdit();
			}
		}
		return( bin );
	}
	
	public static I$SchemaName$GelExecutableObj getExpClassBin( MssCFGelCompiler gelCompiler, I$SchemaName$GenFileObj genFile ) {
		final String S_ProcName = &quot;$SchemaName$GenFileObj.getExpClassBin() &quot;;
		I$SchemaName$GelExecutableObj bin = genFile.getOptionalComponentsExpClassGel();
		if( bin == null ) {
			String source = genFile.getOptionalExpansionClassName();
			bin = gelCompiler.compileExecutable( genFile, source );
			if( bin == null ) {
				throw new RuntimeException( S_ProcName + &quot;Could not compile ExpClass GEL executable from source \&quot;&quot; + source + &quot;\&quot;&quot; );
			}

			I$SchemaName$GenFileEditObj editFile = genFile.getEditAsGenFile();
			if( editFile != null ) {
				editFile.setOptionalComponentsExpClassGel( bin );
			}
			else {
				editFile = (I$SchemaName$GenFileEditObj)genFile.beginEdit();
				editFile.setOptionalComponentsExpClassGel( bin );
				editFile.update();
				editFile.endEdit();
			}
		}
		return( bin );
	}
	
	public static I$SchemaName$GelExecutableObj getExpKeyNameBin( MssCFGelCompiler gelCompiler, I$SchemaName$GenFileObj genFile ) {
		final String S_ProcName = &quot;$SchemaName$GenFileObj.getExpKeyNameBin() &quot;;
		I$SchemaName$GelExecutableObj bin = genFile.getOptionalComponentsExpKeyNameGel();
		if( bin == null ) {
			String source = genFile.getOptionalExpansionKeyName();
			bin = gelCompiler.compileExecutable( genFile, source );
			if( bin == null ) {
				throw new RuntimeException( S_ProcName + &quot;Could not compile ExpKeyName GEL executable from source \&quot;&quot; + source + &quot;\&quot;&quot; );
			}

			I$SchemaName$GenFileEditObj editFile = genFile.getEditAsGenFile();
			if( editFile != null ) {
				editFile.setOptionalComponentsExpKeyNameGel( bin );
			}
			else {
				editFile = (I$SchemaName$GenFileEditObj)genFile.beginEdit();
				editFile.setOptionalComponentsExpKeyNameGel( bin );
				editFile.update();
				editFile.endEdit();
			}
		}
		return( bin );
	}
	
	public static I$SchemaName$GelExecutableObj getExpFileNameBin( MssCFGelCompiler gelCompiler, I$SchemaName$GenFileObj genFile ) {
		final String S_ProcName = &quot;$SchemaName$GenFileObj.getExpFileNameBin() &quot;;
		I$SchemaName$GelExecutableObj bin = genFile.getOptionalComponentsExpFileNameGel();
		if( bin == null ) {
			String source = genFile.getOptionalExpansionFileName();
			bin = gelCompiler.compileExecutable( genFile, source );
			if( bin == null ) {
				throw new RuntimeException( S_ProcName + &quot;Could not compile ExpFileName GEL executable from source \&quot;&quot; + source + &quot;\&quot;&quot; );
			}

			I$SchemaName$GenFileEditObj editFile = genFile.getEditAsGenFile();
			if( editFile != null ) {
				editFile.setOptionalComponentsExpFileNameGel( bin );
			}
			else {
				editFile = (I$SchemaName$GenFileEditObj)genFile.beginEdit();
				editFile.setOptionalComponentsExpFileNameGel( bin );
				editFile.update();
				editFile.endEdit();
			}
		}
		return( bin );
	}
</JavaObjImplementation>
	</Table>

	<TableAddendum FromTable="DefClass">
		<Relation Name="BaseDefClass"
				RelationType="Parent"
				DbName="defcls_basedefcls"
				Label="BaseDefClass"
				Suffix="BaseDefClass"
				FromIndex="DefClassBaseIdx"
				ToIndex="DefClass.DefClassIdIdx"
				IsRequired="false"
				DefaultVisibility="true" >
			<RelationCol Name="BaseId" ToCol="Id" DefaultVisibility="true" />
		</Relation>
	</TableAddendum>

	<TableAddendum FromTable="GelConstrain">
		<Relation Name="Remainder"
				RelationType="Children"
				DbName="gelcons_remdr"
				Label="Called GEL Instructions"
				Suffix="Remainder"
				FromIndex="GelConstrainRemainderInstIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="false"
				IsXsdContainer="true"
				DefaultVisibility="true" >
			<RelationCol Name="RemainderTenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="RemainderCartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="RemainderInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
	</TableAddendum>

	<TableAddendum FromTable="GelExecutable">
		<Relation Name="GenItem"
				RelationType="Container"
				DbName="gelexec_genitm"
				Label="Generation Item"
				Suffix="GenItem"
				FromIndex="GelExecutableGenItemIdx"
				ToIndex="GenItem.GenItemIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GenItemId" ToCol="ItemId" DefaultVisibility="true" />
		</Relation>
	</TableAddendum>

	<TableAddendum FromTable="GelInstruction">
		<Relation Name="Tenant"
				RelationType="Owner"
				DbName="gelinst_tenant"
				Label="Tenant"
				Suffix="Tenant"
				FromIndex="GelInstructionTenantIdx"
				ToIndex="Tenant.TenantIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="Id" DefaultVisibility="true" />
		</Relation>
		<Relation Name="Cartridge"
				RelationType="Parent"
				DbName="gelinst_cart"
				Label="Rule Cartridge"
				Suffix="Cartridge"
				FromIndex="GelInstructionCartridgeIdx"
				ToIndex="RuleCart.RuleCartIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="Id" DefaultVisibility="true" />
		</Relation>
		<Relation Name="Caller"
				RelationType="Container"
				DbName="gelinst_caller"
				Label="Calling GEL Instruction"
				Suffix="Caller"
				FromIndex="GelInstructionCallerIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="false"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="CallerId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
		<Relation Name="Prev"
				RelationType="Lookup"
				DbName="gelinst_prev"
				Label="Previous GEL Instruction"
				Suffix="Prev"
				FromIndex="GelInstructionPrevIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="false"
				DefaultVisibility="true" >
			<RelationCol Name="PrevTenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="PrevCartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="PrevId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
		<Relation Name="Next"
				RelationType="Lookup"
				DbName="gelinst_next"
				Label="Next GEL Instruction"
				Suffix="Next"
				FromIndex="GelInstructionNextIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="false"
				DefaultVisibility="true" >
			<RelationCol Name="NextTenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="NextCartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="NextId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
	</TableAddendum>

	<TableAddendum FromTable="GelModifier">
		<Relation Name="Remainder"
				RelationType="Children"
				DbName="gelmod_remdr"
				Label="Called GEL Instructions"
				Suffix="Remainder"
				FromIndex="GelModifierRemainderInstIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="false"
				IsXsdContainer="true"
				DefaultVisibility="true" >
			<RelationCol Name="RemainderTenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="RemainderCartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="RemainderInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
	</TableAddendum>

	<TableAddendum FromTable="GelPop">
		<Relation Name="Remainder"
				RelationType="Children"
				DbName="gelpop_remdr"
				Label="Called GEL Instructions"
				Suffix="Remainder"
				FromIndex="GelPopRemainderInstIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="false"
				IsXsdContainer="true"
				DefaultVisibility="true" >
			<RelationCol Name="RemainderTenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="RemainderCartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="RemainderInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
	</TableAddendum>

	<TableAddendum FromTable="GelPrefixLine">
		<Relation Name="Remainder"
				RelationType="Children"
				DbName="gelpfxln_remdr"
				Label="Called GEL Instructions"
				Suffix="Remainder"
				FromIndex="GelPrefixLineRemainderInstIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="false"
				IsXsdContainer="true"
				DefaultVisibility="true" >
			<RelationCol Name="RemainderTenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="RemainderCartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="RemainderInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
	</TableAddendum>

	<TableAddendum FromTable="GelReference">
		<Relation Name="Remainder"
				RelationType="Children"
				DbName="gelref_remdr"
				Label="Called GEL Instructions"
				Suffix="Remainder"
				FromIndex="GelReferenceRemainderInstIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="false"
				IsXsdContainer="true"
				DefaultVisibility="true" >
			<RelationCol Name="RemainderTenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="RemainderCartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="RemainderInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
	</TableAddendum>

	<TableAddendum FromTable="GelSequence">
		<Relation Name="CalledSequence"
				RelationType="Components"
				DbName="gelseq_callseq"
				Label="Called GEL Instructions"
				Suffix="CalledSeq"
				FromIndex="GelSequenceIdIdx"
				ToIndex="GelInstruction.GelInstructionCallerIdx"
				IsRequired="false"
				IsXsdContainer="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GelInstId" ToCol="CallerId" DefaultVisibility="true" />
		</Relation>
		<Relation Name="FirstInst"
				RelationType="Lookup"
				DbName="gelseq_firstinst"
				Suffix="FirstInst"
				FromIndex="GelSequenceFirstInstIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="false"
				IsXsdContainer="true"
				DefaultVisibility="true" >
			<RelationCol Name="FirstInstTenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="FirstInstCartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="FirstInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
		<Relation Name="LastInst"
				RelationType="Lookup"
				DbName="gelseq_lastinst"
				Suffix="LastInst"
				FromIndex="GelSequenceLastInstIdx"
				ToIndex="GelInstruction.GelInstructionIdIdx"
				IsRequired="false"
				IsXsdContainer="true"
				DefaultVisibility="true" >
			<RelationCol Name="LastInstTenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="LastInstCartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="LastInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
	</TableAddendum>

	<TableAddendum FromTable="GelSwitch">
		<Relation Name="SwitchLimb"
				RelationType="Components"
				DbName="gelsw_swlmb"
				Label="Switch Limbs"
				Suffix="SwitchLimb"
				FromIndex="GelSwitchIdIdx"
				ToIndex="GelSwitchLimb.GelSwitchLimbSwitchIdx"
				IsRequired="false"
				IsXsdContainer="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GelInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
	</TableAddendum>

	<TableAddendum FromTable="GelSwitchLimb">
		<Relation Name="Switch"
				RelationType="Container"
				DbName="gelswlmb_sw"
				Label="Switch"
				Suffix="Switch"
				FromIndex="GelSwitchLimbSwitchIdx"
				ToIndex="GelSwitch.GelSwitchIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GelInstId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
		<Relation Name="Tenant"
				RelationType="Owner"
				DbName="gelswlmb_tenant"
				Label="Tenant"
				Suffix="Tenant"
				FromIndex="GelSwitchLimbTenantIdx"
				ToIndex="Tenant.TenantIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="Id" DefaultVisibility="true" />
		</Relation>
	</TableAddendum>

	<TableAddendum FromTable="GenFile">
		<Relation Name="SourceBundleGel"
				RelationType="Components"
				DbName="genfil_srcbdlgel"
				Label="GEL Executable"
				Suffix="SrcBundleGel"
				FromIndex="SourceBundleIdx"
				ToIndex="GelExecutable.GelExecutableIdIdx"
				IsRequired="false"
				IsXsdContainer="true"
				DefaultVisibility="true" >
			<RelationCol Name="SourceBundleTenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="SourceBundleCartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="SourceBundleGelId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
		<Relation Name="BasePackageGel"
				RelationType="Components"
				DbName="gelfil_baspkggel"
				Label="GEL Executable"
				Suffix="BasePackageGel"
				FromIndex="BasePackageIdx"
				ToIndex="GelExecutable.GelExecutableIdIdx"
				IsRequired="false"
				IsXsdContainer="true"
				DefaultVisibility="true" >
			<RelationCol Name="BasePackageTenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="BasePackageCartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="BasePackageGelId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
		<Relation Name="SubPackageGel"
				RelationType="Components"
				DbName="gelfil_subpkggel"
				Label="GEL Executable"
				Suffix="SubPackageGel"
				FromIndex="SubPackageIdx"
				ToIndex="GelExecutable.GelExecutableIdIdx"
				IsRequired="false"
				IsXsdContainer="true"
				DefaultVisibility="true" >
			<RelationCol Name="SubPackageTenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="SubPackageCartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="SubPackageGelId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
		<Relation Name="ExpansionClassNameGel"
				RelationType="Components"
				DbName="gelfil_expclsnmgel"
				Label="GEL Executable"
				Suffix="ExpClassGel"
				FromIndex="ExpansionClassNameIdx"
				ToIndex="GelExecutable.GelExecutableIdIdx"
				IsRequired="false"
				IsXsdContainer="true"
				DefaultVisibility="true" >
			<RelationCol Name="ExpansionClassNameTenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="ExpansionClassNameCartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="ExpansionClassNameGelId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
		<Relation Name="ExpansionKeyNameGel"
				RelationType="Components"
				DbName="gelfil_expkeynmgel"
				Suffix="ExpKeyNameGel"
				FromIndex="ExpansionKeyNameIdx"
				ToIndex="GelExecutable.GelExecutableIdIdx"
				IsRequired="false"
				IsXsdContainer="true"
				DefaultVisibility="true" >
			<RelationCol Name="ExpansionKeyNameTenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="ExpansionKeyNameCartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="ExpansionKeyNameGelId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
		<Relation Name="ExpFileNameGel"
				RelationType="Components"
				DbName="gelfil_expflnmgel"
				Suffix="ExpFileNameGel"
				FromIndex="ExpansionFileNameIdx"
				ToIndex="GelExecutable.GelExecutableIdIdx"
				IsRequired="false"
				IsXsdContainer="true"
				DefaultVisibility="true" >
			<RelationCol Name="ExpansionFileNameTenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="ExpansionFileNameCartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="ExpansionFileNameGelId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
	</TableAddendum>

	<TableAddendum FromTable="GenItem">
		<Relation Name="Tenant"
				RelationType="Owner"
				DbName="genitm_tenant"
				Label="Tenant"
				Suffix="Tenant"
				FromIndex="GenItemTenantIdx"
				ToIndex="Tenant.TenantIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="Id" DefaultVisibility="true" />
		</Relation>
		<Relation Name="Cartridge"
				RelationType="Container"
				DbName="genitm_cart"
				Label="Cartridge"
				Suffix="Cartridge"
				FromIndex="GenItemCartIdx"
				ToIndex="RuleCart.RuleCartIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="CartridgeId" ToCol="Id" DefaultVisibility="true" />
		</Relation>
		<Relation Name="RuleType"
				RelationType="Lookup"
				DbName="genitm_rltyp"
				Label="RuleType"
				Suffix="RuleType"
				FromIndex="GenItemRuleTypeIdx"
				ToIndex="RuleType.RuleTypeIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="RuleTypeId" ToCol="Id" DefaultVisibility="true" />
		</Relation>
		<Relation Name="ToolSet"
				RelationType="Lookup"
				DbName="genitm_toolset"
				Label="ToolSet"
				Suffix="ToolSet"
				FromIndex="GenItemToolSetIdx"
				ToIndex="ToolSet.ToolSetIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="ToolSetId" ToCol="Id" DefaultVisibility="true" />
		</Relation>
		<Relation Name="ScopeDef"
				RelationType="Lookup"
				DbName="genitem_scopdef"
				Label="ScopeDef"
				Suffix="ScopeDef"
				FromIndex="GenItemScopeIdx"
				ToIndex="DefClass.DefClassIdIdx"
				IsRequired="false"
				DefaultVisibility="true" >
			<RelationCol Name="ScopeDefId" ToCol="Id" DefaultVisibility="true" />
		</Relation>
		<Relation Name="GenDef"
				RelationType="Lookup"
				DbName="genitm_gendef"
				Label="GenDef"
				Suffix="GenDef"
				FromIndex="GenItemGenDefIdx"
				ToIndex="DefClass.DefClassIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="GenDefId" ToCol="Id" DefaultVisibility="true" />
		</Relation>
		<Relation Name="GelExecutable"
				RelationType="Components"
				DbName="genitm_gelexec"
				Label="GEL Executable"
				Suffix="GelExec"
				FromIndex="GenItemGelExecutableIdx"
				ToIndex="GelExecutable.GelExecutableIdIdx"
				IsRequired="false"
				IsXsdContainer="true"
				DefaultVisibility="true" >
			<RelationCol Name="GelExecutableTenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="GelExecutableCartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="GelExecutableId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
		<Relation Name="Probe"
				RelationType="Lookup"
				DbName="genitm_probe"
				Label="GenItem Probe Link"
				Suffix="Probe"
				FromIndex="GenItemProbeIdx"
				ToIndex="GenItem.GenItemIdIdx"
				IsRequired="false"
				DefaultVisibility="true" >
			<RelationCol Name="ProbeTenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="ProbeCartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="ProbeGenItemId" ToCol="ItemId" DefaultVisibility="true" />
		</Relation>
	</TableAddendum>

	<TableAddendum FromTable="GenRule">
		<Relation Name="BodyGel"
				RelationType="Components"
				DbName="genrul_bodygel"
				Label="GEL Executable"
				Suffix="BodyGel"
				FromIndex="BodyIdx"
				ToIndex="GelExecutable.GelExecutableIdIdx"
				IsRequired="false"
				IsXsdContainer="true"
				DefaultVisibility="true" >
			<RelationCol Name="BodyTenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="BodyCartridgeId" ToCol="CartridgeId" DefaultVisibility="true" />
			<RelationCol Name="BodyGelId" ToCol="GelInstId" DefaultVisibility="true" />
		</Relation>
	</TableAddendum>

	<TableAddendum FromTable="RuleCart">
		<Relation Name="Tenant"
				RelationType="Container"
				DbName="rulcart_tenant"
				Label="Tenant"
				Suffix="Tenant"
				FromIndex="RuleCartTenant"
				ToIndex="Tenant.TenantIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="Id" DefaultVisibility="true" />
		</Relation>
		<Relation Name="Rules"
				RelationType="Components"
				DbName="rulecart_rules"
				Label="Rule"
				Suffix="Rule"
				FromIndex="RuleCartIdIdx"
				ToIndex="GenItem.GenItemCartIdx"
				IsRequired="false"
				IsXsdContainer="true"
				DefaultVisibility="true" >
			<RelationCol Name="TenantId" ToCol="TenantId" DefaultVisibility="true" />
			<RelationCol Name="Id" ToCol="CartridgeId" DefaultVisibility="true" />
		</Relation>
	</TableAddendum>

	<TableAddendum FromTable="Tenant">
		<Relation Name="TenantRuleCart"
				RelationType="Components"
				DbName="tenant_rulecart"
				Label="Rule Cartridge"
				Suffix="RuleCart"
				FromIndex="TenantIdIdx"
				ToIndex="RuleCart.RuleCartTenant"
				IsRequired="false"
				IsXsdContainer="true"
				DefaultVisibility="true" >
			<RelationCol Name="Id" ToCol="TenantId" DefaultVisibility="true" />
		</Relation>
	</TableAddendum>

	<TableAddendum FromTable="Tool">
		<Relation Name="ToolReplaces"
				RelationType="Lookup"
				DbName="tool_tlrepl"
				Label="Replaces"
				Suffix="Replaces"
				FromIndex="ToolReplacesIdx"
				ToIndex="Tool.ToolIdIdx"
				IsRequired="false"
				DefaultVisibility="true" >
			<RelationCol Name="ReplacesId" ToCol="Id" DefaultVisibility="true" />
		</Relation>
	</TableAddendum>

	<TableAddendum FromTable="ToolSet">
		<Relation Name="Tool0"
				RelationType="Lookup"
				DbName="toolset_tl0"
				Label="Tool0"
				Suffix="Tool0"
				FromIndex="ToolSetTool0Idx"
				ToIndex="Tool.ToolIdIdx"
				IsRequired="true"
				DefaultVisibility="true" >
			<RelationCol Name="ToolId0" ToCol="Id" DefaultVisibility="true" />
		</Relation>
		<Relation Name="Tool1"
				RelationType="Lookup"
				DbName="toolset_tl1"
				Label="Tool1"
				Suffix="Tool1"
				FromIndex="ToolSetTool1Idx"
				ToIndex="Tool.ToolIdIdx"
				IsRequired="false"
				DefaultVisibility="true" >
			<RelationCol Name="ToolId1" ToCol="Id" DefaultVisibility="true" />
		</Relation>
		<Relation Name="Tool2"
				RelationType="Lookup"
				DbName="toolset_tl2"
				Label="Tool2"
				Suffix="Tool2"
				FromIndex="ToolSetTool2Idx"
				ToIndex="Tool.ToolIdIdx"
				IsRequired="false"
				DefaultVisibility="true" >
			<RelationCol Name="ToolId2" ToCol="Id" DefaultVisibility="true" />
		</Relation>
		<Relation Name="Tool3"
				RelationType="Lookup"
				DbName="toolset_tl3"
				Label="Tool3"
				Suffix="Tool3"
				FromIndex="ToolSetTool3Idx"
				ToIndex="Tool.ToolIdIdx"
				IsRequired="false"
				DefaultVisibility="true" >
			<RelationCol Name="ToolId3" ToCol="Id" DefaultVisibility="true" />
		</Relation>
		<Relation Name="Tool4"
				RelationType="Lookup"
				DbName="toolset_tl4"
				Label="Tool4"
				Suffix="Tool4"
				FromIndex="ToolSetTool4Idx"
				ToIndex="Tool.ToolIdIdx"
				IsRequired="false"
				DefaultVisibility="true" >
			<RelationCol Name="ToolId4" ToCol="Id" DefaultVisibility="true" />
		</Relation>
		<Relation Name="Tool5"
				RelationType="Lookup"
				DbName="toolset_tl5"
				Label="Tool5"
				Suffix="Tool5"
				FromIndex="ToolSetTool5Idx"
				ToIndex="Tool.ToolIdIdx"
				IsRequired="false"
				DefaultVisibility="true" >
			<RelationCol Name="ToolId5" ToCol="Id" DefaultVisibility="true" />
		</Relation>
		<Relation Name="Tool6"
				RelationType="Lookup"
				DbName="toolset_tl6"
				Label="Tool6"
				Suffix="Tool6"
				FromIndex="ToolSetTool6Idx"
				ToIndex="Tool.ToolIdIdx"
				IsRequired="false"
				DefaultVisibility="true" >
			<RelationCol Name="ToolId6" ToCol="Id" DefaultVisibility="true" />
		</Relation>
		<Relation Name="Tool7"
				RelationType="Lookup"
				DbName="toolset_tl7"
				Label="Tool7"
				Suffix="Tool7"
				FromIndex="ToolSetTool7Idx"
				ToIndex="Tool.ToolIdIdx"
				IsRequired="false"
				DefaultVisibility="true" >
			<RelationCol Name="ToolId7" ToCol="Id" DefaultVisibility="true" />
		</Relation>
	</TableAddendum>

	<TableAddendum FromTable="GelConstrain">
		<DelDep Name="DelRemainder" DelDepChain="Remainder" />
	</TableAddendum>

	<TableAddendum FromTable="GelModifier">
		<DelDep Name="DelRemainder" DelDepChain="Remainder" />
	</TableAddendum>

	<TableAddendum FromTable="GelPop">
		<DelDep Name="DelRemainder" DelDepChain="Remainder" />
	</TableAddendum>

	<TableAddendum FromTable="GelPrefixLine">
		<DelDep Name="DelRemainder" DelDepChain="Remainder" />
	</TableAddendum>

	<TableAddendum FromTable="GelReference">
		<DelDep Name="DelRemainder" DelDepChain="Remainder" />
	</TableAddendum>

	<TableAddendum FromTable="GelSequence">
		<DelDep Name="DelCalledSequence" DelDepChain="CalledSequence" />
	</TableAddendum>

	<TableAddendum FromTable="GelSwitch">
		<DelDep Name="DelSwitchLimb" DelDepChain="SwitchLimb" />
	</TableAddendum>

	<TableAddendum FromTable="GenItem">
		<DelDep Name="DelGelExecutable" DelDepChain="GelExecutable" />
	</TableAddendum>

	<TableAddendum FromTable="RuleCart">
		<DelDep Name="DelRules" DelDepChain="Rules" />
	</TableAddendum>

	<TableAddendum FromTable="Tenant">
		<DelDep Name="DelRuleCart" DelDepChain="TenantRuleCart" />
	</TableAddendum>

</SchemaDef>
						</MinorVersion>
					</MajorVersion>
				</SubProject>
			</TopProject>
		</TopDomain>
	</Tld>
</MSSBam>
