Improve ComunicationType enum and include the translate method.

FEA: ItEr75S28CustomerIncommingCommunicationsLists
This commit is contained in:
Susana Montes Pedreira 2011-11-04 13:49:11 +01:00
parent c99807c08c
commit c0a3ec1392
4 changed files with 25 additions and 10 deletions

View file

@ -21,11 +21,28 @@
package org.libreplan.business.externalcompanies.entities;
import static org.libreplan.business.i18n.I18nHelper._;
/**
* Enum for specified the type of {@link CustomerComunication}
*
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
*/
public enum ComunicationType {
New_Project
NEW_PROJECT(_("New project"));
private String description;
private ComunicationType(String description) {
this.description = description;
}
public String toString() {
return this.description;
}
public static ComunicationType getDefault() {
return NEW_PROJECT;
}
}

View file

@ -63,7 +63,8 @@ public class CustomerComunication extends BaseEntity{
}
public static CustomerComunication createTodayNewProject(Date deadline) {
return (CustomerComunication) create(new CustomerComunication(deadline, new Date(), ComunicationType.New_Project));
return (CustomerComunication) create(new CustomerComunication(deadline,
new Date(), ComunicationType.NEW_PROJECT));
}
protected CustomerComunication(Date deadline, Date comunicationDate, ComunicationType comunicationType) {

View file

@ -31,14 +31,12 @@ import javax.annotation.Resource;
import org.apache.commons.logging.LogFactory;
import org.libreplan.business.common.exceptions.ValidationException;
import org.libreplan.business.externalcompanies.entities.ComunicationType;
import org.libreplan.business.externalcompanies.entities.CustomerComunication;
import org.libreplan.business.materials.entities.MaterialStatusEnum;
import org.libreplan.business.orders.entities.Order;
import org.libreplan.business.workreports.entities.PositionInWorkReportEnum;
import org.libreplan.web.common.IMessagesForUser;
import org.libreplan.web.common.MessagesForUser;
import org.libreplan.web.planner.tabs.IGlobalViewEntryPoints;
import org.zkoss.ganttz.timetracker.zoom.ZoomLevel;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
@ -48,8 +46,6 @@ import org.zkoss.zul.Button;
import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Label;
import org.zkoss.zul.ListModel;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Row;
import org.zkoss.zul.RowRenderer;
import org.zkoss.zul.SimpleListModel;
@ -134,8 +130,9 @@ public class CustomerComunicationCRUDController extends GenericForwardComposer {
CustomerComunication customerComunication = (CustomerComunication) data;
row.setValue(customerComunication);
appendLabel(row, customerComunication.getComunicationType()
.toString());
final ComunicationType type = customerComunication.getComunicationType();
appendLabel(row, type.toString());
appendLabel(row, customerComunication.getOrder().getName());
appendLabel(row, toString(customerComunication.getDeadline()));
appendLabel(row, customerComunication.getOrder().getCode());

View file

@ -325,7 +325,7 @@ public class SubcontractServiceREST implements ISubcontractService {
Date comunicationDate = new Date();
CustomerComunication customerComunication = CustomerComunication
.create(deadline, comunicationDate,
ComunicationType.New_Project, order);
ComunicationType.NEW_PROJECT, order);
customerComunicationDAO.save(customerComunication);
}
}