@Produces(MediaType.APPLICATION_JSON)
public Collection<PlayableElementEntity> search(@QueryParam("uri") String uri, @QueryParam("uriContains") String uriContains, @QueryParam("smdID") String smdID) {
try {
transactionManager.begin();
if (uri != null) {
return new CopyHelper().detachedCopy(repository.findByURIWithRelations(uri, Arrays.asList("reference"), null),Expose.class);
}else if (uriContains != null) {
return new CopyHelper().detachedCopy(repository.findByPartialURIWithRelations(uriContains, Arrays.asList("reference"), null),Expose.class);
} else if (smdID != null) {
return new CopyHelper().detachedCopy(repository.findBySmdIDWithRelations(smdID, Arrays.asList("reference"), null),Expose.class);
} else {
return new CopyHelper().detachedCopy(repository.findAllWithRelations(Arrays.asList("reference"), null),Expose.class);
}
}finally {
transactionManager.end();
}
}