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 MaintenanceFieldBeanDefinitionParser extends KualiBeanDefinitionParserBase {
24
25 @Override
26 protected String getBaseBeanTypeParent(Element element) {
27 return "MaintainableFieldDefinition";
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 unconditionallyReadOnly = element.getAttribute("unconditionallyReadOnly");
36 String defaultValue = element.getAttribute("defaultValue");
37 String defaultValueFinderClass = element.getAttribute("defaultValueFinderClass");
38 String javascriptLeaveFieldFunction = element.getAttribute("javascriptLeaveFieldFunction");
39 String javascriptLeaveFieldCallbackFunction = element.getAttribute("javascriptLeaveFieldCallbackFunction");
40
41
42 if ( StringUtils.hasText(attributeName) ) {
43 bean.addPropertyValue("name", attributeName);
44 }
45 if ( StringUtils.hasText(required) ) {
46 bean.addPropertyValue("required", Boolean.parseBoolean(required));
47 }
48 if ( StringUtils.hasText(unconditionallyReadOnly) ) {
49 bean.addPropertyValue("unconditionallyReadOnly", Boolean.parseBoolean(unconditionallyReadOnly));
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(javascriptLeaveFieldFunction) ) {
57 bean.addPropertyValue("webUILeaveFieldFunction", javascriptLeaveFieldFunction);
58 }
59 if ( StringUtils.hasText(javascriptLeaveFieldCallbackFunction) ) {
60 bean.addPropertyValue("webUILeaveFieldCallbackFunction", javascriptLeaveFieldCallbackFunction);
61 }
62
63
64 parseEmbeddedPropertyElements(element, bean);
65 }
66
67
68 }