Java Code Examples for ims.domain.exceptions.DomainRuntimeException

The following are top voted examples for showing how to use ims.domain.exceptions.DomainRuntimeException. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: AvoinApotti   File: EnvironmentalVisitImpl.java   View source code 6 votes vote down vote up
public EnvironmentalVisitVo getEnvironmentalVisitByClinicalContact(ClinicalContactRefVo voClinicalContactRef) 
{
	if(voClinicalContactRef == null || voClinicalContactRef.getID_ClinicalContact() == null)
		throw new DomainRuntimeException("Contact not provided for get call. ");

	DomainFactory factory = getDomainFactory();
	
	java.util.List environVisitList = factory.find("from  EnvironmentalVisit environList where environList.clinicalContact.id = :contactId ", new String[]{"contactId"}, new Object[]{voClinicalContactRef.getID_ClinicalContact()});
	
	EnvironmentalVisitVoCollection  coll = null;
	if  ((environVisitList != null) && (environVisitList.size()>0))
		coll = EnvironmentalVisitVoAssembler.createEnvironmentalVisitVoCollectionFromEnvironmentalVisit(environVisitList);
		
	if(coll != null && coll.size()>0)
		return coll.get(0);

	return null;
}
 
Example 2
Project: AvoinApotti   File: Hl7AdminImpl.java   View source code 6 votes vote down vote up
public void setInboundFlag(Boolean bStart) throws  DomainInterfaceException
{		
	IHL7Controller controller = HL7ControllerFactory.getController();
	if (bStart.booleanValue())	
		controller.enableInbound();
	else
		controller.disableInbound();
//saveConfigFlag( ConfigFlag.HL7.HL7_START_LISTENER, bStart.toString());
	
	//WDEV-8242 
	try {
		saveConfigFlag2( ConfigFlag.HL7.HL7_START_LISTENER.getName(), bStart.toString(), bStart.toString(), false);
		
	} catch (Exception e) {
		// TODO Auto-generated catch block
		throw new DomainRuntimeException(e);			
	}			
}
 
Example 3
Project: AvoinApotti   File: SelectHistopathologicGradeImpl.java   View source code 6 votes vote down vote up
/**
* Save a HistopathologicRecord
*/
public ims.clinicaladmin.vo.HistopathologicGradeVo saveHistopathologicGrade(ims.clinicaladmin.vo.HistopathologicGradeVo histopathologicGrade) throws ims.domain.exceptions.StaleObjectException, ims.domain.exceptions.ForeignKeyViolationException, ims.domain.exceptions.UniqueKeyViolationException
{
	// Check for value to save
	if (histopathologicGrade == null)
		throw new DomainRuntimeException("Domain Error - Can not save a null histology grade record");
	
	// Check for validated record
	if (!histopathologicGrade.isValidated())
		throw new DomainRuntimeException("Domain Error - Histology grade record must be validated before save");
	
	// Get domain object
	HistopathologicGrade histologyGrade = HistopathologicGradeVoAssembler.extractHistopathologicGrade(getDomainFactory(), histopathologicGrade);
	
	// Attempt save
	getDomainFactory().save(histologyGrade);
	
	return HistopathologicGradeVoAssembler.create(histologyGrade);
}
 
Example 4
Project: AvoinApotti   File: ClinicListwithICPActionsImpl.java   View source code 6 votes vote down vote up
public Booking_AppointmentVo saveOPEpisode(Booking_AppointmentVo voOP) throws DomainInterfaceException, StaleObjectException 
{
	if(voOP == null)
		throw new DomainRuntimeException("Invalid Booking to save");
	if(!voOP.isValidated())
		throw new DomainRuntimeException("Record not validated before save");
	
	
	DomainFactory factory = getDomainFactory();
	Booking_Appointment doAppt = Booking_AppointmentVoAssembler.extractBooking_Appointment(factory, voOP);		
	factory.save(doAppt);
	
	//WDEV-9657 DNA for ICAB appts - no dna hl7 messages in uksh
	if(ConfigFlag.GEN.ICAB_ENABLED.getValue())
	{
		if(doAppt.getApptStatus() != null && doAppt.getApptStatus().equals(getDomLookup(Status_Reason.DNA)))
		{
			if(doAppt.isIsCABBooking() != null && doAppt.isIsCABBooking().booleanValue())
				CABRequests.sendRequestandUpdateReferences(factory, getDomLookup(ActionRequestType.NOTIFY_DNA), doAppt, "Appt DNA Requested from ClinicListWithIcpActions");	
		}
	}
	
	return Booking_AppointmentVoAssembler.create(doAppt);
}
 
Example 5
Project: AvoinApotti   File: ProfilesImpl.java   View source code 6 votes vote down vote up
private void saveProfileTemplates(DomainFactory factory, Sch_Profile domProfile, ProfileTemplateVoCollection templates) throws DomainRuntimeException, StaleObjectException
{
	try
	{
		factory.delete("from ProfileTemplate pt where pt.profile.id = '" + domProfile.getId() + "'" );
	}
	catch (ForeignKeyViolationException e)
	{
		throw new DomainRuntimeException("DomainException occurred saving profile - " + e.getMessage(), e);
	}
	
	if(templates != null)
	{
		for(int i=0; i<templates.size(); i++)
		{
			templates.get(i).setID_ProfileTemplate(null);
			ProfileTemplate doProfTemplate = ProfileTemplateVoAssembler.extractProfileTemplate(factory, templates.get(i));
			doProfTemplate.setProfile(domProfile);
			factory.save(doProfTemplate);
		}
	}
}
 
