use of name.abuchen.portfolio.model.Classification.Assignment in project portfolio by buchen.
the class ClientFactory method assignSecurities.
private static boolean assignSecurities(Client client, Taxonomy taxonomy) {
boolean hasAssignments = false;
int rank = 0;
for (Security security : client.getSecurities()) {
Classification classification = taxonomy.getClassificationById(security.getIndustryClassification());
if (classification != null) {
Assignment assignment = new Assignment(security);
assignment.setRank(rank++);
classification.addAssignment(assignment);
hasAssignments = true;
}
}
return hasAssignments;
}
use of name.abuchen.portfolio.model.Classification.Assignment in project portfolio by buchen.
the class ClientFactory method buildTree.
private static void buildTree(Classification node, Category category) {
int rank = 0;
for (Category child : category.getChildren()) {
Classification classification = new Classification(node, child.getUUID(), child.getName());
classification.setWeight(child.getPercentage() * Values.Weight.factor());
classification.setRank(rank++);
node.addChild(classification);
buildTree(classification, child);
}
for (Object element : category.getElements()) {
Assignment assignment = element instanceof Account ? new Assignment((Account) element) : new Assignment((Security) element);
assignment.setRank(rank++);
node.addAssignment(assignment);
}
}
Aggregations