private TreeModel getPortfolioTreeModel(UniqueId portfolioId, IntegrationToolContext toolContext) {
return new PortfolioTreeModel(portfolioId, toolContext);
}
private ResolutionFailureTreeTableModel createResolutionFailureTreeTableModel(final Object leafNode, final String valueReq) {
DependencyGraphTraceBuilderProperties properties = new DependencyGraphTraceBuilderProperties();
ComputationTargetType targetType = null;
if (leafNode instanceof Position) {
targetType = ComputationTargetType.POSITION;
} else if (leafNode instanceof Trade) {
targetType = ComputationTargetType.TRADE;
} else if (leafNode instanceof PortfolioNode) {
targetType = ComputationTargetType.PORTFOLIO_NODE;
} else if (leafNode instanceof Portfolio) {
targetType = ComputationTargetType.PORTFOLIO;
} else if (leafNode instanceof Security) {
targetType = ComputationTargetType.SECURITY;
}
final String name;
final ValueProperties constraints;
final int i = valueReq.indexOf('[');
if ((i > 0) && (valueReq.charAt(valueReq.length() - 1) == ']')) {
name = valueReq.substring(0, i);
constraints = ValueProperties.parse(valueReq.substring(i + 1, valueReq.length() - 1));
} else {
name = valueReq;
constraints = ValueProperties.none();
}
properties = properties.addRequirement(new ValueRequirement(name, targetType, ((UniqueIdentifiable) leafNode).getUniqueId(), constraints));
DependencyGraphBuildTrace trace = getToolContext().getDependencyGraphTraceProvider().getTrace(properties);
ResolutionFailureTreeTableModel failuresTreeTableModel = new ResolutionFailureTreeTableModel(trace.getFailures());
return failuresTreeTableModel;
}