LPS-45318 Refactor OrderByComparator

Based on fix https://github.com/migue/liferay-portal/pull/222

Have to be pushed together with https://github.com/migue/liferay-plugins/pull/19