01: /**
02: * $Id: GatewayAttributeComparator.java,v 1.4 2005/11/30 11:27:13 ss150821 Exp $
03: * Copyright 2001 Sun Microsystems, Inc. Some preexisting
04: * portions Copyright 2001 Netscape Communications Corp.
05: * All rights reserved. Use of this product is subject to
06: * license terms. Federal Acquisitions: Commercial Software --
07: * Government Users Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and iPlanet are
11: * trademarks or registered trademarks of Sun Microsystems, Inc.
12: * in the United States and other countries. Netscape and the
13: * Netscape N logo are registered trademarks of Netscape
14: * Communications Corporation in the U.S. and other countries.
15: * Other Netscape logos, product names, and service names are
16: * also trademarks of Netscape Communications Corporation,
17: * which may be registered in other countries.
18: */package com.sun.portal.rproxy.admin.model;
19:
20: //import com.iplanet.sm.AttributeSchema;
21: import com.sun.identity.sm.AttributeSchema;
22: import com.sun.portal.log.common.PortalLogger;
23: import java.util.Comparator;
24:
25: /*
26: * The attributes that appear in the properties page or data frame, for a
27: * service, are sorted by their i18nKey. This class provides the comparator
28: * for the TreeSet class to maintain this sorting order.
29: */
30: public class GatewayAttributeComparator implements Comparator {
31: /*
32: * Same as compareTo method of class String and compares the i18nKeys.
33: *
34: * @param o1 Object of type AttributeSchema
35: * @param o2 Object of type AttributeSchema
36: * @return the value 0 if o1's key is equal to o2's key;
37: * a value less than 0 if o1's key is lexicographically less than
38: * the o2's key; and a value greater than 0 if o1's key
39: * is lexicographically greater than the o2's key.
40: */
41: public int compare(Object o1, Object o2) {
42: AttributeSchema as1 = (AttributeSchema) o1;
43: AttributeSchema as2 = (AttributeSchema) o2;
44: String key1 = as1.getI18NKey();
45: String key2 = as2.getI18NKey();
46: return key1.compareTo(key2);
47: }
48: }
|