Example 6
Project: AvoinApotti   File: TheatreTrackingConfigImpl.java   View source code 6 votes vote down vote up
public TrackingStatusConfigVo saveTrackingStatus(TrackingStatusConfigVo trackingStatus) throws DomainInterfaceException, StaleObjectException, ForeignKeyViolationException, UniqueKeyViolationException
{
	if (trackingStatus == null)
		throw new DomainRuntimeException("Can not save a null record");
	
	if (!trackingStatus.isValidated())
		throw new DomainRuntimeException("Can not save a non validated record");
	
	
	// Check for previous settings
	if (!trackingStatus.getID_TrackStatusConfigIsNotNull() && getTrackingStatus() != null)
		throw new StaleObjectException(null);
	
	// Build domain object & save it
	TrackStatusConfig domSettings = TrackingStatusConfigVoAssembler.extractTrackStatusConfig(getDomainFactory(), trackingStatus);
	getDomainFactory().save(domSettings);
	
	// Returned saved VO
	return TrackingStatusConfigVoAssembler.create(domSettings);
}
 
Example 7
Project: AvoinApotti   File: MedAdmisSummImpl.java   View source code 6 votes vote down vote up
public NeuroMotorFindingsVo getNeuroMotorFindingByCareContext(CareContextRefVo carecontextref) 
{
	if(carecontextref == null)
		throw new DomainRuntimeException("Care Context must not be null");

	DomainFactory factory = getDomainFactory();
	String hql = "from NeuExamMotor neuExamMotor where neuExamMotor.clinicalContact.contactType = :ClinContactType and neuExamMotor.careContext.id = :idCareContext";
	List list = factory.find(hql, new String[] {"ClinContactType","idCareContext"}, new Object[] {getDomLookup(ContactType.SPINALMEDICALADMISSION),carecontextref.getID_CareContext()});
			
	if(list != null && list.size() > 0)
	{
		NeuroMotorFindingsVoCollection collNeuroMotorFindings = NeuroMotorFindingsVoAssembler.createNeuroMotorFindingsVoCollectionFromNeuExamMotor(list);
		if(collNeuroMotorFindings != null && collNeuroMotorFindings.size() > 0)
			return collNeuroMotorFindings.get(0);
	}
	
	return null;	
}
 
Example 8
Project: AvoinApotti   File: UserAssessmentNewImpl.java   View source code 6 votes vote down vote up
public UserAssessmentVo saveAssessment(UserAssessmentVo assessment)	throws DomainInterfaceException, StaleObjectException, UniqueKeyViolationException 
{
	if(assessment.isValidated() == false)
		throw new DomainRuntimeException("UserAssessmentVo not validated");
	
	DomainFactory factory = getDomainFactory();
	UserAssessment obj = UserAssessmentVoAssembler.extractUserAssessment(factory, assessment);
	
	try
	{
		factory.save(obj);
	}
	catch(UnqViolationUncheckedException e)
	{
		throw new UniqueKeyViolationException("Already exists a question with this taxonomy code.", e);
	}
	
	return UserAssessmentVoAssembler.create(obj);
}
 
Example 9
Project: AvoinApotti   File: OPDEDClinicNotesImpl.java   View source code 6 votes vote down vote up
public void saveOPDEDVo(ims.generalmedical.vo.OPDErectDysfxnVo voOPDED) throws StaleObjectException, UniqueKeyViolationException
{
	// Ensure the value object has been validated
	if (!voOPDED.isValidated())
		throw new DomainRuntimeException("OPD Erectile Dysfunction has not been validated");

	DomainFactory factory = getDomainFactory();
	if (voOPDED.getID_OPDErectDysfxn() == null)//Inserting a record
	{
		StringBuffer hql = new StringBuffer();
		hql.append("from OPDErectDysfxn as o where o.careContext.id = :CCID and o.isRIE is null");
		java.util.List list = getDomainFactory().find(hql.toString(), "CCID",voOPDED.getCareContext().getID_CareContext());
		if (list == null || list.size() > 0)
			throw new UniqueKeyViolationException(" The screen will be refreshed");
	}
	OPDErectDysfxn doOPDED = OPDErectDysfxnVoAssembler.extractOPDErectDysfxn(factory, voOPDED);
	factory.save(doOPDED);
	return;
}
 
Example 10
Project: AvoinApotti   File: MotorChartConfigurationImpl.java   View source code 6 votes vote down vote up
public ims.core.vo.MotorChartAreaDetailVoCollection saveConfiguration(ims.core.vo.MotorChartAreaDetailVoCollection configuration) throws ims.domain.exceptions.DomainInterfaceException, ims.domain.exceptions.StaleObjectException, ims.domain.exceptions.ForeignKeyViolationException, ims.domain.exceptions.UniqueKeyViolationException
{
	if (configuration == null)
		throw new DomainInterfaceException("Configuration is empty");
	
	if (!configuration.isValidated())
		throw new DomainRuntimeException("Motor Chart Area Configuration not validated");
	
	DomainFactory domainFactory = getDomainFactory();
	
	for (int i = 0; i < configuration.size(); i++)
	{
		domainFactory.save(MotorChartAreaDetailVoAssembler.extractMotorChartAreaDetail(domainFactory, configuration.get(i)));
	}

	return configuration;
}
 
