/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package clips.delegate.lpu;
import beans.directory.lpu.entity.LpuDetails;
import beans.lpu.LpuBean;
import beans.lpu.LpuBeanRemote;
import cli_fmw.delegate.AuditListener;
import cli_fmw.delegate.DelegateLine2;
import cli_fmw.delegate.client.Address;
import cli_fmw.delegate.directory.complex.DirectoryLocator;
import cli_fmw.main.ClipsException;
import clips.delegate.directory.ro.DirectoryCollaborator;
import clips.delegate.directory.ro.DirectoryCollaboratorItem;
import clips.delegate.directory.simple.insurer.DirectoryInsurer;
import clips.delegate.directory.simple.insurer.DirectoryInsurerItem;
import clips.delegate.directory.simple.mes.DirectoryClinicType;
import clips.delegate.directory.simple.mes.DirectoryClinicTypeItem;
import framework.beans.address.entities.AddressDetails;
/**
*
* @author lacoste
*/
public class LpuLocal extends DelegateLine2<LpuBeanRemote, LpuDetails> {
public LpuLocal(AuditListener al) throws ClipsException {
super(al);
}
public LpuLocal(int id, AuditListener al) {
super(id, al);
}
public LpuLocal(LpuDetails details, AuditListener al) {
super(details, al);
}
public String getTitle() throws ClipsException {
return getDetails().title;
}
public void setTitle(String title) throws ClipsException {
getDetails().title = title;
fireContentStateEvent();
}
@Override
protected LpuDetails getNewDetails() {
return new LpuDetails();
}
@Override
protected String getBeanName() {
return LpuBean.class.getSimpleName();
}
public String getLpuCode() throws ClipsException {
return getDetails().lpuCode;
}
public void setLpuCode(String tfoms) throws ClipsException {
getDetails().lpuCode = tfoms;
fireContentStateEvent();
}
public String getOgrn() throws ClipsException {
return getDetails().ogrn;
}
public void setOgrn(String ogrn) throws ClipsException {
getDetails().ogrn = ogrn;
fireContentStateEvent();
}
public Address getAddress() throws ClipsException {
if (getDetails().addressDetails != null) {
return new Address(getDetails().addressDetails.clone());
} else {
return new Address(new AddressDetails());
}
}
public void setAddress(Address address) throws ClipsException {
getDetails().addressDetails = address.getDetails();
fireContentStateEvent();
}
public DirectoryCollaboratorItem getChiefDoctor() throws ClipsException {
DirectoryCollaborator directory = DirectoryLocator.getDirectory(DirectoryCollaborator.class, false);
return directory.getItemFromID(getDetails().chiefDoctor);
}
public void setChiefDoctor(DirectoryCollaboratorItem collaborator) throws ClipsException {
getDetails().chiefDoctor = collaborator.getID();
fireContentStateEvent();
}
public DirectoryCollaboratorItem getAccountant() throws ClipsException {
DirectoryCollaborator directory = DirectoryLocator.getDirectory(DirectoryCollaborator.class, false);
return directory.getItemFromID(getDetails().accountant);
}
public void setAccountant(DirectoryCollaboratorItem collaborator) throws ClipsException {
getDetails().accountant = collaborator.getID();
fireContentStateEvent();
}
public String getPhone() throws ClipsException {
return getDetails().phone;
}
public void setPhone(String phone) throws ClipsException {
getDetails().phone = phone;
fireContentStateEvent();
}
public String getFax() throws ClipsException {
return getDetails().fax;
}
public void setFax(String fax) throws ClipsException {
getDetails().fax = fax;
fireContentStateEvent();
}
public String getEmail() throws ClipsException {
return getDetails().email;
}
public void setEmail(String email) throws ClipsException {
getDetails().email = email;
fireContentStateEvent();
}
public String getOkpo() throws ClipsException {
return getDetails().okpo;
}
public void setOkpo(String okpo) throws ClipsException {
getDetails().okpo = okpo;
fireContentStateEvent();
}
public String getOkonh() throws ClipsException {
return getDetails().okonh;
}
public void setOkonh(String okonh) throws ClipsException {
getDetails().okonh = okonh;
fireContentStateEvent();
}
public String getOkved() throws ClipsException {
return getDetails().okved;
}
public void setOkved(String okved) throws ClipsException {
getDetails().okved = okved;
fireContentStateEvent();
}
public String getOkogu() throws ClipsException {
return getDetails().okogu;
}
public void setOkogu(String okogu) throws ClipsException {
getDetails().okogu = okogu;
fireContentStateEvent();
}
public String getOkopf() throws ClipsException {
return getDetails().okopf;
}
public void setOkopf(String okopf) throws ClipsException {
getDetails().okopf = okopf;
fireContentStateEvent();
}
public String getOkfs() throws ClipsException {
return getDetails().okfc;
}
public void setOkfs(String okfc) throws ClipsException {
getDetails().okfc = okfc;
fireContentStateEvent();
}
public DirectoryClinicTypeItem getClinicType() throws ClipsException {
DirectoryClinicType directory = DirectoryLocator.getDirectory(DirectoryClinicType.class, false);
return directory.getItemFromID(getDetails().clinicType);
}
public void setClinicType(DirectoryClinicTypeItem type) throws ClipsException {
getDetails().clinicType = type.getID();
fireContentStateEvent();
}
public String getLpuSubdivisionCode() throws ClipsException {
return getDetails().subdivisionCode;
}
public void setLpuSubdivisionCode(String code) throws ClipsException {
getDetails().subdivisionCode = code;
fireContentStateEvent();
}
public String getBranchCode() throws ClipsException {
return getDetails().branch;
}
public void setBranchCode(String code) throws ClipsException {
getDetails().branch = code;
fireContentStateEvent();
}
public DirectoryInsurerItem getDefaultInsurer() throws ClipsException {
DirectoryInsurer directory = DirectoryLocator.getDirectory(DirectoryInsurer.class, false);
return directory.getItemFromID(getDetails().insurer);
}
public void setDefaultInsurer(DirectoryInsurerItem insurer) throws ClipsException {
getDetails().insurer = insurer.getID();
fireContentStateEvent();
}
public String getOkato() throws ClipsException {
String okato = Long.toString(getAddress().getOkato());
return okato;
}
}