diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/resources/entities/Resource.java b/navalplanner-business/src/main/java/org/navalplanner/business/resources/entities/Resource.java index 88545684e..bbc56e00a 100644 --- a/navalplanner-business/src/main/java/org/navalplanner/business/resources/entities/Resource.java +++ b/navalplanner-business/src/main/java/org/navalplanner/business/resources/entities/Resource.java @@ -124,7 +124,7 @@ public abstract class Resource extends IntegrationEntity { private Set resourcesCostCategoryAssignments = new HashSet(); - private Boolean limitingResource = Boolean.FALSE; + private ResourceType resourceType = ResourceType.NON_LIMITING_RESOURCE; private LimitingResourceQueue limitingResourceQueue; @@ -1139,11 +1139,15 @@ public abstract class Resource extends IntegrationEntity { } public Boolean isLimitingResource() { - return limitingResource; + return (resourceType == ResourceType.LIMITING_RESOURCE); } - public void setLimitingResource(Boolean limitingResource) { - this.limitingResource = limitingResource; + public ResourceType getResourceType() { + return resourceType; + } + + public void setResourceType(ResourceType resourceType) { + this.resourceType = resourceType; } public LimitingResourceQueue getLimitingResourceQueue() { diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/resources/entities/ResourceType.java b/navalplanner-business/src/main/java/org/navalplanner/business/resources/entities/ResourceType.java new file mode 100644 index 000000000..9aed5abcd --- /dev/null +++ b/navalplanner-business/src/main/java/org/navalplanner/business/resources/entities/ResourceType.java @@ -0,0 +1,54 @@ +/* + * This file is part of NavalPlan + * + * Copyright (C) 2010 Igalia S.L. + * + * 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.resources.entities; + +import static org.navalplanner.business.i18n.I18nHelper._; + +import java.util.EnumSet; +import java.util.Set; + +/** + * Enumerate with the three basic types of resource: non-limiting, limiting and strategic. + * @author Jacobo Aragunde Perez + */ +public enum ResourceType { + + NON_LIMITING_RESOURCE(_("NON LIMITING RESOURCE")), + LIMITING_RESOURCE(_("LIMITING RESOURCE")), + STRATEGIC_RESOURCE(_("STRATEGIC RESOURCE")); + + private String option; + + private ResourceType(String option) { + this.option = option; + } + + public String toString() { + return option; + } + + public static Set getResourceTypeList() { + return EnumSet.of( + ResourceType.NON_LIMITING_RESOURCE, + ResourceType.LIMITING_RESOURCE, + ResourceType.STRATEGIC_RESOURCE); + } + +} diff --git a/navalplanner-business/src/main/resources/db.changelog-1.0.xml b/navalplanner-business/src/main/resources/db.changelog-1.0.xml index a57bfe7ef..0cec1466e 100644 --- a/navalplanner-business/src/main/resources/db.changelog-1.0.xml +++ b/navalplanner-business/src/main/resources/db.changelog-1.0.xml @@ -63,4 +63,22 @@ where day_id IN (5, 6) AND allowed_extra_effort IS NULL + + + Replace column limited_resource with resource_type in resource table + + + + + + limited_resource = false + + + + limited_resource = true + + + + + diff --git a/navalplanner-business/src/main/resources/org/navalplanner/business/resources/entities/Resources.hbm.xml b/navalplanner-business/src/main/resources/org/navalplanner/business/resources/entities/Resources.hbm.xml index 405d0ef23..b7f2a131f 100644 --- a/navalplanner-business/src/main/resources/org/navalplanner/business/resources/entities/Resources.hbm.xml +++ b/navalplanner-business/src/main/resources/org/navalplanner/business/resources/entities/Resources.hbm.xml @@ -19,7 +19,12 @@ - + + + org.navalplanner.business.resources.entities.ResourceType + 12 + +