1 Reply Latest reply on Sep 21, 2015 8:51 AM by cgum

    Event Listener for Polls doesn't raise DELETED event

    cgum

      I'm creating a plugin (Jive 7/8) that requires that Polls get extended properties like other content types.  When a poll gets deleted, I'd like to clean things up.

       

      I have a class that implements EventListener<PollEvent> and it gets notified for VIEWED events, but it's not getting called for DELETED events even though that's one of the types defined on the PollEvent.

       

      @Override
      public void handle(PollEvent e) {

         try {

         if (e.getType() != PollEvent.Type.DELETED || e.getPayload().getObjectType() != JiveObjectType.Poll.getTypeID())

         return;

         long pollId = e.getPayload().getID();

        deleteProperties(pollId);

        }catch (Throwable t) {

         log.error("Error deleting poll extended properties", t);

        }

      }

       

      What kind of EventListener<??> should I have to pick up DELETED events?

        • Re: Event Listener for Polls doesn't raise DELETED event
          cgum

          Looks like you need to be an EventListener<GenericContentEvent>

           

          @Override
          public void handle(GenericContentEvent e) {

             try {

             if (e.getContentModificationType() != ContentEvent.ModificationType.Deleted
             || e.getPayload().getObjectType() != JiveObjectType.Poll.getTypeID() ) return;

             long pollId = e.getPayload().getID();

            deleteProperties(pollId);

            }catch (Throwable t) {

             log.error("Error deleting poll extended properties", t);

            }

          }