Example 11
Project: AvoinApotti   File: TaxonomySearchImpl.java   View source code 6 votes vote down vote up
/**
* Search Read Codes
*/
private TaxonomyMapCollection searchReadCodes(TaxonomyMap filter)  throws ims.domain.exceptions.DomainInterfaceException, ims.domain.exceptions.DomainRuntimeException
{
	String searchType = ConfigFlag.DOM.READ_CODES_SEARCH_TYPE.getValue();
	if (searchType.equals("SQL"))
	{
		return searchReadCodesSql(filter);			
	}
	else if(searchType.equals("DTO"))
	{
		return searchReadCodesDto(filter);			
	}
	else
	{
		throw new ims.domain.exceptions.DomainInterfaceException("Value for READ_CODES_SEARCH_TYPE of " + searchType + " is invalid. Valid values are SQL or DTO");
	}		
}
 
Example 12
Project: AvoinApotti   File: OPDFertilityCLinicImpl.java   View source code 6 votes vote down vote up
public void saveOPDFertClinicVo(OPDFertClinicVo voOPDFertClinic) throws StaleObjectException, UniqueKeyViolationException 
{
	// Ensure the value object has been validated
	if (!voOPDFertClinic.isValidated())
		throw new DomainRuntimeException("OPD Fertility Clinic has not been validated");
	
	DomainFactory factory = getDomainFactory();
	if (voOPDFertClinic.getID_OPDFertClinic() == null)//Inserting a record
	{
		StringBuffer hql = new StringBuffer();
		hql.append("from OPDFertClinic as o where o.careContext.id = :CCID and o.isRIE is null");
		java.util.List list = getDomainFactory().find(hql.toString(), "CCID",voOPDFertClinic.getCareContext().getID_CareContext());
		if (list == null || list.size() > 0)
			throw new UniqueKeyViolationException("A record exists for this Care Context, the screen will be refreshed");
	}
	OPDFertClinic doOPDFertClinic = OPDFertClinicVoAssembler.extractOPDFertClinic(factory, voOPDFertClinic);
	factory.save(doOPDFertClinic);
	
}
 
Example 13
Project: AvoinApotti   File: ImportResultsCategoryImpl.java   View source code 6 votes vote down vote up
public ims.ocrr.vo.ImportResultsConfigVo saveImportResultsConfig(ims.ocrr.vo.ImportResultsConfigVo voSaveImportResultsConfig, ims.ocrr.vo.ImportResultsConfigVo voDeleteImportResultsConfig) throws ims.domain.exceptions.StaleObjectException, ForeignKeyViolationException
{
	if (!voSaveImportResultsConfig.isValidated())
		throw new DomainRuntimeException("ImportResultsConfig has not been validated");
	
	DomainFactory factory = getDomainFactory();
	if(voDeleteImportResultsConfig!=null){
		ImportResultsConfig doDelete = ImportResultsConfigVoAssembler.extractImportResultsConfig(factory, voDeleteImportResultsConfig);
		factory.delete(doDelete);
	}
	ImportResultsConfig doSave = ImportResultsConfigVoAssembler.extractImportResultsConfig(factory, voSaveImportResultsConfig);
		
	factory.save(doSave);
	
	return ImportResultsConfigVoAssembler.create(doSave);
}
 
Example 14
Project: AvoinApotti   File: DischargeSummaryConsultatntWardAndPacuImpl.java   View source code 6 votes vote down vote up
public Boolean hasInpatientEpisode(PatientRefVo patient)
{
	if (patient == null || !patient.getID_PatientIsNotNull())
		throw new DomainRuntimeException("Invalid patient record in domain");
	
	String query = "select count(inpatient) from InpatientEpisode as inpatient left join inpatient.pasEvent as pas left join pas.patient as patient where patient.id = :PAT_ID";
	ArrayList<String> paramNames = new ArrayList<String>();
	ArrayList<Object> paramValues = new ArrayList<Object>();
	
	paramNames.add("PAT_ID");
	paramValues.add(patient.getID_Patient());
	
	@SuppressWarnings("unchecked")
	List<Object> results = getDomainFactory().find(query, paramNames, paramValues);
	
	if (results == null || results.size() == 0)
		return Boolean.FALSE;
	
	if(results.size() > 0 && results.get(0) instanceof Long && (Long)(results.get(0)) > 0)
		return Boolean.TRUE;

	return Boolean.FALSE;
}
 
Example 15
Project: AvoinApotti   File: MosAdminImpl.java   View source code 6 votes vote down vote up
public MemberOfStaffShortVo deactivateMos(MemberOfStaffShortVo mosVo) throws StaleObjectException
{
	if (mosVo.getID_MemberOfStaff() == null)
	{
		throw new DomainRuntimeException("Cannot Activate/Deactivate an MOS with NULL id!");
	}
	DomainFactory factory = getDomainFactory();
	MemberOfStaff mosBo = MemberOfStaffShortVoAssembler.extractMemberOfStaff(getDomainFactory(), mosVo);
	mosBo.setIsActive(!(Boolean.TRUE.equals(mosBo.isIsActive())));
	
	if (mosBo.getHcp() != null)
	{
		mosBo.getHcp().setIsActive(mosBo.isIsActive());
	}
	

	factory.save(mosBo);

	return MemberOfStaffShortVoAssembler.create(mosBo);
}
 
