コード例 #1
0
  private void saveRTT(
      EventVo event,
      EventRTTEventVoCollection rttToBeAdded,
      EventRTTEventVoCollection rttToBeDeteled,
      DomainFactory factory,
      Event domainRecord)
      throws StaleObjectException, ForeignKeyViolationException {
    // Save RTT
    if (rttToBeAdded != null) {
      for (int j = 0; j < rttToBeAdded.size(); j++) {
        EventRTTEvent domainRTT =
            EventRTTEventVoAssembler.extractEventRTTEvent(factory, rttToBeAdded.get(j));
        RTTEvent rttEvent = (RTTEvent) domainRTT.getRTTEvent();
        ;
        rttEvent.setUpperName(rttEvent.getName());
        domainRTT.setEvent(domainRecord);

        if (domainRTT.getStatus().equals(getDomLookup(PreActiveActiveInactiveStatus.ACTIVE))
            && domainRTT.getActivatedDateTime() == null) {
          domainRTT.setStatus(getDomLookup(PreActiveActiveInactiveStatus.ACTIVE));
          domainRTT.setActivatedBy(getUser());
          domainRTT.setActivatedDateTime(new Date());
        } else if (domainRTT
                .getStatus()
                .equals(getDomLookup(PreActiveActiveInactiveStatus.INACTIVE))
            && domainRTT.getInactivatedDateTime() == null) {
          if (domainRTT.getInactivatedBy() == null) {
            domainRTT.setInactivatedBy(getUser());
            domainRTT.setInactivatedDateTime(new Date());
          }
        }

        factory.save(domainRTT);
      }
    }
    if (rttToBeDeteled != null) {
      for (int j = 0; j < rttToBeDeteled.size(); j++) {
        EventRTTEvent domainRTT =
            EventRTTEventVoAssembler.extractEventRTTEvent(factory, rttToBeDeteled.get(j));
        factory.delete(domainRTT);
      }
    }
  }
コード例 #2
0
  @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);
  }