public ims.core.vo.Urinalysis saveUrinanalysis(ims.core.vo.Urinalysis voUrinanalysis) throws StaleObjectException { if (!voUrinanalysis.isValidated()) { throw new DomainRuntimeException("Urinanalysis has not been validated"); } DomainFactory factory = getDomainFactory(); Urinalysis doUrinalysis = UrinalysisAssembler.extractUrinalysis(factory, voUrinanalysis); //java.util.Set formsCSet = doNursingEpisDetails.getUrinalysis(); //formsCSet.add(doUrinalysis); voUrinanalysis.setID_Urinalysis(doUrinalysis.getId()); factory.save(doUrinalysis); return UrinalysisAssembler.create(doUrinalysis); }
/** * lists Urinanalysis records */ public UrinalysisCollection listUrinanalysis(ims.core.vo.Urinalysis voUrinalysis)throws DomainInterfaceException { UrinalysisCollection voCollUrinanalysis = new UrinalysisCollection(); if(voCollUrinanalysis == null) return voCollUrinanalysis; DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(""); String query = "from Urinalysis t"; ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String andStr = ""; if (voUrinalysis.getCareContextIsNotNull()) { hql.append(andStr + " t.careContext.id = :cc"); markers.add("cc"); values.add(voUrinalysis.getCareContext().getID_CareContext()); andStr = " and"; if(voUrinalysis.getIsActiveIsNotNull()) //the active ones { hql.append(andStr + " t.isActive = :active"); markers.add("active"); values.add(voUrinalysis.getIsActive()); andStr = " and"; } } if(andStr.equals(" and")) query += " where"; query += hql.toString(); List urs = factory.find(query, markers, values); return UrinalysisAssembler.createUrinalysisCollectionFromUrinalysis(urs).sort(SortOrder.DESCENDING); }
public ims.core.vo.UrinalysisCollection listUrinalysisByCareContext(ims.core.admin.vo.CareContextRefVo careContextRef, Boolean activeFilter) { if (careContextRef == null || careContextRef.getID_CareContext() == null) { throw new CodingRuntimeException("Cannot get Urinalysis on null Id for CareContext "); } DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); ArrayList<String> markers = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); hql.append("from Urinalysis as urinalysis where urinalysis.careContext.id = :cc "); markers.add("cc"); values.add(careContextRef.getID_CareContext()); if (activeFilter) // the active ones { hql.append(" and urinalysis.isActive = :active"); markers.add("active"); values.add(activeFilter); } List<?> list = factory.find(hql.toString(), markers, values); return UrinalysisAssembler.createUrinalysisCollectionFromUrinalysis(list).sort(SortOrder.DESCENDING); }
public ims.core.vo.Urinalysis save(ims.core.vo.Urinalysis voUrinanalysis) throws ims.domain.exceptions.StaleObjectException { if (!voUrinanalysis.isValidated()) { throw new DomainRuntimeException("Urinanalysis has not been validated"); } DomainFactory factory = getDomainFactory(); Urinalysis doUrinalysis = UrinalysisAssembler.extractUrinalysis(factory, voUrinanalysis); voUrinanalysis.setID_Urinalysis(doUrinalysis.getId()); factory.save(doUrinalysis); return UrinalysisAssembler.create(doUrinalysis); }
public ims.core.vo.Urinalysis getUrinalysis(UrinalysisRefVo urinalysisRef) { if (urinalysisRef == null || urinalysisRef.getID_Urinalysis() == null) { throw new CodingRuntimeException("Cannot get Urinalysis on null Id "); } DomainFactory factory = getDomainFactory(); Urinalysis domainUrinalysis = (Urinalysis) factory.getDomainObject(Urinalysis.class, urinalysisRef.getID_Urinalysis()); return UrinalysisAssembler.create(domainUrinalysis); }