Example 16
Project: AvoinApotti   File: PatientProcedureChecklistImpl.java   View source code 6 votes vote down vote up
public ProcedureListVoCollection listProceduresBySpecialty(ims.core.vo.lookups.Specialty speciality) throws ims.domain.exceptions.DomainInterfaceException
{
	if(speciality == null)
		throw new DomainRuntimeException("Invalid Search criteria. Specialty must be supplied.");

	DomainFactory factory = getDomainFactory();
	
	StringBuffer hql = new StringBuffer("from PMHChecklistConfig p ");
	hql.append(" where (p.specialty.id = " + speciality.getId() + ")");
	PMHChecklistConfigVoCollection voPMHChecklistConfig = PMHChecklistConfigVoAssembler.createPMHChecklistConfigVoCollectionFromPMHChecklistConfig((factory.find(hql.toString())));

	if(voPMHChecklistConfig.size()>0)		
		return voPMHChecklistConfig.get(0).getProcedureList();
	else
		return null;
}
 
Example 17
Project: AvoinApotti   File: WorkOnAdmissionImpl.java   View source code 6 votes vote down vote up
public void save(WorkOnAdmissionVo voWorkOnAdmission) throws StaleObjectException, UniqueKeyViolationException
{
	if(!voWorkOnAdmission.isValidated())
		throw new DomainRuntimeException("This Work On Admission has not been validated");

	if(voWorkOnAdmission.getID_WorkOnAdmission() == null)
	{
		if(voWorkOnAdmission.getCareContext() != null)
		{
			WorkOnAdmissionVo voWorkOnAdmissiontemp = get(voWorkOnAdmission.getCareContext());
			if(voWorkOnAdmissiontemp != null)
				throw new DomainRuntimeException("A Work On Admission record already exists for this CareContext.");
		}
	}
	DomainFactory factory = getDomainFactory();
	WorkOnAdmission doWorkOnAdmiss = WorkOnAdmissionVoAssembler.extractWorkOnAdmission(factory, voWorkOnAdmission);
	factory.save(doWorkOnAdmiss);
}
 
Example 18
Project: AvoinApotti   File: EDischargeMedicationOnAdmissionComponentImpl.java   View source code 6 votes vote down vote up
/**
 * 
 */
public ims.clinical.vo.MedicationOnAdmissionAndChangesLiteVo getMedication(ims.core.admin.vo.CareContextRefVo careContext)
{
	// Check passed care context
	if (careContext == null || !careContext.getID_CareContextIsNotNull())
		throw new DomainRuntimeException("DOMAIN getMedication() - Selected care context is null");

	// Build query and parameter to retrieve the record from database
	String hqlQuery = "from MedicationOnAdmissionAndChanges as meds where meds.careContext.id = :ID";
	ArrayList<String> paramNames = new ArrayList<String>();
	ArrayList<Object> paramValues = new ArrayList<Object>();
	
	paramNames.add("ID");
	paramValues.add(careContext.getID_CareContext());
	
	// Query database for the record
	// Create the VO form the record database
	return MedicationOnAdmissionAndChangesLiteVoAssembler.create((MedicationOnAdmissionAndChanges) getDomainFactory().findFirst(hqlQuery, paramNames, paramValues));
}
 
Example 19
Project: AvoinApotti   File: PneumaticImpl.java   View source code 6 votes vote down vote up
public ElectrotherapyPneumaticVo saveElectrotherapyPneumaticTreatmentVo(ElectrotherapyPneumaticVo electrotherapyPneumaticTreatmentVo) throws StaleObjectException, UniqueKeyViolationException
{
	if(electrotherapyPneumaticTreatmentVo == null)
		throw new CodingRuntimeException ("ElectrotherapyPneumaticVo is null");
	if (!electrotherapyPneumaticTreatmentVo.isValidated())
		throw new DomainRuntimeException ("This ElectrotherapyPneumaticVo has not been validated");
	
	DomainFactory factory = getDomainFactory();	
	
	if (electrotherapyPneumaticTreatmentVo.getID_ElectrotherapyPneumatic() == null)//Inserting a record
	{
		ElectrotherapyPneumaticVo vo = getElectrotheraphyPneumaticVoByClinicalContact(electrotherapyPneumaticTreatmentVo.getClinicalContact());
		if(vo != null)
			throw new UniqueKeyViolationException("The screen will be refreshed");
	}
	
	ElectrotherapyPneumatic domElectrotherapyPneumatic = ElectrotherapyPneumaticVoAssembler.extractElectrotherapyPneumatic(factory, electrotherapyPneumaticTreatmentVo);
	
	factory.save(domElectrotherapyPneumatic);
		
	return ElectrotherapyPneumaticVoAssembler.create(domElectrotherapyPneumatic);
}
 
