2017-09-14 12:37:36 +02:00
|
|
|
package dao.entities;
|
|
|
|
|
2017-10-23 18:06:24 +02:00
|
|
|
import java.util.List;
|
2017-09-14 12:37:36 +02:00
|
|
|
import java.util.UUID;
|
2017-10-23 18:06:24 +02:00
|
|
|
import java.util.stream.Collectors;
|
2017-09-14 12:37:36 +02:00
|
|
|
|
2017-10-23 18:06:24 +02:00
|
|
|
import javax.persistence.Query;
|
|
|
|
import javax.persistence.TypedQuery;
|
2017-09-14 12:37:36 +02:00
|
|
|
|
|
|
|
import dao.JpaDao;
|
|
|
|
import entities.DatasetProfile;
|
2017-10-23 18:06:24 +02:00
|
|
|
import entities.responses.IDLabelPair;
|
2017-09-14 12:37:36 +02:00
|
|
|
|
|
|
|
public class DatasetProfileDaoImpl extends JpaDao<DatasetProfile, UUID> implements DatasetProfileDao {
|
|
|
|
|
|
|
|
|
|
|
|
public DatasetProfile loadDetails(DatasetProfile t) {
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
return null;
|
|
|
|
}
|
2017-10-23 18:06:24 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public List<UUID> listAllIDs() {
|
|
|
|
String queryString = "SELECT dp.id FROM DatasetProfile dp";
|
|
|
|
TypedQuery<UUID> typedQuery = entityManager.createQuery(queryString, UUID.class);
|
|
|
|
return typedQuery.getResultList();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public List<IDLabelPair> listAllIDsLabels() {
|
|
|
|
String queryString = "SELECT dp.id, dp.label FROM DatasetProfile dp";
|
|
|
|
Query query = (Query) entityManager.createQuery(queryString);
|
|
|
|
List<Object[]> rows = query.getResultList();
|
|
|
|
return rows.stream().map(row -> {
|
|
|
|
return new IDLabelPair(row[0].toString(), row[1].toString());
|
|
|
|
})
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
}
|
2017-09-14 12:37:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
}
|