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;
}
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()));
}
});
}
Aggregations