Moved code attribute from InfoComponent to new class InfoComponentWithCode to fix regression.

FEA: ItEr76S26RemoveExternalCodeFromTemplates
This commit is contained in:
Jacobo Aragunde Pérez 2012-05-03 11:37:10 +02:00
parent beba51c1eb
commit bded052097
4 changed files with 51 additions and 16 deletions

View file

@ -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;

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
package org.libreplan.business.orders.entities;
import org.hibernate.validator.NotEmpty;
/**
* @author Jacobo Aragunde Pérez <jaragunde@igalia.com>
*/
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;
}
}

View file

@ -75,7 +75,7 @@ import org.libreplan.business.workreports.entities.WorkReportLine;
public abstract class OrderElement extends IntegrationEntity implements
ICriterionRequirable, ITreeNode<OrderElement> {
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;
}

View file

@ -8,7 +8,7 @@
</generator>
</id>
<version name="version" access="property" type="long" />
<component name="infoComponent" class="org.libreplan.business.orders.entities.InfoComponent">
<component name="infoComponent" class="org.libreplan.business.orders.entities.InfoComponentWithCode">
<property name="name" access="field" />
<property name="description" access="field" type="text" />
<property name="code" access="field" unique="true" />