/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package clips.delegate.kek;
import beans.cec.entity.CommitteeDirectionDetails;
import cli_fmw.delegate.AuditListener;
import clips.delegate.doctor.direction.DirectionLocal;
import cli_fmw.delegate.cache.Cache;
import cli_fmw.main.ClipsException;
import cli_fmw.delegate.lists.DataChunk;
/**
*
* @author lacoste
*/
public class CommitteeDirectionData extends DataChunk<CommitteeDirectionDetails> {
Cache<DirectionLocal> direction = new Cache<DirectionLocal>();
public CommitteeDirectionData(CommitteeLocal committee) throws ClipsException {
super(new CommitteeDirectionDetails());
getDetails().committeeID = committee.getID();
}
public CommitteeDirectionData(CommitteeLocal committee, CommitteeDirectionDetails details)
throws ClipsException {
super(details);
if(committee != null &&
getDetails().committeeID != committee.getID()) {
throw new IllegalArgumentException("Inconsistent committee data");
}
}
public DirectionLocal getDirection(AuditListener al) throws ClipsException {
if(!direction.inCache()) {
DirectionLocal dl = new DirectionLocal(getDetails().directionID, al);
direction.set(dl);
}
return direction.get();
}
public void setDirection(DirectionLocal dir) throws ClipsException {
getDetails().directionID = dir.getID();
direction.set(dir);
}
}