/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package clips.delegate.kek;
import beans.cec.entity.InabilityDetails;
import cli_fmw.main.ContentStateListener;
import clips.delegate.service.SerRenLocal;
import cli_fmw.main.ClipsException;
import cli_fmw.delegate.lists.DataChunk;
import cli_fmw.delegate.lists.Mappable;
import clips.doctor.newEMC.init.generic.ChildrenCacheListener;
import clips.doctor.newEMC.init.generic.DelegateNodeInterface;
import framework.utils.ROList;
import java.util.Date;
/**
* Делегат, предоставляющий доступ к одной записи в таблице invalidity
* (направление на МСЭК)
* @author ViP
*/
public class InabilityData extends DataChunk<InabilityDetails> implements Mappable<Integer>, DelegateNodeInterface<DelegateNodeInterface<?>> {
public InabilityData(CommitteeResolutionData resolution) throws ClipsException {
super(new InabilityDetails());
getDetails().committeeResolutionID = resolution.getId();
if(resolution.getId() == 0) {
throw new RuntimeException("Необходимо сохранить решение КЭК перед направлением на МСЭК");
}
}
public InabilityData(CommitteeResolutionData resolution, InabilityDetails details)
throws ClipsException {
super(details);
if(details.committeeResolutionID == 0
|| getDetails().committeeResolutionID != resolution.getId()) {
throw new RuntimeException("Inconsistent resolution data");
}
}
@Override
public Integer getKey() {
return getDetails().committeeResolutionID;
}
//////////////////////// Геттеры сеттеры
public Date getDate() throws ClipsException {
return getDetails().date;
}
public void setDate(Date date) throws ClipsException {
getDetails().date = date;
fireContentStateEvent();
}
public int getLevelIn() throws ClipsException {
return getDetails().levelIn;
}
public void setLevelIn(int levelIn) throws ClipsException {
getDetails().levelIn = levelIn;
fireContentStateEvent();
}
public Date getDateAnswer() throws ClipsException {
return getDetails().dateAnswer;
}
public void setDateAnswer(Date dateAnswer) throws ClipsException {
getDetails().dateAnswer = dateAnswer;
fireContentStateEvent();
}
public int getLevelOut() throws ClipsException {
return getDetails().levelOut;
}
public void setLevelOut(int levelOut) throws ClipsException {
getDetails().levelOut = levelOut;
fireContentStateEvent();
}
public String getDesc() throws ClipsException {
return getDetails().desc;
}
public void setDesc(String desc) throws ClipsException {
getDetails().desc = desc;
fireContentStateEvent();
}
@Deprecated
public SerRenLocal getSerRen() throws ClipsException {
return null;
}
@Deprecated
public void setSerRen(SerRenLocal serRen) {
}
@Deprecated
public CommitteeResolutionData getComRes() throws ClipsException {
return null;
}
@Deprecated
public void setComRes(CommitteeResolutionData comRes) {
}
public Boolean isClosed() {
if (getDetails().dateAnswer == null) {
return false;
}
return true;
}
@Override
public void addChild(DelegateNodeInterface child) throws ClipsException {
}
@Override
public void addChildrenListener(ChildrenCacheListener listener) {
}
@Override
public int getChildCount() throws ClipsException {
return 0;
}
@Override
public void removeChild(DelegateNodeInterface child) throws ClipsException {
}
@Override
public void removeChildrenListener(ChildrenCacheListener listener) {
}
@Override
public int getID() {
return getId();
}
@Override
public ROList getChildren() throws ClipsException {
return null;
}
@Override
public void addContentStateListener(ContentStateListener listener) {
}
@Override
public void removeContentStateListener(ContentStateListener listener) {
}
}