Example 20
Project: AvoinApotti   File: SpecialtyHotlistConfigurationImpl.java   View source code 6 votes vote down vote up
/** 
 * Gets the hotlist short associated with the given Hotlist ID and CciType
 * @param Integer
 * @param CciType
 * @return IHotlistShort
 * @author mmccarthy
 */
public IHotlistShort getIHotlistShort(Integer hotlistID, CciType cciType)
{
	DomainFactory factory = getDomainFactory();
	
	if ( cciType.equals(CciType.PROCEDURE))
	{
		return ProcedureHotlistShortVoAssembler.create((ProcedureHotlist) factory.getDomainObject(ProcedureHotlist.class, hotlistID));
	}
	else if ( cciType.equals(CciType.PROBLEM) )
	{
		return ProblemHotlistShortVoAssembler.create((ProblemHotlist)factory.getDomainObject(ProblemHotlist.class, hotlistID));
	}
	else if ( cciType.equals(CciType.DIAGNOSIS) )
	{
		return DiagnosisHotListShortVoAssembler.create((DiagnosisHotlist) getDomainFactory().getDomainObject(DiagnosisHotlist.class, hotlistID));
	}
	else if ( cciType.equals(CciType.CANCERIMAGE) )
	{
		return CancerImagingHotlistShortVoAssembler.create((CancerImagingHotlist) getDomainFactory().getDomainObject(CancerImagingHotlist.class, hotlistID));
	}
	else 
	{
		throw new DomainRuntimeException ("Unknown CciType in getIHotlistShort = " + cciType.toString());
	}
}
 
Example 21
Project: AvoinApotti   File: ResultCommentsDialogImpl.java   View source code 6 votes vote down vote up
public void removeComment(OcsPathRadResultVo result, ResultCommentsVo comment) throws StaleObjectException, ForeignKeyViolationException
{
	if (result == null)
		throw new DomainRuntimeException("Can not remove comment from null parent.");
	

	if (Category.PATHOLOGY.equals(result.getCategory()))
	{
		removeComentFromOrderSpecimen(result, comment);
		return;
	}
	
	if (Category.CLINICALIMAGING.equals(result.getCategory()))
	{
		removeCommentFromOrderInvestigation(result, comment);
		return;
	}
	
	return;
}
 
Example 22
Project: AvoinApotti   File: ClinicalOutcomeDetailsImpl.java   View source code 6 votes vote down vote up
/**
 * Function used to list procedures for a given referral
 */
public ClinicalOutcomeProcedureVoCollection listProcedures(CatsReferralRefVo referral)
{
	if (referral == null || !referral.getID_CatsReferralIsNotNull())
		throw new DomainRuntimeException("Expected referral is null in domain.");
	
	String query = "select operative from IntraOperativeCareRecord as operative left join operative.careContext as context1, CatsReferral as cats left join cats.careContext as context2 where context1.id = context2.id and cats.id = :ID";
	
	ArrayList<String> paramNames = new ArrayList<String>();
	ArrayList<Object> paramValues = new ArrayList<Object>();
	
	paramNames.add("ID");
	paramValues.add(referral.getID_CatsReferral());
	
	return ClinicalOutcomeProcedureVoAssembler.createClinicalOutcomeProcedureVoCollectionFromIntraOperativeCareRecord(getDomainFactory().find(query, paramNames, paramValues));
}
 
Example 23
Project: AvoinApotti   File: PatientMovementImpl.java   View source code 6 votes vote down vote up
/**
 * saves Patient Movement
 */
public AssessmentHeaderInfo savePatientMovement(PatientMovement patientMovement, AssessmentHeaderInfo assessment, AssessmentComponent component) throws StaleObjectException
{
	// Ensure the Patient Movement has been validated
	if (!patientMovement.isValidated())
		throw new DomainRuntimeException("Patient Movement has not been validated");

	DomainFactory factory = getDomainFactory();

	PatientMovementHandling domMovement = PatientMovementAssembler.extractPatientMovementHandling(factory, patientMovement);

	factory.save(domMovement);

		/*if (assessment != null)
		{
			AssessmentMobility comp = (AssessmentMobility) component;
			comp.setPatientMovement(PatientMovementAssembler.create(domMovement));
			if (comp.validate() != null)
				throw new DomainRuntimeException("Mobility Component has not been validated");
			return (saveMobilityComponent(assessment, comp));
		}*/
	
	return null;
}
 
Example 24
Project: AvoinApotti   File: TaxonomyLoaderHelper.java   View source code 6 votes vote down vote up
private LocSiteUpprNameVo saveSurgeryVo(LocSiteUpprNameVo surgeryvo) throws DomainInterfaceException, StaleObjectException, UniqueKeyViolationException 
{
	// TODO Auto-generated method stub
	String[] errs = surgeryvo.validate();
	if (errs  != null && errs .length > 0) 
	{
		String concatt = "";
		for (int i = 0; i < errs.length; i++) 
		{
			concatt = concatt + " " + errs[i] + " ";
		}
		throw new DomainRuntimeException(concatt);
	} else 
	{
		return domainTaxonomy.saveSurgeryRecord(surgeryvo);																					            			       			            
	}
}
 
