Package com.opengamma

Examples of com.opengamma.DataNotFoundException


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


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

    final PositionDocument clonedDoc = clonePositionDocument(document);
    removeTrades(storedDocument.getPosition().getTrades());
View Full Code Here

  }

  private void removeTrades(final List<ManageableTrade> trades) {
    for (final ManageableTrade trade : trades) {
      if (_storeTrades.remove(trade.getUniqueId().getObjectId()) == null) {
        throw new DataNotFoundException("Trade not found: " + trade.getUniqueId());
      }
    }
  }
View Full Code Here

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

  @Override
  public ManageableTrade getTrade(final UniqueId tradeId) {
    ArgumentChecker.notNull(tradeId, "tradeId");
    final ManageableTrade trade = _storeTrades.get(tradeId.getObjectId());
    if (trade == null) {
      throw new DataNotFoundException("Trade not found: " + tradeId.getObjectId());
    }
    return JodaBeanUtils.clone(trade);
  }
View Full Code Here

  @Override
  public Position getPosition(final UniqueId uniqueId) {
    ArgumentChecker.notNull(uniqueId, "uniqueId");
    final ManageablePosition manPos = getPositionMaster().get(uniqueId).getPosition();
    if (manPos == null) {
      throw new DataNotFoundException("Unable to find position: " + uniqueId);
    }
    return manPos.toPosition();
  }
View Full Code Here

  public Position getPosition(final ObjectId objectId, final VersionCorrection versionCorrection) {
    ArgumentChecker.notNull(objectId, "objectId");
    ArgumentChecker.notNull(versionCorrection, "versionCorrection");
    final ManageablePosition position = getPositionMaster().get(objectId, versionCorrection).getPosition();
    if (position == null) {
      throw new DataNotFoundException("Unable to find position: " + objectId + " at " + versionCorrection);
    }
    return position.toPosition();
  }
View Full Code Here

  @Override
  public Trade getTrade(final UniqueId uniqueId) {
    ArgumentChecker.notNull(uniqueId, "uniqueId");
    final ManageableTrade manTrade = getPositionMaster().getTrade(uniqueId);
    if (manTrade == null) {
      throw new DataNotFoundException("Unable to find trade: " + uniqueId);
    }
    return manTrade;
  }
View Full Code Here

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

    final UniqueId uniqueId = document.getUniqueId();
    final Instant now = Instant.now();
    final HolidayDocument storedDocument = _store.get(uniqueId.getObjectId());
    if (storedDocument == null) {
      throw new DataNotFoundException("Holiday not found: " + uniqueId);
    }
    document.setVersionFromInstant(now);
    document.setVersionToInstant(null);
    document.setCorrectionFromInstant(now);
    document.setCorrectionToInstant(null);
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.