Package com.opengamma.master.security

Examples of com.opengamma.master.security.ManageableSecurity


    return getFreemarker().build(JSON_DIR + getFreemarkerTemplateName(), out);
  }

  private String getFreemarkerTemplateName() {
    SecurityDocument doc = data().getSecurity();
    ManageableSecurity security = doc.getSecurity();
    String result = "default-security.ftl";
    if (security instanceof FinancialSecurity) {
      FinancialSecurity financialSec = (FinancialSecurity) security;
      String templateName = financialSec.accept(getTemplateProvider());
      if (templateName != null) {
        result = templateName;
      }
    } else {
      if (security.getSecurityType().equals(SecurityEntryData.EXTERNAL_SENSITIVITIES_SECURITY_TYPE)) {
        result = "external-sensitivities.ftl";
      }
      if (security.getSecurityType().equals(FactorExposureData.EXTERNAL_SENSITIVITIES_RISK_FACTORS_SECURITY_TYPE)) {
        result = "external-sensitivities-risk-factors.ftl";
      }
    }
    return result;
  }
View Full Code Here


   * @return the output root data, not null
   */
  protected FlexiBean createRootData() {
    FlexiBean out = super.createRootData();
    SecurityDocument securityDoc = data().getSecurity();
    ManageableSecurity security = securityDoc.getSecurity();
   
    // REVIEW jonathan 2012-01-12 -- we are throwing away any adjuster that may be required, e.g. to apply
    // normalisation to the time-series. This reproduces the previous behaviour but probably indicates that the
    // time-series information is in the wrong place.
   
    // Get the last price HTS for the security
    ObjectId tsObjectId = null;
    HistoricalTimeSeriesInfoSearchRequest searchRequest =
        new HistoricalTimeSeriesInfoSearchRequest(security.getExternalIdBundle());
    HistoricalTimeSeriesInfoSearchResult searchResult = data().getHistoricalTimeSeriesMaster().search(searchRequest);
    if (searchResult.getFirstInfo() != null) {
      tsObjectId = searchResult.getFirstInfo().getUniqueId().getObjectId();
    }

    out.put("securityAttributes", security.getAttributes());
    out.put("securityDoc", securityDoc);
    out.put("security", security);
    out.put("timeSeriesId", tsObjectId);
    out.put("deleted", !securityDoc.isLatest());
    addSecuritySpecificMetaData(security, out);
View Full Code Here

  private void addFutureSecurityType(final String futureType) {
    _out.put("futureSecurityType", futureType);
  }
 
  private void addUnderlyingSecurity(ExternalId underlyingId) {
    ManageableSecurity security = getSecurity(underlyingId);
    if (security != null) {
      _out.put("underlyingSecurity", security);
    }
  }
View Full Code Here

    ArgumentChecker.notNull(document, "document");
    ArgumentChecker.notNull(document.getSecurity(), "document.security");

    final ObjectId objectId = _objectIdSupplier.get();
    final UniqueId uniqueId = objectId.atVersion("");
    final ManageableSecurity security = document.getSecurity();
    security.setUniqueId(uniqueId);
    final Instant now = Instant.now();
    final SecurityDocument doc = new SecurityDocument(security);
    doc.setVersionFromInstant(now);
    doc.setCorrectionFromInstant(now);
    _store.put(objectId, doc);
View Full Code Here

  }

  //-------------------------------------------------------------------------
  @Test
  public void testAddSecurity() {
    final ManageableSecurity target = new ManageableSecurity(null, "Name", "Type", ExternalIdBundle.of("C", "D"));
    final SecurityDocument request = new SecurityDocument(target);
   
    final SecurityDocument result = new SecurityDocument(target);
    result.setUniqueId(UID);
    when(_underlying.add(same(request))).thenReturn(result);
View Full Code Here

    SecurityMaster mock = mock(SecurityMaster.class);
    SecuritySearchRequest request = new SecuritySearchRequest();
    request.addExternalId(ID1);
    request.addExternalId(ID2);
    request.setVersionCorrection(VC);
    ManageableSecurity security = example();
    SecuritySearchResult result = new SecuritySearchResult();
    result.getDocuments().add(new SecurityDocument(security));
   
    when(mock.search(request)).thenReturn(result);
    MasterSecuritySource test = new MasterSecuritySource(mock, VC);
View Full Code Here

    SecurityMaster mock = mock(SecurityMaster.class);
    SecuritySearchRequest request = new SecuritySearchRequest();
    request.addExternalId(ID1);
    request.addExternalId(ID2);
    request.setVersionCorrection(VC);
    ManageableSecurity security = example();
    SecuritySearchResult result = new SecuritySearchResult();
    result.getDocuments().add(new SecurityDocument(security));
   
    when(mock.search(request)).thenReturn(result);
    MasterSecuritySource test = new MasterSecuritySource(mock, VC);
View Full Code Here

    assertEquals("Test", testResult.getName());
  }

  //-------------------------------------------------------------------------
  protected ManageableSecurity example() {
    return new ManageableSecurity(UID, "Test", "EQUITY", ExternalIdBundle.EMPTY);
  }
View Full Code Here

  }

  //-------------------------------------------------------------------------
  @Test
  public void testGetSecurity() {
    final ManageableSecurity security = new ManageableSecurity(null, "Name", "Type", ExternalIdBundle.of("C", "D"));
    final SecurityDocument result = new SecurityDocument(security);
    when(_underlying.get(OID, VersionCorrection.LATEST)).thenReturn(result);
   
    Response test = _resource.get(null, null);
    assertEquals(Status.OK.getStatusCode(), test.getStatus());
View Full Code Here

    assertSame(result, test.getEntity());
  }

  @Test
  public void testUpdateSecurity() {
    final ManageableSecurity security = new ManageableSecurity(null, "Name", "Type", ExternalIdBundle.of("C", "D"));
    final SecurityDocument request = new SecurityDocument(security);
    request.setUniqueId(OID.atLatestVersion());
   
    final SecurityDocument result = new SecurityDocument(security);
    result.setUniqueId(OID.atVersion("1"));
View Full Code Here

TOP

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

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.