/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package clips.delegate.DEC;
import clips.delegate.doctor.DiseaseLocal;
import cli_fmw.delegate.cache.DelegateSecondaryCacheDgt;
import cli_fmw.main.ClipsException;
import beans.DEC.HasDisease;
import cli_fmw.delegate.AuditListener;
import cli_fmw.delegate.DelegateLine2;
/**
*
* @author axe
*/
public class DECDisease extends DelegateSecondaryCacheDgt<DiseaseLocal>{
DelegateLine2<?, ? extends HasDisease> dl2;
private AuditListener al;
public DECDisease(DelegateLine2<?, ? extends HasDisease> dl2, String readableException, AuditListener al) throws ClipsException {
super(dl2.getSCM(), true, readableException);
this.al = al;
this.dl2 = dl2;
}
@Override
protected DiseaseLocal init() throws Exception {
if(dl2.getDetails().getDisease() == 0) {
return null;
}
return new DiseaseLocal(dl2.getDetails().getDisease(), al);
}
@Override
protected void setPrimary(DiseaseLocal type) throws ClipsException {
dl2.getDetails().setDiseaase(type.getID());
}
}