List of usage examples for com.liferay.portal.kernel.exception NoSuchTicketException NoSuchTicketException
public NoSuchTicketException(Throwable cause)
From source file:com.liferay.subscription.web.internal.portlet.action.UnsubscribeMVCActionCommand.java
License:Open Source License
private Ticket _getTicket(String key) throws PortalException { Ticket ticket = _ticketLocalService.getTicket(key); if (ticket.getType() != SubscriptionConstants.TICKET_TYPE) { throw new NoSuchTicketException("Invalid type " + ticket.getType()); }/*from ww w .ja v a 2 s . co m*/ String className = ticket.getClassName(); if (!className.equals(Subscription.class.getName())) { throw new NoSuchTicketException("Invalid className " + className); } return ticket; }
From source file:com.liferay.subscription.web.internal.portlet.action.UnsubscribeMVCActionCommand.java
License:Open Source License
private Subscription _unsubscribe(String key, long userId) throws PortalException { Ticket ticket = _getTicket(key);/*from www.j a v a 2 s . c o m*/ long subscriptionId = ticket.getClassPK(); if (ticket.isExpired()) { _ticketLocalService.deleteTicket(ticket); throw new NoSuchTicketException("{ticketKey=" + key + "}"); } Subscription subscription = _subscriptionLocalService.getSubscription(subscriptionId); _checkUser(userId, subscription); _subscriptionLocalService.deleteSubscription(subscription); return subscription; }