Package name.abuchen.portfolio.model

Examples of name.abuchen.portfolio.model.Classification


        return newChild;
    }

    /* package */TaxonomyNode addChild(Assignment newAssignment)
    {
        Classification classification = getClassification();
        if (classification == null)
            return null;

        classification.addAssignment(newAssignment);

        TaxonomyNode newChild = new AssignmentNode(this, newAssignment);
        newChild.setRank(getTopRank() + 1);
        children.add(newChild);
        return newChild;
View Full Code Here


        return newChild;
    }

    /* package */void removeChild(TaxonomyNode node)
    {
        Classification classification = getClassification();
        if (classification == null)
            throw new UnsupportedOperationException();

        if (node.isClassification())
            classification.getChildren().remove(node.getClassification());
        else
            classification.getAssignments().remove(node.getAssignment());

        children.remove(node);
    }
View Full Code Here

        moveTo(-1, target);
    }

    private void moveTo(int index, TaxonomyNode target)
    {
        Classification classification = target.getClassification();
        if (classification == null)
            throw new UnsupportedOperationException();

        // if node is assignment *and* target contains assignment for same
        // investment vehicle *then* merge nodes

        if (isAssignment())
        {
            InvestmentVehicle investmentVehicle = getAssignment().getInvestmentVehicle();
            TaxonomyNode sibling = target.getChildByInvestmentVehicle(investmentVehicle);

            if (sibling != null)
            {
                sibling.absorb(this);
                return;
            }
        }

        // change parent, update children collections and rank

        this.getParent().removeChild(this);
        this.parent = target;

        if (isClassification())
        {
            getClassification().setParent(classification);
            classification.getChildren().add(getClassification());
        }
        else
        {
            classification.getAssignments().add(getAssignment());
        }
        List<TaxonomyNode> siblings = target.getChildren();

        if (index == -1)
            index = siblings.size();
View Full Code Here

    public TaxonomyBuilder()
    {
        String uuid = UUID.randomUUID().toString();
        this.taxonomy = new Taxonomy(uuid, uuid);

        Classification root = new Classification(uuid, uuid);
        taxonomy.setRootNode(root);
    }
View Full Code Here

        return addClassificaiton(taxonomy.getClassificationById(parent), id);
    }

    private TaxonomyBuilder addClassificaiton(Classification parent, String id)
    {
        Classification c = new Classification(parent, id, id);
        parent.addChild(c);
        return this;
    }
View Full Code Here

        return assign(taxonomy, id, Classification.ONE_HUNDRED_PERCENT);
    }

    public SecurityBuilder assign(Taxonomy taxonomy, String id, int weight)
    {
        Classification classification = taxonomy.getClassificationById(id);
        classification.addAssignment(new Assignment(security, weight));
        return this;
    }
View Full Code Here

        });
    }

    private void allocateLeftOvers(final Map<InvestmentVehicle, Item> vehicle2position)
    {
        Classification classification = new Classification(null, Classification.UNASSIGNED_ID,
                        Messages.LabelWithoutClassification);
        AssetCategory unassigned = new AssetCategory(classification, getValuation());

        for (Entry<InvestmentVehicle, Item> entry : vehicle2position.entrySet())
        {
View Full Code Here

    }

    private void doFixClassificationWeights(TaxonomyNode node)
    {
        Classification classification = node.getClassification();

        if (node.isRoot())
        {
            classification.setWeight(Classification.ONE_HUNDRED_PERCENT);
        }
        else
        {
            classification.setWeight(0);
            int weight = Math.max(0, Classification.ONE_HUNDRED_PERCENT
                            - classification.getParent().getChildrenWeight());
            classification.setWeight(weight);
        }
        onTaxnomyNodeEdited(node);
    }
View Full Code Here

            Set<Classification> selected = new HashSet<Classification>();

            for (IObservableValue value : observables)
            {
                Classification classification = (Classification) value.getValue();
                if (!selected.add(classification))
                    return ValidationStatus.error(MessageFormat.format(
                                    Messages.EditWizardMasterDataMsgDuplicateClassification, classification.getName()));
            }
            return ValidationStatus.ok();
        }
View Full Code Here

                String name = askTaxonomyName(Messages.LabelNewTaxonomy);
                if (name == null)
                    return;

                Taxonomy taxonomy = new Taxonomy(UUID.randomUUID().toString(), name);
                taxonomy.setRootNode(new Classification(UUID.randomUUID().toString(), name));

                addAndOpenTaxonomy(taxonomy);
            }
        });
View Full Code Here

TOP

Related Classes of name.abuchen.portfolio.model.Classification

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.