sc.inheritance.discriminatorValues.put(sd.expression, se.value);
}
}
} else if (se.owner instanceof SpeedoField) {
SpeedoField sf = (SpeedoField) se.owner;
if (SQL_NAME.equals(se.key)) {
if (sf.getReferencedClass() == null) {
initColumnField(sf);
try {
sf.columns[0].name = se.value;
} catch (RuntimeException e) {
logger.log(BasicLevel.WARN, sf.getSourceDesc() + ", cols=" + sf.columns[0], e);
logger.log(BasicLevel.WARN, "se.value" + se.value);
throw e;
}
deprecate(SQL_NAME,"use the 'column' attribut of the tag 'field'.");
} else {
logger.log(BasicLevel.WARN,
"Extension 'sql-name' cannot be specified for a non primitive field: " + sf.getSourceDesc());
}
} else if (SQL_TYPE.equals(se.key)) {
if (sf.getReferencedClass() == null) {
initColumnField(sf);
sf.columns[0].sqlType = se.value;
deprecate(SQL_TYPE,"use the 'sql-type' attribut of the tag 'field'.");
} else {
logger.log(BasicLevel.WARN,
"Extension 'sql-type' cannot be specified for a non primitive field: " + sf.getSourceDesc());
}
} else if (SIZE.equals(se.key)) {
if (sf.getReferencedClass() == null) {
initColumnField(sf);
sf.columns[0].length = Integer.parseInt(se.value);
deprecate(SIZE,"use the 'size' attribut of the tag 'field'.");
} else {
logger.log(BasicLevel.WARN,
"Extension 'size' cannot be specified for a non primitive field: " + sf.getSourceDesc());
}
} else if (SCALE.equals(se.key)) {
if (sf.getReferencedClass() == null) {
initColumnField(sf);
sf.columns[0].scale = Integer.parseInt(se.value);
deprecate(SCALE,"use the 'scale' attribut of the tag 'field'.");
} else {
logger.log(BasicLevel.WARN,
"Extension 'scale' cannot be specified for a non primitive field: " + sf.getSourceDesc());
}
} else if (REVERSE_FIELD.equals(se.key)) {
//@see org.objectweb.speedo.generation.mivisitor.ReverseFieldAdder
} else if (ELEMENT.equals(se.key)) {
if (sf.jdoTuple != null && sf.getReferencedClass() == null) {
initColumnField(sf);
sf.columns[0].name = se.value;
deprecate(ELEMENT,"use the 'column' attribut of the tag 'field'.");
} else {
logger.log(BasicLevel.WARN,
"Extension 'element-sql-name' cannot be specified for a field which is not a collection of primitive element: " + sf.getSourceDesc());
}
} else if (ELEMENT_TYPE.equals(se.key)) {
if (sf.jdoTuple != null && sf.getReferencedClass() == null) {
initColumnField(sf);
sf.columns[0].sqlType = se.value;
deprecate(ELEMENT_TYPE,"use the 'column' attribut of the tag 'field'.");
} else {
logger.log(BasicLevel.WARN,
"Extension 'element-sql-type' cannot be specified for a field which is not a collection of primitive element: " + sf.getSourceDesc());
}
} else if (INDEX.equals(se.key)) {
if (sf.jdoTuple instanceof SpeedoCollection) {
initCollectionIndexColumn(
(SpeedoCollection) sf.jdoTuple).name = se.value;
} else if (sf.jdoTuple instanceof SpeedoMap) {
initMapKeyColumn((SpeedoMap) sf.jdoTuple).name = se.value;
} else {
logger.log(BasicLevel.WARN,
"Extension 'index-sql-name' cannot be specified for a field which is not a collection or a map: " + sf.getSourceDesc());
}
} else if (INDEX_TYPE.equals(se.key)) {
if (sf.jdoTuple instanceof SpeedoCollection) {
initCollectionIndexColumn(
(SpeedoCollection) sf.jdoTuple).sqlType = se.value;
} else if (sf.jdoTuple instanceof SpeedoMap) {
initMapKeyColumn((SpeedoMap) sf.jdoTuple).sqlType = se.value;
} else {
logger.log(BasicLevel.WARN,
"Extension 'index-sql-type' cannot be specified for a field which is not a collection or a map: " + sf.getSourceDesc());
}
}
}