Skip to content

Instantly share code, notes, and snippets.

@opensourceforlife
opensourceforlife / AUI_Carousel_Structure_6.2.xml
Last active August 29, 2015 13:57
AUI Carousel Structure for Liferay 6.2
@opensourceforlife
opensourceforlife / AUI_Carousel_Template_6.2.vm
Created March 21, 2014 13:00
AUI Carousel Template for Liferay 6.2
@opensourceforlife
opensourceforlife / TrashHandler methods
Created February 22, 2014 05:57
TrashHandler methods to deleteTrashEntry & restoring Trash Entry back
public void deleteTrashEntry(final long classPK)
throws PortalException, SystemException {
EventLocalServiceUtil.deleteEvent(classPK);
}
public void restoreTrashEntry(final long userId, final long classPK)
throws PortalException, SystemException {
EventLocalServiceUtil.restoreEntryFromTrash(userId, classPK);
@opensourceforlife
opensourceforlife / getEvents not in Trash
Created February 22, 2014 05:51
getEvents which is not moved to Trash
public List<Event> getEventsByGroupId(
final long groupId, final int start, final int end)
throws SystemException {
return getEventsByGroupId(
groupId, WorkflowConstants.STATUS_IN_TRASH, start, end);
}
@Override
public List<Event> getEventsByGroupId(
@opensourceforlife
opensourceforlife / deleteEvent in LocalServiceImpl
Last active August 29, 2015 13:56
deleteEvent logic change in EventLocalServiceImpl.java
public Event deleteEvent(final Event event)
throws SystemException {
// Trash
try {
trashEntryLocalService.deleteEntry(
Event.class.getName(), event.getEventId());
}
catch (PortalException e) {
_log.error(e.getMessage(), e);
@opensourceforlife
opensourceforlife / restoreEntryFromTrash in LocalServiceImpl
Created February 22, 2014 05:30
restoreEntryFromTrash logic in EventLocalServiceImpl.java
public void restoreEntryFromTrash(final long userId, final long eventId)
throws PortalException, SystemException {
// Entry
TrashEntry trashEntry =
trashEntryLocalService.getEntry(Event.class.getName(), eventId);
updateStatus(eventId, trashEntry.getStatus(), userId);
}
@opensourceforlife
opensourceforlife / moveToTrash in LocalServiceImpl
Created February 22, 2014 05:29
moveToTrash method logic in EventLocalServiceImpl.java
@Override
public Event moveEntryToTrash(final long userId, final long eventId) throws PortalException, SystemException {
Event event = eventPersistence.findByPrimaryKey(eventId);
updateStatus(event.getEventId(), WorkflowConstants.STATUS_IN_TRASH, userId);
return event;
}
public Event updateStatus(final long eventId, final int status, final long userId) throws SystemException, PortalException {
Event event = eventPersistence.findByPrimaryKey(eventId);
@opensourceforlife
opensourceforlife / deleteEvent action change in Controller
Created February 22, 2014 05:08
deleteEvent action change in Controller
public void deleteEvent(
final ActionRequest request, final ActionResponse response)
throws Exception {
long eventId = ParamUtil.getLong(request, "eventId");
String cmd = ParamUtil.getString(request, Constants.CMD);
ThemeDisplay themeDisplay =
(ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
@opensourceforlife
opensourceforlife / Trash changes in Delete action
Created February 22, 2014 04:35
Trash changes in Delete action
<portlet:actionURL name="deleteEvent" var="deleteURL">
<portlet:param name="<%= Constants.CMD %>" value="<%= TrashUtil.isTrashEnabled(scopeGroupId) ? Constants.MOVE_TO_TRASH : Constants.DELETE %>" />
<portlet:param name="eventId" value="<%= String.valueOf(eventId) %>" />
<portlet:param name="redirect" value="<%= redirect %>" />
</portlet:actionURL>
<liferay-ui:icon-delete
label="<%= true %>"
trash="<%= TrashUtil.isTrashEnabled(scopeGroupId) %>"
url="<%= deleteURL.toString() %>"
@opensourceforlife
opensourceforlife / TrashEntry Reference in service.xml
Created February 22, 2014 04:16
TrashEntry Reference in service.xml
<!-- References -->
<reference package-path="com.liferay.portlet.trash" entity="TrashEntry" />