Package com.opengamma

Examples of com.opengamma.DataNotFoundException


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


  @Override
  public PortfolioNode getPortfolioNode(UniqueId uniqueId, VersionCorrection versionCorrection) {
    ArgumentChecker.notNull(uniqueId, "uniqueId");
    final ManageablePortfolioNode manNode = getPortfolioMaster().getNode(uniqueId);
    if (manNode == null) {
      throw new DataNotFoundException("Unable to find node: " + uniqueId);
    }
    final SimplePortfolioNode node = new SimplePortfolioNode();
    convertNode(manNode, node, versionCorrection);
    return node;
  }
View Full Code Here

      final DbMapSqlParameterSource args = argsGetByOidInstants(objectId, vc);
      final NamedParameterJdbcOperations namedJdbc = getDbConnector().getJdbcTemplate();
      final String sql = getElSqlBundle().getSql("GetByOidInstants", args);
      final List<D> docs = namedJdbc.query(sql, args, extractor);
      if (docs.isEmpty()) {
        throw new DataNotFoundException(masterName + " not found: " + objectId);
      }
      return docs.get(0);
    } finally {
      context.stop();
    }
View Full Code Here

      final DbMapSqlParameterSource args = argsGetById(uniqueId);
      final NamedParameterJdbcOperations namedJdbc = getDbConnector().getJdbcTemplate();
      final String sql = getElSqlBundle().getSql("GetById", args);
      final List<D> docs = namedJdbc.query(sql, args, extractor);
      if (docs.isEmpty()) {
        throw new DataNotFoundException(masterName + " not found: " + uniqueId);
      }
      return docs.get(0);
    } finally {
      context.stop();
    }
View Full Code Here

  protected D doRemoveInTransaction(final ObjectIdentifiable objectIdentifiable) {
    // load old row
    final D oldDoc = get(objectIdentifiable.getObjectId(), VersionCorrection.LATEST);

    if (oldDoc == null) {
      throw new DataNotFoundException("There is no document with oid:" + objectIdentifiable.getObjectId());
    }
    // update old row
    final Instant now = now();
    oldDoc.setVersionToInstant(now);
    updateVersionToInstant(oldDoc);
View Full Code Here

      return getTransactionTemplateRetrying(getMaxRetries()).execute(new TransactionCallback<List<UniqueId>>() {
        @Override
        public List<UniqueId> doInTransaction(final TransactionStatus status) {
          final D storedDocument = get(uniqueId);
          if (storedDocument == null) {
            throw new DataNotFoundException("Document not found: " + uniqueId.getObjectId());
          }
          ArgumentChecker.isTrue(storedDocument.getCorrectionToInstant() == null, "we can replace only current document. The " + storedDocument.getUniqueId() + " is not current.");

          final Instant storedVersionFrom = storedDocument.getVersionFromInstant();
          final Instant storedVersionTo = storedDocument.getVersionToInstant();
View Full Code Here

  @Override
  public Security get(UniqueId uniqueId) {
    ArgumentChecker.notNull(uniqueId, "uniqueId");
    Security security = _securities.get(uniqueId.getObjectId());
    if (security == null) {
      throw new DataNotFoundException("Security not found: " + uniqueId);
    }
    return security;
  }
View Full Code Here

  public Security get(ObjectId objectId, VersionCorrection versionCorrection) {
    ArgumentChecker.notNull(objectId, "objectId");
    ArgumentChecker.notNull(versionCorrection, "versionCorrection");
    Security security = _securities.get(objectId);
    if (security == null) {
      throw new DataNotFoundException("Security not found: " + objectId);
    }
    return security;
  }
View Full Code Here

  @Test(expectedExceptions = DataNotFoundException.class)
  public void test_getSecurity_UniqueId_notFound() throws Exception {
    SecurityMaster mock = mock(SecurityMaster.class);
   
    when(mock.get(OID, VC)).thenThrow(new DataNotFoundException(""));
    MasterSecuritySource test = new MasterSecuritySource(mock, VC);
    try {
      test.get(UID);
    } finally {
      verify(mock, times(1)).get(OID, VC);
View Full Code Here

  @Test(expectedExceptions = DataNotFoundException.class)
  public void test_getSecurity_ObjectId_notFound() throws Exception {
    SecurityMaster mock = mock(SecurityMaster.class);
   
    when(mock.get(OID, VC)).thenThrow(new DataNotFoundException(""));
    MasterSecuritySource test = new MasterSecuritySource(mock, VC);
    try {
      test.get(OID, VC);
    } finally {
      verify(mock, times(1)).get(OID, VC);
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.