001: /*
002: * Copyright 2005-2006 The Kuali Foundation.
003: *
004: *
005: * Licensed under the Educational Community License, Version 1.0 (the "License");
006: * you may not use this file except in compliance with the License.
007: * You may obtain a copy of the License at
008: *
009: * http://www.opensource.org/licenses/ecl1.php
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package edu.iu.uis.eden.actions;
018:
019: import java.io.Serializable;
020: import java.util.ArrayList;
021: import java.util.List;
022:
023: import edu.iu.uis.eden.EdenConstants;
024:
025: /**
026: * Specifies a set of Action codes.
027: *
028: * @author ewestfal
029: */
030: public class ActionSet implements Serializable {
031:
032: /**
033: *
034: */
035: private static final long serialVersionUID = 7857749268529671300L;
036: private List actionSet = new ArrayList();
037:
038: public boolean hasAction(String actionCode) {
039: return actionSet.contains(actionCode);
040: }
041:
042: public boolean addAction(String actionCode) {
043: if (!actionSet.contains(actionCode)) {
044: actionSet.add(actionCode);
045: return true;
046: }
047: return false;
048: }
049:
050: public boolean removeAction(String actionCode) {
051: return actionSet.remove(actionCode);
052: }
053:
054: // some convienance methods for common actions
055:
056: public boolean hasApprove() {
057: return hasAction(EdenConstants.ACTION_TAKEN_APPROVED_CD);
058: }
059:
060: public boolean hasComplete() {
061: return hasAction(EdenConstants.ACTION_TAKEN_COMPLETED_CD);
062: }
063:
064: public boolean hasAcknowledge() {
065: return hasAction(EdenConstants.ACTION_TAKEN_ACKNOWLEDGED_CD);
066: }
067:
068: public boolean hasFyi() {
069: return hasAction(EdenConstants.ACTION_TAKEN_FYI_CD);
070: }
071:
072: public boolean hasDisapprove() {
073: return hasAction(EdenConstants.ACTION_TAKEN_DENIED_CD);
074: }
075:
076: public boolean hasCancel() {
077: return hasAction(EdenConstants.ACTION_TAKEN_CANCELED_CD);
078: }
079:
080: public boolean hasRouted() {
081: return hasAction(EdenConstants.ACTION_TAKEN_ROUTED_CD);
082: }
083:
084: public boolean addApprove() {
085: return addAction(EdenConstants.ACTION_TAKEN_APPROVED_CD);
086: }
087:
088: public boolean addComplete() {
089: return addAction(EdenConstants.ACTION_TAKEN_COMPLETED_CD);
090: }
091:
092: public boolean addAcknowledge() {
093: return addAction(EdenConstants.ACTION_TAKEN_ACKNOWLEDGED_CD);
094: }
095:
096: public boolean addFyi() {
097: return addAction(EdenConstants.ACTION_TAKEN_FYI_CD);
098: }
099:
100: public boolean addDisapprove() {
101: return addAction(EdenConstants.ACTION_TAKEN_DENIED_CD);
102: }
103:
104: public boolean addCancel() {
105: return addAction(EdenConstants.ACTION_TAKEN_CANCELED_CD);
106: }
107:
108: public boolean addRouted() {
109: return addAction(EdenConstants.ACTION_TAKEN_ROUTED_CD);
110: }
111: }
|