Example 25
Project: AvoinApotti   File: TENSImpl.java   View source code 6 votes vote down vote up
public ims.therapies.vo.ElectrotherapyTENSVo getElectrotherapyTens(ims.core.vo.ClinicalContactShortVo voClinicalContactShort)
{
	if(voClinicalContactShort == null || voClinicalContactShort.getID_ClinicalContact() == null)
		throw new DomainRuntimeException("Contact not provided for get call. ");
	
	DomainFactory factory = getDomainFactory();
	ElectrotherapyTENSVo voElectrotherapyTENS  = new ElectrotherapyTENSVo();
	
	java.util.List electrotherapyTENSList = factory.find("from ElectrotherapyTENS EctTENS where EctTENS.clinicalContact.id = :contactId", new String[]{"contactId"}, new Object[]{voClinicalContactShort.getID_ClinicalContact()});
	
	ElectrotherapyTENSVoCollection coll = ElectrotherapyTENSVoAssembler.createElectrotherapyTENSVoCollectionFromElectrotherapyTENS(electrotherapyTENSList);//	WDEV-13592
	
	if (coll != null && coll.size()>0)//	WDEV-13592
		voElectrotherapyTENS = coll.get(0);   //	WDEV-13592 
	else
		voElectrotherapyTENS = null;
	
	return voElectrotherapyTENS;
}
 
Example 26
Project: AvoinApotti   File: ProcedureListImpl.java   View source code 6 votes vote down vote up
public ServiceActivityVo checkForServiceActivityUsingChangedProcedure(ActivityRefVo activityRefVo)
{
	DomainFactory factory = getDomainFactory();	
	
	if( activityRefVo == null )
		throw new DomainRuntimeException("checkForServiceActivityUsingChangedProcedure : activityRefVo is Null.");
	
	//wdev3999 - ignore inactive records in this check
	java.util.List servactList = factory.find("from ServiceActivity servact join servact.taxonomyMap tax where servact.activity.id = :activityid and tax.taxonomyName = :taxname and servact.isActive = :isActive", new String[]{"activityid", "taxname", "isActive"}, new Object[]{activityRefVo.getID_Activity(), getDomLookup(TaxonomyType.EXCH), Boolean.TRUE});
	ServiceActivityVoCollection coll = ServiceActivityVoAssembler.createServiceActivityVoCollectionFromServiceActivity(servactList).sort();

	if(coll != null && coll.size() > 0)
		return coll.get(0);
	
	return null;
}
 
Example 27
Project: AvoinApotti   File: ContactListImpl.java   View source code 6 votes vote down vote up
public SoapNoteVo saveSoapNoteVo(SoapNoteVo soapNoteVo) throws StaleObjectException
{
	if(soapNoteVo == null)
		throw new RuntimeException("Cannot save null value for SoapNoteVo");
	
	if (!soapNoteVo.isValidated())
		throw new CodingRuntimeException("SoapNoteVo value object has not been validated");

	//if a new SoapNoteVo record must be save check if already exist a SoapNoteVo record for selected clinical contact
	if(soapNoteVo != null && !soapNoteVo.getID_SoapNoteIsNotNull())
	{			
		if(soapNoteVo.getClinicalContactIsNotNull())
		{
			SoapNoteVo tempVo = getSoapNoteVo(soapNoteVo.getClinicalContact()); 

			if(tempVo != null)
				throw new DomainRuntimeException("A Therapy Contact record already exists for this clinical contact");
		}
	}
	
	DomainFactory factory = getDomainFactory();
	SoapNote doSoapNote = SoapNoteVoAssembler.extractSoapNote(factory, soapNoteVo);
	factory.save(doSoapNote);

	return SoapNoteVoAssembler.create(doSoapNote);
}
 
Example 28
Project: AvoinApotti   File: TaxonomyLoaderHelper.java   View source code 6 votes vote down vote up
private GpVo saveGpVo(GpVo vo) throws DomainInterfaceException, StaleObjectException, UniqueKeyViolationException 
{
	// TODO Auto-generated method stub
	String[] err = vo.validate();
	if (err != null && err.length > 0) 
	{
		String concat = "";
		for (int i = 0; i < err.length; i++) 
		{
			concat = concat + " " + err[i] + " ";
		}
		throw new DomainRuntimeException(concat);
	} else
	{
		return domainTaxonomy.saveGPRecord(vo);			
	}
}
 
Example 29
Project: AvoinApotti   File: HospitalAtNightCutOffPointsConfigImpl.java   View source code 6 votes vote down vote up
public ims.clinical.vo.HospitalAtNightCutOffPointsConfigVo saveHospitalAtNight(ims.clinical.vo.HospitalAtNightCutOffPointsConfigVo hospitalConfig) throws ims.domain.exceptions.StaleObjectException, ims.domain.exceptions.UniqueKeyViolationException
{
	if (hospitalConfig == null)
		throw new CodingRuntimeException("Cannot save null hospitalConfig");

	if (!hospitalConfig.isValidated())
		throw new DomainRuntimeException("HospitalVo Not Validated.");

	try
	{

		DomainFactory factory = getDomainFactory();
		HospitalAtNightCutOverPointsConfig domainHospital = HospitalAtNightCutOffPointsConfigVoAssembler.extractHospitalAtNightCutOverPointsConfig(factory, hospitalConfig);

		factory.save(domainHospital);

		return HospitalAtNightCutOffPointsConfigVoAssembler.create(domainHospital);
	}
	catch (UnqViolationUncheckedException e)
	{
		throw new UniqueKeyViolationException("Hospital already exists in the system.", e);
	}
}
 
