Skip to content

Commit

Permalink
add GET TelescopeArray/s API calls to ObservatoryResource, add GET Fi…
Browse files Browse the repository at this point in the history
…lters API call to ObservingModeResource
  • Loading branch information
DJWalker42 committed Feb 12, 2025
1 parent 6124b9f commit 535efc9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,28 @@ public Response updateObservatoryWikiId(@PathParam("id") Long id, String replace

//TELESCOPE ARRAY *****************************************************************************

@GET
@Path("{observatoryId}/array")
@Operation(summary = "get a list of all TelescopeArrays belonging to the given Observatory")
public List<ObjectIdentifier> getTelescopeArrays(@PathParam("observatoryId") Long observatoryId)
throws WebApplicationException
{
return getObjectIdentifiers("select a._id,a.name from Observatory o inner join o.arrays a where o._id = "+observatoryId+" order by a.name");
}

@GET
@Path("{observatoryId}/array/{arrayId}")
@Operation(summary = "get the TelescopeArray specified from the given Observatory")
public TelescopeArray getTelescopeArray(@PathParam("observatoryId") Long observatoryId,
@PathParam("arrayId") Long arrayId)
throws WebApplicationException
{
return findChildByQuery(Observatory.class, TelescopeArray.class,
"arrays", observatoryId, arrayId);
}



@PUT
@Operation(summary = "add an existing TelescopeArray to the Observatory")
@Path("{id}/array")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import jakarta.persistence.Query;
import org.eclipse.microprofile.openapi.annotations.Operation;
import org.eclipse.microprofile.openapi.annotations.tags.Tag;
import org.ivoa.dm.proposal.management.Filter;
import org.ivoa.dm.proposal.management.ObservingMode;
import org.orph2020.pst.common.json.ObjectIdentifier;

Expand Down Expand Up @@ -57,4 +58,17 @@ public ObservingMode getCycleObservingMode(@PathParam("cycleId") Long cycleId,
{
return findObservingModeByQuery(cycleId, modeId);
}

@GET
@Path("filters")
@Operation(summary = "get all the distinct filters associated with observing modes of a given cycle")
public List<Filter> getObservingModesFilters(@PathParam("cycleId") Long cycleId)
throws WebApplicationException
{
String qlString = "select distinct om.filter from ProposalCycle c inner join c.observingModes om where c._id=" + cycleId;

Query query = em.createQuery(qlString);

return query.getResultList();
}
}

0 comments on commit 535efc9

Please sign in to comment.