Skip to content

Commit

Permalink
LPS-203810 Remove DL interface and move constants to DLUtil, apply to…
Browse files Browse the repository at this point in the history
… usages

# breaking

## What portal-kernel/src/com/liferay/document/library/kernel/util/DL.java

DL interface is being removed.

## Why

DL interface is no longer needed since we do not need Spring to register its implementation as OSGi component anymore.

## Alternatives

Use DLUtil directly.

----
  • Loading branch information
JanisZhang committed Jan 8, 2024
1 parent 66b4da3 commit 89c4e71
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.liferay.document.library.kernel.processor.PDFProcessorUtil;
import com.liferay.document.library.kernel.processor.VideoProcessorUtil;
import com.liferay.document.library.kernel.service.DLAppLocalService;
import com.liferay.document.library.kernel.util.DL;
import com.liferay.document.library.service.DLFileVersionPreviewLocalService;
import com.liferay.document.library.url.provider.DLFileVersionURLProvider;
import com.liferay.document.library.util.DLURLHelper;
Expand Down Expand Up @@ -39,6 +38,7 @@
import com.liferay.portal.kernel.util.URLCodec;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.util.PropsValues;
import com.liferay.portlet.documentlibrary.util.DLUtil;
import com.liferay.portlet.documentlibrary.webdav.DLWebDAVUtil;
import com.liferay.trash.TrashHelper;

Expand Down Expand Up @@ -326,7 +326,7 @@ public String getWebDavURL(
webDavURLSB.append("/webdav");

if (manualCheckInRequired) {
webDavURLSB.append(DL.MANUAL_CHECK_IN_REQUIRED_PATH);
webDavURLSB.append(DLUtil.MANUAL_CHECK_IN_REQUIRED_PATH);
}

Group group = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.liferay.document.library.kernel.service.DLFileEntryTypeLocalService;
import com.liferay.document.library.kernel.service.DLFileVersionLocalService;
import com.liferay.document.library.kernel.service.DLTrashService;
import com.liferay.document.library.kernel.util.DL;
import com.liferay.document.library.util.DLFileEntryTypeUtil;
import com.liferay.document.library.web.internal.helper.DLTrashHelper;
import com.liferay.dynamic.data.mapping.kernel.DDMFormValues;
Expand Down Expand Up @@ -71,6 +70,7 @@
import com.liferay.portal.webdav.BaseWebDAVStorageImpl;
import com.liferay.portal.webdav.LockException;
import com.liferay.portal.webdav.WebDAVUtil;
import com.liferay.portlet.documentlibrary.util.DLUtil;
import com.liferay.portlet.documentlibrary.webdav.DLFileEntryResourceImpl;
import com.liferay.portlet.documentlibrary.webdav.DLWebDAVUtil;

Expand Down Expand Up @@ -467,7 +467,7 @@ public Status lockResource(
DLFileEntry.class.getName(), webDAVRequest);

serviceContext.setAttribute(
DL.MANUAL_CHECK_IN_REQUIRED,
DLUtil.MANUAL_CHECK_IN_REQUIRED,
webDAVRequest.isManualCheckInRequired());

_populateServiceContext(serviceContext, fileEntry);
Expand Down Expand Up @@ -902,7 +902,7 @@ public boolean unlockResource(WebDAVRequest webDAVRequest, String token)
DLFileEntry.class.getName(), webDAVRequest);

serviceContext.setAttribute(
DL.WEBDAV_CHECK_IN_MODE, Boolean.TRUE);
DLUtil.WEBDAV_CHECK_IN_MODE, Boolean.TRUE);

