001
014
015 package com.liferay.portlet.trash.util;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.search.Hits;
020 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
021 import com.liferay.portal.kernel.util.OrderByComparator;
022 import com.liferay.portal.model.Group;
023 import com.liferay.portal.theme.ThemeDisplay;
024 import com.liferay.portlet.trash.model.TrashEntry;
025
026 import java.util.Date;
027 import java.util.List;
028
029 import javax.portlet.PortletURL;
030
031 import javax.servlet.http.HttpServletRequest;
032
033
036 public class TrashUtil {
037
038 public static final String TRASH_ATTACHMENTS_DIR = ".trashed_";
039
040 public static final int TRASH_DEFAULT_VALUE = -1;
041
042 public static final int TRASH_DISABLED = 0;
043
044 public static final int TRASH_DISABLED_BY_DEFAULT = 1;
045
046 public static final int TRASH_ENABLED = 3;
047
048 public static final int TRASH_ENABLED_BY_DEFAULT = 2;
049
050 public static final String TRASH_TIME_SEPARATOR = "_TRASH_TIME_";
051
052 public static void addBaseModelBreadcrumbEntries(
053 HttpServletRequest request, String className, long classPK,
054 PortletURL containerModelURL)
055 throws PortalException, SystemException {
056
057 getTrash().addBaseModelBreadcrumbEntries(
058 request, className, classPK, containerModelURL);
059 }
060
061 public static void addContainerModelBreadcrumbEntries(
062 HttpServletRequest request, String className, long classPK,
063 PortletURL containerModelURL)
064 throws PortalException, SystemException {
065
066 getTrash().addContainerModelBreadcrumbEntries(
067 request, className, classPK, containerModelURL);
068 }
069
070 public static void deleteEntriesAttachments(
071 long companyId, long repositoryId, Date date,
072 String[] attachmentFileNames)
073 throws PortalException, SystemException {
074
075 getTrash().deleteEntriesAttachments(
076 companyId, repositoryId, date, attachmentFileNames);
077 }
078
079 public static List<TrashEntry> getEntries(Hits hits)
080 throws PortalException, SystemException {
081
082 return getTrash().getEntries(hits);
083 }
084
085 public static OrderByComparator getEntryOrderByComparator(
086 String orderByCol, String orderByType) {
087
088 return getTrash().getEntryOrderByComparator(orderByCol, orderByType);
089 }
090
091 public static int getMaxAge(Group group)
092 throws PortalException, SystemException {
093
094 return getTrash().getMaxAge(group);
095 }
096
097 public static String getNewName(ThemeDisplay themeDisplay, String oldName) {
098 return getTrash().getNewName(themeDisplay, oldName);
099 }
100
101 public static String getOriginalTitle(String title) {
102 return getTrash().getOriginalTitle(title);
103 }
104
105 public static Trash getTrash() {
106 PortalRuntimePermission.checkGetBeanProperty(TrashUtil.class);
107
108 return _trash;
109 }
110
111 public static String getTrashTime(String title, String separator) {
112 return getTrash().getTrashTime(title, separator);
113 }
114
115 public static String getTrashTitle(long trashEntryId) {
116 return getTrash().getTrashTitle(trashEntryId);
117 }
118
119 public static boolean isInTrash(String className, long classPK)
120 throws PortalException, SystemException {
121
122 return getTrash().isInTrash(className, classPK);
123 }
124
125 public static boolean isTrashEnabled(long groupId)
126 throws PortalException, SystemException {
127
128 return getTrash().isTrashEnabled(groupId);
129 }
130
131 public void setTrash(Trash trash) {
132 PortalRuntimePermission.checkSetBeanProperty(getClass());
133
134 _trash = trash;
135 }
136
137 private static Trash _trash;
138
139 }