|
@@ -1,14 +1,11 @@ |
1 |
1 |
|
// This Source Code is in the Public Domain per: http://unlicense.org |
2 |
2 |
|
package org.litesoft.GWT.forms.server; |
3 |
3 |
|
|
4 |
|
- |
import org.litesoft.commonfoundation.typeutils.*; |
5 |
|
- |
|
6 |
|
- |
import java.util.*; |
7 |
|
- |
|
8 |
4 |
|
import org.litesoft.GWT.forms.server.support.*; |
9 |
5 |
|
import org.litesoft.GWT.forms.server.support.mdconstruction.*; |
10 |
6 |
|
import org.litesoft.GWT.forms.server.support.nonpublic.*; |
11 |
7 |
|
import org.litesoft.commonfoundation.typeutils.Objects; |
|
8 |
+ |
import org.litesoft.commonfoundation.typeutils.*; |
12 |
9 |
|
import org.litesoft.core.simpletypes.*; |
13 |
10 |
|
import org.litesoft.orsup.base.*; |
14 |
11 |
|
import org.litesoft.orsup.otherattributeaccessors.*; |
|
@@ -18,24 +15,22 @@ |
18 |
15 |
|
import org.litesoft.ui.support.*; |
19 |
16 |
|
import org.litesoft.ui_1_5.*; |
20 |
17 |
|
|
21 |
|
- |
public class POFormServicePeer extends AbstractFormServicePeer |
22 |
|
- |
{ |
|
18 |
+ |
import java.util.*; |
|
19 |
+ |
|
|
20 |
+ |
public class POFormServicePeer extends AbstractFormServicePeer { |
23 |
21 |
|
public static final String ERR_PO_NOT_FOUND = "PoNotFound"; |
24 |
22 |
|
|
25 |
23 |
|
protected final NonTransactionalFinder mFinder; |
26 |
24 |
|
|
27 |
|
- |
public POFormServicePeer( NonTransactionalFinder pFinder ) |
28 |
|
- |
{ |
|
25 |
+ |
public POFormServicePeer( NonTransactionalFinder pFinder ) { |
29 |
26 |
|
Objects.assertNotNull( "Finder", mFinder = pFinder ); |
30 |
27 |
|
} |
31 |
28 |
|
|
32 |
|
- |
public boolean clearToOneFilter( String pToOneAttributeName ) |
33 |
|
- |
{ |
|
29 |
+ |
public boolean clearToOneFilter( String pToOneAttributeName ) { |
34 |
30 |
|
return ((POTypeHelper) getRootTypeHelper()).clearToOneFilter( pToOneAttributeName ); |
35 |
31 |
|
} |
36 |
32 |
|
|
37 |
|
- |
public boolean setToOneFilter( String pToOneAttributeName, String pToOnesAttribute, Object pFilterValue ) |
38 |
|
- |
{ |
|
33 |
+ |
public boolean setToOneFilter( String pToOneAttributeName, String pToOnesAttribute, Object pFilterValue ) { |
39 |
34 |
|
return ((POTypeHelper) getRootTypeHelper()).setToOneFilter( pToOneAttributeName, pToOnesAttribute, |
40 |
35 |
|
pFilterValue ); |
41 |
36 |
|
} |
|
@@ -43,14 +38,12 @@ |
43 |
38 |
|
public TypeHelper createTypeHelper( FSPTypeHelperBackDoor pBackDoor, // |
44 |
39 |
|
ExternalizationInterface pExternalization, // |
45 |
40 |
|
FormAccessControl pAccessControl, // |
46 |
|
- |
TypeHelper pParent, String pRelativeType, FormUsage pUsage ) |
47 |
|
- |
{ |
|
41 |
+ |
TypeHelper pParent, String pRelativeType, FormUsage pUsage ) { |
48 |
42 |
|
return new POTypeHelper( pBackDoor, pExternalization, pAccessControl, pParent, pRelativeType, |
49 |
43 |
|
pUsage ); |
50 |
44 |
|
} |
51 |
45 |
|
|
52 |
|
- |
public InstanceHelper createRootInstanceHelper( TypeHelper pTypeHelper ) |
53 |
|
- |
{ |
|
46 |
+ |
public InstanceHelper createRootInstanceHelper( TypeHelper pTypeHelper ) { |
54 |
47 |
|
return new POInstanceHelper( pTypeHelper, null ); |
55 |
48 |
|
} |
56 |
49 |
|
|
|
@@ -59,8 +52,7 @@ |
59 |
52 |
|
* |
60 |
53 |
|
* @param pPO !null |
61 |
54 |
|
*/ |
62 |
|
- |
protected void onRootPoCreate( PersistentObject pPO ) |
63 |
|
- |
{ |
|
55 |
+ |
protected void onRootPoCreate( PersistentObject pPO ) { |
64 |
56 |
|
} |
65 |
57 |
|
|
66 |
58 |
|
/** |
|
@@ -68,36 +60,27 @@ |
68 |
60 |
|
* |
69 |
61 |
|
* @param pPO !null |
70 |
62 |
|
*/ |
71 |
|
- |
protected void onRootPoLoad( PersistentObject pPO ) |
72 |
|
- |
{ |
|
63 |
+ |
protected void onRootPoLoad( PersistentObject pPO ) { |
73 |
64 |
|
} |
74 |
65 |
|
|
75 |
|
- |
public void reloadOptions( String pToThemRegisteredPOName ) |
76 |
|
- |
{ |
77 |
|
- |
if ( !isDisposed() ) |
78 |
|
- |
{ |
|
66 |
+ |
public void reloadOptions( String pToThemRegisteredPOName ) { |
|
67 |
+ |
if ( !isDisposed() ) { |
79 |
68 |
|
updateComboBoxOptions( findAMDconvertPairsByRegisteredPOName( pToThemRegisteredPOName ) ); |
80 |
69 |
|
} |
81 |
70 |
|
} |
82 |
71 |
|
|
83 |
|
- |
private List<AMDconverterPair> findAMDconvertPairsByRegisteredPOName( String pRegisteredPOName ) |
84 |
|
- |
{ |
|
72 |
+ |
private List<AMDconverterPair> findAMDconvertPairsByRegisteredPOName( String pRegisteredPOName ) { |
85 |
73 |
|
List<AMDconverterPair> result = new ArrayList<AMDconverterPair>(); |
86 |
74 |
|
|
87 |
75 |
|
TypeHelper zHelper = getRootTypeHelper(); |
88 |
|
- |
if ( zHelper != null ) |
89 |
|
- |
{ |
|
76 |
+ |
if ( zHelper != null ) { |
90 |
77 |
|
AMDconverterPair[] zPairs = zHelper.getAMDconvertPairs(); |
91 |
|
- |
if ( zPairs != null ) |
92 |
|
- |
{ |
93 |
|
- |
for ( AMDconverterPair pair : zPairs ) |
94 |
|
- |
{ |
95 |
|
- |
if ( pair.getDataConverter() instanceof POKeyValuePairConverter ) |
96 |
|
- |
{ |
|
78 |
+ |
if ( zPairs != null ) { |
|
79 |
+ |
for ( AMDconverterPair pair : zPairs ) { |
|
80 |
+ |
if ( pair.getDataConverter() instanceof POKeyValuePairConverter ) { |
97 |
81 |
|
POKeyValuePairConverter converter = (POKeyValuePairConverter) pair.getDataConverter(); |
98 |
82 |
|
|
99 |
|
- |
if ( pRegisteredPOName.equals( converter.getRegisteredPOName() ) ) |
100 |
|
- |
{ |
|
83 |
+ |
if ( pRegisteredPOName.equals( converter.getRegisteredPOName() ) ) { |
101 |
84 |
|
result.add( pair ); |
102 |
85 |
|
} |
103 |
86 |
|
} |
|
@@ -108,25 +91,19 @@ |
108 |
91 |
|
return result; |
109 |
92 |
|
} |
110 |
93 |
|
|
111 |
|
- |
public void reloadOptionsByAttributeReference( String pAttributeReference ) |
112 |
|
- |
{ |
|
94 |
+ |
public void reloadOptionsByAttributeReference( String pAttributeReference ) { |
113 |
95 |
|
updateComboBoxOptions( findAMDconvertPairsByAttributeReference( pAttributeReference ) ); |
114 |
96 |
|
} |
115 |
97 |
|
|
116 |
|
- |
private List<AMDconverterPair> findAMDconvertPairsByAttributeReference( String pAttributeReference ) |
117 |
|
- |
{ |
|
98 |
+ |
private List<AMDconverterPair> findAMDconvertPairsByAttributeReference( String pAttributeReference ) { |
118 |
99 |
|
List<AMDconverterPair> result = new ArrayList<AMDconverterPair>(); |
119 |
100 |
|
|
120 |
101 |
|
TypeHelper zHelper = getRootTypeHelper(); |
121 |
|
- |
if ( zHelper != null ) |
122 |
|
- |
{ |
|
102 |
+ |
if ( zHelper != null ) { |
123 |
103 |
|
AMDconverterPair[] zPairs = zHelper.getAMDconvertPairs(); |
124 |
|
- |
if ( zPairs != null ) |
125 |
|
- |
{ |
126 |
|
- |
for ( AMDconverterPair pair : zPairs ) |
127 |
|
- |
{ |
128 |
|
- |
if ( pAttributeReference.equals( pair.getAttributeMetaData().getAttributeReference() ) ) |
129 |
|
- |
{ |
|
104 |
+ |
if ( zPairs != null ) { |
|
105 |
+ |
for ( AMDconverterPair pair : zPairs ) { |
|
106 |
+ |
if ( pAttributeReference.equals( pair.getAttributeMetaData().getAttributeReference() ) ) { |
130 |
107 |
|
result.add( pair ); |
131 |
108 |
|
} |
132 |
109 |
|
} |
|
@@ -136,25 +113,19 @@ |
136 |
113 |
|
return result; |
137 |
114 |
|
} |
138 |
115 |
|
|
139 |
|
- |
private void updateComboBoxOptions( List<AMDconverterPair> pPairs ) |
140 |
|
- |
{ |
|
116 |
+ |
private void updateComboBoxOptions( List<AMDconverterPair> pPairs ) { |
141 |
117 |
|
boolean updated = false; |
142 |
|
- |
if ( pPairs != null ) |
143 |
|
- |
{ |
144 |
|
- |
for ( AMDconverterPair pair : pPairs ) |
145 |
|
- |
{ |
|
118 |
+ |
if ( pPairs != null ) { |
|
119 |
+ |
for ( AMDconverterPair pair : pPairs ) { |
146 |
120 |
|
FormSendableDataConverter zDataConverter = pair.getDataConverter(); |
147 |
|
- |
if ( zDataConverter instanceof POKeyValuePairConverter ) |
148 |
|
- |
{ |
|
121 |
+ |
if ( zDataConverter instanceof POKeyValuePairConverter ) { |
149 |
122 |
|
POKeyValuePairConverter dataConverter = (POKeyValuePairConverter) zDataConverter; |
150 |
123 |
|
AttributeMetaData zAttributeMD = pair.getAttributeMetaData(); |
151 |
124 |
|
POTypeHelper helper = (POTypeHelper) getRootTypeHelper(); |
152 |
|
- |
if ( helper != null ) |
153 |
|
- |
{ |
|
125 |
+ |
if ( helper != null ) { |
154 |
126 |
|
SimpleKeyValuePair[] options = |
155 |
127 |
|
helper.getValidOptions( zAttributeMD.getAttributeReference(), dataConverter ); |
156 |
|
- |
if ( Objects.isNotNullOrEmpty( options ) ) |
157 |
|
- |
{ |
|
128 |
+ |
if ( Objects.isNotNullOrEmpty( options ) ) { |
158 |
129 |
|
ComboBoxAttributeUpdateFormData update = |
159 |
130 |
|
new ComboBoxAttributeUpdateFormData( null, zAttributeMD, options ); |
160 |
131 |
|
|
|
@@ -165,50 +136,39 @@ |
165 |
136 |
|
} |
166 |
137 |
|
} |
167 |
138 |
|
} |
168 |
|
- |
if ( updated ) |
169 |
|
- |
{ |
|
139 |
+ |
if ( updated ) { |
170 |
140 |
|
sendUnsolicitedData(); |
171 |
141 |
|
} |
172 |
142 |
|
} |
173 |
143 |
|
|
174 |
|
- |
public PersistentObject getRootPO() |
175 |
|
- |
{ |
|
144 |
+ |
public PersistentObject getRootPO() { |
176 |
145 |
|
return ((POInstanceHelper) getRootInstanceHelper()).getPO(); |
177 |
146 |
|
} |
178 |
147 |
|
|
179 |
|
- |
public void setRootPO( PersistentObject pPO ) |
180 |
|
- |
{ |
|
148 |
+ |
public void setRootPO( PersistentObject pPO ) { |
181 |
149 |
|
((POInstanceHelper) getRootInstanceHelper()).setPO( pPO ); |
182 |
150 |
|
} |
183 |
151 |
|
|
184 |
|
- |
protected boolean hasRootObject() |
185 |
|
- |
{ |
186 |
|
- |
if ( getRootPO() == null ) |
187 |
|
- |
{ |
|
152 |
+ |
protected boolean hasRootObject() { |
|
153 |
+ |
if ( getRootPO() == null ) { |
188 |
154 |
|
addError( ERR_PO_NOT_FOUND ); |
189 |
155 |
|
return false; |
190 |
156 |
|
} |
191 |
157 |
|
return true; |
192 |
158 |
|
} |
193 |
159 |
|
|
194 |
|
- |
protected String LLsharedNewRootObject( PersistentObject pPO ) |
195 |
|
- |
{ |
|
160 |
+ |
protected String LLsharedNewRootObject( PersistentObject pPO ) { |
196 |
161 |
|
RuntimeException zProblem; |
197 |
|
- |
if ( pPO != null ) |
198 |
|
- |
{ |
199 |
|
- |
try |
200 |
|
- |
{ |
|
162 |
+ |
if ( pPO != null ) { |
|
163 |
+ |
try { |
201 |
164 |
|
setRootPO( pPO ); |
202 |
165 |
|
onRootPoCreate( pPO ); // hook to let subclasses fiddle with the new PO |
203 |
166 |
|
return pPO.getPersistentObjectUniqueKey().toString(); |
204 |
167 |
|
} |
205 |
|
- |
catch ( RuntimeException e ) |
206 |
|
- |
{ |
|
168 |
+ |
catch ( RuntimeException e ) { |
207 |
169 |
|
zProblem = e; |
208 |
170 |
|
} |
209 |
|
- |
} |
210 |
|
- |
else |
211 |
|
- |
{ |
|
171 |
+ |
} else { |
212 |
172 |
|
zProblem = new RuntimeException( "No New Root Object" ); |
213 |
173 |
|
} |
214 |
174 |
|
setRootPO( null ); |
|
@@ -217,16 +177,14 @@ |
217 |
177 |
|
return null; |
218 |
178 |
|
} |
219 |
179 |
|
|
220 |
|
- |
protected Transaction createTransaction() |
221 |
|
- |
{ |
|
180 |
+ |
protected Transaction createTransaction() { |
222 |
181 |
|
return mFinder.createTransaction().setTransactionSource( FormServicePeer.class ); |
223 |
182 |
|
} |
224 |
183 |
|
|
225 |
184 |
|
/** |
226 |
185 |
|
* @return new Root Objects Key |
227 |
186 |
|
*/ |
228 |
|
- |
protected String LLnewRootObject() |
229 |
|
- |
{ |
|
187 |
+ |
protected String LLnewRootObject() { |
230 |
188 |
|
PersistentObject<?> zPersistentObject = LLnewRootPO(); |
231 |
189 |
|
return LLsharedNewRootObject( zPersistentObject ); |
232 |
190 |
|
} |
|
@@ -234,18 +192,15 @@ |
234 |
192 |
|
/** |
235 |
193 |
|
* @return true if succeeded |
236 |
194 |
|
*/ |
237 |
|
- |
protected boolean LLloadExistingRootObject( String pNewRootObjectKey ) |
238 |
|
- |
{ |
|
195 |
+ |
protected boolean LLloadExistingRootObject( String pNewRootObjectKey ) { |
239 |
196 |
|
PersistentObject<?> zPO = null; |
240 |
197 |
|
RuntimeException zProblem = null; |
241 |
|
- |
try |
242 |
|
- |
{ |
|
198 |
+ |
try { |
243 |
199 |
|
PersistentObjectUniqueKey zPOUK = |
244 |
200 |
|
mFinder.createPersistentObjectUniqueKeyFrom( getRootType(), pNewRootObjectKey ); |
245 |
201 |
|
zPO = LLloadExistingRootPO( zPOUK ); |
246 |
202 |
|
} |
247 |
|
- |
catch ( RuntimeException e ) |
248 |
|
- |
{ |
|
203 |
+ |
catch ( RuntimeException e ) { |
249 |
204 |
|
zProblem = e; |
250 |
205 |
|
} |
251 |
206 |
|
return LLsharedLoadingExistingRootObject( zPO, zProblem ); |
|
@@ -254,71 +209,56 @@ |
254 |
209 |
|
/** |
255 |
210 |
|
* @return true if succeeded |
256 |
211 |
|
*/ |
257 |
|
- |
protected boolean LLreloadExistingRootObject() |
258 |
|
- |
{ |
|
212 |
+ |
protected boolean LLreloadExistingRootObject() { |
259 |
213 |
|
PersistentObject zPO = null; |
260 |
214 |
|
RuntimeException zProblem = null; |
261 |
|
- |
try |
262 |
|
- |
{ |
|
215 |
+ |
try { |
263 |
216 |
|
zPO = LLreloadExistingRootPO(); |
264 |
217 |
|
} |
265 |
|
- |
catch ( RuntimeException e ) |
266 |
|
- |
{ |
|
218 |
+ |
catch ( RuntimeException e ) { |
267 |
219 |
|
zProblem = e; |
268 |
220 |
|
} |
269 |
221 |
|
return LLsharedLoadingExistingRootObject( zPO, zProblem ); |
270 |
222 |
|
} |
271 |
223 |
|
|
272 |
|
- |
protected PersistentObject<?> LLnewRootPO() |
273 |
|
- |
{ |
|
224 |
+ |
protected PersistentObject<?> LLnewRootPO() { |
274 |
225 |
|
return createTransaction().create( getRootType() ); |
275 |
226 |
|
} |
276 |
227 |
|
|
277 |
|
- |
protected PersistentObject<?> LLloadExistingRootPO( PersistentObjectUniqueKey pPOUK ) |
278 |
|
- |
{ |
|
228 |
+ |
protected PersistentObject<?> LLloadExistingRootPO( PersistentObjectUniqueKey pPOUK ) { |
279 |
229 |
|
return createTransaction().findOne( getRootType(), pPOUK ); |
280 |
230 |
|
} |
281 |
231 |
|
|
282 |
|
- |
protected PersistentObject<?> LLloadExistingRootPO( PersistentObjectURL pURL ) |
283 |
|
- |
{ |
|
232 |
+ |
protected PersistentObject<?> LLloadExistingRootPO( PersistentObjectURL pURL ) { |
284 |
233 |
|
return createTransaction().findOne( pURL ); |
285 |
234 |
|
} |
286 |
235 |
|
|
287 |
|
- |
protected PersistentObject<?> LLreloadExistingRootPO() |
288 |
|
- |
{ |
|
236 |
+ |
protected PersistentObject<?> LLreloadExistingRootPO() { |
289 |
237 |
|
return getRootPO().refreshInto( createTransaction() ); |
290 |
238 |
|
} |
291 |
239 |
|
|
292 |
|
- |
protected boolean LLsharedLoadingExistingRootObject( PersistentObject pPO, RuntimeException pProblem ) |
293 |
|
- |
{ |
294 |
|
- |
if ( pPO != null ) |
295 |
|
- |
{ |
296 |
|
- |
try |
297 |
|
- |
{ |
|
240 |
+ |
protected boolean LLsharedLoadingExistingRootObject( PersistentObject pPO, RuntimeException pProblem ) { |
|
241 |
+ |
if ( pPO != null ) { |
|
242 |
+ |
try { |
298 |
243 |
|
setRootPO( pPO ); |
299 |
244 |
|
onRootPoLoad( pPO ); |
300 |
245 |
|
return true; |
301 |
246 |
|
} |
302 |
|
- |
catch ( RuntimeException e ) |
303 |
|
- |
{ |
|
247 |
+ |
catch ( RuntimeException e ) { |
304 |
248 |
|
pProblem = e; |
305 |
249 |
|
} |
306 |
250 |
|
} |
307 |
251 |
|
setRootPO( null ); |
308 |
252 |
|
LOGGER.error.log( pProblem ); |
309 |
|
- |
if ( pProblem == null ) |
310 |
|
- |
{ |
|
253 |
+ |
if ( pProblem == null ) { |
311 |
254 |
|
addError( ERR_PO_NOT_FOUND ); |
312 |
|
- |
} |
313 |
|
- |
else |
314 |
|
- |
{ |
|
255 |
+ |
} else { |
315 |
256 |
|
addError( ERR_PO_NOT_FOUND, pProblem.getMessage() ); |
316 |
257 |
|
} |
317 |
258 |
|
return false; |
318 |
259 |
|
} |
319 |
260 |
|
|
320 |
|
- |
protected void LLcommit() |
321 |
|
- |
{ |
|
261 |
+ |
protected void LLcommit() { |
322 |
262 |
|
LLcommitPo( getRootPO().getTransaction() ); // commit what we've got |
323 |
263 |
|
mIsNewRootObject = false; // if it was new, not it's not! |
324 |
264 |
|
// start a new transaction |
|
@@ -326,29 +266,24 @@ |
326 |
266 |
|
setRootPO( getRootPO().copyInto( transaction ) ); |
327 |
267 |
|
} |
328 |
268 |
|
|
329 |
|
- |
protected void LLcommitPo( Transaction pTransaction ) |
330 |
|
- |
{ |
|
269 |
+ |
protected void LLcommitPo( Transaction pTransaction ) { |
331 |
270 |
|
pTransaction.setTransactionSource( FormServicePeer.class ); |
332 |
271 |
|
pTransaction.commit(); |
333 |
272 |
|
} |
334 |
273 |
|
|
335 |
|
- |
public class POInstanceHelper extends InstanceHelper |
336 |
|
- |
{ |
|
274 |
+ |
public class POInstanceHelper extends InstanceHelper { |
337 |
275 |
|
protected PersistentObject mPO; |
338 |
276 |
|
|
339 |
|
- |
public POInstanceHelper( TypeHelper pTypeHelper, PersistentObject pPO ) |
340 |
|
- |
{ |
|
277 |
+ |
public POInstanceHelper( TypeHelper pTypeHelper, PersistentObject pPO ) { |
341 |
278 |
|
super( pTypeHelper, (pPO != null) ? pPO.getPersistentObjectUniqueKey().toString() : null ); |
342 |
279 |
|
mPO = pPO; |
343 |
280 |
|
} |
344 |
281 |
|
|
345 |
|
- |
public synchronized PersistentObject getPO() |
346 |
|
- |
{ |
|
282 |
+ |
public synchronized PersistentObject getPO() { |
347 |
283 |
|
return mPO; |
348 |
284 |
|
} |
349 |
285 |
|
|
350 |
|
- |
public synchronized void setPO( PersistentObject pPO ) |
351 |
|
- |
{ |
|
286 |
+ |
public synchronized void setPO( PersistentObject pPO ) { |
352 |
287 |
|
mPO = pPO; |
353 |
288 |
|
} |
354 |
289 |
|
|
|
@@ -357,17 +292,13 @@ |
357 |
292 |
|
* |
358 |
293 |
|
* @return true if successful |
359 |
294 |
|
*/ |
360 |
|
- |
protected boolean removeRow() |
361 |
|
- |
{ |
|
295 |
+ |
protected boolean removeRow() { |
362 |
296 |
|
PersistentObject zPO = getPO(); |
363 |
|
- |
if ( zPO != null ) |
364 |
|
- |
{ |
365 |
|
- |
if ( zPO.isImmortal() ) |
366 |
|
- |
{ |
|
297 |
+ |
if ( zPO != null ) { |
|
298 |
+ |
if ( zPO.isImmortal() ) { |
367 |
299 |
|
MetaDataForPO zMetaDataForPO = zPO.getMetaDataForPO(); |
368 |
300 |
|
String zImmortalAttributeName = zMetaDataForPO.getInstanceImmortalImmortalAttributeName(); |
369 |
|
- |
if ( Strings.isNullOrEmpty( zImmortalAttributeName ) ) |
370 |
|
- |
{ |
|
301 |
+ |
if ( Strings.isNullOrEmpty( zImmortalAttributeName ) ) { |
371 |
302 |
|
mTypeHelper.getCollectorProxy().addError( |
372 |
303 |
|
mTypeHelper.resolveError( "MayNotRemoveImmortals" ) ); |
373 |
304 |
|
return true; |
|
@@ -379,58 +310,47 @@ |
379 |
310 |
|
return true; |
380 |
311 |
|
} |
381 |
312 |
|
|
382 |
|
- |
public boolean valueUpdated( String pAttributeReference, Object pValueForAttribute ) |
383 |
|
- |
{ |
384 |
|
- |
if ( hasRootObject() ) |
385 |
|
- |
{ |
|
313 |
+ |
public boolean valueUpdated( String pAttributeReference, Object pValueForAttribute ) { |
|
314 |
+ |
if ( hasRootObject() ) { |
386 |
315 |
|
setRawAttributeValue( pAttributeReference, pValueForAttribute ); |
387 |
316 |
|
} |
388 |
317 |
|
return true; |
389 |
318 |
|
} |
390 |
319 |
|
|
391 |
320 |
|
@SuppressWarnings({"unchecked"}) |
392 |
|
- |
protected Object getRawAttributeValue( String pAttributeRef ) |
393 |
|
- |
{ |
|
321 |
+ |
protected Object getRawAttributeValue( String pAttributeRef ) { |
394 |
322 |
|
PersistentObject zPO = getPO(); |
395 |
|
- |
if ( zPO == null ) |
396 |
|
- |
{ |
|
323 |
+ |
if ( zPO == null ) { |
397 |
324 |
|
return "No PO"; |
398 |
325 |
|
} |
399 |
326 |
|
|
400 |
|
- |
if ( !zPO.getMetaDataForPO().hasAttribute( pAttributeRef ) ) |
401 |
|
- |
{ |
|
327 |
+ |
if ( !zPO.getMetaDataForPO().hasAttribute( pAttributeRef ) ) { |
402 |
328 |
|
return "Field is missing"; |
403 |
329 |
|
} |
404 |
330 |
|
|
405 |
331 |
|
return zPO.getAttributeValue( pAttributeRef ); |
406 |
332 |
|
} |
407 |
333 |
|
|
408 |
|
- |
protected void setRawAttributeValue( String pAttributeRef, Object pValueForAttribute ) |
409 |
|
- |
{ |
|
334 |
+ |
protected void setRawAttributeValue( String pAttributeRef, Object pValueForAttribute ) { |
410 |
335 |
|
getPO().setAttributeValue( pAttributeRef, pValueForAttribute ); |
411 |
336 |
|
} |
412 |
337 |
|
|
413 |
|
- |
protected List<String> getRowKeysFor( String pRelSubFormRef ) |
414 |
|
- |
{ |
|
338 |
+ |
protected List<String> getRowKeysFor( String pRelSubFormRef ) { |
415 |
339 |
|
List<PersistentObject> zRelPOs = getRelatedPOs( pRelSubFormRef ); |
416 |
|
- |
if ( zRelPOs.isEmpty() ) |
417 |
|
- |
{ |
|
340 |
+ |
if ( zRelPOs.isEmpty() ) { |
418 |
341 |
|
return Collections.emptyList(); |
419 |
342 |
|
} |
420 |
343 |
|
List<String> zRowKeys = new ArrayList<String>( zRelPOs.size() ); |
421 |
|
- |
for ( PersistentObject zPO : zRelPOs ) |
422 |
|
- |
{ |
|
344 |
+ |
for ( PersistentObject zPO : zRelPOs ) { |
423 |
345 |
|
zRowKeys.add( zPO.getPersistentObjectUniqueKey().toString() ); |
424 |
346 |
|
} |
425 |
347 |
|
return zRowKeys; |
426 |
348 |
|
} |
427 |
349 |
|
|
428 |
350 |
|
@SuppressWarnings({"unchecked"}) |
429 |
|
- |
protected List<PersistentObject> getRelatedPOs( String pRelSubFormRef ) |
430 |
|
- |
{ |
|
351 |
+ |
protected List<PersistentObject> getRelatedPOs( String pRelSubFormRef ) { |
431 |
352 |
|
Object zValue = getRawAttributeValue( pRelSubFormRef ); |
432 |
|
- |
if ( zValue instanceof List ) |
433 |
|
- |
{ |
|
353 |
+ |
if ( zValue instanceof List ) { |
434 |
354 |
|
return (List<PersistentObject>) zValue; |
435 |
355 |
|
} |
436 |
356 |
|
LOGGER.error.log( "getRelatedPOs( '", pRelSubFormRef, "' ) on '", getPO(), "' resulted in: ", |
|
@@ -439,21 +359,18 @@ |
439 |
359 |
|
} |
440 |
360 |
|
} |
441 |
361 |
|
|
442 |
|
- |
protected class POTypeHelper extends TypeHelper |
443 |
|
- |
{ |
|
362 |
+ |
protected class POTypeHelper extends TypeHelper { |
444 |
363 |
|
protected MetaDataForPO mMetaDataForPO; |
445 |
364 |
|
|
446 |
365 |
|
public POTypeHelper( FSPTypeHelperBackDoor pBackDoor, // |
447 |
366 |
|
ExternalizationInterface pExternalization, // |
448 |
367 |
|
FormAccessControl pAccessControl, // |
449 |
|
- |
TypeHelper pParent, String pRelativeType, FormUsage pUsage ) |
450 |
|
- |
{ |
|
368 |
+ |
TypeHelper pParent, String pRelativeType, FormUsage pUsage ) { |
451 |
369 |
|
super( pBackDoor, pExternalization, pAccessControl, pParent, pRelativeType, pUsage ); |
452 |
370 |
|
mMetaDataForPO = mFinder.getMetaDataRequired( pRelativeType ); |
453 |
371 |
|
} |
454 |
372 |
|
|
455 |
|
- |
public MetaDataForPO getMetaDataForPO() |
456 |
|
- |
{ |
|
373 |
+ |
public MetaDataForPO getMetaDataForPO() { |
457 |
374 |
|
return mMetaDataForPO; |
458 |
375 |
|
} |
459 |
376 |
|
|
|
@@ -464,66 +381,53 @@ |
464 |
381 |
|
* |
465 |
382 |
|
* @return true if successful |
466 |
383 |
|
*/ |
467 |
|
- |
protected boolean createNewRow( InstanceHelper pParentInstanceHelper ) |
468 |
|
- |
{ |
469 |
|
- |
if ( !(pParentInstanceHelper instanceof POInstanceHelper) ) |
470 |
|
- |
{ |
|
384 |
+ |
protected boolean createNewRow( InstanceHelper pParentInstanceHelper ) { |
|
385 |
+ |
if ( !(pParentInstanceHelper instanceof POInstanceHelper) ) { |
471 |
386 |
|
throw new IllegalStateException( "No Parent or Unacceptable Instance" ); |
472 |
387 |
|
} |
473 |
388 |
|
PersistentObject zPO = ((POInstanceHelper) pParentInstanceHelper).getPO(); |
474 |
389 |
|
String zRelToThisSubForm = getRelToThisSubForm(); // Where to add |
475 |
390 |
|
PersistentObject zPOtoAdd = createNewRow( zPO.getTransaction() ); |
476 |
|
- |
if ( zPOtoAdd != null ) |
477 |
|
- |
{ |
|
391 |
+ |
if ( zPOtoAdd != null ) { |
478 |
392 |
|
zPO.addToAttributeSet( zRelToThisSubForm, zPOtoAdd ); |
479 |
393 |
|
return true; |
480 |
394 |
|
} |
481 |
395 |
|
return false; |
482 |
396 |
|
} |
483 |
397 |
|
|
484 |
|
- |
protected PersistentObject createNewRow( Transaction pTransaction ) |
485 |
|
- |
{ |
|
398 |
+ |
protected PersistentObject createNewRow( Transaction pTransaction ) { |
486 |
399 |
|
return mMetaDataForPO.createNew( pTransaction ); |
487 |
400 |
|
} |
488 |
401 |
|
|
489 |
|
- |
protected String cleanUpRelativeTypeForToolTip( String pRelativeType ) |
490 |
|
- |
{ |
|
402 |
+ |
protected String cleanUpRelativeTypeForToolTip( String pRelativeType ) { |
491 |
403 |
|
String s = "." + pRelativeType; |
492 |
404 |
|
return s.substring( s.lastIndexOf( '.' ) + 1 ); |
493 |
405 |
|
} |
494 |
406 |
|
|
495 |
|
- |
protected InstanceHelper LLcreateRelSubInstanceHelper( InstanceHelper pParent, String pRowKey ) |
496 |
|
- |
{ |
|
407 |
+ |
protected InstanceHelper LLcreateRelSubInstanceHelper( InstanceHelper pParent, String pRowKey ) { |
497 |
408 |
|
Transaction zTrans = ((POInstanceHelper) pParent).getPO().getTransaction(); |
498 |
409 |
|
PersistentObject zPO; |
499 |
|
- |
if ( pRowKey == null ) |
500 |
|
- |
{ |
|
410 |
+ |
if ( pRowKey == null ) { |
501 |
411 |
|
zPO = createNewRow( zTrans ); |
502 |
|
- |
} |
503 |
|
- |
else |
504 |
|
- |
{ |
|
412 |
+ |
} else { |
505 |
413 |
|
PersistentObjectUniqueKey zPOUK = mMetaDataForPO.createUniqueKeyFrom( pRowKey ); |
506 |
414 |
|
zPO = zTrans.findOne( mMetaDataForPO.getPOregistrationName(), zPOUK ); |
507 |
415 |
|
} |
508 |
416 |
|
return LLcreateRelSubInstanceHelper( zPO ); |
509 |
417 |
|
} |
510 |
418 |
|
|
511 |
|
- |
protected InstanceHelper LLcreateRelSubInstanceHelper( PersistentObject pPO ) |
512 |
|
- |
{ |
|
419 |
+ |
protected InstanceHelper LLcreateRelSubInstanceHelper( PersistentObject pPO ) { |
513 |
420 |
|
return new POInstanceHelper( this, pPO ); |
514 |
421 |
|
} |
515 |
422 |
|
|
516 |
|
- |
protected String determineRelSubFormRootType( String pRelAttributeRef ) |
517 |
|
- |
{ |
|
423 |
+ |
protected String determineRelSubFormRootType( String pRelAttributeRef ) { |
518 |
424 |
|
AttributeAccessorSCD scd = mMetaDataForPO.getAccessorSCDoptional( pRelAttributeRef ); |
519 |
|
- |
if ( scd == null ) |
520 |
|
- |
{ |
|
425 |
+ |
if ( scd == null ) { |
521 |
426 |
|
throw new IllegalArgumentException( mMetaDataForPO.getPOregistrationName() + |
522 |
427 |
|
" does not have an Attribute for: '" + pRelAttributeRef + |
523 |
428 |
|
"'" ); |
524 |
429 |
|
} |
525 |
|
- |
switch ( scd.getForm() ) |
526 |
|
- |
{ |
|
430 |
+ |
switch ( scd.getForm() ) { |
527 |
431 |
|
default: |
528 |
432 |
|
case Local: |
529 |
433 |
|
throw new IllegalArgumentException( mMetaDataForPO.getPOregistrationName() + |
|
@@ -532,8 +436,7 @@ |
532 |
436 |
|
case ToMany: |
533 |
437 |
|
return ((AbstractAttributeAccessorSCDtoMany) scd).getToThemName(); |
534 |
438 |
|
case ToOne: |
535 |
|
- |
if ( scd instanceof AttributeAccessorSCDtoOneRegular ) |
536 |
|
- |
{ |
|
439 |
+ |
if ( scd instanceof AttributeAccessorSCDtoOneRegular ) { |
537 |
440 |
|
return ((AttributeAccessorSCDtoOneRegular) scd).getToThemName(); |
538 |
441 |
|
} |
539 |
442 |
|
throw new IllegalArgumentException( |
|
@@ -542,16 +445,13 @@ |
542 |
445 |
|
} |
543 |
446 |
|
} |
544 |
447 |
|
|
545 |
|
- |
protected boolean validAttributeReference( String pLocalReference ) |
546 |
|
- |
{ |
|
448 |
+ |
protected boolean validAttributeReference( String pLocalReference ) { |
547 |
449 |
|
return (null != mMetaDataForPO.getAccessorSCDoptional( pLocalReference )); |
548 |
450 |
|
} |
549 |
451 |
|
|
550 |
|
- |
protected AMDconverterPair createAttributeMetaData( CreateAMDParams pParams ) |
551 |
|
- |
{ |
|
452 |
+ |
protected AMDconverterPair createAttributeMetaData( CreateAMDParams pParams ) { |
552 |
453 |
|
AttributeAccessorSCD scd = mMetaDataForPO.getAccessorSCDrequired( pParams.getLocalReference() ); |
553 |
|
- |
switch ( scd.getForm() ) |
554 |
|
- |
{ |
|
454 |
+ |
switch ( scd.getForm() ) { |
555 |
455 |
|
case Local: |
556 |
456 |
|
return createSimpleAMDpair( (AbstractAttributeAccessorSCDlocal) scd, pParams ); |
557 |
457 |
|
case ToOne: |
|
@@ -564,20 +464,17 @@ |
564 |
464 |
|
} |
565 |
465 |
|
|
566 |
466 |
|
protected AMDconverterPair createSimpleAMDpair( AbstractAttributeAccessorSCDlocal pSCD, |
567 |
|
- |
CreateAMDParams pParams ) |
568 |
|
- |
{ |
|
467 |
+ |
CreateAMDParams pParams ) { |
569 |
468 |
|
return createAttributeMetaData( new CreateAMDParamsPlus( pParams, pSCD ), // |
570 |
469 |
|
pSCD.getValidOptions(), false, pSCD.getColumnType() ); |
571 |
470 |
|
} |
572 |
471 |
|
|
573 |
|
- |
protected POQueryIterator getValidOptionsPOsOfType( String pToThemName, WhereClause pWhereClause ) |
574 |
|
- |
{ |
|
472 |
+ |
protected POQueryIterator getValidOptionsPOsOfType( String pToThemName, WhereClause pWhereClause ) { |
575 |
473 |
|
return mFinder.findAllCursored( pToThemName, pWhereClause ); |
576 |
474 |
|
} |
577 |
475 |
|
|
578 |
476 |
|
protected AMDconverterPair createToOneAMDpair( AbstractAttributeAccessorSCDtoOne pSCD, |
579 |
|
- |
CreateAMDParams pParams ) |
580 |
|
- |
{ |
|
477 |
+ |
CreateAMDParams pParams ) { |
581 |
478 |
|
POKeyValuePairConverter dataConverter = createToOneDataConverter( pSCD.getToThemName() ); |
582 |
479 |
|
|
583 |
480 |
|
return createAttributeMetaData( new CreateAMDParamsPlus( pParams, pSCD ), // |
|
@@ -586,24 +483,20 @@ |
586 |
483 |
|
dataConverter ); |
587 |
484 |
|
} |
588 |
485 |
|
|
589 |
|
- |
protected POKeyValuePairConverter createToOneDataConverter( String pToThemName ) |
590 |
|
- |
{ |
|
486 |
+ |
protected POKeyValuePairConverter createToOneDataConverter( String pToThemName ) { |
591 |
487 |
|
return new POKeyValuePairConverter( pToThemName ); |
592 |
488 |
|
} |
593 |
489 |
|
|
594 |
490 |
|
protected SimpleKeyValuePair[] getValidOptions( String pToOneAttributeName, |
595 |
|
- |
POKeyValuePairConverter pDataConverter ) |
596 |
|
- |
{ |
|
491 |
+ |
POKeyValuePairConverter pDataConverter ) { |
597 |
492 |
|
return getValidOptions( pToOneAttributeName, pDataConverter, null ); |
598 |
493 |
|
} |
599 |
494 |
|
|
600 |
495 |
|
protected SimpleKeyValuePair[] getValidOptions( String pToOneAttributeName, |
601 |
496 |
|
POKeyValuePairConverter pDataConverter, |
602 |
|
- |
WhereClause pWhereClause ) |
603 |
|
- |
{ |
|
497 |
+ |
WhereClause pWhereClause ) { |
604 |
498 |
|
ValidOptionsFieldFilter zFieldFilter = mValidOptionsFieldFilters.get( pToOneAttributeName ); |
605 |
|
- |
if ( zFieldFilter != null ) |
606 |
|
- |
{ |
|
499 |
+ |
if ( zFieldFilter != null ) { |
607 |
500 |
|
WhereClauseFactory f = WhereClauseFactory.INSTANCE; |
608 |
501 |
|
WhereClause zWhereClause = f.isEqual( zFieldFilter.getSCDtoFilterOn(), // |
609 |
502 |
|
zFieldFilter.getFilterValue() ); |
|
@@ -611,33 +504,26 @@ |
611 |
504 |
|
} |
612 |
505 |
|
POQueryIterator it = getValidOptionsPOsOfType( pDataConverter.getRegisteredPOName(), // |
613 |
506 |
|
pWhereClause ); |
614 |
|
- |
try |
615 |
|
- |
{ |
616 |
|
- |
if ( !it.hasNext() ) |
617 |
|
- |
{ |
|
507 |
+ |
try { |
|
508 |
+ |
if ( !it.hasNext() ) { |
618 |
509 |
|
return null; |
619 |
510 |
|
} |
620 |
511 |
|
List<SimpleKeyValuePair> options = new ArrayList<SimpleKeyValuePair>(); |
621 |
|
- |
while ( it.hasNext() ) |
622 |
|
- |
{ |
|
512 |
+ |
while ( it.hasNext() ) { |
623 |
513 |
|
PersistentObject po = it.next(); |
624 |
514 |
|
options.add( pDataConverter.createSimpleKeyValuePair( po ) ); |
625 |
515 |
|
} |
626 |
516 |
|
return options.toArray( new SimpleKeyValuePair[options.size()] ); |
627 |
517 |
|
} |
628 |
|
- |
finally |
629 |
|
- |
{ |
|
518 |
+ |
finally { |
630 |
519 |
|
it.releaseResources(); |
631 |
520 |
|
} |
632 |
521 |
|
} |
633 |
522 |
|
|
634 |
|
- |
private AMDconverterPair find1stPOKeyAMDconvertPairByAttributeReference( String pAttributeReference ) |
635 |
|
- |
{ |
636 |
|
- |
for ( AMDconverterPair pair : getRootTypeHelper().getAMDconvertPairs() ) |
637 |
|
- |
{ |
|
523 |
+ |
private AMDconverterPair find1stPOKeyAMDconvertPairByAttributeReference( String pAttributeReference ) { |
|
524 |
+ |
for ( AMDconverterPair pair : getRootTypeHelper().getAMDconvertPairs() ) { |
638 |
525 |
|
if ( pAttributeReference.equals( pair.getAttributeMetaData().getAttributeReference() ) && |
639 |
|
- |
(pair.getDataConverter() instanceof POKeyValuePairConverter) ) |
640 |
|
- |
{ |
|
526 |
+ |
(pair.getDataConverter() instanceof POKeyValuePairConverter) ) { |
641 |
527 |
|
return pair; |
642 |
528 |
|
} |
643 |
529 |
|
} |
|
@@ -645,10 +531,8 @@ |
645 |
531 |
|
return null; |
646 |
532 |
|
} |
647 |
533 |
|
|
648 |
|
- |
public boolean clearToOneFilter( String pToOneAttributeName ) |
649 |
|
- |
{ |
650 |
|
- |
if ( null != mValidOptionsFieldFilters.remove( pToOneAttributeName ) ) |
651 |
|
- |
{ |
|
534 |
+ |
public boolean clearToOneFilter( String pToOneAttributeName ) { |
|
535 |
+ |
if ( null != mValidOptionsFieldFilters.remove( pToOneAttributeName ) ) { |
652 |
536 |
|
reloadOptionsByAttributeReference( pToOneAttributeName ); |
653 |
537 |
|
return true; |
654 |
538 |
|
} |
|
@@ -656,18 +540,14 @@ |
656 |
540 |
|
} |
657 |
541 |
|
|
658 |
542 |
|
public boolean setToOneFilter( String pToOneAttributeName, String pToOnesAttribute, |
659 |
|
- |
Object pFilterValue ) |
660 |
|
- |
{ |
|
543 |
+ |
Object pFilterValue ) { |
661 |
544 |
|
AMDconverterPair zPair = find1stPOKeyAMDconvertPairByAttributeReference( pToOneAttributeName ); |
662 |
|
- |
if ( zPair != null ) |
663 |
|
- |
{ |
|
545 |
+ |
if ( zPair != null ) { |
664 |
546 |
|
MetaDataForPO zMDtoOnePO = mFinder.getMetaDataOptional( |
665 |
547 |
|
((POKeyValuePairConverter) zPair.getDataConverter()).getRegisteredPOName() ); |
666 |
|
- |
if ( zMDtoOnePO != null ) |
667 |
|
- |
{ |
|
548 |
+ |
if ( zMDtoOnePO != null ) { |
668 |
549 |
|
AttributeAccessorSCD zSCD = zMDtoOnePO.getAccessorSCDoptional( pToOnesAttribute ); |
669 |
|
- |
if ( zSCD != null ) |
670 |
|
- |
{ |
|
550 |
+ |
if ( zSCD != null ) { |
671 |
551 |
|
mValidOptionsFieldFilters.put( pToOneAttributeName, // |
672 |
552 |
|
new ValidOptionsFieldFilter( zSCD, pFilterValue ) ); |
673 |
553 |
|
reloadOptionsByAttributeReference( pToOneAttributeName ); |
|
@@ -682,68 +562,54 @@ |
682 |
562 |
|
new HashMap<String, ValidOptionsFieldFilter>(); |
683 |
563 |
|
} |
684 |
564 |
|
|
685 |
|
- |
protected static class ValidOptionsFieldFilter |
686 |
|
- |
{ |
|
565 |
+ |
protected static class ValidOptionsFieldFilter { |
687 |
566 |
|
private SimpleColumnDefinition mSCDtoFilterOn; // !null |
688 |
567 |
|
private Object mFilterValue; // Null Allowed... |
689 |
568 |
|
|
690 |
|
- |
public ValidOptionsFieldFilter( SimpleColumnDefinition pSCDtoFilterOn, Object pFilterValue ) |
691 |
|
- |
{ |
|
569 |
+ |
public ValidOptionsFieldFilter( SimpleColumnDefinition pSCDtoFilterOn, Object pFilterValue ) { |
692 |
570 |
|
mSCDtoFilterOn = pSCDtoFilterOn; |
693 |
571 |
|
mFilterValue = pFilterValue; |
694 |
572 |
|
} |
695 |
573 |
|
|
696 |
|
- |
public SimpleColumnDefinition getSCDtoFilterOn() |
697 |
|
- |
{ |
|
574 |
+ |
public SimpleColumnDefinition getSCDtoFilterOn() { |
698 |
575 |
|
return mSCDtoFilterOn; |
699 |
576 |
|
} |
700 |
577 |
|
|
701 |
|
- |
public Object getFilterValue() |
702 |
|
- |
{ |
|
578 |
+ |
public Object getFilterValue() { |
703 |
579 |
|
return mFilterValue; |
704 |
580 |
|
} |
705 |
581 |
|
} |
706 |
582 |
|
|
707 |
|
- |
protected static class POAttributeMetaDataFactory implements FormAttributeMetaDataFactory |
708 |
|
- |
{ |
|
583 |
+ |
protected static class POAttributeMetaDataFactory implements FormAttributeMetaDataFactory { |
709 |
584 |
|
public static final FormAttributeMetaDataFactory INSTANCE = new POAttributeMetaDataFactory(); |
710 |
585 |
|
|
711 |
|
- |
public AMDconverterPair createAttributeMetaData( CreateAMDParamsPlus pParams ) |
712 |
|
- |
{ |
|
586 |
+ |
public AMDconverterPair createAttributeMetaData( CreateAMDParamsPlus pParams ) { |
713 |
587 |
|
return TextFieldFormAMD.INSTANCE.create( pParams ); |
714 |
588 |
|
} |
715 |
589 |
|
} |
716 |
590 |
|
|
717 |
|
- |
protected class POKeyValuePairConverter extends AbstractSendableKeyValuePairConverter |
718 |
|
- |
{ |
|
591 |
+ |
protected class POKeyValuePairConverter extends AbstractSendableKeyValuePairConverter { |
719 |
592 |
|
private String mRegisteredPOname; |
720 |
593 |
|
|
721 |
|
- |
public POKeyValuePairConverter( String pRegisteredPOname ) |
722 |
|
- |
{ |
|
594 |
+ |
public POKeyValuePairConverter( String pRegisteredPOname ) { |
723 |
595 |
|
mRegisteredPOname = pRegisteredPOname; |
724 |
596 |
|
} |
725 |
597 |
|
|
726 |
|
- |
public String getRegisteredPOName() |
727 |
|
- |
{ |
|
598 |
+ |
public String getRegisteredPOName() { |
728 |
599 |
|
return mRegisteredPOname; |
729 |
600 |
|
} |
730 |
601 |
|
|
731 |
|
- |
public SimpleKeyValuePair createSimpleKeyValuePair( Object pOption ) |
732 |
|
- |
{ |
733 |
|
- |
if ( pOption == null ) |
734 |
|
- |
{ |
|
602 |
+ |
public SimpleKeyValuePair createSimpleKeyValuePair( Object pOption ) { |
|
603 |
+ |
if ( pOption == null ) { |
735 |
604 |
|
return new StringKeyValuePair( "" ); |
736 |
605 |
|
} |
737 |
|
- |
if ( pOption instanceof SimpleKeyValuePair ) |
738 |
|
- |
{ |
|
606 |
+ |
if ( pOption instanceof SimpleKeyValuePair ) { |
739 |
607 |
|
return (SimpleKeyValuePair) pOption; |
740 |
608 |
|
} |
741 |
|
- |
if ( pOption instanceof ResourceKeyNameURLaccessor ) |
742 |
|
- |
{ |
|
609 |
+ |
if ( pOption instanceof ResourceKeyNameURLaccessor ) { |
743 |
610 |
|
return ((ResourceKeyNameURLaccessor) pOption).getResourceKeyNameURL(); |
744 |
611 |
|
} |
745 |
|
- |
if ( pOption instanceof PersistentObject ) |
746 |
|
- |
{ |
|
612 |
+ |
if ( pOption instanceof PersistentObject ) { |
747 |
613 |
|
PersistentObject po = (PersistentObject) pOption; |
748 |
614 |
|
return new DataStoreKeyValuePair( po.getPersistentObjectUniqueKey().toString(), |
749 |
615 |
|
po.getDisplayValue() ); |
|
@@ -752,16 +618,12 @@ |
752 |
618 |
|
return new StringKeyValuePair( zOptionAsString ); |
753 |
619 |
|
} |
754 |
620 |
|
|
755 |
|
- |
protected Object convertSimpleKeyValuePairKey( Object pKey ) |
756 |
|
- |
{ |
757 |
|
- |
if ( pKey instanceof String ) |
758 |
|
- |
{ |
759 |
|
- |
try |
760 |
|
- |
{ |
|
621 |
+ |
protected Object convertSimpleKeyValuePairKey( Object pKey ) { |
|
622 |
+ |
if ( pKey instanceof String ) { |
|
623 |
+ |
try { |
761 |
624 |
|
return mFinder.createPersistentObjectUniqueKeyFrom( mRegisteredPOname, pKey.toString() ); |
762 |
625 |
|
} |
763 |
|
- |
catch ( IllegalArgumentException e ) |
764 |
|
- |
{ |
|
626 |
+ |
catch ( IllegalArgumentException e ) { |
765 |
627 |
|
// Fall thru... |
766 |
628 |
|
} |
767 |
629 |
|
} |