Package com.opengamma.integration.copier.portfolio.rowparser

Examples of com.opengamma.integration.copier.portfolio.rowparser.RowParser


      if (SheetFormat.of(filename) == SheetFormat.CSV || SheetFormat.of(filename) == SheetFormat.XLS) {
//        if (securityType.equalsIgnoreCase("exchangetraded")) {
//          return new SingleSheetSimplePortfolioWriter(filename, new ExchangeTradedRowParser(s_context.getBloombergSecuritySource()));
//        } else {
       
        RowParser rowParser = JodaBeanRowParser.newJodaBeanRowParser(securityType);
        if (rowParser != null) {
          return new SingleSheetSimplePortfolioWriter(filename, rowParser, includeTrades);
        } else {
          throw new OpenGammaRuntimeException("Could not create a row parser for security type " + securityType);
        }
View Full Code Here


   
    // Identify the correct portfolio writer for this security
    String className = security.getClass().toString();
    className = className.substring(className.lastIndexOf('.') + 1).replace("Security", "");
    _currentWriter = _writerMap.get(className);
    RowParser parser;

    // create writer/output buffer map entry if not there for this security type
    if (_currentWriter == null) {

      s_logger.info("Creating a new row parser for " + className + " securities");

      parser = JodaBeanRowParser.newJodaBeanRowParser(className);
      if (parser == null) {
        return null;
      }
      Map<String, RowParser> parserMap = new HashMap<String, RowParser>();
      parserMap.put(className, parser);

      ByteArrayOutputStream out = new ByteArrayOutputStream();
      SheetWriter sheet = new CsvSheetWriter(out, parser.getColumns());

      _currentWriter = new SingleSheetMultiParserPortfolioWriter(sheet, parserMap, _includeTrades);

      _writerMap.put(className, _currentWriter);
      _bufferMap.put(className, out);
      _versionMap.put(className, parser.getSecurityHashCode());
    }

    return _currentWriter;
  }
View Full Code Here

        _currentPath = (String[]) ArrayUtils.subarray(fullPath, 0, fullPath.length - 1);
       
        // Set up a sheet reader and a row parser for the current CSV file in the ZIP archive
        SheetReader sheet = new CsvSheetReader(_zipFile.getInputStream(entry));
       
        RowParser parser = JodaBeanRowParser.newJodaBeanRowParser(secType);
        if (parser == null) {
          s_logger.error("Could not build a row parser for security type '" + secType + "'");
          return null;
        }
        if (!_ignoreVersion) {
          if (_versionMap.get(secType) == null) {
            s_logger.error("Versioning hash for security type '" + secType + "' could not be found");
            return null;
          }
          if (parser.getSecurityHashCode() != _versionMap.get(secType)) {
            s_logger.error("The parser version for the '" + secType + "' security (hash " +
                Integer.toHexString(parser.getSecurityHashCode()) +
                ") does not match the data stored in the archive (hash " +
                Integer.toHexString(_versionMap.get(secType)) + ")");
            return null;
          }
        }
View Full Code Here

                                                                           dataProvider,
                                                                           dataFields);
      final PortfolioWriter portfolioWriter =
          new MasterPortfolioWriter(portfolioName, _portfolioMaster, _positionMaster, _securityMaster, false, false, true);
      SheetFormat format = getFormatForFileName(fileName);
      RowParser rowParser = new ExchangeTradedRowParser(_securityProvider);
      final PortfolioReader portfolioReader = new SingleSheetSimplePortfolioReader(format, fileStream, rowParser);
      StreamingOutput streamingOutput = new StreamingOutput() {
        @Override
        public void write(OutputStream output) throws IOException, WebApplicationException {
          // TODO callback for progress updates as portoflio is copied
View Full Code Here

TOP

Related Classes of com.opengamma.integration.copier.portfolio.rowparser.RowParser

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.