Search in sources :

Example 1 with MetadataField

use of com.epam.pipeline.entity.metadata.MetadataField in project cloud-pipeline by epam.

the class MetadataEntityDao method getMetadataKeys.

public List<MetadataField> getMetadataKeys(Long folderId, Long classId) {
    List<MetadataField> result = new ArrayList<>();
    result.addAll(MetadataEntityParameters.fieldNames.values());
    List<String> dataFields = getJdbcTemplate().queryForList(loadMetadataKeysQuery, String.class, folderId, classId);
    result.addAll(dataFields.stream().map(name -> new MetadataField(name, null, false)).collect(Collectors.toList()));
    return result;
}
Also used : ArrayList(java.util.ArrayList) MetadataField(com.epam.pipeline.entity.metadata.MetadataField)

Example 2 with MetadataField

use of com.epam.pipeline.entity.metadata.MetadataField in project cloud-pipeline by epam.

the class MetadataEntityDao method addFilterConditions.

private void addFilterConditions(StringBuilder clause, List<MetadataFilter.FilterQuery> filters) {
    if (CollectionUtils.isEmpty(filters)) {
        return;
    }
    filters.forEach(filter -> {
        clause.append(AND);
        MetadataField field = MetadataEntityParameters.getFieldNames().get(filter.getKey().toUpperCase());
        if (field != null) {
            clause.append(String.format("%s::text = '%s'", field.getDbName(), filter.getValue()));
        } else {
            clause.append(String.format("e.data -> '%s' @> '{\"value\":\"%s\"}'", filter.getKey(), filter.getValue()));
        }
    });
}
Also used : MetadataField(com.epam.pipeline.entity.metadata.MetadataField)

Aggregations

MetadataField (com.epam.pipeline.entity.metadata.MetadataField)2 ArrayList (java.util.ArrayList)1