public String expandBody(MssCFGenContext genContext) { ICFLibAnyObj genDef; final String S_ProcName = "expandBody"; if (genContext == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "genContext"); } genDef = genContext.getGenDef(); if (genDef == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "genContext.GenDef"); } if (!(genDef instanceof ICFBamTableObj)) { throw CFLib.getDefaultExceptionFactory() .newUnsupportedClassException( getClass(), S_ProcName, "genContext.GenDef", genDef, "ICFBamTableObj"); } ICFBamTableObj table = (ICFBamTableObj) genDef; String ret; String raw = table.getOptionalJObjImplementation(); if ((raw == null) || (raw.length() <= 0)) { ret = ""; } else { ICFGenKbGelInstructionObj bin = genContext .getGenEngine() .getGelCompiler() .compileExecutable(genContext.getGenFile(), raw); ret = bin.expand(genContext); } return (ret); }
public String expand(MssCFGenContext genContext) { String retval; final String S_ProcName = "CFGenKbGelReference.expand() "; String referenceName = getRequiredReferenceName(); ICFGenKbGenItemObj genItem = genContext.getGenEngine().findContextItem(genContext, referenceName); if (genItem == null) { genContext .getGenEngine() .getLog() .message( "Could not resolve reference method \"" + referenceName + "\". \"" + "$" + getRequiredSourceText() + "$" + "\" is invalid"); return (null); } if (!(genItem instanceof MssCFGenReferenceObj)) { genContext .getGenEngine() .getLog() .message( "Resolution of reference method \"" + referenceName + "\" returned a " + genItem.getClass().getPackage().getName() + "." + genItem.getClass().getName() + ", not a MssCFGenReferenceObj. \"" + "$" + getRequiredSourceText() + "$" + "\" is invalid"); return (null); } MssCFGenReferenceObj reference = (MssCFGenReferenceObj) genItem; ICFLibAnyObj refDef = reference.dereference(genContext); if (refDef == null) { genContext .getGenEngine() .getLog() .message( "Resolution of reference \"" + referenceName + "\" returned null. \"" + "$" + getRequiredSourceText() + "$" + "\" is invalid"); return (null); } MssCFGenContext refContext = genContext.buildRefContext(refDef); if (refContext == null) { throw new RuntimeException(S_ProcName + "buildRefContext() failed"); } ICFGenKbGelInstructionObj remainder = getOptionalChildrenRemainder(); String expansion; if (remainder == null) { expansion = ""; } else { expansion = remainder.expand(refContext); } return (expansion); }