BrightSide Workbench Full Report + Source Code
org.turro.contacts.util.TypedRelationComparator Class Reference
Inheritance diagram for org.turro.contacts.util.TypedRelationComparator:
Collaboration diagram for org.turro.contacts.util.TypedRelationComparator:

Public Member Functions

int compare (BusinessRelation o1, BusinessRelation o2)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 30 of file TypedRelationComparator.java.

Member Function Documentation

◆ compare()

int org.turro.contacts.util.TypedRelationComparator.compare ( BusinessRelation  o1,
BusinessRelation  o2 
)

Definition at line 33 of file TypedRelationComparator.java.

33  {
34  int result = -CompareUtil.compareNull(o1.getContact(), o2.getContact());
35  if(result == 0) {
36  result = -CompareUtil.compareNull(o1.getBusiness(), o2.getBusiness());
37  }
38  if(result == 0) {
39  RelationType rt1 = RelationType.getFromString(o1.getRelationType()),
40  rt2 = RelationType.getFromString(o2.getRelationType());
41  if(rt1 != null && rt2 != null) {
42  result = CompareUtil.compare((rt1.getGroup() * 10000) + rt1.getLevel(), (rt2.getGroup() * 10000) + rt2.getLevel());
43  }
44  }
45  if(result == 0) {
46  result = CompareUtil.compare(o1.getFormattedDescription(), o2.getFormattedDescription());
47  }
48  if(result == 0) {
49  String id1 = o1.getContact() == null ? null : o1.getContact().getId(),
50  id2 = o2.getContact() == null ? null : o2.getContact().getId();
51  result = CompareUtil.compare(id1, id2);
52  }
53  if(result == 0) {
54  String id1 = o1.getBusiness()== null ? null : o1.getBusiness().getId(),
55  id2 = o2.getBusiness()== null ? null : o2.getBusiness().getId();
56  result = CompareUtil.compare(id1, id2);
57  }
58  if(result == 0) {
59  result = CompareUtil.compare(o1.getId(), o2.getId());
60  }
61  return result;
62  }
Here is the call graph for this function:

The documentation for this class was generated from the following file: