Package com.opengamma.master.security

Examples of com.opengamma.master.security.SecuritySearchRequest


  private void createSurfaces(String name, boolean dryRun) {
    ConfigMaster configMaster = getToolContext().getConfigMaster();
    SecurityMaster securityMaster = getToolContext().getSecurityMaster();
    ReferenceDataProvider bbgRefData = getToolContext().getBloombergReferenceDataProvider();

    SecuritySearchRequest securityRequest = new SecuritySearchRequest();
    securityRequest.setName(name);
    securityRequest.setSortOrder(SecuritySearchSortOrder.NAME_ASC);

    for (SecurityDocument doc : SecuritySearchIterator.iterable(securityMaster, securityRequest)) {
      FinancialSecurity security = (FinancialSecurity) doc.getSecurity();
      try {
        security.accept(new FuturePriceCurveCreatorVisitor(configMaster, bbgRefData, _curveSpecificationNames, _curveDefinitionNames, dryRun));
View Full Code Here


    AbstractTool<ToolContext> remoteServerTool = new AbstractTool<ToolContext>() {

      @Override
      protected void doRun() throws Exception {
        SecurityMaster remotesecurityMaster = getToolContext().getSecurityMaster();
        for (SecurityDocument securityDocument : SecuritySearchIterator.iterable(remotesecurityMaster, new SecuritySearchRequest())) {
          securityDocument.setUniqueId(null);
          demoSecurityMaster.add(securityDocument);
        }
      }
    };
View Full Code Here

  private ManageableSecurity loadSecurity(SecurityLink securityLink) {
    if (securityLink.getObjectId() != null) {
      return getSecurityMaster().get(securityLink.getObjectId(), VersionCorrection.LATEST).getSecurity();
    } else if (securityLink.getExternalId() != null) {
      ExternalIdBundle idBundle = securityLink.getExternalId();
      SecuritySearchResult searchResult = getSecurityMaster().search(new SecuritySearchRequest(idBundle));
      if (searchResult.getSecurities().isEmpty()) {
        throw new IllegalArgumentException("No security found for ID bundle " + idBundle);
      }
      return searchResult.getFirstSecurity();
    } else {
View Full Code Here

   * Creates the output root data.
   * @return the output root data, not null
   */
  protected FlexiBean createRootData() {
    FlexiBean out = super.createRootData();
    SecuritySearchRequest searchRequest = new SecuritySearchRequest();
    out.put("searchRequest", searchRequest);
    return out;
  }
View Full Code Here

  public static ManageableSecurity getSecurity(final ExternalId underlyingIdentifier, final SecurityMaster securityMaster) {
    if (underlyingIdentifier == null) {
      return null;
    }
    SecuritySearchRequest request = new SecuritySearchRequest();
    request.addExternalId(underlyingIdentifier);
    SecuritySearchResult search = securityMaster.search(request);
    return search.getFirstSecurity();
  }
View Full Code Here

  private FlexiBean createSearchResultData(PagingRequest pr, SecuritySearchSortOrder so, String name, String identifier,
      String type, List<String> securityIdStrs, UriInfo uriInfo) {
    FlexiBean out = createRootData();
   
    SecuritySearchRequest searchRequest = new SecuritySearchRequest();
    searchRequest.setPagingRequest(pr);
    searchRequest.setSortOrder(so);
    searchRequest.setName(StringUtils.trimToNull(name));
    searchRequest.setExternalIdValue(StringUtils.trimToNull(identifier));
    searchRequest.setSecurityType(StringUtils.trimToNull(type));
    for (String securityIdStr : securityIdStrs) {
      searchRequest.addObjectId(ObjectId.parse(securityIdStr));
    }
    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);
    }
    out.put("searchRequest", searchRequest);
   
    if (data().getUriInfo().getQueryParameters().size() > 0) {
      SecuritySearchResult searchResult = data().getSecurityMaster().search(searchRequest);
View Full Code Here

   * Creates the output root data.
   * @return the output root data, not null
   */
  protected FlexiBean createRootData() {
    FlexiBean out = super.createRootData();
    SecuritySearchRequest searchRequest = new SecuritySearchRequest();
    out.put("searchRequest", searchRequest);
    final SecurityMetaDataRequest request = new SecurityMetaDataRequest();
    request.setSchemaVersion(true);
    SecurityMetaDataResult metaData = data().getSecurityMaster().metaData(request);
    out.put("securityTypes", new TreeSet<String>(metaData.getSecurityTypes()));
View Full Code Here

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

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

    return AbstractSecuritySource.getSingle(this, bundle, versionCorrection);
  }

  @SuppressWarnings({"rawtypes", "unchecked" })
  private Collection<ManageableSecurity> getSecuritiesInternal(ExternalIdBundle bundle, VersionCorrection versionCorrection) {
    final SecuritySearchRequest request = new SecuritySearchRequest();
    request.addExternalIds(bundle);
    request.setVersionCorrection(versionCorrection);
    return (Collection) search(request).getSecurities(); // cast safe as supplied list will not be altered   
  }
View Full Code Here

  private void assertUnderlyingIsLoaded(final ExternalId underlyingIdentifier) {
    assertUnderlyingIsLoaded(ExternalIdBundle.of(underlyingIdentifier));
  }

  private void assertUnderlyingIsLoaded(ExternalIdBundle identifiers) {
    SecuritySearchResult result = _securityMaster.search(new SecuritySearchRequest(identifiers));
    assertNotNull(result);
    assertFalse(result.getDocuments().isEmpty());
    assertNotNull(result.getFirstDocument().getSecurity());
  }
View Full Code Here

TOP

Related Classes of com.opengamma.master.security.SecuritySearchRequest

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.