1 package org.apache.ojb.broker.accesslayer;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 import java.util.HashMap;
19 import java.util.Map;
20
21 import org.apache.ojb.broker.PersistenceBroker;
22 import org.apache.ojb.broker.metadata.CollectionDescriptor;
23 import org.apache.ojb.broker.query.Query;
24 import org.apache.ojb.broker.query.QueryByCriteria;
25
26
27
28
29
30
31
32 public class QueryCustomizerDefaultImpl implements QueryCustomizer
33 {
34
35 private Map m_attributeList = null;
36
37
38
39
40 public QueryCustomizerDefaultImpl()
41 {
42 super();
43 }
44
45
46
47
48
49
50 public Query customizeQuery(Object anObject, PersistenceBroker aBroker, CollectionDescriptor aCod, QueryByCriteria aQuery)
51 {
52 return aQuery;
53 }
54
55
56
57
58
59 public void addAttribute(String attributeName, String attributeValue)
60 {
61 if (attributeName==null)
62 {
63 return;
64 }
65 if (m_attributeList==null)
66 {
67 m_attributeList=new HashMap();
68 }
69 m_attributeList.put(attributeName,attributeValue);
70 }
71
72
73
74
75 public String getAttribute(String attributeName, String defaultValue)
76 {
77 String result = defaultValue;
78 if (m_attributeList!=null)
79 {
80 result = (String)m_attributeList.get(attributeName);
81 if (result==null)
82 {
83 result = defaultValue;
84 }
85 }
86 return result;
87 }
88
89
90
91
92 public String getAttribute(String attributeName)
93 {
94 return this.getAttribute(attributeName,null);
95 }
96
97 }