class UpgradeTaskId implements Comparable<UpgradeTaskId> {

    @Override
    public int compareTo(UpgradeTaskId other) {

        if (other == null) {
            return 1;
        }

        // compare version only if needed
        if (!StringUtils.equals(version, other.getVersion())) {

            // split with by '.'
            final String[] versionParts = version.split("\\.");
            final String[] otherVersionParts = other.getVersion().split("\\.");

            // compare each part with a left pad so that '1-PE' < '2-EE' < '100-PE'
            for (int i = 0; i < versionParts.length; i++) {
                String currentPart = leftPad(versionParts[i], 6, '0');

                // if there's no match for the other version, let's consider 0
                String otherPart = "000000";
                if (i < otherVersionParts.length) {
                    otherPart = leftPad(otherVersionParts[i], 6, '0');
                }

                final int result = currentPart.compareTo(otherPart);
                if (result != 0) {
                    return result;
                }
            }
        }

        // then order
        return Integer.compare(order, other.getOrder());
    }

    public  UpgradeTaskId();
    public  UpgradeTaskId(String version, String name, int order);

}