cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Min Chen <>
Subject Question on ListEventsCmd
Date Fri, 07 Dec 2012 23:37:23 GMT
Hi there,

In refactoring ListEventsCmd api, I ran into the following code which is a mystery to me,
hope that somebody can explain here:

        if ((entryTime != null) && (duration != null)) {

            if (entryTime <= duration) {

                throw new InvalidParameterValueException("Entry time must be greater than


            Calendar calMin = Calendar.getInstance();

            Calendar calMax = Calendar.getInstance();

            calMin.add(Calendar.SECOND, -entryTime);

            calMax.add(Calendar.SECOND, -duration);

            Date minTime = calMin.getTime();

            Date maxTime = calMax.getTime();


            sc.setParameters("startId", 0);

            sc.setParameters("createDate", minTime, maxTime);

            List<EventJoinVO> startedEvents = _eventJoinDao.searchAllEvents(sc, searchFilter);

            List<EventJoinVO> pendingEvents = new ArrayList<EventJoinVO>();

            for (EventVO event : startedEvents) {

                EventVO completedEvent = _eventDao.findCompletedEvent(event.getId());

                if (completedEvent == null) {




            return pendingEvents;


   I have several questions here:

 1. What are entryTime and duration parameters here? Based on API doc, here are description
on these two cmd parameters:

     entryTime:  the time the event is entered

     duration:   the duration of the event

    But from code, it seems that they are both Integer type. So not sure how to understand
the entryTime and duration here, contradictory to my English understanding.

 2. In the code above, why must we have "Entry time must be greater than duration"?

 3. When user provides entryTime and duration parameters in the search, what kind of events
are we supposed to return here? I don't quite understand the pendingEvents list we are constructing



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message