package org.ovirt.engine.core.bll;

import java.util.Comparator;

/**
 * Used to sort the login domain list on the login page. Business rule is sort alphabetically,
 * but put "internal" at the end.
 */
public class LoginDomainComparator implements Comparator<String> {

    private String internal;

    public LoginDomainComparator(String internal) {
        this.internal = internal;
    }

    @Override
    public int compare(String a, String b) {
        if (a == b) return 0;
        if (a == null) return -1;
        if (b == null) return 1;
        if (a.equals(internal)) return 1;
        if (b.equals(internal)) return -1;
        return a.compareTo(b);
    }

}

@@ -29,16 +29,45 @@
 e.bll;%0A%0A
+import java.io.Serializable;%0A
 import j
@@ -289,18 +289,105 @@
 %3CString%3E
- %7B
+, Serializable %7B%0A%0A    private static final long serialVersionUID = -1679928871675563671L;
 %0A%0A    pr

make LoginDomainComparator Serializable