56 lines
1.3 KiB
Java
56 lines
1.3 KiB
Java
package eu.eudat.query;
|
|
|
|
import eu.eudat.data.DmpEntity;
|
|
import eu.eudat.data.dao.DatabaseAccessLayer;
|
|
import eu.eudat.data.DescriptionEntity;
|
|
import eu.eudat.queryable.QueryableList;
|
|
import eu.eudat.queryable.types.FieldSelectionType;
|
|
import eu.eudat.queryable.types.SelectionField;
|
|
|
|
import jakarta.persistence.criteria.Subquery;
|
|
|
|
import javax.management.InvalidApplicationException;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.UUID;
|
|
|
|
public class DatasetQuery extends Query<DescriptionEntity, UUID> {
|
|
|
|
private UUID id;
|
|
private String label;
|
|
|
|
public DatasetQuery(DatabaseAccessLayer<DescriptionEntity, UUID> databaseAccessLayer) {
|
|
super(databaseAccessLayer);
|
|
}
|
|
|
|
public DatasetQuery(DatabaseAccessLayer<DescriptionEntity, UUID> databaseAccessLayer, List<String> selectionFields) {
|
|
super(databaseAccessLayer, selectionFields);
|
|
}
|
|
|
|
public UUID getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(UUID id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public String getLabel() {
|
|
return label;
|
|
}
|
|
|
|
public void setLabel(String label) {
|
|
this.label = label;
|
|
}
|
|
|
|
|
|
@Override
|
|
public QueryableList<DescriptionEntity> getQuery() throws InvalidApplicationException {
|
|
QueryableList<DescriptionEntity> query = this.databaseAccessLayer.asQueryable();
|
|
if (this.id != null) {
|
|
query.where((builder, root) -> builder.equal(root.get("id"), this.id));
|
|
}
|
|
return query;
|
|
}
|
|
}
|