1
19
20 package com.liferay.portlet.softwarecatalog.util;
21
22 import com.liferay.portal.kernel.util.OrderByComparator;
23 import com.liferay.portlet.softwarecatalog.util.comparator.ProductEntryCreateDateComparator;
24 import com.liferay.portlet.softwarecatalog.util.comparator.ProductEntryModifiedDateComparator;
25 import com.liferay.portlet.softwarecatalog.util.comparator.ProductEntryNameComparator;
26 import com.liferay.portlet.softwarecatalog.util.comparator.ProductEntryTypeComparator;
27
28
34 public class SCUtil {
35
36 public static OrderByComparator getProductEntryOrderByComparator(
37 String orderByCol, String orderByType) {
38
39 boolean orderByAsc = false;
40
41 if (orderByType.equals("asc")) {
42 orderByAsc = true;
43 }
44
45 OrderByComparator orderByComparator = null;
46
47 if (orderByCol.equals("create-date")) {
48 orderByComparator =
49 new ProductEntryCreateDateComparator(orderByAsc);
50 }
51 else if (orderByCol.equals("modified-date")) {
52 orderByComparator =
53 new ProductEntryModifiedDateComparator(orderByAsc);
54 }
55 else if (orderByCol.equals("name")) {
56 orderByComparator = new ProductEntryNameComparator(orderByAsc);
57 }
58 else if (orderByCol.equals("type")) {
59 orderByComparator = new ProductEntryTypeComparator(orderByAsc);
60 }
61
62 return orderByComparator;
63 }
64
65 }