}
if (sf.relationType == SpeedoField.MANY_REFERENCE) {
sf.join = new SpeedoJoin();
}
for (JoinColumn jc : jcs) {
SpeedoColumn scol = new SpeedoColumn();
scol.targetColumn = jc.referencedColumnName();
if (scol.targetColumn.equals("")) {
if (jcs.length > 1) {
nbErrors++;
logger.log(BasicLevel.ERROR, sc.getSourceDescShort()
+ ": try to define the join of a reference or association field ("
+ sf.name + ") without defining names of referenced columns.");
continue;
}
}
if (jc.name().equals("")) {
if (jcs.length > 1) {
nbErrors++;
logger.log(BasicLevel.ERROR, sc.getSourceDescShort()
+ ": try to define the join of a reference or association field ("
+ sf.name + ") without defining names of join columns.");
continue;
}
scol.name = sf.name + "_" + scol.targetColumn;
} else {
scol.name = jc.name();
}
if (! jc.table().equals("")) {
scol.table = sc.getExtTable(jc.table(), true);
} else {
scol.table = sc.mainTable;
}
if (sf.relationType == SpeedoField.MANY_REFERENCE) {
if (sf.join.mainTable == null) {
sf.join.mainTable = scol.table;
} else if (sf.join.mainTable != scol.table) {
nbErrors++;
logger.log(BasicLevel.ERROR, sc.getSourceDescShort()
+ ": cannot map the reference field ("
+ sf.name + ") to columns belonging to several tables.");
continue;
}
}
SpeedoColumn fscol = sc.getColumn(scol.name, false);
if ((fscol != null) && (fscol.table == scol.table)) {
nbErrors++;
logger.log(BasicLevel.ERROR, sc.getSourceDescShort()
+ ": cannot define a column twice for column named ("
+ scol.name + ").");