Example 30
Project: AvoinApotti   File: PresentationComponentImpl.java   View source code 6 votes vote down vote up
public PresentationReferralSummaryVo savePresentationReferralSummary(PresentationReferralSummaryVo value) throws StaleObjectException
{
	
	if (value != null)
	{
		if (!value.isValidated())
			throw new DomainRuntimeException("voPresentation not validated");
	}
	DomainFactory factory = getDomainFactory();

	PresentationReferralSummary doPres = PresentationReferralSummaryVoAssembler.extractPresentationReferralSummary(factory, value);
	factory.save(doPres);

	return PresentationReferralSummaryVoAssembler.create(doPres);
	
}
 
Example 31
Project: AvoinApotti   File: BaseContextEvalProvider.java   View source code 5 votes vote down vote up
protected final Context getContext()
{		
	Context ctx = getSessionData().context.get();
	if (ctx == null)
		throw new DomainRuntimeException("Context in SessionData in domain session cannot be null");
	
	return ctx;
}
 
Example 32
Project: AvoinApotti   File: MedicationDosesImpl.java   View source code 5 votes vote down vote up
public MedicationOverViewLiteVoCollection listMedicationOverviews(MedicationOverViewFilterVo voMedicationViewFilter) 
{
	if (voMedicationViewFilter == null)
		throw new DomainRuntimeException("Invalid Overview");
	
	DomainFactory factory = getDomainFactory();

	String hql = " from MedicationOverview mv where mv.careContext.episodeOfCare.careSpell.patient.id = :patid order by mv.authoringInformation.authoringDateTime desc"; 
	List overs = factory.find(hql, new String[]{"patid"}, new Object[]{voMedicationViewFilter.getPatientRef().getID_Patient()});
	if(overs.size() == 0)
		return null;
		
	return MedicationOverViewLiteVoAssembler.createMedicationOverViewLiteVoCollectionFromMedicationOverview(overs);

}
 
Example 33
Project: AvoinApotti   File: WardViewImpl.java   View source code 5 votes vote down vote up
public BedSpaceStateLiteVo getBedSpaceState(BedSpaceRefVo bed) 
{
	if(bed == null )
		throw new DomainRuntimeException("Invalid BedRefVo");
	
	String hql = "select bs from BedSpaceState as bs left join bs.bedSpace as bed where bed.id = " + bed.getID_BedSpace();
	List bedState = getDomainFactory().find(hql);
	
	//WDEV-11039
	boolean hasAlerts = false;
	if(bedState != null && bedState.size() > 0)
	{	
		BedSpaceState doBed = (BedSpaceState)bedState.get(0);
		if(doBed.getInpatientEpisode() != null && doBed.getInpatientEpisode().getPasEvent() != null && doBed.getInpatientEpisode().getPasEvent().getPatient() != null && doBed.getInpatientEpisode().getPasEvent().getPatient().getPatientAlerts() != null)
			if(doBed.getInpatientEpisode().getPasEvent().getPatient().getPatientAlerts().size() > 0 && isOneActive(doBed.getInpatientEpisode().getPasEvent().getPatient().getPatientAlerts(), true))
				hasAlerts = true;
	}
	
	BedSpaceStateLiteVoCollection voColl = BedSpaceStateLiteVoAssembler.createBedSpaceStateLiteVoCollectionFromBedSpaceState(bedState);
	
	if (voColl != null && voColl.size() > 0)
	{
		if(voColl.get(0).getInpatientEpisodeIsNotNull() && voColl.get(0).getInpatientEpisode().getPasEventIsNotNull() && voColl.get(0).getInpatientEpisode().getPasEvent().getPatientIsNotNull())
			voColl.get(0).getInpatientEpisode().getPasEvent().getPatient().setHasAlerts(hasAlerts);
		
		return voColl.get(0);		
	}
	return null;
}
 
Example 34
Project: AvoinApotti   File: VitalSignsImpl.java   View source code 5 votes vote down vote up
public VitalSignsVo saveABGO2Sats(VitalSignsVo voVitalABGO2) throws StaleObjectException
{
	if (!voVitalABGO2.isValidated())
	{
		throw new DomainRuntimeException("This Vital Sign has not been validated");
	}

	DomainFactory factory = getDomainFactory();
	VitalSigns doVitals = VitalSignsVoAssembler.extractVitalSigns(factory, voVitalABGO2);
	
	factory.save(doVitals);
	
	return VitalSignsVoAssembler.create(doVitals);
	
}
 
Example 35
Project: AvoinApotti   File: ReferralStatusHistoryImpl.java   View source code 5 votes vote down vote up
public ims.core.vo.MemberOfStaffLiteVo getMemberOfStaff(ims.core.resource.people.vo.MemberOfStaffRefVo memberOfStaffReff) throws ims.domain.exceptions.DomainInterfaceException
{
	if(memberOfStaffReff == null || (memberOfStaffReff != null && !memberOfStaffReff.getID_MemberOfStaffIsNotNull()))
		throw new DomainRuntimeException("Cannot get MemberOfStaff on null ID.");
	
	DomainFactory factory = getDomainFactory();
	
	return MemberOfStaffLiteVoAssembler.create((MemberOfStaff) factory.getDomainObject(MemberOfStaff.class, memberOfStaffReff.getID_MemberOfStaff()));
}
 
