-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFieldOrder.java
More file actions
99 lines (83 loc) · 3.18 KB
/
Copy pathFieldOrder.java
File metadata and controls
99 lines (83 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package javaxt.exchange;
//******************************************************************************
//** FieldOrder Class
//******************************************************************************
/**
* This class is used by the Folder.getItems() method to sort results.
*
******************************************************************************/
public class FieldOrder {
private FieldURI field;
private boolean descending;
//**************************************************************************
//** Constructor
//**************************************************************************
/** Creates a new instance of this class using a FieldURI or
* ExtendedFieldURI.
*
* @param field A FieldURI or ExtendedFieldURI representing a field to sort
* by.
*
* @param descending Indicates the sort direction. True indicates descending
* order. False indicates ascending order.
*/
public FieldOrder(FieldURI field, boolean descending){
this.field = field;
this.descending = descending;
}
//**************************************************************************
//** getField
//**************************************************************************
/** Returns the FieldURI or ExtendedFieldURI by which to sort.
*/
public FieldURI getField(){
return field;
}
//**************************************************************************
//** getOrder
//**************************************************************************
/** Returns the direction of the sort (e.g. "Ascending" or "Descending").
*/
public String getOrder(){
return descending? "Descending" : "Ascending";
}
//**************************************************************************
//** toXML
//**************************************************************************
/** Returns an XML fragment representing the field and order. This method is
* used by the
* http://msdn.microsoft.com/en-us/library/aa564968%28v=exchg.140%29.aspx
*/
protected String toXML(){
return
"<t:FieldOrder Order=\"" + getOrder() + "\">" + this.field.toXML("t") +
"</t:FieldOrder>";
}
public String toString(){
return field.toString() + " " + getOrder();
}
//**************************************************************************
//** hashCode
//**************************************************************************
/** Returns the field's hash code.
*/
public int hashCode(){
return field.hashCode();
}
//**************************************************************************
//** equals
//**************************************************************************
/** Used to compare this FieldOrder to another. Returns true if the field
* and sort direction match.
*/
public boolean equals(Object obj){
if (obj!=null){
if (obj instanceof FieldOrder){
FieldOrder field = (FieldOrder) obj;
return (field.hashCode()==this.hashCode() &&
field.descending==this.descending);
}
}
return false;
}
}