Package org.libreplan.business.orders.entities

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


                        }
                        return result;
                    }

                    private OrderElement orderFrom(OrderElement initial) {
                        OrderElement current = initial;
                        OrderElement result = current;
                        while (current != null) {
                            result = current;
                            current = findParent(current);
                        }
                        return result;
                    }

                    private OrderElement findParent(OrderElement orderElement) {
                        Query query = getSession()
                                .createQuery(
                                        "select e.parent from OrderElement e where e.id = :id")
                                .setParameter("id", orderElement.getId());
                        return (OrderElement) query.uniqueResult();
                    }

                });
        List<Order> result = new ArrayList<Order>();
        for (OrderElement each : orders) {
            if (each != null) {
                result.add(findExistingEntity(each.getId()));
            } else {
                result.add(null);
            }
        }
        return result;
    }
View Full Code Here


        // check out the expenseSheet without lines
        ExpenseSheet expense = ExpenseSheet.create();
        expense.setCode("code-expense-sheet-1");

        // order element empty
        OrderElement orderElement = null;

        // a expense sheet with valid value,date but without order element.
        ExpenseSheetLine line1 = ExpenseSheetLine.create(BigDecimal.ZERO, "concept",
                new LocalDate(), orderElement);
View Full Code Here

        // create the expenseSheet without lines
        ExpenseSheet expense = ExpenseSheet.create();
        expense.setCode("code-expense-sheet-1");

        // order element empty
        OrderElement orderElement = this.givenOrderElement("order-element-2");

        // a expense sheet with valid date and order element, but invalid value.
        ExpenseSheetLine line1 = ExpenseSheetLine.create(null, "concept", new LocalDate(),
                orderElement);
View Full Code Here

        // create the expenseSheet without lines
        ExpenseSheet expense = ExpenseSheet.create();
        expense.setCode("code-expense-sheet-1");

        // order element empty
        OrderElement orderElement = this.givenOrderElement("order-element-2");

        // a expense sheet with valid date and order element, but invalid value.
        ExpenseSheetLine line1 = ExpenseSheetLine.create(BigDecimal.ONE, "concept", null,
                orderElement);
View Full Code Here

        ExpenseSheet expense = ExpenseSheet.create();
        expense.setCode("code-expense-sheet-1");

        // check out the order element
        String orderLineCode = "order-line-code";
        OrderElement orderElement = givenSavedOrderElement(orderLineCode);

        // check out the resource
        Worker worker = givenSavedValidWorker();

        // add line 1 with a resource
View Full Code Here

        resourceDAO.flush();
        return worker;
    }

    private OrderElement givenSavedOrderElement(String orderLineCode) {
        OrderElement orderElement = givenOrderElement(orderLineCode);
        orderElementDAO.save(orderElement);
        orderElementDAO.flush();
        return orderElement;
    }
View Full Code Here

    public void testSaveTwoExpenseSheetWithTheSameCode() {
        int previousExpenses = expenseSheetDAO.getAll().size();

        // create a valid order element
        String orderLineCode = "order-line-code";
        OrderElement orderElement = givenSavedOrderElement(orderLineCode);

        ExpenseSheet expense = getValidExpenseSheet("code-expense-sheet-1", orderElement);
        try {
            expenseSheetDAO.save(expense);
            expenseSheetDAO.flush();
View Full Code Here

    public void testSaveTwoValidExpenseSheets() {
        int previousExpenses = expenseSheetDAO.getAll().size();

        // create a valid order element
        String orderLineCode = "order-line-code";
        OrderElement orderElement = givenSavedOrderElement(orderLineCode);

        ExpenseSheet expense = getValidExpenseSheet("code-expense-sheet-1", orderElement);
        try {
            expenseSheetDAO.save(expense);
            expenseSheetDAO.flush();
View Full Code Here

        int previousExpenses = expenseSheetDAO.getAll().size();
        int previousExpenseLines = expenseSheetLineDAO.findAll().size();

        // create a valid order element
        String orderLineCode = "order-line-code";
        OrderElement orderElement = givenSavedOrderElement(orderLineCode);

        ExpenseSheet expense = getValidExpenseSheet("code-expense-sheet-1", orderElement);
        try {
            expenseSheetDAO.save(expense);
            expenseSheetDAO.flush();
View Full Code Here

        ExpenseSheet expense = ExpenseSheet.create();
        expense.setCode("code-expense-sheet-1");

        // check out the order element
        String orderLineCode = "order-line-code";
        OrderElement orderElement = givenSavedOrderElement(orderLineCode);

        // check out the resource
        Worker worker = givenSavedValidWorker();

        // add line 1 with a resource
View Full Code Here

TOP

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

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.