use of ch.interlis.ili2c.metamodel.EnumerationType in project ili2db by claeis.
the class FromXtfRecordConverter method addAttrToInsertStmt.
public String addAttrToInsertStmt(boolean isUpdate, StringBuffer ret, StringBuffer values, String sep, AttributeDef attr, String sqlTableName) {
if (attr.getExtending() == null) {
Type type = attr.getDomainResolvingAliases();
String attrSqlName = ili2sqlName.mapIliAttributeDef(attr, sqlTableName, null);
if (attr.isDomainBoolean()) {
ret.append(sep);
ret.append(attrSqlName);
if (isUpdate) {
ret.append("=?");
} else {
values.append(",?");
}
sep = ",";
} else if (type instanceof CompositionType) {
if (TrafoConfigNames.CATALOGUE_REF_TRAFO_COALESCE.equals(trafoConfig.getAttrConfig(attr, TrafoConfigNames.CATALOGUE_REF_TRAFO))) {
ret.append(sep);
ret.append(attrSqlName);
if (isUpdate) {
ret.append("=?");
} else {
values.append(",?");
}
sep = ",";
} else if (TrafoConfigNames.MULTISURFACE_TRAFO_COALESCE.equals(trafoConfig.getAttrConfig(attr, TrafoConfigNames.MULTISURFACE_TRAFO))) {
ret.append(sep);
ret.append(attrSqlName);
multiSurfaceAttrs.addMultiSurfaceAttr(attr);
int srsid = getSrsid(getMultiSurfaceAttrDef(type, multiSurfaceAttrs.getMapping(attr)));
if (isUpdate) {
ret.append("=" + geomConv.getInsertValueWrapperMultiSurface("?", srsid));
} else {
values.append("," + geomConv.getInsertValueWrapperMultiSurface("?", srsid));
}
sep = ",";
} else if (TrafoConfigNames.MULTILINE_TRAFO_COALESCE.equals(trafoConfig.getAttrConfig(attr, TrafoConfigNames.MULTILINE_TRAFO))) {
ret.append(sep);
ret.append(attrSqlName);
multiLineAttrs.addMultiLineAttr(attr);
int srsid = getSrsid(getMultiLineAttrDef(type, multiLineAttrs.getMapping(attr)));
if (isUpdate) {
ret.append("=" + geomConv.getInsertValueWrapperMultiPolyline("?", srsid));
} else {
values.append("," + geomConv.getInsertValueWrapperMultiPolyline("?", srsid));
}
sep = ",";
} else if (TrafoConfigNames.MULTIPOINT_TRAFO_COALESCE.equals(trafoConfig.getAttrConfig(attr, TrafoConfigNames.MULTIPOINT_TRAFO))) {
ret.append(sep);
ret.append(attrSqlName);
multiPointAttrs.addMultiPointAttr(attr);
int srsid = getSrsid(getMultiPointAttrDef(type, multiPointAttrs.getMapping(attr)));
if (isUpdate) {
ret.append("=" + geomConv.getInsertValueWrapperMultiCoord("?", srsid));
} else {
values.append("," + geomConv.getInsertValueWrapperMultiCoord("?", srsid));
}
sep = ",";
} else if (TrafoConfigNames.ARRAY_TRAFO_COALESCE.equals(trafoConfig.getAttrConfig(attr, TrafoConfigNames.ARRAY_TRAFO))) {
ret.append(sep);
ret.append(attrSqlName);
arrayAttrs.addArrayAttr(attr);
if (isUpdate) {
ret.append("=" + geomConv.getInsertValueWrapperArray("?"));
} else {
values.append("," + geomConv.getInsertValueWrapperArray("?"));
}
sep = ",";
} else if (TrafoConfigNames.MULTILINGUAL_TRAFO_EXPAND.equals(trafoConfig.getAttrConfig(attr, TrafoConfigNames.MULTILINGUAL_TRAFO))) {
for (String sfx : DbNames.MULTILINGUAL_TXT_COL_SUFFIXS) {
ret.append(sep);
ret.append(attrSqlName + sfx);
if (isUpdate) {
ret.append("=?");
} else {
values.append(",?");
}
sep = ",";
}
}
} else if (type instanceof PolylineType) {
ret.append(sep);
ret.append(attrSqlName);
if (isUpdate) {
ret.append("=" + geomConv.getInsertValueWrapperPolyline("?", getSrsid(attr)));
} else {
values.append("," + geomConv.getInsertValueWrapperPolyline("?", getSrsid(attr)));
}
sep = ",";
} else if (type instanceof SurfaceOrAreaType) {
if (createItfLineTables) {
} else {
ret.append(sep);
ret.append(attrSqlName);
if (isUpdate) {
ret.append("=" + geomConv.getInsertValueWrapperSurface("?", getSrsid(attr)));
} else {
values.append("," + geomConv.getInsertValueWrapperSurface("?", getSrsid(attr)));
}
sep = ",";
}
if (createItfAreaRef) {
if (type instanceof AreaType) {
ret.append(sep);
ret.append(attrSqlName + DbNames.ITF_MAINTABLE_GEOTABLEREF_COL_SUFFIX);
if (isUpdate) {
ret.append("=" + geomConv.getInsertValueWrapperCoord("?", getSrsid(attr)));
} else {
values.append("," + geomConv.getInsertValueWrapperCoord("?", getSrsid(attr)));
}
sep = ",";
}
}
} else if (type instanceof CoordType) {
ret.append(sep);
ret.append(attrSqlName);
if (isUpdate) {
ret.append("=" + geomConv.getInsertValueWrapperCoord("?", getSrsid(attr)));
} else {
values.append("," + geomConv.getInsertValueWrapperCoord("?", getSrsid(attr)));
}
sep = ",";
} else if (type instanceof EnumerationType) {
ret.append(sep);
ret.append(attrSqlName);
if (isUpdate) {
ret.append("=?");
} else {
values.append(",?");
}
sep = ",";
if (createEnumTxtCol) {
ret.append(sep);
ret.append(attrSqlName + DbNames.ENUM_TXT_COL_SUFFIX);
if (isUpdate) {
ret.append("=?");
} else {
values.append(",?");
}
sep = ",";
}
} else if (type instanceof ReferenceType) {
ArrayList<ViewableWrapper> targetTables = getTargetTables(((ReferenceType) type).getReferred());
for (ViewableWrapper targetTable : targetTables) {
attrSqlName = ili2sqlName.mapIliAttributeDef(attr, sqlTableName, targetTable.getSqlTablename(), targetTables.size() > 1);
ret.append(sep);
ret.append(attrSqlName);
if (isUpdate) {
ret.append("=?");
} else {
values.append(",?");
}
sep = ",";
}
} else {
ret.append(sep);
ret.append(attrSqlName);
if (isUpdate) {
ret.append("=?");
} else {
values.append(",?");
}
sep = ",";
}
}
return sep;
}
use of ch.interlis.ili2c.metamodel.EnumerationType in project ili2db by claeis.
the class TransferFromXtf method allReferencesKnownHelper.
private void allReferencesKnownHelper(IomObject iomObj, AttributeDef attr, FixIomObjectExtRefs extref) {
String attrName = attr.getName();
if (attr.isDomainBoolean()) {
} else if (attr.isDomainIli1Date()) {
} else if (attr.isDomainIli2Date()) {
} else if (attr.isDomainIli2Time()) {
} else if (attr.isDomainIli2DateTime()) {
} else {
Type type = attr.getDomainResolvingAliases();
if (type instanceof CompositionType) {
// enqueue struct values
int structc = iomObj.getattrvaluecount(attrName);
for (int structi = 0; structi < structc; structi++) {
IomObject struct = iomObj.getattrobj(attrName, structi);
allReferencesKnownHelper(struct, extref);
}
} else if (type instanceof PolylineType) {
} else if (type instanceof SurfaceOrAreaType) {
} else if (type instanceof CoordType) {
} else if (type instanceof NumericType) {
} else if (type instanceof EnumerationType) {
} else if (type instanceof ReferenceType) {
IomObject structvalue = iomObj.getattrobj(attrName, 0);
String refoid = null;
if (structvalue != null) {
refoid = structvalue.getobjectrefoid();
}
if (refoid != null) {
Viewable targetClass = ((ReferenceType) type).getReferred();
if (!oidPool.containsXtfid(Ili2cUtility.getRootViewable(targetClass).getScopedName(null), refoid)) {
extref.addFix(structvalue, targetClass);
}
}
} else {
}
}
}
Aggregations