use of io.jans.orm.cloud.spanner.model.TableMapping in project jans by JanssenProject.
the class SpannerConnectionProvider method getChildTableMappingByKey.
public TableMapping getChildTableMappingByKey(String key, TableMapping tableMapping, String columnName) {
String childTableName = tableMapping.getTableName() + "_" + columnName;
TableMapping childTableMapping = getTableMappingByKey(key, tableMapping.getObjectClass(), childTableName);
return childTableMapping;
}
use of io.jans.orm.cloud.spanner.model.TableMapping in project jans by JanssenProject.
the class SpannerConnectionProvider method getTableMappingByKey.
public TableMapping getTableMappingByKey(String key, String objectClass, String tableName) {
Map<String, StructField> columTypes = tableColumnsMap.get(tableName);
if (!tableColumnsMap.containsKey(tableName)) {
throw new MappingException(String.format("Table '%s' metadata is not exists '", tableName));
}
if ("_".equals(key)) {
return new TableMapping("", tableName, objectClass, columTypes);
}
String[] baseNameParts = key.split("_");
if (ArrayHelper.isEmpty(baseNameParts)) {
throw new KeyConversionException("Failed to determine base key part!");
}
TableMapping tableMapping = new TableMapping(baseNameParts[0], tableName, objectClass, columTypes);
return tableMapping;
}
Aggregations