Package org.libreplan.business.orders.entities

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


        return list(Order.class);
    }

    @Override
    public void remove(Long id) throws InstanceNotFoundException {
        Order order = find(id);
        OrderElementDAO.removeTaskSourcesFor(taskSourceDAO, order);
        super.remove(id);
    }
View Full Code Here


        List<OrderCostsPerResourceDTO> list = query.list();

        List<OrderCostsPerResourceDTO> filteredList = new ArrayList<OrderCostsPerResourceDTO>();
        for (OrderCostsPerResourceDTO each : list) {

            Order order = loadOrderAvoidingProxyFor(each.getOrderElement());

            // Apply filtering
            if (matchFilterCriterion(each.getOrderElement(), criterions)
                    && isOrderContained(order, orders)) {

                // Attach ordername value
                each.setOrderName(order.getName());
                each.setOrderCode(order.getCode());
                // Attach calculated pricePerHour
                BigDecimal pricePerHour = CostCategoryDAO
                        .getPriceByResourceDateAndHourType(each.getWorker(),
                                new LocalDate(each.getDate()), each
                                        .getHoursTypeCode());
View Full Code Here

            List<OrderAuthorization> authorizations = orderAuthorizationDAO.listByUserAndItsProfiles(user);
            for(OrderAuthorization authorization : authorizations) {
                if (authorization.getAuthorizationType() == OrderAuthorizationType.READ_AUTHORIZATION ||
                    authorization.getAuthorizationType() == OrderAuthorizationType.WRITE_AUTHORIZATION) {

                    Order order = authorization.getOrder();
                    if(!orders.contains(order)) {
                        order.getName(); //this lines forces the load of the basic attributes of the order
                        orders.add(order);
                    }
                }
            }
            return orders;
View Full Code Here

        else {
            List<Order> orders = new ArrayList<Order>();
            List<OrderAuthorization> authorizations = orderAuthorizationDAO.listByUserAndItsProfiles(user);
            for(OrderAuthorization authorization : authorizations) {
                if (authorization.getAuthorizationType() == OrderAuthorizationType.WRITE_AUTHORIZATION) {
                    Order order = authorization.getOrder();
                    if(!orders.contains(order)) {
                        order.getName(); //this lines forces the load of the basic attributes of the order
                        orders.add(order);
                    }
                }
            }
            return orders;
View Full Code Here

        if (StringUtils.isBlank(code)) {
            throw new InstanceNotFoundException(null, getEntityClass()
                    .getName());
        }

        Order entity = (Order) getSession().createCriteria(getEntityClass())
                .add(
                        Restrictions.eq("infoComponent.code", code.trim())
                                .ignoreCase()).uniqueResult();

        if (entity == null) {
View Full Code Here

        if (StringUtils.isBlank(name)) {
            throw new InstanceNotFoundException(null,
                getEntityClass().getName());
        }

        Order order = (Order) getSession().createCriteria(getEntityClass())
                .add(Restrictions.eq("infoComponent.name", name).ignoreCase())
                .uniqueResult();

        if (order == null) {
            throw new InstanceNotFoundException(
View Full Code Here

    @Override
    @Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW)
    public boolean existsByNameAnotherTransaction(String name) {
        try {
            Order order = findByName(name);
            return order != null;
        } catch (InstanceNotFoundException e) {
            return false;
        }
    }
View Full Code Here

        List<CostExpenseSheetDTO> list = query.list();

        List<CostExpenseSheetDTO> filteredList = new ArrayList<CostExpenseSheetDTO>();
        for (CostExpenseSheetDTO each : list) {
            Order order = loadOrderAvoidingProxyFor(each.getOrderElement());
            // Apply filtering
            if (matchFilterCriterion(each.getOrderElement(), criterions)
                    && isOrderContained(order, orders)) {
                each.setOrder(order);
                filteredList.add(each);
View Full Code Here

        assertNotNull(orderElementDAO);
        assertNotNull(expenseSheetDAO);
    }

    private Order createValidOrder(String name) {
        Order order = Order.create();
        order.setName(name);
        order.setCode(UUID.randomUUID().toString());
        order.setInitDate(new Date());
        BaseCalendar basicCalendar = BaseCalendarTest.createBasicCalendar();
        calendarDAO.save(basicCalendar);
        OrderVersion orderVersion = ResourceAllocationDAOTest.setupVersionUsing(scenarioManager,
                order);
        order.useSchedulingDataFor(orderVersion);
        return order;
    }
View Full Code Here

        worker.setNif("NIF" + UUID.randomUUID().toString());
        return worker;
    }

    private OrderElement givenOrderElement(String orderLineCode) {
        Order order = createValidOrder(orderLineCode + "-order-1");
        OrderLine line = OrderLine.create();
        line.setCode(orderLineCode);
        line.setName(orderLineCode + "-name-1");
        line.setInitDate(new Date());
        order.add(line);
        return line;
    }
View Full Code Here

TOP

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

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.