From bded052097954c62ebc542821964da1ebcf4dcd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacobo=20Aragunde=20P=C3=A9rez?= Date: Thu, 3 May 2012 11:37:10 +0200 Subject: [PATCH] Moved code attribute from InfoComponent to new class InfoComponentWithCode to fix regression. FEA: ItEr76S26RemoveExternalCodeFromTemplates --- .../orders/entities/InfoComponent.java | 12 ----- .../entities/InfoComponentWithCode.java | 47 +++++++++++++++++++ .../orders/entities/OrderElement.java | 6 +-- .../business/orders/entities/Orders.hbm.xml | 2 +- 4 files changed, 51 insertions(+), 16 deletions(-) create mode 100644 libreplan-business/src/main/java/org/libreplan/business/orders/entities/InfoComponentWithCode.java diff --git a/libreplan-business/src/main/java/org/libreplan/business/orders/entities/InfoComponent.java b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/InfoComponent.java index fe23533ae..2fd1cf33c 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/orders/entities/InfoComponent.java +++ b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/InfoComponent.java @@ -27,8 +27,6 @@ import org.hibernate.validator.NotEmpty; */ public class InfoComponent { - private String code; - private String name; private String description; @@ -36,15 +34,6 @@ public class InfoComponent { public InfoComponent() { } - public void setCode(String code) { - this.code = code; - } - - @NotEmpty(message = "code not specified") - public String getCode() { - return code; - } - public void setName(String name) { this.name = name; } @@ -64,7 +53,6 @@ public class InfoComponent { public InfoComponent copy() { InfoComponent result = new InfoComponent(); - result.setCode(getCode()); result.setName(getName()); result.setDescription(getDescription()); return result; diff --git a/libreplan-business/src/main/java/org/libreplan/business/orders/entities/InfoComponentWithCode.java b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/InfoComponentWithCode.java new file mode 100644 index 000000000..a1d313821 --- /dev/null +++ b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/InfoComponentWithCode.java @@ -0,0 +1,47 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2012 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.libreplan.business.orders.entities; + +import org.hibernate.validator.NotEmpty; + +/** + * @author Jacobo Aragunde Pérez + */ +public class InfoComponentWithCode extends InfoComponent { + + private String code; + + public void setCode(String code) { + this.code = code; + } + + @NotEmpty(message = "code not specified") + public String getCode() { + return code; + } + + public InfoComponentWithCode copy() { + InfoComponentWithCode result = new InfoComponentWithCode(); + result.setCode(getCode()); + result.setName(getName()); + result.setDescription(getDescription()); + return result; + } + +} diff --git a/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderElement.java b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderElement.java index e9bfa7e53..d289376bf 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderElement.java +++ b/libreplan-business/src/main/java/org/libreplan/business/orders/entities/OrderElement.java @@ -75,7 +75,7 @@ import org.libreplan.business.workreports.entities.WorkReportLine; public abstract class OrderElement extends IntegrationEntity implements ICriterionRequirable, ITreeNode { - protected InfoComponent infoComponent = new InfoComponent(); + protected InfoComponentWithCode infoComponent = new InfoComponentWithCode(); private Date initDate; @@ -1267,9 +1267,9 @@ public abstract class OrderElement extends IntegrationEntity implements } @Valid - public InfoComponent getInfoComponent() { + public InfoComponentWithCode getInfoComponent() { if (infoComponent == null) { - infoComponent = new InfoComponent(); + infoComponent = new InfoComponentWithCode(); } return infoComponent; } diff --git a/libreplan-business/src/main/resources/org/libreplan/business/orders/entities/Orders.hbm.xml b/libreplan-business/src/main/resources/org/libreplan/business/orders/entities/Orders.hbm.xml index d1ada6218..566468552 100644 --- a/libreplan-business/src/main/resources/org/libreplan/business/orders/entities/Orders.hbm.xml +++ b/libreplan-business/src/main/resources/org/libreplan/business/orders/entities/Orders.hbm.xml @@ -8,7 +8,7 @@ - +