Package com.opengamma

Examples of com.opengamma.DataNotFoundException


      return new JSONObject().toString();
    }
    ExternalId securityExternalId = ExternalId.parse(securityExternalIdStr);
    SecuritySearchResult searchResult = _securityMaster.search(new SecuritySearchRequest(securityExternalId));
    if (searchResult.getSecurities().size() == 0) {
      throw new DataNotFoundException("No security found with ID " + securityExternalId);
    }
    ManageableSecurity security = searchResult.getFirstSecurity();
    BeanVisitor<JSONObject> securityVisitor =
        new BuildingBeanVisitor<>(security, new JsonDataSink(BlotterUtils.getJsonBuildingConverters()));
    BeanTraverser securityTraverser = BlotterUtils.securityJsonBuildingTraverser();
View Full Code Here


      JsonDataSink tradeSink = new JsonDataSink(BlotterUtils.getJsonBuildingConverters());
      if (isOtc(security)) {
        _otcTradeBuilder.extractTradeData(trade, tradeSink);
        MetaBean securityMetaBean = s_metaBeansByTypeName.get(security.getClass().getSimpleName());
        if (securityMetaBean == null) {
          throw new DataNotFoundException("No MetaBean is registered for security type " + security.getClass().getName());
        }
        BeanVisitor<JSONObject> securityVisitor =
            new BuildingBeanVisitor<>(security, new JsonDataSink(BlotterUtils.getJsonBuildingConverters()));
        BeanTraverser securityTraverser = BlotterUtils.securityJsonBuildingTraverser();
        JSONObject securityJson = (JSONObject) securityTraverser.traverse(securityMetaBean, securityVisitor);
View Full Code Here

    } else {
      SecuritySearchRequest searchRequest = new SecuritySearchRequest(securityLink.getExternalId());
      SecuritySearchResult searchResult = _securityMaster.search(searchRequest);
      securityDocument = searchResult.getFirstDocument();
      if (securityDocument == null) {
        throw new DataNotFoundException("No security found with external IDs " + securityLink.getExternalId());
      }
    }
    return securityDocument.getSecurity();
  }
View Full Code Here

    }
   
    ExternalIdBundle id = ExternalIdBundle.of(ExternalId.of(idScheme, idValue));
    UniqueId secUid = getSecurityUniqueId(id);
    if (secUid == null) {
      throw new DataNotFoundException("invalid " + idScheme + "~" + idValue);
    }
    Collection<ManageableTrade> trades = null;
    if (tradesJson != null) {
      trades = parseTrades(tradesJson);
    } else {
View Full Code Here

   
    if (data().getParentNode() == null) {
      throw new IllegalArgumentException("Root node cannot be deleted");
    }
    if (data().getParentNode().removeNode(data().getNode().getUniqueId()) == false) {
      throw new DataNotFoundException("PortfolioNode not found: " + data().getNode().getUniqueId());
    }
    doc = data().getPortfolioMaster().update(doc);
    data().setPortfolio(doc);
    URI uri = WebPortfolioNodeResource.uri(data(), data().getParentNode().getUniqueId());
    return Response.seeOther(uri).build();
View Full Code Here

    if (doc.isLatest()) {
      if (data().getParentNode() == null) {
        throw new IllegalArgumentException("Root node cannot be deleted");
      }
      if (data().getParentNode().removeNode(data().getNode().getUniqueId()) == false) {
        throw new DataNotFoundException("PortfolioNode not found: " + data().getNode().getUniqueId());
      }
      doc = data().getPortfolioMaster().update(doc);
    }
    return Response.ok().build();
  }
View Full Code Here

    data().setUriNodeId(idStr);
    UniqueId oid = UniqueId.parse(idStr);
    PortfolioDocument portfolioDoc = data().getVersioned();
    Stack<ManageablePortfolioNode> nodes = portfolioDoc.getPortfolio().getRootNode().findNodeStackByObjectId(oid);
    if (nodes.isEmpty()) {
      throw new DataNotFoundException("PortfolioNode not found: " + idStr);
    }
    data().setNode(nodes.pop());
    if (nodes.size() > 0) {
      data().setParentNode(nodes.pop());
    }
View Full Code Here

    data().setUriNodeId(idStr);
    UniqueId oid = UniqueId.parse(idStr);
    PortfolioDocument portfolioDoc = data().getPortfolio();
    Stack<ManageablePortfolioNode> nodes = portfolioDoc.getPortfolio().getRootNode().findNodeStackByObjectId(oid);
    if (nodes.isEmpty()) {
      throw new DataNotFoundException("PortfolioNode not found: " + idStr);
    }
    data().setNode(nodes.pop());
    if (nodes.size() > 0) {
      data().setParentNode(nodes.pop());
    }
View Full Code Here

  @Override
  public ClientConnection getConnectionByClientId(String userId, String clientId) {
    ArgumentChecker.notEmpty(clientId, "clientId");
    ClientConnection connection = _connectionsByClientId.get(clientId);
    if (connection == null) {
      throw new DataNotFoundException("Unknown client ID: " + clientId);
    }
    if (!Objects.equal(userId, connection.getUserId())) {
      throw new DataNotFoundException("User ID " + userId + " is not associated with client ID " + clientId);
    }
    return connection;
  }
View Full Code Here

  public SecurityDocument get(final ObjectIdentifiable objectId, final VersionCorrection versionCorrection) {
    ArgumentChecker.notNull(objectId, "objectId");
    ArgumentChecker.notNull(versionCorrection, "versionCorrection");
    final SecurityDocument document = _store.get(objectId.getObjectId());
    if (document == null) {
      throw new DataNotFoundException("Security not found: " + objectId);
    }
    return document;
  }
View Full Code Here

TOP

Related Classes of com.opengamma.DataNotFoundException

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.