01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.kuali.workflow.attribute;
17:
18: import org.w3c.dom.Element;
19:
20: /**
21: * This class...
22: */
23: public class KualiXMLBooleanTranslatorSearchableAttributeImpl extends
24: KualiXmlSearchableAttributeImpl {
25:
26: public static final String VALUE_FOR_TRUE = "Yes";
27: public static final String VALUE_FOR_FALSE = "No";
28:
29: private boolean alreadyTranslated = false;
30:
31: /**
32: * TODO delyea - documentation
33: *
34: * @see org.kuali.workflow.attribute.KualiXmlSearchableAttributeImpl#getConfigXML()
35: */
36: @Override
37: public Element getConfigXML() {
38: alreadyTranslated = true;
39: String[] xpathElementsToInsert = new String[3];
40: xpathElementsToInsert[0] = "concat( substring('"
41: + getValueForXPathTrueEvaluation() + "', number(not(";
42: xpathElementsToInsert[1] = "))*string-length('"
43: + getValueForXPathTrueEvaluation()
44: + "')+1), substring('"
45: + getValueForXPathFalseEvaluation() + "', number(";
46: xpathElementsToInsert[2] = ")*string-length('"
47: + getValueForXPathFalseEvaluation() + "')+1))";
48: Element root = super .getAttributeConfigXML();
49: return new KualiXmlAttributeHelper().processConfigXML(root,
50: xpathElementsToInsert);
51: }
52:
53: public String getValueForXPathTrueEvaluation() {
54: return VALUE_FOR_TRUE;
55: }
56:
57: public String getValueForXPathFalseEvaluation() {
58: return VALUE_FOR_FALSE;
59: }
60:
61: }
|