1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.pluto.portlet.admin.util;
17
18 import java.util.Comparator;
19
20 import org.apache.pluto.portalImpl.om.entity.impl.PortletApplicationEntityImpl;
21 import org.apache.pluto.portlet.admin.BaseAdminObject;
22
23 /***
24 * Implementation of Comparator for comparing Castor
25 * PortletApplicationEntityImp instances.
26 * .
27 *
28 * @author Craig Doremus
29 * @see org.apache.pluto.portalImpl.om.entity.impl.PortletApplicationEntityImpl
30 */
31 public class PortletApplicationEntityImplComparator extends BaseAdminObject implements Comparator {
32
33 private static final String CLASS_NAME = "PortletApplicationEntityImplComparator";
34 public PortletApplicationEntityImplComparator() {
35 super(CLASS_NAME);
36 }
37 /***
38 * Implementation method
39 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
40 */
41 public int compare(Object obj1, Object obj2) {
42 if (!(obj1 instanceof PortletApplicationEntityImpl) || !(obj2 instanceof PortletApplicationEntityImpl)) {
43 throw new ClassCastException("Wrong class type used for PortletApplicationEntityImplComparator");
44 } else {
45 PortletApplicationEntityImpl app1 = (PortletApplicationEntityImpl)obj1;
46 PortletApplicationEntityImpl app2 = (PortletApplicationEntityImpl)obj2;
47 return app1.getCastorId().compareTo(app2.getCastorId());
48 }
49 }
50
51 }