public boolean existTrackingAreaCubiclesForTrackingArea(Integer trackAreaId,DomainFactory factory) { if( trackAreaId == null) return false; StringBuffer hql = new StringBuffer(); //List only Emergency Department hql.append(" select t1_1 from TrackingAreaCubicles as t1_1 left join t1_1.trackingArea as t2_1 where (t2_1.id = :trackareaid)"); List<?> trackingList = factory.find(hql.toString(), new String[]{"trackareaid"}, new Object[]{trackAreaId}); if( trackingList != null && trackingList.size() > 0) { TrackingAreaCubiclesVoCollection tempColl = TrackingAreaCubiclesVoAssembler.createTrackingAreaCubiclesVoCollectionFromTrackingAreaCubicles(trackingList); if( tempColl != null && tempColl.size() > 0) return true; else return false; } return false; }
public ims.emergency.vo.TrackingAreaCubiclesVo getTrackingAreaCubicle(ims.emergency.configuration.vo.TrackingAreaRefVo trackingAreaRef) { if(trackingAreaRef == null) throw new CodingRuntimeException("TrackingAreaRefVo is null."); StringBuffer hql = new StringBuffer(); hql.append("select t1_1 from TrackingAreaCubicles as t1_1 left join t1_1.trackingArea as t2_1 "); hql.append("where (t2_1.id = :trackinAreaId) "); DomainFactory factory = getDomainFactory(); List<?> list = factory.find(hql.toString(), new String[] {"trackinAreaId"}, new Object[] {trackingAreaRef.getID_TrackingArea()}); if (list!=null && list.size()>0) { return TrackingAreaCubiclesVoAssembler.createTrackingAreaCubiclesVoCollectionFromTrackingAreaCubicles(list).get(0); } return null; }
public TrackingAreaCubiclesVo getTrackingAreaCubicle(TrackingAreaRefVo trackingAreaRef) { if(trackingAreaRef == null || trackingAreaRef.getID_TrackingArea() == null) return null; StringBuffer hql = new StringBuffer(); hql.append("select t1_1 from TrackingAreaCubicles as t1_1 left join t1_1.trackingArea as t2_1 "); hql.append("where (t2_1.id = :trackinAreaId) "); DomainFactory factory = getDomainFactory(); List<?> list = factory.find(hql.toString(), new String[] {"trackinAreaId"}, new Object[] {trackingAreaRef.getID_TrackingArea()}); if (list!=null && list.size()>0) { return TrackingAreaCubiclesVoAssembler.createTrackingAreaCubiclesVoCollectionFromTrackingAreaCubicles(list).get(0); } return null; }
public TrackingAreaCubiclesVo getTrackingAreaCubicles(TrackingAreaRefVo trackingAreaRef) { if( trackingAreaRef == null ) return null; DomainFactory factory = getDomainFactory(); StringBuffer hql = new StringBuffer(); hql.append("select t1_1 from TrackingAreaCubicles as t1_1 left join t1_1.trackingArea as t2_1 where (t2_1.id = :trackingAreaId) "); List list = factory.find(hql.toString(), new String[] {"trackingAreaId"}, new Object[] {trackingAreaRef.getID_TrackingArea()}); if( list != null && list.size() > 0) { TrackingAreaCubiclesVoCollection tempColl = TrackingAreaCubiclesVoAssembler.createTrackingAreaCubiclesVoCollectionFromTrackingAreaCubicles(list); if( tempColl != null ) return tempColl.get(0); } return null; }
public TrackingAreaCubiclesVo saveTrackingAreaCubicle(TrackingAreaCubiclesVo trackingAreaCubicle) throws StaleObjectException, UniqueKeyViolationException { if( trackingAreaCubicle == null) throw new CodingRuntimeException("TrackingAreaCubiclesVo is null"); DomainFactory factory = getDomainFactory(); if( trackingAreaCubicle != null && trackingAreaCubicle.getID_TrackingAreaCubicles() == null ) { if( existTrackingAreaCubiclesForTrackingArea(trackingAreaCubicle.getTrackingArea().getID_TrackingArea(),factory) == true) { throw new StaleObjectException(null); } } TrackingAreaCubicles trackingAreaCub = TrackingAreaCubiclesVoAssembler.extractTrackingAreaCubicles(factory, trackingAreaCubicle); factory.save(trackingAreaCub); return TrackingAreaCubiclesVoAssembler.create(trackingAreaCub); }