public void create(
FemRoutine routine,
GeneratedDdlStmt stmt)
{
SqlBuilder sb = createSqlBuilder();
final ProcedureType routineType = routine.getType();
final CwmClassifier owner = routine.getSpecification().getOwner();
boolean method =
(routine.getSpecification() != null)
&& (owner
instanceof FemUserDefinedType);
if (method) {
createHeader(sb, "SPECIFIC METHOD", stmt);
} else if (routineType.equals(ProcedureTypeEnum.FUNCTION)) {
createHeader(sb, "FUNCTION", stmt);
} else if (routineType.equals(ProcedureTypeEnum.PROCEDURE)) {
createHeader(sb, "PROCEDURE", stmt);
}
name(sb, routine.getNamespace(), routine.getInvocationName());
stmt.addStmt(sb.getSqlAndClear());
if (method) {
sb.append(NL);
sb.append("FOR ");
name(sb, owner.getNamespace(), owner.getName());
} else {
methodBody(routine, sb);
}
if (routine.getExternalName() == null) {
sb.append(NL);
sb.append(routine.getBody().getBody());
}
stmt.addStmt(sb.getSqlAndClear());
}