use of org.molgenis.data.postgresql.identifier.AttributeDescription in project molgenis by molgenis.
the class PostgreSqlExceptionTranslator method getAttributeName.
/**
* Returns the attribute name for this table name
*
* @param tableName table name
* @param colName column name
* @return attribute name
*/
private String getAttributeName(String tableName, String colName) {
EntityTypeDescription entityTypeDescription = entityTypeRegistry.getEntityTypeDescription(tableName);
if (entityTypeDescription == null) {
throw new RuntimeException(format("Unknown entity for table name [%s]", tableName));
}
AttributeDescription attrDescription = entityTypeDescription.getAttributeDescriptionMap().get(colName);
if (attrDescription == null) {
throw new RuntimeException(format("Unknown attribute for column name [%s]", colName));
}
return attrDescription.getName();
}
Aggregations