01: /*
02: * Copyright 2005-2006 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.php
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package edu.iu.uis.eden.actionlist.dao;
18:
19: import java.util.Comparator;
20:
21: import edu.iu.uis.eden.actionitem.ActionItem;
22: import edu.iu.uis.eden.actionrequests.ActionRequestValue;
23:
24: /**
25: * Compares an action item to another action item.
26: *
27: * @author ewestfal
28: */
29: public class ActionItemComparator implements Comparator {
30:
31: public int compare(Object object1, Object object2)
32: throws ClassCastException {
33: ActionItem actionItem1 = (ActionItem) object1;
34: ActionItem actionItem2 = (ActionItem) object2;
35: int actionCodeValue = ActionRequestValue.compareActionCode(
36: actionItem1.getActionRequestCd(), actionItem2
37: .getActionRequestCd());
38: if (actionCodeValue != 0) {
39: return actionCodeValue;
40: }
41: int recipientTypeValue = ActionRequestValue
42: .compareRecipientType(actionItem1
43: .getRecipientTypeCode(), actionItem2
44: .getRecipientTypeCode());
45: if (recipientTypeValue != 0) {
46: return recipientTypeValue;
47: }
48: return ActionRequestValue.compareDelegationType(actionItem1
49: .getDelegationType(), actionItem2.getDelegationType());
50: }
51:
52: }
|