Examples of RegionDocument


Examples of com.opengamma.master.region.RegionDocument

   * Creates the output root data.
   * @return the output root data, not null
   */
  protected FlexiBean createRootData() {
    FlexiBean out = super.createRootData();
    RegionDocument doc = data().getRegion();
    out.put("regionDoc", doc);
    out.put("region", doc.getRegion());
    out.put("deleted", !doc.isLatest());
    return out;
  }
View Full Code Here

Examples of com.opengamma.master.region.RegionDocument

  //-------------------------------------------------------------------------
  @Path("{versionId}")
  public WebRegionVersionResource findVersion(@PathParam("versionId") String idStr) {
    data().setUriVersionId(idStr);
    RegionDocument doc = data().getRegion();
    UniqueId combined = doc.getUniqueId().withVersion(idStr);
    if (doc.getUniqueId().equals(combined) == false) {
      RegionDocument versioned = data().getRegionMaster().get(combined);
      data().setVersioned(versioned);
    } else {
      data().setVersioned(doc);
    }
    return new WebRegionVersionResource(this);
View Full Code Here

Examples of com.opengamma.master.region.RegionDocument

    search.setChildrenOfId(data().getRegion().getUniqueId());
    RegionSearchResult children = data().getRegionMaster().search(search);
    data().setRegionChildren(children.getDocuments());
   
    for (UniqueId parentId : data().getRegion().getRegion().getParentRegionIds()) {
      RegionDocument parent = data().getRegionMaster().get(parentId);
      data().getRegionParents().add(parent);
    }
   
    FlexiBean out = createRootData();
    return getFreemarker().build(HTML_DIR + "region.ftl", out);
View Full Code Here

Examples of com.opengamma.master.region.RegionDocument

    search.setChildrenOfId(data().getRegion().getUniqueId());
    RegionSearchResult children = data().getRegionMaster().search(search);
    data().setRegionChildren(children.getDocuments());

    for (UniqueId parentId : data().getRegion().getRegion().getParentRegionIds()) {
      RegionDocument parent = data().getRegionMaster().get(parentId);
      data().getRegionParents().add(parent);
    }

    FlexiBean out = createRootData();
    return getFreemarker().build(JSON_DIR + "region.ftl", out);
View Full Code Here

Examples of com.opengamma.master.region.RegionDocument

    region.setFullName(fullName);
    region.setClassification(classification);
    region.setCountry(countryISO != null ? Country.of(countryISO) : null);
    region.setCurrency(currencyISO != null ? Currency.of(currencyISO) : null);
    region.setTimeZone(timeZoneId != null ? ZoneId.of(timeZoneId) : null);
    RegionDocument doc = new RegionDocument(region);
    RegionDocument added = data().getRegionMaster().add(doc);
    return WebRegionResource.uri(data(), added.getUniqueId());
  }
View Full Code Here

Examples of com.opengamma.master.region.RegionDocument

    region.setFullName(fullName);
    region.setClassification(classification);
    region.setCountry(countryISO != null ? Country.of(countryISO) : null);
    region.setCurrency(currencyISO != null ? Currency.of(currencyISO) : null);
    region.setTimeZone(timeZoneId != null ? ZoneId.of(timeZoneId) : null);
    RegionDocument doc = new RegionDocument(region);
    doc = data().getRegionMaster().update(doc);
    data().setRegion(doc);
    return WebRegionResource.uri(data());
  }
View Full Code Here

Examples of com.opengamma.master.region.RegionDocument

  //-------------------------------------------------------------------------
  @DELETE
  @Produces(MediaType.TEXT_HTML)
  public Response deleteHTML() {
    RegionDocument doc = data().getRegion();
    if (doc.isLatest() == false) {
      return Response.status(Status.FORBIDDEN).entity(getHTML()).build();
    }
   
    data().getRegionMaster().remove(doc.getUniqueId());
    URI uri = WebRegionResource.uri(data());
    return Response.seeOther(uri).build();
  }
View Full Code Here

Examples of com.opengamma.master.region.RegionDocument

  }

  @DELETE
  @Produces(MediaType.APPLICATION_JSON)
  public Response deleteJSON() {
    RegionDocument doc = data().getRegion();
    if (doc.isLatest()) {  // idempotent
      data().getRegionMaster().remove(doc.getUniqueId());
    }
    return Response.ok().build();
  }
View Full Code Here

Examples of com.opengamma.master.region.RegionDocument

  //-------------------------------------------------------------------------
  @Test
  public void testAddRegion() {
    final ManageableRegion target = new ManageableRegion();
    target.setFullName("Bananaville");
    final RegionDocument request = new RegionDocument(target);
   
    final RegionDocument result = new RegionDocument(target);
    result.setUniqueId(UID);
    when(_underlying.add(same(request))).thenReturn(result);
   
    Response test = _resource.add(_uriInfo, request);
    assertEquals(Status.CREATED.getStatusCode(), test.getStatus());
    assertSame(result, test.getEntity());
View Full Code Here

Examples of com.opengamma.master.region.RegionDocument

  public void test_search_name() {
    RegionSearchRequest request = new RegionSearchRequest();
    request.setName("United Kingdom");
    assertEquals(1, _regionMaster.search(request).getDocuments().size());
    RegionDocument doc = _regionMaster.search(request).getFirstDocument();
    ManageableRegion ukRegion = doc.getRegion();
    assertNotNull(ukRegion);
    assertEquals("United Kingdom", ukRegion.getName());
    assertEquals(RegionClassification.INDEPENDENT_STATE, ukRegion.getClassification());
    assertEquals(Country.GB, ukRegion.getCountry());
    assertEquals(Currency.GBP, ukRegion.getCurrency());
    assertEquals(3, ukRegion.getParentRegionIds().size());
   
    RegionDocument gotDoc = _regionMaster.get(doc.getUniqueId());
    assertEquals(doc, gotDoc);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.