Package org.libreplan.business.costcategories.entities

Examples of org.libreplan.business.costcategories.entities.CostCategory


        }
        return false;
    }

    private boolean acceptCostCategory(FilterPair filter, Resource resource) {
        CostCategory filterCostCategory = (CostCategory) filter.getValue();
        for (ResourcesCostCategoryAssignment assignedCostCategory : resource
                .getResourcesCostCategoryAssignments()) {
            if (assignedCostCategory.getCostCategory().getId().equals(
                    filterCostCategory.getId())) {
                return true;
            }
        }
        return false;
    }
View Full Code Here


    }

    public final static CostCategory toEntity(CostCategoryDTO costCategoryDTO) {

        CostCategory costCategory = CostCategory.createUnvalidated(StringUtils
                .trim(costCategoryDTO.code), StringUtils
                .trim(costCategoryDTO.name), costCategoryDTO.enabled);

        for (HourCostDTO hourCostDTO : costCategoryDTO.hourCostDTOs) {
            HourCost hourCost = toEntity(hourCostDTO);
            hourCost.setCategory(costCategory);
            costCategory.addHourCost(hourCost);
        }

        return costCategory;

    }
View Full Code Here

                listCostCategories.renderAll();

                final Rows rows = listCostCategories.getRows();
                for (Iterator i = rows.getChildren().iterator(); i.hasNext(); ) {
                    final Row row = (Row) i.next();
                    final CostCategory category = (CostCategory) row.getValue();
                    Button btnDelete = (Button) ((Hbox)row.getChildren().get(2)).getChildren().get(1);
                    if (!canRemoveCostCategory(category)) {
                        btnDelete.setDisabled(true);
                        btnDelete.setImage("/common/img/ico_borrar_out.png");
                        btnDelete.setHoverImage("/common/img/ico_borrar_out.png");
View Full Code Here

    private void appendTextboxCode(final Row row) {
        final HourCost hourCost = ((HourCost) row.getValue());
        final Textbox txtCode = new Textbox();
        txtCode.setWidth("200px");
        if (hourCost != null) {
            CostCategory costCategory = hourCost.getCategory();
            txtCode.setDisabled(costCategory.isCodeAutogenerated());
            Util.bind(txtCode, new Util.Getter<String>() {
                @Override
                public String get() {
                    return hourCost.getCode();
                }
View Full Code Here

        return dao.findActive();
    }

    @Override
    public String _toString(Object value) {
        final CostCategory costCategory = (CostCategory) value;
        return (costCategory != null) ? costCategory.getName() : "";
    }
View Full Code Here

                TypeOfWorkHours.create(UUID.randomUUID().toString(), UUID.randomUUID().toString());
        type.setDefaultPrice(BigDecimal.TEN);
        hourCost.setType(type);
        typeOfWorkHoursDAO.save(type);

        CostCategory costCategory = CostCategory.create(UUID.randomUUID().toString());
        hourCost.setCategory(costCategory);
        costCategoryDAO.save(costCategory);

        return hourCost;
    }
View Full Code Here

    @Test
    @Transactional
    public void testHourCostNotInTwoCategories() {
        HourCost hourCost = createValidHourCost();
        CostCategory costCategory1 = CostCategory.create(UUID.randomUUID().toString());
        CostCategory costCategory2 = CostCategory.create(UUID.randomUUID().toString());

        hourCost.setCategory(costCategory1);
        hourCost.setCategory(costCategory2);
        hourCostDAO.save(hourCost);

        assertFalse(costCategory1.getHourCosts().contains(hourCost));
        assertTrue(costCategory2.getHourCosts().contains(hourCost));

        costCategory1.addHourCost(hourCost);
        costCategory2.addHourCost(hourCost);
        hourCostDAO.save(hourCost);

        assertFalse(costCategory1.getHourCosts().contains(hourCost));
        assertTrue(costCategory2.getHourCosts().contains(hourCost));
    }
View Full Code Here

    public void testInSpringContainer() {
        assertNotNull(resourcesCostCategoryAssignmentDAO);
    }

    private ResourcesCostCategoryAssignment createValidResourcesCostCategoryAssignment() {
        CostCategory costCategory = createValidCostCategory();
        costCategoryDAO.save(costCategory);
        Worker worker = createValidWorker();
        workerDAO.save(worker);

        ResourcesCostCategoryAssignment assignment = ResourcesCostCategoryAssignment.create();
View Full Code Here

        assignment.setResource(worker);
        return assignment;
    }

    private CostCategory createValidCostCategory() {
        CostCategory costCategory = CostCategory.create(UUID.randomUUID().toString());
        return costCategory;
    }
View Full Code Here

    private List<FilterPair> fillWithFirstTenFiltersCostCategories() {
        List<CostCategory> costCategories = databaseSnapshots
                .snapshotListCostCategories();
        for (int i = 0; getListMatching().size() < 10
                && i < costCategories.size(); i++) {
            CostCategory costCategory = costCategories.get(i);
            addCostCategory(costCategory);
        }
        return getListMatching();
    }
View Full Code Here

TOP

Related Classes of org.libreplan.business.costcategories.entities.CostCategory

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.