/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package beans.doctor.checkup.dicom;
import framework.beans.FacadeBean;
import framework.beans.security.BeanRights;
import framework.beans.EntityDetails;
import framework.generic.ClipsServerException;
import java.util.Date;
import javax.ejb.Stateful;
import beans.UserRightsSet;
import framework.audit.AuditDoc;
import java.util.List;
/**
*
* @author finder
*/
@Stateful(mappedName="clips-beans/DicomDeviceParamsBean")
public class DicomDeviceParamsBean extends FacadeBean<DicomDeviceParams> implements DicomDeviceParamsBeanRemote {
public DicomDeviceParamsBean() {
super(DicomDeviceParams.class);
}
protected void initBeanRights() {
int [] r = new int[4];
r[COMMAND_READ] = RightPresence(UserRightsSet.READ_ANALYSE_LIST.id);
if (r[COMMAND_READ] < 0) {
r[COMMAND_READ] = RightPresence(UserRightsSet.READ_MEDICAL_DATA.id);
}
int cmr = RightPresence(UserRightsSet.WRITE_ANALYSE_ANY_TIME.id);
if (cmr < 0) {
cmr = RightPresence(UserRightsSet.WRITE_ANALYSE_DURING_DAY.id);
}
if (cmr < 0) {
cmr = RightPresence(UserRightsSet.WRITE_MEDICAL_DATA_ANY_TIME.id);
}
if (cmr < 0) {
cmr = RightPresence(UserRightsSet.WRITE_MEDICAL_DATA_DURING_DAY.id);
}
r[COMMAND_CREATE] = cmr;
r[COMMAND_MODIFY] = cmr;
r[COMMAND_REMOVE] = cmr;
rights = new BeanRights(r);
}
@Override
protected void onUpdate(DicomDeviceParams entity, EntityDetails details,
AuditDoc auditDoc, List<AuditDoc> auditDocLost) throws ClipsServerException {
DicomDeviceParamsDetails det = (DicomDeviceParamsDetails) details;
entity.setUserFriendlyName(det.userFriendlyName);
entity.setModelName(det.modelName);
entity.setDeviceUi(det.deviceUi);
entity.setImplementationUid(det.implementationUid);
entity.setImplementationVersion(det.implementationVersion);
entity.setIpAddres(det.ipAddres);
entity.setIpAddres(det.ipAddres);
entity.setPort(det.port);
entity.setModifyTime(new Date());
entity.setConfigXml(det.configXml);
//MATHAFAKA! че за сохранение во время просмотра???
}
}