@Override protected void supplementCsvRowData( int rowId, ComputationTargetSpecification target, String[] row) { PortfolioRow portfolioRow = _rowIdToRowMap.get(rowId); PortfolioRow parentRow = portfolioRow.getParentRow(); String parentRowIdText = parentRow != null ? Integer.toString(getGridStructure().getRowIds(parentRow.getTarget())[0]) : null; String name; String quantity; if (target.getType() == ComputationTargetType.POSITION) { Position position = portfolioRow.getPosition(); name = position.getSecurity().getName(); quantity = position.getQuantity().toPlainString(); } else { name = portfolioRow.getAggregateName(); quantity = ""; } row[0] = Integer.toString(rowId); row[1] = parentRowIdText; row[2] = name; row[3] = quantity; }
@Override protected void addRowDetails(UniqueId target, int rowId, Map<String, Object> details) { PortfolioRow row = _rowIdToRowMap.get(rowId); details.put("indent", row.getDepth()); if (row.getParentRow() != null) { final int[] parentRowIds = getGridStructure().getRowIds(row.getParentRow().getTarget()); details.put("parentRowId", parentRowIds[0]); } ComputationTargetType targetType = row.getTarget().getType(); details.put("type", targetType.toString()); if (targetType == ComputationTargetType.POSITION) { Position position = row.getPosition(); details.put("posId", position.getUniqueId()); details.put("position", position.getSecurity().getName()); DoubleValueFormatter formatter = new DoubleValueOptionalDecimalPlaceFormatter(); details.put( "quantity", position.getQuantity().signum() == 0 ? "0" : formatter.format(position.getQuantity())); } else { details.put("position", row.getAggregateName()); } }