diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/materials/entities/Material.java b/navalplanner-business/src/main/java/org/navalplanner/business/materials/entities/Material.java new file mode 100644 index 000000000..eddfa7c3f --- /dev/null +++ b/navalplanner-business/src/main/java/org/navalplanner/business/materials/entities/Material.java @@ -0,0 +1,51 @@ +/* + * This file is part of ###PROJECT_NAME### + * + * Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e + * Desenvolvemento Tecnolóxico de Galicia + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.navalplanner.business.materials.entities; + +import java.math.BigDecimal; + +import org.hibernate.validator.NotEmpty; +import org.navalplanner.business.common.BaseEntity; + +/** + * Material entity + * + * @author Jacobo Aragunde Perez + * + */ +public class Material extends BaseEntity { + + private String description; + + private BigDecimal defaultUnitPrice; + + @NotEmpty + private String materialCode; + + private boolean disabled; + + private MaterialCategory category; + + // Default constructor, needed by Hibernate + protected Material() { + + } +} diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/materials/entities/MaterialCategory.java b/navalplanner-business/src/main/java/org/navalplanner/business/materials/entities/MaterialCategory.java new file mode 100644 index 000000000..a9fa1cc8e --- /dev/null +++ b/navalplanner-business/src/main/java/org/navalplanner/business/materials/entities/MaterialCategory.java @@ -0,0 +1,51 @@ +/* + * This file is part of ###PROJECT_NAME### + * + * Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e + * Desenvolvemento Tecnolóxico de Galicia + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.navalplanner.business.materials.entities; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import org.hibernate.validator.NotEmpty; +import org.navalplanner.business.common.BaseEntity; + +/** + * MaterialCategory entity + * + * @author Jacobo Aragunde Perez + * + */ +public class MaterialCategory extends BaseEntity { + + @NotEmpty + private String name; + + private MaterialCategory parent; + + private Set subcategories = new HashSet(); + + private Set materials = new HashSet(); + + // Default constructor, needed by Hibernate + protected MaterialCategory() { + + } +} diff --git a/navalplanner-business/src/main/resources/navalplanner-business-spring-config.xml b/navalplanner-business/src/main/resources/navalplanner-business-spring-config.xml index 96fa8b660..17927bdac 100644 --- a/navalplanner-business/src/main/resources/navalplanner-business-spring-config.xml +++ b/navalplanner-business/src/main/resources/navalplanner-business-spring-config.xml @@ -52,6 +52,9 @@ org/navalplanner/business/common/entities/Configuration.hbm.xml + + org/navalplanner/business/materials/entities/Materials.hbm.xml + diff --git a/navalplanner-business/src/main/resources/org/navalplanner/business/materials/entities/Materials.hbm.xml b/navalplanner-business/src/main/resources/org/navalplanner/business/materials/entities/Materials.hbm.xml new file mode 100644 index 000000000..03830ccee --- /dev/null +++ b/navalplanner-business/src/main/resources/org/navalplanner/business/materials/entities/Materials.hbm.xml @@ -0,0 +1,52 @@ + + + + + + + + + 100 + + + + + + + + + + + + + + + + + + + + + 100 + + + + + + + + + + + + + + + + + + + + + + diff --git a/navalplanner-business/src/test/resources/navalplanner-business-spring-config-test.xml b/navalplanner-business/src/test/resources/navalplanner-business-spring-config-test.xml index 4b242a00d..e6f947c0a 100644 --- a/navalplanner-business/src/test/resources/navalplanner-business-spring-config-test.xml +++ b/navalplanner-business/src/test/resources/navalplanner-business-spring-config-test.xml @@ -60,7 +60,10 @@ org/navalplanner/business/common/entities/Configuration.hbm.xml - + + org/navalplanner/business/materials/entities/Materials.hbm.xml + + TestEntities.hbm.xml