_dlAppService.checkInFileEntry(
fileEntry.getFileEntryId(), token, serviceContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.liferay.document.library.kernel.model.DLVersionNumberIncrease;
import com.liferay.document.library.kernel.service.DLAppHelperLocalService;
import com.liferay.document.library.kernel.service.DLFolderLocalService;
import com.liferay.document.library.kernel.util.DL;
import com.liferay.portal.kernel.exception.NoSuchRepositoryEntryException;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
Expand All @@ -34,6 +33,7 @@
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.UnicodeProperties;
import com.liferay.portlet.documentlibrary.util.DLUtil;

import java.io.File;
import java.io.FileInputStream;
Expand Down Expand Up @@ -433,7 +433,7 @@ protected void clearManualCheckInRequired(
throws NoSuchRepositoryEntryException {

boolean webDAVCheckInMode = GetterUtil.getBoolean(
serviceContext.getAttribute(DL.WEBDAV_CHECK_IN_MODE));
serviceContext.getAttribute(DLUtil.WEBDAV_CHECK_IN_MODE));

if (webDAVCheckInMode) {
return;
Expand Down Expand Up @@ -467,7 +467,7 @@ protected void setManualCheckInRequired(
throws NoSuchRepositoryEntryException {

if (!GetterUtil.getBoolean(
serviceContext.getAttribute(DL.MANUAL_CHECK_IN_REQUIRED))) {
serviceContext.getAttribute(DLUtil.MANUAL_CHECK_IN_REQUIRED))) {

return;
}
Expand Down
6 changes: 3 additions & 3 deletions portal-impl/src/com/liferay/portal/webdav/WebDAVUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package com.liferay.portal.webdav;

import com.liferay.document.library.kernel.util.DL;
import com.liferay.osgi.service.tracker.collections.map.ServiceTrackerMap;
import com.liferay.osgi.service.tracker.collections.map.ServiceTrackerMapFactory;
import com.liferay.petra.string.CharPool;
Expand Down Expand Up @@ -34,6 +33,7 @@
import com.liferay.portal.kernel.webdav.WebDAVStorage;
import com.liferay.portal.kernel.xml.Namespace;
import com.liferay.portal.kernel.xml.SAXReaderUtil;
import com.liferay.portlet.documentlibrary.util.DLUtil;

import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -308,11 +308,11 @@ public static boolean isOverwrite(HttpServletRequest httpServletRequest) {
}

public static String stripManualCheckInRequiredPath(String url) {
return stripToken(url, DL.MANUAL_CHECK_IN_REQUIRED_PATH);
return stripToken(url, DLUtil.MANUAL_CHECK_IN_REQUIRED_PATH);
}

public static String stripOfficeExtension(String url) {
String strippedUrl = stripToken(url, DL.OFFICE_EXTENSION_PATH);
String strippedUrl = stripToken(url, DLUtil.OFFICE_EXTENSION_PATH);

if (strippedUrl.length() != url.length()) {
strippedUrl = FileUtil.stripExtension(strippedUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import com.liferay.document.library.kernel.service.persistence.DLFolderPersistence;
import com.liferay.document.library.kernel.store.DLStoreRequest;
import com.liferay.document.library.kernel.store.DLStoreUtil;
import com.liferay.document.library.kernel.util.DL;
import com.liferay.document.library.kernel.util.DLAppHelperThreadLocal;
import com.liferay.document.library.kernel.util.DLValidatorUtil;
import com.liferay.document.library.kernel.util.comparator.RepositoryModelModifiedDateComparator;
Expand Down Expand Up @@ -397,7 +396,7 @@ public void checkInFileEntry(
fileEntryId);

boolean webDAVCheckInMode = GetterUtil.getBoolean(
serviceContext.getAttribute(DL.WEBDAV_CHECK_IN_MODE));
serviceContext.getAttribute(DLUtil.WEBDAV_CHECK_IN_MODE));

boolean manualCheckInRequired = dlFileEntry.isManualCheckInRequired();

Expand Down Expand Up @@ -2385,7 +2384,7 @@ private DLFileEntry _checkOutDLFileEntryModel(
serviceContext.setUserId(userId);

boolean manualCheckinRequired = GetterUtil.getBoolean(
serviceContext.getAttribute(DL.MANUAL_CHECK_IN_REQUIRED));
serviceContext.getAttribute(DLUtil.MANUAL_CHECK_IN_REQUIRED));

if (dlFileEntry.isManualCheckInRequired() ^ manualCheckinRequired) {
dlFileEntry.setManualCheckInRequired(manualCheckinRequired);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@
*/
public class DLUtil {

public static final String MANUAL_CHECK_IN_REQUIRED =
"manualCheckInRequired";

public static final String MANUAL_CHECK_IN_REQUIRED_PATH =
StringPool.SLASH + MANUAL_CHECK_IN_REQUIRED;

public static final String OFFICE_EXTENSION = "officeExtension";

public static final String OFFICE_EXTENSION_PATH =
StringPool.SLASH + OFFICE_EXTENSION;

public static final String WEBDAV_CHECK_IN_MODE = "webDAVCheckInMode";

public static int compareVersions(String version1, String version2) {
int[] splitVersion1 = StringUtil.split(version1, StringPool.PERIOD, 0);
int[] splitVersion2 = StringUtil.split(version2, StringPool.PERIOD, 0);
Expand Down
148 changes: 0 additions & 148 deletions portal-kernel/src/com/liferay/document/library/kernel/util/DL.java

This file was deleted.

0 comments on commit 89c4e71

Please sign in to comment.