public EventVo getEvent(EventRefVo voRef) { if (voRef == null) throw new DomainRuntimeException("Cannot get EventVo for null EventRefVo"); DomainFactory factory = getDomainFactory(); Event doEvent = (Event) factory.getDomainObject(Event.class, voRef.getID_Event()); return EventVoAssembler.create(doEvent); }
// WDEV-19572 public EventLiteVoCollection listEvents(String value, EventRefVo excludedEvent) { if (value == null || value.length() == 0) throw new DomainRuntimeException("Value passed to the search query is null"); DomainFactory factory = getDomainFactory(); ArrayList<String> marques = new ArrayList<String>(); ArrayList<Object> values = new ArrayList<Object>(); String hqlquery = "select ev from Event as ev left join ev.status as stat where ev.upperName like :EVENT_NAME and stat.id = :STATUS_ID "; marques.add("EVENT_NAME"); values.add(value.trim().toUpperCase() + "%"); marques.add("STATUS_ID"); values.add(PreActiveActiveInactiveStatus.ACTIVE.getID()); if (excludedEvent != null) { hqlquery += " and ev.id <> :EVENT_ID"; marques.add("EVENT_ID"); values.add(excludedEvent.getID_Event()); } hqlquery += " order by ev.upperName asc"; List<?> eventList = factory.find(hqlquery, marques.toArray(new String[marques.size()]), values.toArray()); if (eventList == null || eventList.isEmpty()) return null; return EventLiteVoAssembler.createEventLiteVoCollectionFromEvent(eventList); }
public EventTargetVoCollection getEventTargetsByEvent(EventRefVo voRef) { // list all ACTIVE and PREACTIVE EventsTargets return EventTargetVoAssembler.createEventTargetVoCollectionFromEventTarget( getDomainFactory() .find( "from EventTarget et where et.event.id = :id ", new String[] {"id"}, new Object[] {voRef.getID_Event()})); }
@SuppressWarnings("unchecked") public EventRTTEventVoCollection getEventRTTEvent( EventRefVo voRef, PreActiveActiveInactiveStatus status) { DomainFactory factory = getDomainFactory(); ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String query = "select ertt from EventRTTEvent as ertt where ertt.event.id = :idEvent"; markers.add("idEvent"); values.add(voRef.getID_Event()); if (status != null) { query += " and ertt.event.status = :status"; markers.add("status"); values.add(getDomLookup(status)); } List rtts = factory.find(query, markers, values); return EventRTTEventVoAssembler.createEventRTTEventVoCollectionFromEventRTTEvent(rtts); }
@SuppressWarnings("unchecked") public EventExternalEventMappingVoCollection getEventExternalEventMapping( EventRefVo voRef, PreActiveActiveInactiveStatus status) { DomainFactory factory = getDomainFactory(); ArrayList markers = new ArrayList(); ArrayList values = new ArrayList(); String query = "select eeem from EventExternalEventMapping as eeem where eeem.event.id = :idEvent"; markers.add("idEvent"); values.add(voRef.getID_Event()); if (status != null) { query += " and eeem.event.status = :status"; markers.add("status"); values.add(getDomLookup(status)); } List eeem = factory.find(query, markers, values, 1000); return EventExternalEventMappingVoAssembler .createEventExternalEventMappingVoCollectionFromEventExternalEventMapping(eeem); }