use of org.jooq.Record5 in project jOOQ by jOOQ.
the class MySQLDatabase method getEnums0.
@Override
protected List<EnumDefinition> getEnums0() throws SQLException {
List<EnumDefinition> result = new ArrayList<EnumDefinition>();
Result<Record5<String, String, String, String, String>> records = create().select(Columns.TABLE_SCHEMA, Columns.COLUMN_COMMENT, Columns.TABLE_NAME, Columns.COLUMN_NAME, Columns.COLUMN_TYPE).from(COLUMNS).where(Columns.COLUMN_TYPE.like("enum(%)").and(Columns.TABLE_SCHEMA.in(getInputSchemata()))).orderBy(Columns.TABLE_SCHEMA.asc(), Columns.TABLE_NAME.asc(), Columns.COLUMN_NAME.asc()).fetch();
for (Record record : records) {
SchemaDefinition schema = getSchema(record.get(Columns.TABLE_SCHEMA));
String comment = record.get(Columns.COLUMN_COMMENT);
String table = record.get(Columns.TABLE_NAME);
String column = record.get(Columns.COLUMN_NAME);
String name = table + "_" + column;
String columnType = record.get(Columns.COLUMN_TYPE);
// [#1237] Don't generate enum classes for columns in MySQL tables
// that are excluded from code generation
TableDefinition tableDefinition = getTable(schema, table);
if (tableDefinition != null) {
ColumnDefinition columnDefinition = tableDefinition.getColumn(column);
if (columnDefinition != null) {
// are explicitly forced to another type
if (getConfiguredForcedType(columnDefinition, columnDefinition.getType()) == null) {
DefaultEnumDefinition definition = new DefaultEnumDefinition(schema, name, comment);
CSVReader reader = new CSVReader(new StringReader(columnType.replaceAll("(^enum\\()|(\\)$)", "")), // Separator
',', // Quote character
'\'', // Strict quotes
true);
for (String string : reader.next()) {
definition.addLiteral(string);
}
result.add(definition);
}
}
}
}
return result;
}
use of org.jooq.Record5 in project textdb by TextDB.
the class UserFileResource method listUserFiles.
@GET
@Path("/list")
public List<UserFile> listUserFiles(@Session HttpSession session) {
UInteger userID = UserResource.getUser(session).getUserID();
Result<Record5<UInteger, String, String, String, UInteger>> result = getUserFileRecord(userID);
if (result == null)
return new ArrayList<>();
List<UserFile> fileList = result.stream().map(record -> new UserFile(record.get(FILE.FID), record.get(FILE.NAME), record.get(FILE.PATH), record.get(FILE.DESCRIPTION), record.get(FILE.SIZE))).collect(Collectors.toList());
return fileList;
}
use of org.jooq.Record5 in project waltz by khartec.
the class PeopleExtractor method registerExtractForApp.
private void registerExtractForApp(String path) {
post(path, (request, response) -> {
EntityReference entityRef = WebUtilities.getEntityReference(request);
IdSelectionOptions selectionOptions = mkOpts(entityRef, HierarchyQueryScope.determineUpwardsScopeForKind(entityRef.kind()));
GenericSelector selector = genericSelectorFactory.apply(selectionOptions);
SelectSeekStep1<Record5<String, String, String, String, String>, String> qry = dsl.select(PERSON.DISPLAY_NAME.as("Name"), PERSON.TITLE.as("Title"), PERSON.OFFICE_PHONE.as("Telephone"), PERSON.EMAIL.as("Email"), INVOLVEMENT_KIND.NAME.as("Role")).from(PERSON).innerJoin(INVOLVEMENT).on(INVOLVEMENT.EMPLOYEE_ID.eq(PERSON.EMPLOYEE_ID)).innerJoin(INVOLVEMENT_KIND).on(INVOLVEMENT_KIND.ID.eq(INVOLVEMENT.KIND_ID)).where(INVOLVEMENT.ENTITY_ID.in(selector.selector()).and(INVOLVEMENT.ENTITY_KIND.eq(selector.kind().name()))).orderBy(PERSON.DISPLAY_NAME);
return writeExtract("involved_people", qry, request, response);
});
}
Aggregations