use of edu.harvard.iq.dataverse.engine.command.impl.ListFacetsCommand in project dataverse by IQSS.
the class Dataverses method listFacets.
@GET
@Path("{identifier}/facets/")
public /**
* return list of facets for the dataverse with alias `dvIdtf`
*/
Response listFacets(@PathParam("identifier") String dvIdtf) {
try {
User u = findUserOrDie();
DataverseRequest r = createDataverseRequest(u);
Dataverse dataverse = findDataverseOrDie(dvIdtf);
JsonArrayBuilder fs = Json.createArrayBuilder();
for (DataverseFacet f : execCommand(new ListFacetsCommand(r, dataverse))) {
fs.add(f.getDatasetFieldType().getName());
}
return allowCors(ok(fs));
} catch (WrappedResponse e) {
return e.getResponse();
}
}
Aggregations