LPS-42260

The code is suppose to encapsulate this logic

    String orderByCol = ParamUtil.getString(request, "orderByCol");
    String orderByType = ParamUtil.getString(request, "orderByType");

    if (Validator.isNotNull(orderByCol) && Validator.isNotNull(orderByType)) {
        portalPreferences.setValue(PortletKeys.LAYOUT_PROTOTYPE, "layout-prototypes-order-by-col", orderByCol);
        portalPreferences.setValue(PortletKeys.LAYOUT_PROTOTYPE, "layout-prototypes-order-by-type", orderByType);
    }
    else {
        orderByCol = portalPreferences.getValue(PortletKeys.LAYOUT_PROTOTYPE, "layout-prototypes-order-by-col", "name");
        orderByType = portalPreferences.getValue(PortletKeys.LAYOUT_PROTOTYPE, "layout-prototypes-order-by-type", "asc");
    }

    OrderByComparator obc = OrderByComparatorFactoryUtil.create(LayoutPrototypeModelImpl.TABLE_NAME, orderByCol, orderByType.equals("asc"));