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

import gov.nih.nci.calab.domain.nano.characterization.Characterization;
import gov.nih.nci.calab.domain.nano.characterization.physical.MolecularWeight;
import gov.nih.nci.calab.dto.characterization.CharacterizationBean;
import gov.nih.nci.calab.dto.characterization.DatumBean;
import gov.nih.nci.calab.dto.characterization.DerivedBioAssayDataBean;

import java.util.List;

/**
 * This class represents the size characterization information to be shown in
 * the view page.
 * 
 * @author pansu
 * 
 */
public class MolecularWeightBean extends CharacterizationBean {
	public MolecularWeightBean() {
		super();
		initSetup();
	}

	public MolecularWeightBean(Characterization aChar) {
		super(aChar);
		/*
		 * this.setCharacterizationSource(aChar.getSource());
		 * this.setViewTitle(aChar.getIdentificationName());
		 * this.setDescription(aChar.getDescription()); if
		 * (aChar.getInstrument() != null) {
		 * this.getInstrument().setType(aChar.getInstrument().getInstrumentType().getName());
		 * this.getInstrument().setDescription(aChar.getInstrument().getDescription());
		 * this.getInstrument().setManufacturer(aChar.getInstrument().getManufacturer().getName()); }
		 * this.setNumberOfDerivedBioAssayData(Integer.valueOf(aChar.getDerivedBioAssayDataCollection().size()).toString());
		 * for (DerivedBioAssayData table :
		 * aChar.getDerivedBioAssayDataCollection()) { DerivedBioAssayDataBean
		 * ctBean = new DerivedBioAssayDataBean(table);
		 * this.getDerivedBioAssayData().add(ctBean); } if
		 * (aChar.getCharacterizationProtocol() != null) {
		 * this.getCharacterizationProtocol().setId(aChar.getCharacterizationProtocol().getId());
		 * this.getCharacterizationProtocol().setName(aChar.getCharacterizationProtocol().getName());
		 * this.getCharacterizationProtocol().setVersion(aChar.getCharacterizationProtocol().getVersion()); }
		 */
	}

	public void setDerivedBioAssayDataList(
			List<DerivedBioAssayDataBean> derivedBioAssayData) {
		super.setDerivedBioAssayDataList(derivedBioAssayData);
		initSetup();
	}

	public void initSetup() {
		for (DerivedBioAssayDataBean table : getDerivedBioAssayDataList()) {
			if (table.getDatumList().isEmpty()) {
				DatumBean mw = new DatumBean();
				mw.setType("Molecular Weight");
				mw.setValueUnit("kDa");

				table.getDatumList().add(mw);
			}
		}
	}

	public MolecularWeight getDomainObj() {
		MolecularWeight molecularWeight = new MolecularWeight();
		super.updateDomainObj(molecularWeight);
		return molecularWeight;
	}
}

@@ -398,16 +398,71 @@
 ataBean;
+%0Aimport gov.nih.nci.calab.service.util.CananoConstants;
 %0A%0Aimport
@@ -808,1166 +808,8 @@
 r);%0A
-%09%09/*%0A%09%09 * this.setCharacterizationSource(aChar.getSource());%0A%09%09 * this.setViewTitle(aChar.getIdentificationName());%0A%09%09 * this.setDescription(aChar.getDescription()); if%0A%09%09 * (aChar.getInstrument() != null) %7B%0A%09%09 * this.getInstrument().setType(aChar.getInstrument().getInstrumentType().getName());%0A%09%09 * this.getInstrument().setDescription(aChar.getInstrument().getDescription());%0A%09%09 * this.getInstrument().setManufacturer(aChar.getInstrument().getManufacturer().getName()); %7D%0A%09%09 * this.setNumberOfDerivedBioAssayData(Integer.valueOf(aChar.getDerivedBioAssayDataCollection().size()).toString());%0A%09%09 * for (DerivedBioAssayData table :%0A%09%09 * aChar.getDerivedBioAssayDataCollection()) %7B DerivedBioAssayDataBean%0A%09%09 * ctBean = new DerivedBioAssayDataBean(table);%0A%09%09 * this.getDerivedBioAssayData().add(ctBean); %7D if%0A%09%09 * (aChar.getCharacterizationProtocol() != null) %7B%0A%09%09 * this.getCharacterizationProtocol().setId(aChar.getCharacterizationProtocol().getId());%0A%09%09 * this.getCharacterizationProtocol().setName(aChar.getCharacterizationProtocol().getName());%0A%09%09 * this.getCharacterizationProtocol().setVersion(aChar.getCharacterizationProtocol().getVersion()); %7D%0A%09%09 */%0A
 %09%7D%0A%0A
@@ -1175,26 +1175,49 @@
 ype(
-%22Molecular Weight%22
+CananoConstants.PHYSICAL_MOLECULAR_WEIGHT
 );%0A%09

Clean up the constructor and use Constants value.