Java 类org.jooq.impl.UpdatableRecordImpl 实例源码

项目:cattle    文件:ResourceIdOutputFilter.java   
@Override
public Resource filter(ApiRequest request, Object original, Resource converted) {
    if (original instanceof UpdatableRecordImpl){
        UpdatableRecordImpl<?> record = (UpdatableRecordImpl<?>) original;
        for (Field<?> field: record.fields()){
            if (RESOURCE_ID_FIELD.equalsIgnoreCase(field.getName())
                    && StringUtils.isNotBlank(String.valueOf(record.getValue(RESOURCE_ID_FIELD)))){
                converted.getFields().put(RESOURCE_ID , ApiContext.getContext()
                        .getIdFormatter().formatId(String.valueOf(record.getValue(RESOURCE_TYPE_FIELD)), record.getValue(RESOURCE_ID_FIELD)));
                break;
            }
        }
    }
    return converted;
}