org.jooq.TableField Java Examples

The following examples show how to use org.jooq.TableField. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RelationManyToManyOrdered.java    From FROST-Server with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public TableRef<J> join(QueryState<J> queryState, TableRef<J> sourceRef) {
    T targetAliased = (T) target.as(queryState.getNextAlias());
    L linkTableAliased = (L) linkTable.as(queryState.getNextAlias());
    TableField<Record, J> sourceField = sourceFieldAcc.getField(source);
    TableField<Record, J> sourceLinkField = sourceLinkFieldAcc.getField(linkTableAliased);
    TableField<Record, J> targetLinkField = targetLinkFieldAcc.getField(linkTableAliased);
    TableField<Record, J> targetField = targetFieldAcc.getField(targetAliased);
    queryState.setSqlFrom(queryState.getSqlFrom().innerJoin(linkTableAliased).on(sourceLinkField.eq(sourceField)));
    queryState.setSqlFrom(queryState.getSqlFrom().innerJoin(targetAliased).on(targetField.eq(targetLinkField)));
    if (queryState.isFilter()) {
        queryState.setDistinctRequired(true);
    } else {
        TableField<Record, K> orderField = orderFieldAcc.getField(linkTableAliased);
        queryState.getSqlSortFields().add(orderField, OrderBy.OrderType.ASCENDING);
    }
    return QueryBuilder.createJoinedRef(sourceRef, targetType, targetAliased);
}
 
Example #2
Source File: TPanel.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
private TableField<TmorphSetsRecord, Integer> kitToField(KitType kitType)
{
	switch (kitType)
	{
		case HEAD:
			return TMORPH_SETS.HELMET;
		case CAPE:
			return TMORPH_SETS.CAPE;
		case AMULET:
			return TMORPH_SETS.AMULET;
		case WEAPON:
			return TMORPH_SETS.WEAPON;
		case TORSO:
			return TMORPH_SETS.TORSO;
		case SHIELD:
			return TMORPH_SETS.SHIELD;
		case LEGS:
			return TMORPH_SETS.LEGS;
		case HANDS:
			return TMORPH_SETS.HANDS;
		case BOOTS:
			return TMORPH_SETS.BOOTS;
		default:
			return null;
	}
}
 
Example #3
Source File: ReflectedTable.java    From java-crud-api with MIT License 6 votes vote down vote up
@SuppressWarnings("unchecked")
public ReflectedTable(Table<?> table) {
	super(table.getQualifiedName());
	this.table = table;
	for (Field<?> field : table.fields()) {
		String name = field.getName();
		DataType<Object> dataType = (DataType<Object>) field.getDataType();
		TableField newField = createField(name, dataType);
		fields.put(name, newField);
	}
	UniqueKey<?> primaryKey = table.getPrimaryKey();
	if (primaryKey != null) {
		if (primaryKey.getFields().size() == 1) {
			pk = primaryKey.getFields().get(0);
		}
	}
	for (ForeignKey<?, ?> fk : table.getReferences()) {
		fks.put(findForeignKeyFieldName(fk), findForeignKeyReference(fk));
	}
}
 
Example #4
Source File: ReflectedTable.java    From java-crud-api with MIT License 5 votes vote down vote up
private TableField<?, ?> findPrimaryKey(Table<?> table) {
	UniqueKey<?> pk = table.getPrimaryKey();
	if (pk != null) {
		TableField<?, ?>[] pks = pk.getFieldsArray();
		if (pks.length == 1) {
			return pks[0];
		}
	}
	return null;
}
 
Example #5
Source File: ReflectedTable.java    From java-crud-api with MIT License 5 votes vote down vote up
private String findForeignKeyFieldName(ForeignKey<?, ?> fk) {
	TableField<?, ?>[] pks = fk.getFieldsArray();
	if (pks.length == 1) {
		return pks[0].getName();
	}
	return null;
}
 
Example #6
Source File: ReflectedTable.java    From java-crud-api with MIT License 5 votes vote down vote up
@Override
public Identity getIdentity() {
	TableField<?, ?> pk = findPrimaryKey(table);
	if (pk == null) {
		return null;
	}
	return new DynamicIdentity(table, pk);
}
 
