Announcements
class x extends classZBatch
{
private RecordInsertList recordInsertList = new RecordInsertList(tableNum(TableA));
public void run()
{
this.process();
this.postProcess();
}
public void postProcess() {
recordInsertList.insertDatabase();
}
void process()
{
str line;
const str fieldDelimiter = '\r\n';
const str recordDelimiter = '\r\n';
importFile.inFieldDelimiter(fieldDelimiter);
importFile.inRecordDelimiter(recordDelimiter);
while (importFile.status() == IO_Status::Ok)
{
line = conPeek(importFile.read(), 1);
ttsbegin;
this.processLine(line);
ttscommit;
}
}
protected void processLine(str _line)
{
ClassA process = classA::newFromEnumX(EnumX::First);
process.insertTableA(_line);
recordInsertList = process.getRecordInsertList();
}
}
abstract class classA
{
private TableA tableA;
private RecordInsertList recordInsertList = new RecordInsertList(tableNum(TableA));
final public void insertTableA(str _line)
{
tableA.clear();
// logic to fill table A
recordInsertList.add(tableA);
}
public static ClassA newFromEnumX(EnumX _enumX)
{
EnumXAtrribute enumXAttribute = new EnumXAtrribute(_enumX);
return SysExtensionAppClassFactory::getClassFromSysAttribute(classStr(ClassA), enumXAttribute);
}
public RecordInsertList getRecordInsertList()
{
return recordInsertList;
}
}
class EnumXAtrribute extends SysAttribute implements SysExtensionIAttribute
{
EnumX enumX;
public void new(EnumX _enumX)
{
super();
enumX = _enumX;
}
public str parmCacheKey()
{
return classStr(EnumXAtrribute) + ';'+ int2str(enum2int(enumX));
}
public boolean useSingleton()
{
return true;
}
}
}
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,186 Super User 2024 Season 2
Martin Dráb 227,996 Super User 2024 Season 2
nmaenpaa 101,148