com.liferay.fragment.web.internal.util.FragmentPortletUtil Maven / Gradle / Ivy
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
package com.liferay.fragment.web.internal.util;
import com.liferay.fragment.model.FragmentCollection;
import com.liferay.fragment.util.comparator.FragmentCollectionCreateDateComparator;
import com.liferay.fragment.util.comparator.FragmentCollectionNameComparator;
import com.liferay.fragment.util.comparator.FragmentCompositionFragmentEntryModifiedDateComparator;
import com.liferay.fragment.util.comparator.FragmentCompositionFragmentEntryNameComparator;
import com.liferay.portal.kernel.util.OrderByComparator;
/**
* @author Jürgen Kappler
*/
public class FragmentPortletUtil {
public static OrderByComparator
getFragmentCollectionOrderByComparator(
String orderByCol, String orderByType) {
boolean orderByAsc = false;
if (orderByType.equals("asc")) {
orderByAsc = true;
}
OrderByComparator orderByComparator = null;
if (orderByCol.equals("create-date")) {
orderByComparator =
FragmentCollectionCreateDateComparator.getInstance(orderByAsc);
}
else if (orderByCol.equals("name")) {
orderByComparator = FragmentCollectionNameComparator.getInstance(
orderByAsc);
}
return orderByComparator;
}
public static OrderByComparator