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