WebPositionsResource extends AbstractWebPositionResource { @GET @Produces(MediaType.APPLICATION_JSON) @SubscribeMaster(MasterType.POSITION) public String getJSON( @QueryParam("pgIdx") Integer pgIdx, @QueryParam("pgNum") Integer pgNum, @QueryParam("pgSze") Integer pgSze, @QueryParam("identifier") String identifier, @QueryParam("minquantity") String minQuantityStr, @QueryParam("maxquantity") String maxQuantityStr, @QueryParam("positionId") List<String> positionIdStrs, @QueryParam("tradeId") List<String> tradeIdStrs, @QueryParam("uniqueIdScheme") String uniqueIdScheme) { PagingRequest pr = buildPagingRequest(pgIdx, pgNum, pgSze); FlexiBean out = createSearchResultData(pr, identifier, minQuantityStr, maxQuantityStr, positionIdStrs, tradeIdStrs, uniqueIdScheme); return getFreemarker().build(JSON_DIR + "positions.ftl", out); } WebPositionsResource(final PositionMaster positionMaster, final SecurityLoader securityLoader, final SecuritySource securitySource,
      final HistoricalTimeSeriesSource htsSource, final Map<ExternalScheme, String> externalSchemes); @GET @Produces(MediaType.TEXT_HTML) @SubscribeMaster(MasterType.POSITION) String getHTML(
      @QueryParam("pgIdx") Integer pgIdx,
      @QueryParam("pgNum") Integer pgNum,
      @QueryParam("pgSze") Integer pgSze,
      @QueryParam("identifier") String identifier,
      @QueryParam("minquantity") String minQuantityStr,
      @QueryParam("maxquantity") String maxQuantityStr,
      @QueryParam("positionId") List<String> positionIdStrs,
      @QueryParam("tradeId") List<String> tradeIdStrs,
      @QueryParam("uniqueIdScheme") String uniqueIdScheme); @GET @Produces(MediaType.APPLICATION_JSON) @SubscribeMaster(MasterType.POSITION) String getJSON(
      @QueryParam("pgIdx") Integer pgIdx,
      @QueryParam("pgNum") Integer pgNum,
      @QueryParam("pgSze") Integer pgSze,
      @QueryParam("identifier") String identifier,
      @QueryParam("minquantity") String minQuantityStr,
      @QueryParam("maxquantity") String maxQuantityStr,
      @QueryParam("positionId") List<String> positionIdStrs,
      @QueryParam("tradeId") List<String> tradeIdStrs,
      @QueryParam("uniqueIdScheme") String uniqueIdScheme); @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.TEXT_HTML) Response postHTML(
      @FormParam("quantity") String quantityStr,
      @FormParam("idscheme") String idScheme,
      @FormParam("idvalue") String idValue,
      @FormParam("type") String type,
      @FormParam(POSITION_XML) String positionXml,
      @FormParam("uniqueIdScheme") String uniqueIdScheme); @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.APPLICATION_JSON) Response postJSON(
      @FormParam("quantity") String quantityStr,
      @FormParam("idscheme") String idScheme,
      @FormParam("idvalue") String idValue,
      @FormParam("tradesJson") String tradesJson,
      @FormParam("type") String type,
      @FormParam(POSITION_XML) String positionXml,
      @FormParam("uniqueIdScheme") String uniqueIdScheme); @Path("{positionId}") WebPositionResource findPosition(@Subscribe @PathParam("positionId") String idStr); static URI uri(WebPositionsData data);  }
@Test public void testGetAllPositions() throws Exception { populatePositionMaster(); MultivaluedMap<String, String> queryParameters = _uriInfo.getQueryParameters(); queryParameters.putSingle("identifier", StringUtils.EMPTY); queryParameters.putSingle("minquantity", StringUtils.EMPTY); queryParameters.putSingle("maxquantity", StringUtils.EMPTY); queryParameters.put("tradeId", Collections.<String>emptyList()); queryParameters.put("positionId", Collections.<String>emptyList()); String allPositions = _webPositionsResource.getJSON(null, null, null, null, null, null, queryParameters.get("positionId"), queryParameters.get("tradeId"), null); assertNotNull(allPositions); assertJSONObjectEquals(loadJson("com/opengamma/web/position/allPositionsJson.txt"), new JSONObject(allPositions)); }