1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package nl.hippo.portal.cms.repository;
17
18 import nl.hippo.client.api.content.Document;
19
20 public class WebdavResource implements Comparable {
21
22 private Document document;
23
24 public WebdavResource(Document document){
25 this.document=document;
26 }
27
28 public Document getDocument() {
29 return document;
30 }
31
32 public boolean equals(Object o){
33 if (o instanceof WebdavResource){
34 return this.document.getPath().equals(((WebdavResource)o).getDocument().getPath());
35 }
36 return false;
37 }
38
39 public int compareTo(Object o) {
40 if (o instanceof WebdavResource){
41 Document otherDoc = ((WebdavResource)o).getDocument();
42 Integer thisInteger = this.document.getMetadata().getIndex();
43 Integer otherInteger = otherDoc.getMetadata().getIndex();
44
45 if (thisInteger == null && otherInteger == null){
46 return (this == o)?0:-1;
47 } else
48 if (thisInteger == null){
49 return 1;
50 } else
51 if (otherInteger == null){
52 return -1;
53 } else {
54 return thisInteger.compareTo(otherInteger);
55 }
56 }
57 return -1;
58 }
59
60
61 }