package gov.nih.nci.calab.dto.characterization;

import gov.nih.nci.calab.domain.Measurement;
import gov.nih.nci.calab.domain.nano.characterization.Datum;

/**
 * This class represents the data within a characterization file to be shown in
 * the view page.
 * 
 * @author chand
 * 
 */
public class DatumBean {
	private String id;

	private String type;

	private String value;

	private String valueUnit;

	public DatumBean() {

	}
	
	public DatumBean(Datum datum) {
		this.id = datum.getId().toString();
		this.type = datum.getType();
		this.value = datum.getValue().getValue();
		this.valueUnit = datum.getValue().getUnitOfMeasurement();
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String getValueUnit() {
		return valueUnit;
	}

	public void setValueUnit(String valueUnit) {
		this.valueUnit = valueUnit;
	}

	public Datum getDomainObj() {
		Datum tableData = new Datum();
		if (getId() != null && getId().length() > 0) {
			tableData.setId(new Long(getId()));
		}
		tableData.setType(type);
		Measurement measurement=new Measurement();
		measurement.setValue(value);
		measurement.setUnitOfMeasurement(valueUnit);
		tableData.setValue(measurement);
		return tableData;
	}
}

@@ -147,16 +147,67 @@
 n.Datum;
+%0Aimport gov.nih.nci.calab.service.util.StringUtils;
 %0A%0A/**%0A *
@@ -593,24 +593,77 @@
 his.value = 
+(datum.getValue()!=null)?StringUtils.convertToString(
 datum.getVal
@@ -677,16 +677,20 @@
 tValue()
+):%22%22
 ;%0A%09%09this
@@ -702,16 +702,69 @@
 eUnit = 
+(datum.getValue()!=null)?StringUtils.convertToString(
 datum.ge
@@ -794,16 +794,20 @@
 rement()
+):%22%22
 ;%0A%09%7D%0A%0A%09p

check if getValue()==null to avoid nullpointer