Package com.opengamma

Examples of com.opengamma.DataNotFoundException


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


    final UniqueId uniqueId = document.getUniqueId();
    final Instant now = Instant.now();
    final OrganizationDocument storedDocument = _store.get(uniqueId.getObjectId());
    if (storedDocument == null) {
      throw new DataNotFoundException("Organization not found: " + uniqueId);
    }

    final OrganizationDocument clonedDoc = cloneOrganizationDocument(document);

View Full Code Here

  @Override
  public void remove(ObjectIdentifiable objectIdentifiable) {
    ArgumentChecker.notNull(objectIdentifiable, "objectIdentifiable");
    OrganizationDocument storedDocument = _store.remove(objectIdentifiable.getObjectId());
    if (storedDocument == null) {
      throw new DataNotFoundException("Organization not found " + objectIdentifiable);
    }   
    _changeManager.entityChanged(ChangeType.REMOVED, objectIdentifiable.getObjectId(), null, null, Instant.now());
  }
View Full Code Here

  @Override
  public ManageableOrganization getOrganization(UniqueId organizationId) {
    ArgumentChecker.notNull(organizationId, "organizationId");
    ManageableOrganization organization = _store.get(organizationId.getObjectId()).getOrganization();
    if (organization == null) {
      throw new DataNotFoundException("Organization not found: " + organizationId);
    }
    return cloneOrganization(organization);
  }
View Full Code Here

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

    final UniqueId uniqueId = document.getUniqueId();
    final Instant now = Instant.now();
    final RegionDocument storedDocument = _store.get(uniqueId.getObjectId());
    if (storedDocument == null) {
      throw new DataNotFoundException("Region not found: " + uniqueId);
    }
    document.setVersionFromInstant(now);
    document.setVersionToInstant(null);
    document.setCorrectionFromInstant(now);
    document.setCorrectionToInstant(null);
View Full Code Here

  //-------------------------------------------------------------------------
  @Override
  public void remove(final ObjectIdentifiable objectIdentifiable) {
    ArgumentChecker.notNull(objectIdentifiable, "objectIdentifiable");
    if (_store.remove(objectIdentifiable.getObjectId()) == null) {
      throw new DataNotFoundException("Region not found: " + objectIdentifiable);
    }
    _changeManager.entityChanged(ChangeType.REMOVED, objectIdentifiable.getObjectId(), null, null, Instant.now());
  }
View Full Code Here

    final PositionDocumentExtractor extractor = new PositionDocumentExtractor();
    final NamedParameterJdbcOperations namedJdbc = getDbConnector().getJdbcTemplate();
    final String sql = getElSqlBundle().getSql("GetTradeByOidInstants", args);
    final List<PositionDocument> docs = namedJdbc.query(sql, args, extractor);
    if (docs.isEmpty()) {
      throw new DataNotFoundException("Trade not found: " + uniqueId);
    }
    return docs.get(0).getPosition().getTrades().get(0); // SQL loads desired trade as only trade
  }
View Full Code Here

    final PositionDocumentExtractor extractor = new PositionDocumentExtractor();
    final NamedParameterJdbcOperations namedJdbc = getDbConnector().getJdbcTemplate();
    final String sql = getElSqlBundle().getSql("GetTradeById", args);
    final List<PositionDocument> docs = namedJdbc.query(sql, args, extractor);
    if (docs.isEmpty()) {
      throw new DataNotFoundException("Trade not found: " + uniqueId);
    }
    return docs.get(0).getPosition().getTrades().get(0); // SQL loads desired trade as only trade
  }
View Full Code Here

    position.setTrades(trades);
    ManageablePosition savedPosition = getPositionMaster().update(new PositionDocument(position)).getPosition();
    ManageableTrade savedTrade = savedPosition.getTrade(trade.getUniqueId().getObjectId());
    if (savedTrade == null) {
      // shouldn't ever happen
      throw new DataNotFoundException("Failed to save trade " + trade + " to position " + savedPosition);
    } else {
      return savedTrade.getUniqueId();
    }
  }
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.