001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
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 org.apache.jetspeed.profiler.rules.impl;
018:
019: import org.apache.jetspeed.profiler.rules.RuleCriterion;
020:
021: /**
022: * RuleCriterionImpl
023: *
024: * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
025: * @version $Id: RuleCriterionImpl.java 516448 2007-03-09 16:25:47Z ate $
026: */
027: public class RuleCriterionImpl implements RuleCriterion {
028: private String id;
029: private String ruleId;
030: private String type;
031: private String name = null;
032: private String value;
033: private int fallbackType = RuleCriterion.FALLBACK_CONTINUE;
034: private int fallbackOrder;
035:
036: public RuleCriterionImpl() {
037: }
038:
039: public RuleCriterionImpl(RuleCriterion master) {
040: this .name = master.getName();
041: this .ruleId = master.getRuleId();
042: this .type = master.getType();
043: this .value = master.getValue();
044: this .fallbackOrder = master.getFallbackOrder();
045: this .fallbackType = master.getFallbackType();
046: }
047:
048: /**
049: * two objects of type RuleCriterion should be considered equal if their name and type are the same
050: *
051: */
052: public boolean equals(Object o) {
053: if (this == o)
054: return true;
055: if ((o == null) || (!(o instanceof RuleCriterion)))
056: return false;
057: RuleCriterion r = (RuleCriterion) o;
058: if (this .name != null) {
059: if (!(this .name.equals(r.getName())))
060: return false;
061: } else if (r.getName() != null)
062: return false;
063: if (this .type != null) {
064: if (!(this .type.equals(r.getName())))
065: return false;
066: } else if (r.getType() != null)
067: return false;
068: return true;
069:
070: }
071:
072: /* (non-Javadoc)
073: * @see org.apache.jetspeed.profiler.rules.RuleCriterion#getType()
074: */
075: public String getType() {
076: return this .type;
077: }
078:
079: /* (non-Javadoc)
080: * @see org.apache.jetspeed.profiler.rules.RuleCriterion#setType(java.lang.String)
081: */
082: public void setType(String type) {
083: this .type = type;
084: }
085:
086: /* (non-Javadoc)
087: * @see org.apache.jetspeed.profiler.rules.RuleCriterion#getName()
088: */
089: public String getName() {
090: return this .name;
091: }
092:
093: /* (non-Javadoc)
094: * @see org.apache.jetspeed.profiler.rules.RuleCriterion#setName(java.lang.String)
095: */
096: public void setName(String name) {
097: this .name = name;
098: }
099:
100: /* (non-Javadoc)
101: * @see org.apache.jetspeed.profiler.rules.RuleCriterion#getRuleId()
102: */
103: public String getRuleId() {
104: return ruleId;
105: }
106:
107: /* (non-Javadoc)
108: * @see org.apache.jetspeed.profiler.rules.RuleCriterion#setRuleId(java.lang.String)
109: */
110: public void setRuleId(String ruleId) {
111: this .ruleId = ruleId;
112: }
113:
114: /* (non-Javadoc)
115: * @see org.apache.jetspeed.profiler.rules.RuleCriterion#getFallbackOrder()
116: */
117: public int getFallbackOrder() {
118: return fallbackOrder;
119: }
120:
121: /* (non-Javadoc)
122: * @see org.apache.jetspeed.profiler.rules.RuleCriterion#getValue()
123: */
124: public String getValue() {
125: return value;
126: }
127:
128: /* (non-Javadoc)
129: * @see org.apache.jetspeed.profiler.rules.RuleCriterion#setFallbackOrder(int)
130: */
131: public void setFallbackOrder(int i) {
132: fallbackOrder = i;
133: }
134:
135: /* (non-Javadoc)
136: * @see org.apache.jetspeed.profiler.rules.RuleCriterion#setValue(java.lang.String)
137: */
138: public void setValue(String value) {
139: this .value = value;
140: }
141:
142: /* (non-Javadoc)
143: * @see org.apache.jetspeed.profiler.rules.RuleCriterion#getFallbackType()
144: */
145: public int getFallbackType() {
146: return fallbackType;
147: }
148:
149: /* (non-Javadoc)
150: * @see org.apache.jetspeed.profiler.rules.RuleCriterion#setFallbackType(int)
151: */
152: public void setFallbackType(int i) {
153: fallbackType = i;
154: }
155:
156: }
|