Example #1
0
  protected static com.liferay.portlet.polls.model.PollsDisplay remove(
      com.liferay.portlet.polls.ejb.PollsDisplayPK pollsDisplayPK)
      throws com.liferay.portlet.polls.NoSuchDisplayException, com.liferay.portal.SystemException {
    PollsDisplayPersistence persistence = (PollsDisplayPersistence) InstancePool.get(PERSISTENCE);
    ModelListener listener = null;

    if (Validator.isNotNull(LISTENER)) {
      try {
        listener = (ModelListener) Class.forName(LISTENER).newInstance();
      } catch (Exception e) {
        Logger.error(PollsDisplayUtil.class, e.getMessage(), e);
      }
    }

    if (listener != null) {
      listener.onBeforeRemove(findByPrimaryKey(pollsDisplayPK));
    }

    com.liferay.portlet.polls.model.PollsDisplay pollsDisplay = persistence.remove(pollsDisplayPK);

    if (listener != null) {
      listener.onAfterRemove(pollsDisplay);
    }

    return pollsDisplay;
  }