engine: Introducing Nameable Comparator

Introduced the NameableComparator which compares Nameables by their
name, and used wherever possible to replace duplicate code in Linq.

Subsequent patches will make more classes Nameables and remove more
duplications.

Change-Id: Iefff7c751c8ed009be1505da75e18485db399a71
Signed-off-by: Allon Mureinik <amureini@redhat.com>
engine: Remove Linq.VdsGroupByNameComparer

The aim of this patch is to remove Linq.VdsGroupByNameComparer and
replace all its usages with the standard NameableComparator.

In order to achieve this goal, the following was performed:
1. VDSGroup's getname() and setname(String) were rename to getName() and
   setName(String), as per the proper Java convention.
2. VDSGroup was changed to implement Nameable (now that it has a
   getName()) method.
3. Linq.VdsGroupByNameComparer was removed, and all its references were
   changed to use NameableComparator.

Change-Id: I964e4fcccac8f2635f34748163fb3841c5b6f646
Signed-off-by: Allon Mureinik <amureini@redhat.com>
engine: Remove Linq.StorageDomainByNameComparer

The aim of this patch is to remove Linq.StorageDomainByNameComparer and
replace all its usages with the standard NameableComparator.

In order to achieve this goal, the following was performed:
1. StorageDomain.getName() was added. In the interest of causing the
   least amount of noise, it simply delegates to the old
   getStorageName().
2. StorageDomain was changed to implement Nameable (now that it has a
   getName()) method.
3. Linq.StorageDomainByNameComparer was removed, and all its
   references were changed to use NameableComparator.

Change-Id: I68b2a9f575acd4f4f4018a8c035a9e056becad2a
Signed-off-by: Allon Mureinik <amureini@redhat.com>
engine: Remove Linq.StoragePoolByNameComparer

The aim of this patch is to remove Linq.StoragePoolByNameComparer and
replace all its usages with the standard NameableComparator.

In order to achieve this goal, the following was performed:
1. StoragePool's getname() and setname(String) were rename to
   getName() and setName(String), as per the proper Java convention.
2. StoragePool was changed to implement Nameable (now that it has a
   getName()) method.
3. Linq.StoragePoolByNameComparer was removed, and all its references
   were changed to use NameableComparator.

Change-Id: I0fc6440c524d378fc1f72e24431a939bbbcde570
Signed-off-by: Allon Mureinik <amureini@redhat.com>
engine: Remove Linq.VmAndPoolByNameComparer

VmAndPoolByNameComparer is used to compare instances of either a VM or a
VMPool by their getName() method. Since both these classes implement the
Nameable interface NameableComparator can simply be used instead, and
save both runtime type checking and the additional lines of code.

Change-Id: I3c9fd116c6a3911ed70e677a86ec489ccec1ad95
Signed-off-by: Allon Mureinik <amureini@redhat.com>
webadmin: Remove Linq.CaseInsensitiveComparer

Linq.CaseInsensitiveComparer has exactly the same functionality of
java.lang.String.CASE_INSENSITIVE_ORDER, and hence can be removed.

Change-Id: I1e7e33af8ae9f68f8f94369a8ceebca1abb25b6f
Signed-off-by: Allon Mureinik <amureini@redhat.com>
webadmin: Remove Linq.sort(Collection, Comparator)

All this method did was to delegate to Collections.sort, which is
redundant - it could have been called directly.

The javadoc offers no reason why this method should be present either.
if a collection contains objects of different classes they still need
some common ancestor to be sorted by.

Change-Id: I1c1a3016d75aca77a040d2680074d5fb4f44da3c
Signed-off-by: Allon Mureinik <amureini@redhat.com>
webadmin: Remove commented out block from Linq

Change-Id: I76377bf859e330a5662a25021fe77b31b71dec46
Signed-off-by: Allon Mureinik <amureini@redhat.com>
webadmin: Clean up RpmVersion comparing

RpmVersionComparaer just returns the natural ordering of RpmVersion, and
is thus redundant and should be removed.

Instead of calling the soon to be delete Linq.orderByDescending, Java's
built in Collection.reverseOrder() is used to sort the list of
RpmVersions more efficiently.

Change-Id: I5e2fb041d3254ae5629972efa882462dd8f941d4
Signed-off-by: Allon Mureinik <amureini@redhat.com>
webadmin: Remove Linq.orderByDescending(List)

This method is not used anywhere in the codebase, and can safely be
removed.

Change-Id: I1cdfe1de5277340126325de77634e3bb2dea4304
Signed-off-by: Allon Mureinik <amureini@redhat.com>
webadmin: Linq.orderByDescending(List, Comparator)

Removed Linq.orderByDescending (List, Comparator), as it is completely
equivalent to the JDK's built-in
Collections.sort (List, Collections.reverseOrder(Comparator)).

Change-Id: Ib23b7152ed5c01042dc60eff3462f25c8cac5cc6
Signed-off-by: Allon Mureinik <amureini@redhat.com>
webadmin: Added serialVersionUUID to Linq

Change debe519fe5ccce6bf2f2ab9827e5cff48e34b728 made all the comparators
in Linq serializeable.
This patch completes the work and gives them all serialVersionUUIDs, as
per Java's requirement.

Change-Id: I660dea6f21d567da6d1cab2c5dd81d834eae2616
Signed-off-by: Allon Mureinik <amureini@redhat.com>
webadmin: Remove redundant parens in Linq

Removed redundant parens that only hinder readability from
Linq.AuditLoqComparer.

Change-Id: Iecd96483386019bd4ffc0ec7c5995c678c116aea
Signed-off-by: Allon Mureinik <amureini@redhat.com>