Examples of MaterialCategory


Examples of org.libreplan.business.materials.entities.MaterialCategory

    }

    private Treeitem findTreeItemByMaterialCategory(Tree tree, MaterialCategory materialCategory) {
        for (Iterator i = tree.getItems().iterator(); i.hasNext();)  {
            final Treeitem treeitem = (Treeitem) i.next();
            final MaterialCategory _materialCategory = (MaterialCategory) treeitem.getValue();
            if (_materialCategory.getId() != null && _materialCategory.getId().equals(materialCategory.getId())) {
                return treeitem;
            }
        }
        return null;
    }
View Full Code Here

Examples of org.libreplan.business.materials.entities.MaterialCategory

    }

    @Test
    @Transactional
    public void testRemoveChildrenMaterialCategories() {
        MaterialCategory category = createValidMaterialCategory();
        MaterialCategory subcategory = createValidMaterialCategory();
        category.addSubcategory(subcategory);
        materialCategoryDAO.save(category);
        int previous = category.getSubcategories().size();

        category.removeSubcategory(subcategory);
View Full Code Here

Examples of org.libreplan.business.materials.entities.MaterialCategory

    }

    @Test
    @Transactional
    public void testSaveMaterialSubcategoryTopDown() {
        MaterialCategory category = createValidMaterialCategory();
        MaterialCategory subcategory = createValidMaterialCategory();
        category.addSubcategory(subcategory);
        //materialCategoryDAO.save(subcategory); //unnecessary due to cascade=all
        materialCategoryDAO.save(category);
        List<MaterialCategory> list = materialCategoryDAO.list(MaterialCategory.class);
        for(MaterialCategory listCategory:list) {
            if(listCategory.getId()==category.getId()) {
                assertEquals(1, listCategory.getSubcategories().size());
            }
            if(listCategory.getId()==subcategory.getId()) {
                assertNotNull(listCategory.getParent());
                assertEquals(category.getId(), listCategory.getParent().getId());
            }
        }
    }
View Full Code Here

Examples of org.libreplan.business.materials.entities.MaterialCategory

        materialCategoryBootstrap.loadRequiredData();
        unitTypeBootstrap.loadRequiredData();
    }

    private MaterialCategory createValidMaterialCategory() {
        MaterialCategory materialCategory = MaterialCategory.create(UUID.randomUUID().toString());
        return materialCategory;
    }
View Full Code Here

Examples of org.libreplan.business.materials.entities.MaterialCategory

        MaterialCategory materialCategory = MaterialCategory.create(UUID.randomUUID().toString());
        return materialCategory;
    }

    private Material createValidMaterial() {
        MaterialCategory materialCategory = MaterialCategory.create(UUID.randomUUID().toString());
        materialCategoryDAO.save(materialCategory);
        Material material = Material.create(UUID.randomUUID().toString());
        material.setDescription("material");
        material.setCategory(materialCategory);
        return material;
View Full Code Here

Examples of org.libreplan.business.materials.entities.MaterialCategory

    }

    @Test
    @Transactional
    public void testListMaterialsFromCategory() {
        MaterialCategory category = createValidMaterialCategory();
        int previous = category.getMaterials().size();
        Material material = createValidMaterial();
        category.addMaterial(material);

        materialCategoryDAO.save(category);
        try {
            category = materialCategoryDAO.find(category.getId());
            assertEquals(previous + 1, category.getMaterials().size());
        } catch (InstanceNotFoundException e) {

        }
    }
View Full Code Here

Examples of org.libreplan.business.materials.entities.MaterialCategory

    @Resource
    private IDataBootstrap unitTypeBootstrap;

    private Material createValidMaterial() {
        MaterialCategory materialCategory = MaterialCategory.create(UUID.randomUUID().toString());
        materialCategoryDAO.save(materialCategory);
        UnitType unitType = UnitType.create("m");
        unitTypeDAO.save(unitType);
        Material material = Material.create(UUID.randomUUID().toString());
        material.setDescription("material");
View Full Code Here

Examples of org.libreplan.business.materials.entities.MaterialCategory

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

    private MaterialCategory createValidMaterialCategory() {
        MaterialCategory materialCategory = MaterialCategory.create(UUID.randomUUID().toString());
        return materialCategory;
    }
View Full Code Here

Examples of org.libreplan.business.materials.entities.MaterialCategory

    }

    @Test
    @Transactional
    public void testSaveMaterialCategory() {
        MaterialCategory materialCategory = createValidMaterialCategory();
        materialCategoryDAO.save(materialCategory);
        assertTrue(materialCategory.getId() != null);
    }
View Full Code Here

Examples of org.libreplan.business.materials.entities.MaterialCategory

    }

    @Test
    @Transactional
    public void testRemoveMaterialCategory() throws InstanceNotFoundException {
        MaterialCategory materialCategory = createValidMaterialCategory();
        materialCategoryDAO.save(materialCategory);
        materialCategoryDAO.remove(materialCategory.getId());
        assertFalse(materialCategoryDAO.exists(materialCategory.getId()));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.