Package com.opengamma.master.region

Examples of com.opengamma.master.region.RegionSearchRequest


  //-------------------------------------------------------------------------
  @SuppressWarnings({"unchecked", "rawtypes" })
  @Override
  public Collection<Region> get(ExternalIdBundle bundle, VersionCorrection versionCorrection) {
    RegionSearchRequest request = new RegionSearchRequest(bundle);
    request.setVersionCorrection(getVersionCorrection());
    return (List) getMaster().search(request).getRegions();
  }
View Full Code Here


    return (List) getMaster().search(request).getRegions();
  }

  @Override
  public ManageableRegion getHighestLevelRegion(ExternalId regionId) {
    RegionSearchRequest request = new RegionSearchRequest(regionId);
    request.setPagingRequest(PagingRequest.ONE);
    request.setVersionCorrection(getVersionCorrection());
    return getMaster().search(request).getFirstRegion();
  }
View Full Code Here

    return getMaster().search(request).getFirstRegion();
  }

  @Override
  public ManageableRegion getHighestLevelRegion(ExternalIdBundle regionIds) {
    RegionSearchRequest request = new RegionSearchRequest(regionIds);
    request.setPagingRequest(PagingRequest.ONE);
    request.setVersionCorrection(getVersionCorrection());
    return getMaster().search(request).getFirstRegion();
  }
View Full Code Here

                                 EHCachingSearchCache.extractUniqueIds(result.getDocuments()));
      }
    });

    // Prime document search cache
    RegionSearchRequest defaultSearch = new RegionSearchRequest();
    _documentSearchCache.prefetch(defaultSearch, PagingRequest.FIRST_PAGE);
  }
View Full Code Here

    addParent(region, countryISO);
    return region;
  }

  private void addParent(ManageableRegion region, String countryISO) {
    RegionSearchRequest request = new RegionSearchRequest();
    request.addCountry(Country.of(countryISO));
    ManageableRegion parent = _regionMaster.search(request).getFirstRegion();
    if (parent == null) {
      throw new OpenGammaRuntimeException("Cannot find parent '" + countryISO + "'  for '" + region.getName() + "'");
    }
    region.getParentRegionIds().add(parent.getUniqueId());
View Full Code Here

  private void store(Set<ManageableRegion> regions) {
    for (ManageableRegion region : regions) {
      RegionDocument doc = new RegionDocument();
      doc.setRegion(region);
      RegionSearchRequest request = new RegionSearchRequest();
      request.addExternalIds(region.getExternalIdBundle());
      RegionSearchResult result = _regionMaster.search(request);
      if (result.getDocuments().size() == 0) {
        _regionMaster.add(doc);
      } else {
        RegionDocument existing = result.getFirstDocument();
View Full Code Here

  //-------------------------------------------------------------------------
  @GET
  @Produces(MediaType.TEXT_HTML)
  public String getHTML() {
    RegionSearchRequest search = new RegionSearchRequest();
    search.setPagingRequest(PagingRequest.ALL)// may need to add paging
    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);
View Full Code Here

  }

  @GET
  @Produces(MediaType.APPLICATION_JSON)
  public String getJSON() {
    RegionSearchRequest search = new RegionSearchRequest();
    search.setPagingRequest(PagingRequest.ALL)// may need to add paging
    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);
View Full Code Here

    EntityTag etag = new EntityTag(data().getVersioned().getUniqueId().toString());
    ResponseBuilder builder = request.evaluatePreconditions(etag);
    if (builder != null) {
      return builder.build();
    }
    RegionSearchRequest search = new RegionSearchRequest();
    search.setPagingRequest(PagingRequest.ALL)// may need to add paging
    search.setChildrenOfId(data().getVersioned().getUniqueId());
    RegionSearchResult children = data().getRegionMaster().search(search);
    data().setRegionChildren(children.getDocuments());

    for (UniqueId parentId : data().getRegion().getRegion().getParentRegionIds()) {
      RegionDocument parent = data().getRegionMaster().get(parentId);
View Full Code Here

  private FlexiBean createSearchResultData(PagingRequest pr, String name, RegionClassification classification,
      List<String> regionIdStrs, UriInfo uriInfo) {
    FlexiBean out = createRootData();
   
    RegionSearchRequest searchRequest = new RegionSearchRequest();
    searchRequest.setPagingRequest(pr);
    searchRequest.setName(StringUtils.trimToNull(name));
    searchRequest.setClassification(classification);
    MultivaluedMap<String, String> query = uriInfo.getQueryParameters();
    for (int i = 0; query.containsKey("idscheme." + i) && query.containsKey("idvalue." + i); i++) {
      ExternalId id = ExternalId.of(query.getFirst("idscheme." + i), query.getFirst("idvalue." + i));
      searchRequest.addExternalId(id);
    }
    for (String regionIdStr : regionIdStrs) {
      searchRequest.addObjectId(ObjectId.parse(regionIdStr));
    }
    out.put("searchRequest", searchRequest);
   
    if (data().getUriInfo().getQueryParameters().size() > 0) {
      RegionSearchResult searchResult = data().getRegionMaster().search(searchRequest);
View Full Code Here

TOP

Related Classes of com.opengamma.master.region.RegionSearchRequest

Copyright © 2018 www.massapicom. 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.