Example 36
Project: AvoinApotti   File: AssessmentComponentImpl.java   View source code 5 votes vote down vote up
private AdmissionAssessment getAdmissionAssessment(CareContextRefVo careContext) {
	if (careContext == null || careContext.getID_CareContext() == null)
		throw new DomainRuntimeException("Invalid CareContextRefVo provided");
	String hql = "select aa from AdmissionAssessment as aa where (aa.careContext.id = :id)";
	List<?> domObjs = getDomainFactory().find(hql,"id",careContext.getID_CareContext());
	if (domObjs == null || domObjs.size() == 0)
		return null;
	return (AdmissionAssessment) domObjs.get(0);
}
 
Example 37
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private void setColDiscipline(ClinicalNotesShortVoCollection voCollNotes, int i, DynamicGridRow row)
{
	DynamicGridColumn col = getCol("Discipline");
	if (col == null)
		throw new DomainRuntimeException("No column for Identifier");

	DynamicGridCell disCell = row.getCells().newCell(col, DynamicCellType.STRING);
	disCell.setValue(voCollNotes.get(i).getDisciplineIsNotNull() ? voCollNotes.get(i).getDiscipline().getText() : "");
}
 
Example 38
Project: AvoinApotti   File: DiagnosisComplicationsImpl.java   View source code 5 votes vote down vote up
public DiagLiteVoCollection listHotListDiagnosis(String diagName, Specialty specialty) throws DomainInterfaceException
{
	if(diagName == null)
		throw new DomainRuntimeException("Invalid Search criteria. Diagnosis name filter must be supplied.");
	
	if(specialty == null)
		throw new DomainRuntimeException("Invalid Search criteria. Specialty must be supplied.");

	DomainFactory factory = getDomainFactory();

	StringBuffer hql = new StringBuffer("  select distinct item from DiagnosisHotlistItem item join item.diagnosis as diag join diag.keywords as kw "); 
	ArrayList names = new ArrayList();
	ArrayList values = new ArrayList();

	hql.append(" where diag.isActive = :isActive");
	names.add("isActive");
	values.add(Boolean.TRUE);	

	hql.append(" and item.hotlist.specialty = :spec");
	names.add("spec");
	values.add(getDomLookup(specialty));			

	List hits = Keywords.searchByKeywords(factory, diagName, hql.toString(), names, values);		
	
	List diags = new ArrayList();		
	for (int i = 0; i < hits.size(); i++)
	{
		diags.add(((DiagnosisHotlistItem)hits.get(i)).getDiagnosis());
	}
	
	return DiagLiteVoAssembler.createDiagLiteVoCollectionFromDiagnosis(diags);
}
 
Example 39
Project: AvoinApotti   File: Logic.java   View source code 5 votes vote down vote up
private void populateDemographicINfo() 
{
	PatientShort pat = form.getGlobalContext().Core.getPatientShort();
	
	if (pat == null)
		throw new DomainRuntimeException("No Patient Supplied");

	if (pat.getNameIsNotNull())
	{
		form.lblSurname().setValue(pat.getName().getSurname());
		form.lblForename().setValue(pat.getName().getForename());
	}

	form.lblSex().setValue(pat.getSexIsNotNull() ? pat.getSex().toString() : "");
	form.lblDOB().setValue(pat.getDobIsNotNull() ? pat.getDob().toString() : "");

	GenForm.grdIdentifiersRow row;

	PatientIdCollection identifers = pat.getIdentifiers();
	if (identifers != null)
	{
		for (int i = 0; i < identifers.size(); i++)
		{
			ims.core.vo.PatientId id = identifers.get(i);
			row = form.grdIdentifiers().getRows().newRow();
			bindColType(row, false);
			row.getcolIdType().setValue(id.getType());
			row.setcolIdValue(id.getValue());
			row.setValue(id);
			if (id.getVerifiedIsNotNull() && !id.getVerified() && id.getType().equals(PatIdType.NHSN))
			{
				row.setBackColor(Color.Orange);
				row.setReadOnly(true);
			}
			if (id.getTypeIsNotNull() && id.getType().equals(PatIdType.NHSN) && !ConfigFlag.GEN.ALLOW_UPDATES_TO_NHS_NO.getValue())
				row.setReadOnly(true);

		}
	}
}
 
Example 40
Project: AvoinApotti   File: InvasiveDeviceConfigImpl.java   View source code 5 votes vote down vote up
public ims.clinicaladmin.vo.InvasiveDeviceConfigVo get(ims.clinical.configuration.vo.InvasiveDeviceConfigRefVo id)
{
	if(id == null || id.getID_InvasiveDeviceConfig() == null)
	{
		throw new DomainRuntimeException("Invalid record");
	}
	
	DomainFactory factory = getDomainFactory();
	InvasiveDeviceConfig domainRecord = (InvasiveDeviceConfig)factory.
		getDomainObject(InvasiveDeviceConfig.class, id.getID_InvasiveDeviceConfig().intValue());
	
	return InvasiveDeviceConfigVoAssembler.create(domainRecord);
}