Ejemplo n.º 1
0
 public Portfolio filter(final Portfolio inputPortfolio) {
   return new SimplePortfolio(
       UniqueId.of(
           inputPortfolio.getUniqueId().getScheme(),
           buildPortfolioName(inputPortfolio.getUniqueId().getValue())),
       buildPortfolioName(inputPortfolio.getName()),
       filter(inputPortfolio.getRootNode()));
 }
Ejemplo n.º 2
0
 /**
  * Resolves the securities.
  *
  * @param compilationContext the compilation context containing the view being compiled, not null
  * @param portfolio the portfolio to update, not null
  * @param versionCorrection the version-correction at which to resolve the securities, not null
  * @return the updated portfolio, not null
  */
 private static Portfolio resolveSecurities(
     ViewCompilationContext compilationContext,
     Portfolio portfolio,
     VersionCorrection versionCorrection) {
   OperationTimer timer =
       new OperationTimer(s_logger, "Resolving all securities for {}", portfolio.getName());
   try {
     new SecurityLinkResolver(compilationContext, versionCorrection)
         .resolveSecurities(portfolio.getRootNode());
   } catch (Exception e) {
     throw new OpenGammaRuntimeException(
         "Unable to resolve all securities for portfolio " + portfolio.getName());
   } finally {
     timer.finished();
   }
   return portfolio;
 }
Ejemplo n.º 3
0
 private static List<PortfolioRow> flattenPortfolio(final Portfolio portfolio) {
   List<PortfolioRow> rows = new ArrayList<PortfolioRow>();
   if (portfolio == null) {
     return rows;
   }
   flattenPortfolio(portfolio.getRootNode(), null, 0, portfolio.getName(), rows);
   return rows;
 }