001
014
015 package com.liferay.portlet.trash.util;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.exception.PortalException;
020 import com.liferay.portal.kernel.portlet.LiferayPortletResponse;
021 import com.liferay.portal.kernel.search.Hits;
022 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
023 import com.liferay.portal.kernel.util.OrderByComparator;
024 import com.liferay.portal.model.Group;
025 import com.liferay.portal.model.TrashedModel;
026 import com.liferay.portal.theme.ThemeDisplay;
027 import com.liferay.portlet.trash.model.TrashEntry;
028
029 import java.util.Date;
030 import java.util.List;
031
032 import javax.portlet.ActionRequest;
033 import javax.portlet.PortletException;
034 import javax.portlet.PortletURL;
035
036 import javax.servlet.http.HttpServletRequest;
037
038
041 @ProviderType
042 public class TrashUtil {
043
044 public static void addBaseModelBreadcrumbEntries(
045 HttpServletRequest request,
046 LiferayPortletResponse liferayPortletResponse, String className,
047 long classPK, PortletURL containerModelURL)
048 throws PortalException, PortletException {
049
050 getTrash().addBaseModelBreadcrumbEntries(
051 request, liferayPortletResponse, className, classPK,
052 containerModelURL);
053 }
054
055 public static void addContainerModelBreadcrumbEntries(
056 HttpServletRequest request,
057 LiferayPortletResponse liferayPortletResponse, String className,
058 long classPK, PortletURL containerModelURL)
059 throws PortalException, PortletException {
060
061 getTrash().addContainerModelBreadcrumbEntries(
062 request, liferayPortletResponse, className, classPK,
063 containerModelURL);
064 }
065
066 public static void addTrashSessionMessages(
067 ActionRequest actionRequest, List<TrashedModel> trashedModels) {
068
069 getTrash().addTrashSessionMessages(actionRequest, trashedModels);
070 }
071
072 public static void addTrashSessionMessages(
073 ActionRequest actionRequest, List<TrashedModel> trashedModels,
074 String cmd) {
075
076 getTrash().addTrashSessionMessages(actionRequest, trashedModels, cmd);
077 }
078
079 public static void addTrashSessionMessages(
080 ActionRequest actionRequest, TrashedModel trashedModel) {
081
082 getTrash().addTrashSessionMessages(actionRequest, trashedModel);
083 }
084
085 public static void addTrashSessionMessages(
086 ActionRequest actionRequest, TrashedModel trashedModel, String cmd) {
087
088 getTrash().addTrashSessionMessages(actionRequest, trashedModel, cmd);
089 }
090
091 public static void deleteEntriesAttachments(
092 long companyId, long repositoryId, Date date,
093 String[] attachmentFileNames)
094 throws PortalException {
095
096 getTrash().deleteEntriesAttachments(
097 companyId, repositoryId, date, attachmentFileNames);
098 }
099
100 public static List<TrashEntry> getEntries(Hits hits)
101 throws PortalException {
102
103 return getTrash().getEntries(hits);
104 }
105
106 public static OrderByComparator<TrashEntry> getEntryOrderByComparator(
107 String orderByCol, String orderByType) {
108
109 return getTrash().getEntryOrderByComparator(orderByCol, orderByType);
110 }
111
112 public static int getMaxAge(Group group) throws PortalException {
113 return getTrash().getMaxAge(group);
114 }
115
116 public static String getNewName(String oldName, String token) {
117 return getTrash().getNewName(oldName, token);
118 }
119
120 public static String getNewName(
121 ThemeDisplay themeDisplay, String className, long classPK,
122 String oldName)
123 throws PortalException {
124
125 return getTrash().getNewName(themeDisplay, className, classPK, oldName);
126 }
127
128 public static String getOriginalTitle(String title) {
129 return getTrash().getOriginalTitle(title);
130 }
131
132 public static String getOriginalTitle(String title, String paramName) {
133 return getTrash().getOriginalTitle(title, paramName);
134 }
135
136 public static Trash getTrash() {
137 PortalRuntimePermission.checkGetBeanProperty(TrashUtil.class);
138
139 return _trash;
140 }
141
142 public static String getTrashTime(String title, String separator) {
143 return getTrash().getTrashTime(title, separator);
144 }
145
146 public static String getTrashTitle(long trashEntryId) {
147 return getTrash().getTrashTitle(trashEntryId);
148 }
149
150 public static PortletURL getViewContentURL(
151 HttpServletRequest request, String className, long classPK)
152 throws PortalException {
153
154 return getTrash().getViewContentURL(request, className, classPK);
155 }
156
157 public static boolean isInTrash(String className, long classPK)
158 throws PortalException {
159
160 return getTrash().isInTrash(className, classPK);
161 }
162
163 public static boolean isTrashEnabled(Group group) {
164 return getTrash().isTrashEnabled(group);
165 }
166
167 public static boolean isTrashEnabled(long groupId) throws PortalException {
168 return getTrash().isTrashEnabled(groupId);
169 }
170
171 public void setTrash(Trash trash) {
172 PortalRuntimePermission.checkSetBeanProperty(getClass());
173
174 _trash = trash;
175 }
176
177 private static Trash _trash;
178
179 }