Package org.libreplan.business.orders.entities

Examples of org.libreplan.business.orders.entities.OrderLineGroup


        model.addElement("element", 100);
        OrderLine element = (OrderLine) order.getChildren().get(0);
        model.addElementAt(element, "element2", 50);

        OrderLineGroup container = (OrderLineGroup) order.getChildren().get(0);
        model.removeNode(container.getChildren().iterator().next());

        IndirectCriterionRequirement indirectCriterionRequirement = (IndirectCriterionRequirement) container
                .getCriterionRequirements().iterator().next();
        assertTrue(indirectCriterionRequirement.getCriterion().isEquivalent(
                criterion));
        indirectCriterionRequirement.setValid(false);

        addAnotherCriterionRequirement(container);

        // This calls toLeaf in the container
        model.removeNode(container.getChildren().get(0));

        element = (OrderLine) order.getChildren().get(0);

        assertThat(element.getCriterionRequirements().size(), equalTo(2));
        for (CriterionRequirement each : element.getCriterionRequirements()) {
View Full Code Here


        assertTrue(order.getDirectAdvanceAssignments().isEmpty());
        assertThat(order.getIndirectAdvanceAssignments().size(), equalTo(2));
        assertNotNull(order.getIndirectAdvanceAssignment(advanceType));
        assertTrue(order.getCriterionRequirements().isEmpty());

        OrderLineGroup container = (OrderLineGroup) order.getChildren().get(0);
        assertTrue(container.getDirectAdvanceAssignments().isEmpty());
        assertThat(container.getIndirectAdvanceAssignments().size(), equalTo(2));
        assertNotNull(container.getIndirectAdvanceAssignment(advanceType));
        assertTrue(container.getCriterionRequirements().isEmpty());

        assertTrue(element.getDirectAdvanceAssignments().isEmpty());
        assertTrue(element.getCriterionRequirements().isEmpty());
        assertTrue(element.getHoursGroups().get(0).getCriterionRequirements()
                .isEmpty());
View Full Code Here

        assertTrue(order.getDirectAdvanceAssignments().isEmpty());
        assertNotNull(order.getIndirectAdvanceAssignment(advanceType));
        assertTrue(order.getCriterionRequirements().isEmpty());

        OrderLineGroup container = (OrderLineGroup) order.getChildren().get(0);
        assertTrue(container.getDirectAdvanceAssignments().isEmpty());
        assertNotNull(container.getIndirectAdvanceAssignment(advanceType));
        assertTrue(container.getCriterionRequirements().isEmpty());

        assertNotNull(element.getAdvanceAssignmentByType(advanceType));
        assertThat(element.getCriterionRequirements().size(), equalTo(1));
        assertDirectCriterion(element.getCriterionRequirements().iterator()
                .next(), criterion);
View Full Code Here

            DuplicateAdvanceAssignmentForOrderElementException {
        model.addElement("element", 100);
        model.addElementAt(order.getChildren().get(0), "element2", 50);
        model.addElement("element3", 30);

        OrderLineGroup container = null;
        OrderLine element3 = null;
        for (OrderElement each : order.getChildren()) {
            if (each.getName().equals("element")) {
                container = (OrderLineGroup) each;
            } else if (each.getName().equals("element3")) {
                element3 = (OrderLine) each;
            }
        }

        addCriterionRequirement(container);
        addDirectAdvanceAssignment(container);

        model.indent(element3);

        assertTrue(order.getDirectAdvanceAssignments().isEmpty());
        assertNotNull(order.getIndirectAdvanceAssignment(advanceType));
        assertTrue(order.getCriterionRequirements().isEmpty());

        assertNotNull(container.getAdvanceAssignmentByType(advanceType));
        assertThat(container.getCriterionRequirements().size(), equalTo(1));
        assertDirectCriterion(container.getCriterionRequirements().iterator()
                .next(), criterion);

        assertTrue(element3.getDirectAdvanceAssignments().isEmpty());
        assertThat(element3.getCriterionRequirements().size(), equalTo(1));
        assertDirectCriterion(container.getCriterionRequirements().iterator()
                .next(), criterion);
        assertThat(element3.getHoursGroups().get(0).getCriterionRequirements()
                .size(), equalTo(1));
        assertIndirectCriterion(container.getHoursGroups().get(0)
                .getCriterionRequirements().iterator().next(), criterion);
    }
View Full Code Here

        assertTrue(order.getDirectAdvanceAssignments().isEmpty());
        assertNotNull(order.getIndirectAdvanceAssignment(advanceType));
        assertNotNull(order.getIndirectAdvanceAssignment(advanceType2));
        assertThat(order.getCriterionRequirements().size(), equalTo(1));

        OrderLineGroup container = (OrderLineGroup) order.getChildren().get(0);
        assertTrue(container.getDirectAdvanceAssignments().isEmpty());
        assertNull(container.getIndirectAdvanceAssignment(advanceType));
        assertNotNull(container.getIndirectAdvanceAssignment(advanceType2));
        assertThat(container.getCriterionRequirements().size(), equalTo(1));

        assertThat(element.getDirectAdvanceAssignments().size(), equalTo(1));
        assertNotNull(element.getAdvanceAssignmentByType(advanceType2));
        assertThat(element.getCriterionRequirements().size(), equalTo(1));
        assertThat(element.getHoursGroups().get(0).getCriterionRequirements()
View Full Code Here

        assertNotNull(order.getIndirectAdvanceAssignment(advanceType2));
        assertThat(order.getCriterionRequirements().size(), equalTo(1));
        assertDirectCriterion(order.getCriterionRequirements().iterator()
                .next(), criterion3);

        OrderLineGroup container = (OrderLineGroup) order.getChildren().get(0);
        assertTrue(container.getDirectAdvanceAssignments().isEmpty());
        assertNotNull(container.getIndirectAdvanceAssignment(advanceType));
        assertNotNull(container.getIndirectAdvanceAssignment(advanceType2));
        assertNull(container.getIndirectAdvanceAssignment(advanceType3));
        assertThat(container.getCriterionRequirements().size(), equalTo(1));
        assertIndirectCriterion(container.getCriterionRequirements().iterator()
                .next(), criterion3);

        assertNotNull(element.getAdvanceAssignmentByType(advanceType));
        assertThat(element.getCriterionRequirements().size(), equalTo(2));
        for (CriterionRequirement each : element.getCriterionRequirements()) {
View Full Code Here

            throws DuplicateValueTrueReportGlobalAdvanceException,
            DuplicateAdvanceAssignmentForOrderElementException {
        model.addElement("element", 100);
        model.addElementAt(order.getChildren().get(0), "element2", 50);

        OrderLineGroup container = (OrderLineGroup) order.getChildren().get(0);

        OrderLine element = null;
        OrderLine element2 = null;
        for (OrderElement each : container.getChildren()) {
            if (each.getName().equals("")) {
                element = (OrderLine) each;
            } else if (each.getName().equals("element2")) {
                element2 = (OrderLine) each;
            }
        }

        model.unindent(element2);

        addCriterionRequirement(container);
        addDirectAdvanceAssignment(container);

        addAnotherCriterionRequirement(element2);
        addAnotherDirectAdvanceAssignment(element2);

        addAnotherDifferentCriterionRequirement(order);
        addAnotherDifferentDirectAdvanceAssignment(order);

        model.move(element2, container);

        assertThat(order.getDirectAdvanceAssignments().size(), equalTo(1));
        assertNotNull(order.getDirectAdvanceAssignmentByType(advanceType3));
        assertNotNull(order.getIndirectAdvanceAssignment(advanceType));
        assertNotNull(order.getIndirectAdvanceAssignment(advanceType2));
        assertThat(order.getCriterionRequirements().size(), equalTo(1));
        assertDirectCriterion(order.getCriterionRequirements().iterator()
                .next(), criterion3);

        assertThat(container.getDirectAdvanceAssignments().size(), equalTo(1));
        assertNotNull(container.getDirectAdvanceAssignmentByType(advanceType));
        assertNotNull(container.getIndirectAdvanceAssignment(advanceType2));
        assertNull(container.getIndirectAdvanceAssignment(advanceType3));
        assertThat(container.getCriterionRequirements().size(), equalTo(2));
        for (CriterionRequirement each : container.getCriterionRequirements()) {
            if (each.getCriterion().isEquivalent(criterion3)) {
                assertTrue(each instanceof IndirectCriterionRequirement);
            } else if (each.getCriterion().isEquivalent(criterion)) {
                assertTrue(each instanceof DirectCriterionRequirement);
            } else {
View Full Code Here

    public void createFromTemplate() {
        templateFinderPopup.openForSubElemenetCreation(tree, "after_pointer",
                new IOnResult<OrderElementTemplate>() {
                    @Override
                    public void found(OrderElementTemplate template) {
                        OrderLineGroup parent = (OrderLineGroup) getModel()
                                .getRoot();
                        orderModel.createFrom(parent, template);
                        getModel().addNewlyAddedChildrenOf(parent);

                        reloadTreeUIAfterChanges();
View Full Code Here

        Hibernate.initialize(orderElement.getChildren());
        initalizeOrder(orderElement);
    }

    private void initalizeOrder(OrderElement orderElement) {
        OrderLineGroup parent = orderElement.getParent();
        while (parent != null) {
            Hibernate.initialize(parent);
            parent = parent.getParent();
        }
    }
View Full Code Here

    @Override
    @Transactional(readOnly = true)
    public boolean isOnlyChildAndParentAlreadyInUseByHoursOrExpenses(
            OrderElement orderElement) {
        try {
            OrderLineGroup parent = orderElement.getParent();
            if (!parent.isOrder() && !parent.isNewObject()
                    && parent.getChildren().size() == 1) {
                if (orderElementDAO.isAlreadyInUse(parent)) {
                    return true;
                }
                if (orderElementDAO.hasImputedExpenseSheet(parent.getId())) {
                    return true;
                }
            }
            return false;
        } catch (InstanceNotFoundException e) {
View Full Code Here

TOP

Related Classes of org.libreplan.business.orders.entities.OrderLineGroup

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.