Example #7
Source File: RelationManyToMany.java    From FROST-Server with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public TableRef<J> join(QueryState<J> queryState, TableRef<J> sourceRef) {
    L linkTableAliased = (L) linkTable.as(queryState.getNextAlias());
    T targetAliased = (T) target.as(queryState.getNextAlias());
    TableField<Record, J> sourceField = sourceFieldAcc.getField(source);
    TableField<Record, J> sourceLinkField = sourceLinkFieldAcc.getField(linkTableAliased);
    TableField<Record, J> targetLinkField = targetLinkFieldAcc.getField(linkTableAliased);
    TableField<Record, J> targetField = targetFieldAcc.getField(targetAliased);
    queryState.setSqlFrom(queryState.getSqlFrom().innerJoin(linkTableAliased).on(sourceLinkField.eq(sourceField)));
    queryState.setSqlFrom(queryState.getSqlFrom().innerJoin(targetAliased).on(targetField.eq(targetLinkField)));
    queryState.setDistinctRequired(true);
    return QueryBuilder.createJoinedRef(sourceRef, targetType, targetAliased);
}
 
Example #8
Source File: TableStringDatastreams.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TableField<Record, String> getId() {
    return colId;
}
 
Example #9
Source File: TableLongThings.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TableField<Record, Long> getId() {
    return colId;
}
 
Example #10
Source File: TableStringMultiDatastreamsObsProperties.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TableField<Record, String> getObsPropertyId() {
    return colObsPropertyId;
}
 
Example #11
Source File: TableStringThings.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TableField<Record, String> getId() {
    return colId;
}
 
Example #12
Source File: AbstractTableSensors.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public abstract TableField<Record, J> getId();
 
Example #13
Source File: TableLongObservations.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TableField<Record, Long> getFeatureId() {
    return colFeatureId;
}
 
Example #14
Source File: TableStringMultiDatastreamsObsProperties.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TableField<Record, String> getMultiDatastreamId() {
    return colMultiDatastreamId;
}
 
Example #15
Source File: TableLongMultiDatastreams.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TableField<Record, Long> getId() {
    return colId;
}
 
Example #16
Source File: TableStringDatastreams.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TableField<Record, String> getObsPropertyId() {
    return colObsPropertyId;
}
 
Example #17
Source File: TableLongFeatures.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TableField<Record, Long> getId() {
    return colId;
}
 
Example #18
Source File: TableStringFeatures.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TableField<Record, String> getId() {
    return colId;
}
 
Example #19
Source File: TableStringMultiDatastreams.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TableField<Record, String> getId() {
    return colId;
}
 
Example #20
Source File: TableLongMultiDatastreams.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TableField<Record, Long> getSensorId() {
    return colSensorId;
}
 
Example #21
Source File: TableStringTaskingCapabilities.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TableField<Record, String> getId() {
    return colId;
}
 
Example #22
Source File: TableStringLocationsHistLocations.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TableField<Record, String> getHistLocationId() {
    return colHistLocationId;
}
 
Example #23
Source File: TableStringObsProperties.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TableField<Record, String> getId() {
    return colId;
}
 
Example #24
Source File: TableLongDatastreams.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TableField<Record, Long> getObsPropertyId() {
    return colObsPropertyId;
}
 
Example #25
Source File: AbstractTableHistLocations.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public abstract TableField<Record, J> getId();
 
Example #26
Source File: TableLongSensors.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TableField<Record, Long> getId() {
    return colId;
}
 
Example #27
Source File: AbstractTableTasks.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public abstract TableField<Record, J> getId();
 
Example #28
Source File: AbstractTableTaskingCapabilities.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public abstract TableField<Record, J> getId();
 
Example #29
Source File: TableUuidActuators.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TableField<Record, UUID> getId() {
    return colId;
}
 
Example #30
Source File: TableLongTaskingCapabilities.java    From FROST-Server with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TableField<Record, Long> getThingId() {
    return colThingId;
}