1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.sys.spring.datadictionary;
17
18 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
19 import org.springframework.beans.factory.xml.ParserContext;
20 import org.springframework.util.StringUtils;
21 import org.w3c.dom.Element;
22
23 public class FieldBeanDefinitionParser extends KualiBeanDefinitionParserBase {
24
25 @Override
26 protected String getBaseBeanTypeParent(Element element) {
27 return "FieldDefinition";
28 }
29
30 @Override
31 protected void doParse(Element element, ParserContext context, BeanDefinitionBuilder bean) {
32
33 String attributeName = element.getAttribute("attributeName");
34 String required = element.getAttribute("required");
35 String inquiry = element.getAttribute("inquiry");
36 String lookup = element.getAttribute("lookup");
37 String defaultValue = element.getAttribute("defaultValue");
38 String defaultValueFinderClass = element.getAttribute("defaultValueFinderClass");
39 String maxLength = element.getAttribute("maxLength");
40 String useShortLabel = element.getAttribute("useShortLabel");
41 String hidden = element.getAttribute("hidden");
42 String readOnly = element.getAttribute("readOnly");
43
44
45 if ( StringUtils.hasText(attributeName) ) {
46 bean.addPropertyValue("attributeName", attributeName);
47 }
48 if ( StringUtils.hasText(required) ) {
49 bean.addPropertyValue("required", Boolean.parseBoolean(required));
50 }
51 if ( StringUtils.hasText(defaultValue) ) {
52 bean.addPropertyValue("defaultValue", defaultValue);
53 } else if ( StringUtils.hasText(defaultValueFinderClass) ) {
54 bean.addPropertyValue("defaultValueFinderClass", defaultValueFinderClass);
55 }
56 if ( StringUtils.hasText(maxLength) ) {
57 bean.addPropertyValue("maxLength", Integer.parseInt(maxLength));
58 }
59 if ( inquiry.equals( "no" ) ) {
60 bean.addPropertyValue("noInquiry", Boolean.TRUE);
61 } else if ( inquiry.equals( "force" ) ) {
62 bean.addPropertyValue("forceInquiry", Boolean.TRUE);
63 }
64 if ( lookup.equals( "no" ) ) {
65 bean.addPropertyValue("noLookup", Boolean.TRUE);
66 } else if ( lookup.equals( "force" ) ) {
67 bean.addPropertyValue("forceLookup", Boolean.TRUE);
68 }
69 if ( StringUtils.hasText(useShortLabel) ) {
70 bean.addPropertyValue("useShortLabel", Boolean.parseBoolean(useShortLabel));
71 }
72 if ( StringUtils.hasText(hidden)) {
73 bean.addPropertyValue("hidden", Boolean.parseBoolean(hidden));
74 }
75 if ( StringUtils.hasText(readOnly)) {
76 bean.addPropertyValue("readOnly", Boolean.parseBoolean(readOnly));
77 }
78
79
80 parseEmbeddedPropertyElements(element, bean);
81 }
82
83
84 }