Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/Java/GWT/OldServer/src/org/litesoft/GWT/forms/server/support/nonpublic/AbstractFormServicePeer.java

Diff revisions: vs.
  @@ -1,17 +1,13 @@
1 1 // This Source Code is in the Public Domain per: http://unlicense.org
2 2 package org.litesoft.GWT.forms.server.support.nonpublic;
3 3
4 - import java.io.*;
5 -
6 - import org.litesoft.commonfoundation.base.*;
7 - import org.litesoft.commonfoundation.exceptions.*;
8 - import org.litesoft.commonfoundation.typeutils.Objects;
9 - import java.util.*;
10 -
11 4 import org.litesoft.GWT.forms.server.*;
12 5 import org.litesoft.GWT.forms.server.support.*;
13 6 import org.litesoft.*;
14 7 import org.litesoft.changemanagement.*;
8 + import org.litesoft.commonfoundation.base.*;
9 + import org.litesoft.commonfoundation.exceptions.*;
10 + import org.litesoft.commonfoundation.typeutils.Objects;
15 11 import org.litesoft.core.delayed.*;
16 12 import org.litesoft.core.simpletypes.*;
17 13 import org.litesoft.delayed.*;
  @@ -20,10 +16,12 @@
20 16 import org.litesoft.ui.support.*;
21 17 import org.litesoft.ui_1_5.*;
22 18
19 + import java.io.*;
20 + import java.util.*;
21 +
23 22 public abstract class AbstractFormServicePeer implements FormServicePeer,
24 23 ServerStateChangedListener,
25 - FSPTypeHelperBackDoor
26 - {
24 + FSPTypeHelperBackDoor {
27 25 public static final String ERR_COMMIT_FAILED = "CommitFailed";
28 26 public static final String ERR_COMMIT_OUT_OF_DATE_DATA = "OutOfDateDataCausedCommitFailure";
29 27
  @@ -42,34 +40,27 @@
42 40
43 41 private ServicePeerToFormDataProxy mCollectorProxy = new ServicePeerToFormDataProxy();
44 42
45 - public ServicePeerToFormDataProxy getCollectorProxy()
46 - {
43 + public ServicePeerToFormDataProxy getCollectorProxy() {
47 44 return mCollectorProxy;
48 45 }
49 46
50 - protected void rootObjectCommited()
51 - {
47 + protected void rootObjectCommited() {
52 48 FormInteractionStructure zFIS = mInteractionHelper.rootObjectCommited();
53 - if ( zFIS != null )
54 - {
49 + if ( zFIS != null ) {
55 50 publish( zFIS, ServerStateChange.Action.UPDATED );
56 51 }
57 52 }
58 53
59 - private void handle( FormInteractionChange pChange )
60 - {
61 - if ( pChange != null )
62 - {
54 + private void handle( FormInteractionChange pChange ) {
55 + if ( pChange != null ) {
63 56 FormInteractionStructure zOldData = pChange.getOldData();
64 57 FormInteractionStructure zNewData = pChange.getNewData();
65 58
66 - if ( zOldData.isPublishable() )
67 - {
59 + if ( zOldData.isPublishable() ) {
68 60 // todo: Need Instance of: ChangeListenerManager.removeListener( this );
69 61 publish( zOldData, ServerStateChange.Action.DELETED );
70 62 }
71 - if ( zNewData.isPublishable() )
72 - {
63 + if ( zNewData.isPublishable() ) {
73 64 // todo: Need Instance of: ChangeListenerManager.addListener( this, "FSP:" + zNewData.getRootType(), (Serializable) zNewData.getRootObjectKey() );
74 65 publish( zNewData, ServerStateChange.Action.CREATED );
75 66 }
  @@ -78,32 +69,26 @@
78 69 }
79 70 }
80 71
81 - protected void setOurData( FormInteractionStructure pNewData )
82 - {
72 + protected void setOurData( FormInteractionStructure pNewData ) {
83 73 handle( mInteractionHelper.setOurData( pNewData ) );
84 74 }
85 75
86 - private void publish( FormInteractionStructure pData, ServerStateChange.Action pAction )
87 - {
76 + private void publish( FormInteractionStructure pData, ServerStateChange.Action pAction ) {
88 77 ServerStateChange zChange = new ServerStateChange( pAction, "FSP:" + pData.getRootType(), pData.getRootObjectKey(), null, pData );
89 78 Long zSourceUniqueID = pData.getUniqueFormServicePeerID();
90 79 ServerStateChangeSet zChangeSet = new ServerStateChangeSet( zSourceUniqueID, null, zChange );
91 80 // todo: Need Instance of: ChangeListenerManager.notifyAllListeners( zChangeSet );
92 81 }
93 82
94 - public void serverStateChanged( ServerStateChangeSet pServerStateChangeSet )
95 - {
83 + public void serverStateChanged( ServerStateChangeSet pServerStateChangeSet ) {
96 84 // event order?
97 85 FormInteractionIntersection zFII = mInteractionHelper.createFormInteractionIntersection( pServerStateChangeSet );
98 - if ( zFII.getData().isPublishable() )
99 - {
100 - if ( zFII.isNewOthers() )
101 - {
86 + if ( zFII.getData().isPublishable() ) {
87 + if ( zFII.isNewOthers() ) {
102 88 // New Others may not know about us, so we publish (again)
103 89 publish( zFII.getData(), ServerStateChange.Action.CREATED );
104 90 }
105 - if ( zFII.isUpdateOthers() || zFII.isNewOthers() || zFII.isDelOthers() )
106 - {
91 + if ( zFII.isUpdateOthers() || zFII.isNewOthers() || zFII.isDelOthers() ) {
107 92 getCollectorProxy().forceReturn();
108 93 mRunnable.runOnOrAfter( 2000 ); // 2 secs
109 94 }
  @@ -112,34 +97,27 @@
112 97
113 98 private MyTimedRunnable mRunnable = new MyTimedRunnable();
114 99
115 - private class MyTimedRunnable implements TimedRunnable
116 - {
100 + private class MyTimedRunnable implements TimedRunnable {
117 101 private Long mSendWhen = null;
118 102
119 - public synchronized void runOnOrAfter( int pSendIn )
120 - {
103 + public synchronized void runOnOrAfter( int pSendIn ) {
121 104 boolean zNotLaunched = (mSendWhen == null);
122 105
123 106 long zSendWhen = mMillisecTimeSource.now() + pSendIn;
124 107
125 108 mSendWhen = zSendWhen;
126 109
127 - if ( zNotLaunched )
128 - {
110 + if ( zNotLaunched ) {
129 111 TimedRunnableManager.INSTANCE.runOnOrAfter( this, zSendWhen );
130 112 }
131 113 }
132 114
133 - public Again runOnce()
134 - {
135 - synchronized ( this )
136 - {
137 - if ( mSendWhen == null )
138 - {
115 + public Again runOnce() {
116 + synchronized ( this ) {
117 + if ( mSendWhen == null ) {
139 118 return null;
140 119 }
141 - if ( mMillisecTimeSource.now() < mSendWhen )
142 - {
120 + if ( mMillisecTimeSource.now() < mSendWhen ) {
143 121 return new RunAgainOnOrAfter( mSendWhen );
144 122 }
145 123 mSendWhen = null;
  @@ -149,100 +127,87 @@
149 127 }
150 128 }
151 129
152 - protected Long getUniqueFormID()
153 - {
130 + protected Long getUniqueFormID() {
154 131 return mInteractionHelper.getOurUniqueFormServicePeerID();
155 132 }
156 133
157 - public SerializableSystemUserRef getSystemUserRef()
158 - {
134 + public SerializableSystemUserRef getSystemUserRef() {
159 135 return mInteractionHelper.getOurSystemUserRef();
160 136 }
161 137
162 - protected String getRootType()
163 - {
138 + protected String getRootType() {
164 139 return mInteractionHelper.getOurRootType();
165 140 }
166 141
167 - protected String getRootObjectKey()
168 - {
142 + protected String getRootObjectKey() {
169 143 return mInteractionHelper.getOurRootObjectKey();
170 144 }
171 145
172 - protected void setRootObjectKey( String pRootObjectKey )
173 - {
146 + protected void setRootObjectKey( String pRootObjectKey ) {
174 147 handle( mInteractionHelper.setRootObjectKey( pRootObjectKey ) );
175 148 }
176 149
177 - public TypeHelper getRootTypeHelper()
178 - {
150 + public TypeHelper getRootTypeHelper() {
179 151 return mTypeHelperManager.getRootTypeHelper();
180 152 }
181 153
182 - public InstanceHelper getRootInstanceHelper()
183 - {
154 + public InstanceHelper getRootInstanceHelper() {
184 155 return mInstanceHelperManager.getRootInstanceHelper();
185 156 }
186 157
187 - protected void setFullUpdate()
188 - {
158 + protected void setFullUpdate() {
189 159 getCollectorProxy().setFullUpdate();
190 160 }
191 161
192 - protected void setCloseRequested()
193 - {
162 + protected void setCloseRequested() {
194 163 getCollectorProxy().setCloseRequested();
195 164 }
196 165
197 - protected void addWarning( String pWarningID, Object... pParameters )
198 - {
166 + protected void addWarning( String pWarningID, Object... pParameters ) {
199 167 getCollectorProxy().addWarning( rootTypeResolveError( pWarningID, pParameters ) );
200 168 }
201 169
202 - protected void addError( String pErrorID, Object... pParameters )
203 - {
170 + protected void addError( String pErrorID, Object... pParameters ) {
204 171 getCollectorProxy().addError( rootTypeResolveError( pErrorID, pParameters ) );
205 172 }
206 173
207 - protected boolean hasErrors()
208 - {
174 + protected boolean hasErrors() {
209 175 return getCollectorProxy().hasErrors();
210 176 }
211 177
212 - protected void setSuccessfulTriggeringActionIDIfNotSet( String pSuccessfulTriggeringActionID )
213 - {
178 + protected void setSuccessfulTriggeringActionIDIfNotSet( String pSuccessfulTriggeringActionID ) {
214 179 getCollectorProxy().setSuccessfulTriggeringActionIDIfNotSet( pSuccessfulTriggeringActionID );
215 180 }
216 181
217 - private String rootTypeResolveError( String pErrorID, Object... pParameters )
218 - {
182 + private String rootTypeResolveError( String pErrorID, Object... pParameters ) {
219 183 TypeHelper zTypeHelper = getRootTypeHelper();
220 184 String resolved = (zTypeHelper != null) ? zTypeHelper.resolveError( pErrorID ) : pErrorID;
221 185 return ExternalizationInterface.Helper.injectParameters( resolved, pParameters );
222 186 }
223 187
224 - private ExternalizationInterface getRootTypeExternalizationInterface()
225 - {
188 + private ExternalizationInterface getRootTypeExternalizationInterface() {
226 189 TypeHelper zTypeHelper = getRootTypeHelper();
227 190 return (zTypeHelper != null) ? zTypeHelper.getExternalization() : null;
228 191 }
229 192
230 - protected void sendUnsolicitedData()
231 - {
193 + protected void sendUnsolicitedData() {
232 194 PushInterface zPushInterface = mPushInterface;
233 - if ( zPushInterface != null )
234 - {
235 - ServicePeerToFormData zData = getCollectorProxy().createReturnValueFromCollectorIfMatches( null, mInteractionHelper, getRootTypeExternalizationInterface() );
236 - if ( zData != null )
237 - {
195 + if ( zPushInterface != null ) {
196 + ServicePeerToFormData zData =
197 + getCollectorProxy().createReturnValueFromCollectorIfMatches( null, mInteractionHelper, getRootTypeExternalizationInterface() );
198 + if ( zData != null ) {
238 199 zPushInterface.sendUnsolicitedData( zData );
239 200 }
240 201 }
241 202 }
242 203
243 204 // protects serializes FormServicePeer interface
244 - public synchronized final ServicePeerToFormCreationData initializeAndCreateFormMetaData( PushInterface pPushInterface, ISystemUserResolver pSystemUserResolver, Long pUniqueFormServicePeerID, ISystemUser pSystemUser, FormUsage pUsage, Serializable pInitializationPayload, ExternalizationInterface pExternalization, FormAccessControl pAccessControl )
245 - {
205 + public synchronized final ServicePeerToFormCreationData initializeAndCreateFormMetaData( PushInterface pPushInterface,
206 + ISystemUserResolver pSystemUserResolver,
207 + Long pUniqueFormServicePeerID, ISystemUser pSystemUser,
208 + FormUsage pUsage, Serializable pInitializationPayload,
209 + ExternalizationInterface pExternalization,
210 + FormAccessControl pAccessControl ) {
246 211 mPushInterface = pPushInterface;
247 212
248 213 initializationPayloadAvailable( mInitializationPayload = pInitializationPayload );
  @@ -265,43 +230,34 @@
265 230 return new ServicePeerToFormCreationData( zMetaData, getFormRenderedServicePeerXtra() );
266 231 }
267 232
268 - protected String getRootTypeFromUsage( FormUsage pUsage )
269 - {
233 + protected String getRootTypeFromUsage( FormUsage pUsage ) {
270 234 return pUsage.getRootType();
271 235 }
272 236
273 - public void add( TypeHelper pTypeHelper )
274 - {
237 + public void add( TypeHelper pTypeHelper ) {
275 238 mTypeHelperManager.add( pTypeHelper );
276 239 }
277 240
278 - public void add( InstanceHelper pInstanceHelper )
279 - {
241 + public void add( InstanceHelper pInstanceHelper ) {
280 242 mInstanceHelperManager.add( pInstanceHelper );
281 243 }
282 244
283 - public void removeInstanceHelper( FormDataRowKey pFormDataRowKey )
284 - {
245 + public void removeInstanceHelper( FormDataRowKey pFormDataRowKey ) {
285 246 mInstanceHelperManager.remove( pFormDataRowKey );
286 247 }
287 248
288 - public final boolean isDisposed()
289 - {
249 + public final boolean isDisposed() {
290 250 return mDisposed;
291 251 }
292 252
293 253 // protects serializes FormServicePeer interface
294 - public synchronized final void dispose()
295 - {
296 - if ( !mDisposed )
297 - {
254 + public synchronized final void dispose() {
255 + if ( !mDisposed ) {
298 256 mDisposed = true;
299 - try
300 - {
257 + try {
301 258 LLdispose();
302 259 }
303 - catch ( RuntimeException e )
304 - {
260 + catch ( RuntimeException e ) {
305 261 LOGGER.error.log( e );
306 262 }
307 263
  @@ -314,8 +270,7 @@
314 270 }
315 271
316 272 // protects serializes FormServicePeer interface
317 - public synchronized final ServicePeerToFormData setRootObjectTo( Integer pAsyncMessageNumber, String pKey )
318 - {
273 + public synchronized final ServicePeerToFormData setRootObjectTo( Integer pAsyncMessageNumber, String pKey ) {
319 274 LOGGER.trace.log( getRootType(), "-setRootObjectTo, key:", pKey );
320 275
321 276 getCollectorProxy().setCallFromClientForm( pAsyncMessageNumber );
  @@ -330,14 +285,12 @@
330 285 }
331 286
332 287 // protects serializes FormServicePeer interface
333 - public synchronized final AttributeResourceOptionsResponseData getResourceOptions( AttributeResourceOptionsRequestData pRequest )
334 - {
288 + public synchronized final AttributeResourceOptionsResponseData getResourceOptions( AttributeResourceOptionsRequestData pRequest ) {
335 289 return getResourceOptions( pRequest.getFormDataRowKey(), pRequest.getUniqueID(), pRequest.getAttributeReference() );
336 290 }
337 291
338 292 // protects serializes FormServicePeer interface
339 - public synchronized final ServicePeerToFormData formEvent( FormToServicePeerData pToServicePeerData )
340 - {
293 + public synchronized final ServicePeerToFormData formEvent( FormToServicePeerData pToServicePeerData ) {
341 294 Objects.assertNotNull( "ToServicePeerData", pToServicePeerData );
342 295
343 296 Integer zAsyncMessageNumber = pToServicePeerData.getAsyncMessageNumber();
  @@ -345,32 +298,26 @@
345 298 getCollectorProxy().setCallFromClientForm( zAsyncMessageNumber );
346 299
347 300 ValueUpdatedFormData[] zValueUpdates = pToServicePeerData.getAttributeUpdates();
348 - if ( zValueUpdates != null )
349 - {
350 - for ( ValueUpdatedFormData update : zValueUpdates )
351 - {
301 + if ( zValueUpdates != null ) {
302 + for ( ValueUpdatedFormData update : zValueUpdates ) {
352 303 processValueUpdated( update.getFormDataRowKey(), //
353 304 update.getUniqueID(), update.getAttributeReference(), update.getCurrentValue() );
354 305 }
355 306 }
356 307
357 308 ActionRequestFormData action = pToServicePeerData.getActionRequest();
358 - if ( action != null )
359 - {
309 + if ( action != null ) {
360 310 processActionRequest( action.getFormDataRowKey(), action.getActionID(), action.isInputAction(), action.getParentFormDataRowKey() );
361 311 }
362 312
363 313 return getCollectorProxy().createReturnValueFromCollectorIfMatches( zAsyncMessageNumber, mInteractionHelper, getRootTypeExternalizationInterface() );
364 314 }
365 315
366 - protected AttributeResourceOptionsResponseData getResourceOptions( FormDataRowKey pFormDataRowKey, Integer pUniqueID, String pAttributeReference )
367 - {
316 + protected AttributeResourceOptionsResponseData getResourceOptions( FormDataRowKey pFormDataRowKey, Integer pUniqueID, String pAttributeReference ) {
368 317 InstanceHelper zInstanceHelper = getInstanceHelper( pFormDataRowKey );
369 - if ( (zInstanceHelper != null) )
370 - {
318 + if ( (zInstanceHelper != null) ) {
371 319 AMDconverterPair changingPair = zInstanceHelper.findAttribute( pUniqueID );
372 - if ( changingPair != null )
373 - {
320 + if ( changingPair != null ) {
374 321 return zInstanceHelper.getTypeHelper().getResourceOptions( pAttributeReference, changingPair.getDataConverter() );
375 322 }
376 323 }
  @@ -379,150 +326,115 @@
379 326
380 327 private void processValueUpdated( FormDataRowKey pFormDataRowKey, //
381 328 Integer pUniqueID, String pAttributeReference, //
382 - Serializable pNewValue )
383 - {
329 + Serializable pNewValue ) {
384 330 //System.out.println( getRootType() + "-valueUpdated on (" + pFormDataRowKey + ") '" +
385 331 // pAttributeReference + "' to '" + pNewValue + "' type:" +
386 332 // ((pNewValue != null) ? pNewValue.getClass() : null) );
387 333 //
388 - LOGGER.trace.log( getRootType(), "-valueUpdated on (", pFormDataRowKey, ") '", pAttributeReference, "' to '", pNewValue, "' type:", ((pNewValue != null) ? pNewValue.getClass() : null) );
334 + LOGGER.trace.log( getRootType(), "-valueUpdated on (", pFormDataRowKey, ") '", pAttributeReference, "' to '", pNewValue, "' type:",
335 + ((pNewValue != null) ? pNewValue.getClass() : null) );
389 336
390 337 String zResolvedError = null;
391 338 AMDconverterPair changingPair = null;
392 339 boolean handled = false;
393 340
394 - try
395 - {
341 + try {
396 342 handled = LLrawValueUpdated( pFormDataRowKey, pAttributeReference, pNewValue );
397 343 }
398 - catch ( IllegalArgumentException e )
399 - {
344 + catch ( IllegalArgumentException e ) {
400 345 addError( ERR_ILLEGAL_VALUE, "LLrawValueUpdated", e.getMessage() );
401 346 }
402 - catch ( RuntimeException e )
403 - {
347 + catch ( RuntimeException e ) {
404 348 addError( ERR_UNEXPECTED, "LLrawValueUpdated", e.getMessage() );
405 349 }
406 350
407 - if ( !handled && !hasErrors() )
408 - {
351 + if ( !handled && !hasErrors() ) {
409 352 InstanceHelper zInstanceHelper = getInstanceHelper( pFormDataRowKey );
410 - if ( zInstanceHelper == null )
411 - {
353 + if ( zInstanceHelper == null ) {
412 354 addError( ERR_ATTR_NOT_FOUND );
413 - }
414 - else if ( (null == (changingPair = zInstanceHelper.findAttribute( pUniqueID ))) )
415 - {
355 + } else if ( (null == (changingPair = zInstanceHelper.findAttribute( pUniqueID ))) ) {
416 356 addError( ERR_ATTR_NOT_FOUND );
417 - }
418 - else
419 - {
357 + } else {
420 358 Object zValueForAttribute = null;
421 - try
422 - {
359 + try {
423 360 zValueForAttribute = changingPair.getDataConverter().convertFromPassable( pNewValue );
424 361 }
425 - catch ( IllegalArgumentException e )
426 - {
362 + catch ( IllegalArgumentException e ) {
427 363 zResolvedError = rootTypeResolveError( ERR_ILLEGAL_VALUE, "Converted", e.getMessage() );
428 364 }
429 - catch ( RuntimeException e )
430 - {
365 + catch ( RuntimeException e ) {
431 366 zResolvedError = rootTypeResolveError( ERR_UNEXPECTED, "Converted", e.getMessage() );
432 367 }
433 - if ( zResolvedError == null )
434 - {
435 - try
436 - {
437 - if ( !(handled = LLvalueUpdated( zInstanceHelper, pAttributeReference, zValueForAttribute )) )
438 - {
368 + if ( zResolvedError == null ) {
369 + try {
370 + if ( !(handled = LLvalueUpdated( zInstanceHelper, pAttributeReference, zValueForAttribute )) ) {
439 371 zResolvedError = rootTypeResolveError( ERR_VALUE_UPDATE_NOT_HANDLED );
440 372 }
441 373 }
442 - catch ( IllegalArgumentException e )
443 - {
374 + catch ( IllegalArgumentException e ) {
444 375 zResolvedError = rootTypeResolveError( ERR_ILLEGAL_VALUE, "Update", e.getMessage() );
445 376 }
446 - catch ( NoSuchElementException e )
447 - {
377 + catch ( NoSuchElementException e ) {
448 378 zResolvedError = rootTypeResolveError( ERR_ATTR_NOT_FOUND, "Update", e.getMessage() );
449 379 }
450 - catch ( RuntimeException e )
451 - {
380 + catch ( RuntimeException e ) {
452 381 zResolvedError = rootTypeResolveError( ERR_UNEXPECTED, "Update", e.getMessage() );
453 382 }
454 383 }
455 384 }
456 385 }
457 - if ( handled || (zResolvedError != null) )
458 - {
386 + if ( handled || (zResolvedError != null) ) {
459 387 checkForChanges( changingPair, pNewValue, zResolvedError );
460 388 }
461 389 }
462 390
463 - protected boolean LLvalueUpdated( InstanceHelper pInstanceHelper, String pAttributeReference, Object pValueForAttribute )
464 - {
391 + protected boolean LLvalueUpdated( InstanceHelper pInstanceHelper, String pAttributeReference, Object pValueForAttribute ) {
465 392 return pInstanceHelper.valueUpdated( pAttributeReference, pValueForAttribute );
466 393 }
467 394
468 - private void processActionRequest( FormDataRowKey pFormDataRowKey, String pActionID, boolean pInputAction, FormDataRowKey pParentFormDataRowKey )
469 - {
395 + private void processActionRequest( FormDataRowKey pFormDataRowKey, String pActionID, boolean pInputAction, FormDataRowKey pParentFormDataRowKey ) {
470 396 LOGGER.trace.log( getRootType(), "-actionRequest, ", (pInputAction ? "Input" : "Reg"), " action:", pActionID );
471 397
472 - if ( actionRequest( pFormDataRowKey, pActionID, pInputAction, pParentFormDataRowKey ) )
473 - {
398 + if ( actionRequest( pFormDataRowKey, pActionID, pInputAction, pParentFormDataRowKey ) ) {
474 399 checkForChanges( null, null, null );
475 - }
476 - else if ( !pInputAction )
477 - {
400 + } else if ( !pInputAction ) {
478 401 addError( ERR_UNKNOWN_ACTION );
479 402 }
480 - if ( !hasErrors() )
481 - {
403 + if ( !hasErrors() ) {
482 404 setSuccessfulTriggeringActionIDIfNotSet( pActionID );
483 405 }
484 406 }
485 407
486 - protected void checkForChanges( AMDconverterPair pChangingPair, Serializable pNewValue, String pResolvedError )
487 - {
408 + protected void checkForChanges( AMDconverterPair pChangingPair, Serializable pNewValue, String pResolvedError ) {
488 409 // Snag a list to avoid Concurrent Changes
489 410 InstanceHelpersSnapShot zSnapShot = mInstanceHelperManager.getInstanceHelpers();
490 411 InstanceHelper zRootHelper = zSnapShot.getRootInstanceHelper();
491 412 zRootHelper.checkForChanges( pChangingPair, pNewValue, pResolvedError );
492 - for ( InstanceHelper helper : zSnapShot.getAllInstanceHelpers() )
493 - {
494 - if ( helper != zRootHelper )
495 - {
413 + for ( InstanceHelper helper : zSnapShot.getAllInstanceHelpers() ) {
414 + if ( helper != zRootHelper ) {
496 415 helper.checkForChanges( pChangingPair, pNewValue, pResolvedError );
497 416 }
498 417 }
499 418 }
500 419
501 - public boolean actionRequest( FormDataRowKey pFormDataRowKey, String pActionID, boolean pInputAction, FormDataRowKey pParentFormDataRowKey )
502 - {
503 - if ( UiFormDef.ACTION_CLOSE.equals( pActionID ) )
504 - {
420 + public boolean actionRequest( FormDataRowKey pFormDataRowKey, String pActionID, boolean pInputAction, FormDataRowKey pParentFormDataRowKey ) {
421 + if ( UiFormDef.ACTION_CLOSE.equals( pActionID ) ) {
505 422 return actionClose( pActionID );
506 423 }
507 - if ( UiFormDef.ACTION_DONE.equals( pActionID ) )
508 - {
424 + if ( UiFormDef.ACTION_DONE.equals( pActionID ) ) {
509 425 return actionDone( pActionID );
510 426 }
511 - if ( UiFormDef.ACTION_COMMIT.equals( pActionID ) )
512 - {
427 + if ( UiFormDef.ACTION_COMMIT.equals( pActionID ) ) {
513 428 return actionCommit( pActionID );
514 429 }
515 - if ( UiFormDef.ACTION_RELOAD.equals( pActionID ) )
516 - {
430 + if ( UiFormDef.ACTION_RELOAD.equals( pActionID ) ) {
517 431 return actionReload( pActionID );
518 432 }
519 - if ( UiFormDef.ACTION_NEW.equals( pActionID ) )
520 - {
433 + if ( UiFormDef.ACTION_NEW.equals( pActionID ) ) {
521 434 return actionNew( pActionID );
522 435 }
523 436 InstanceHelper zInstanceHelper = getInstanceHelper( pFormDataRowKey );
524 - if ( zInstanceHelper != null )
525 - {
437 + if ( zInstanceHelper != null ) {
526 438 return zInstanceHelper.actionRequest( pActionID, pInputAction );
527 439 }
528 440 TypeHelper zTypeHelper = getTypeHelper( pFormDataRowKey );
  @@ -530,26 +442,22 @@
530 442 zTypeHelper.actionRequest( pActionID, pInputAction, getInstanceHelper( pParentFormDataRowKey ) );
531 443 }
532 444
533 - public ArrayList<FormDataRowKey> getAllCurrentFormDataRowKeys()
534 - {
445 + public ArrayList<FormDataRowKey> getAllCurrentFormDataRowKeys() {
535 446 return mInstanceHelperManager.getAllCurrentFormDataRowKeys();
536 447 }
537 448
538 - public InstanceHelper getInstanceHelper( FormDataRowKey pFormDataRowKey )
539 - {
449 + public InstanceHelper getInstanceHelper( FormDataRowKey pFormDataRowKey ) {
540 450 return mInstanceHelperManager.getInstanceHelper( pFormDataRowKey ); // null == Root
541 451 }
542 452
543 - private TypeHelper getTypeHelper( FormDataRowKey pFormDataRowKey )
544 - {
453 + private TypeHelper getTypeHelper( FormDataRowKey pFormDataRowKey ) {
545 454 return mTypeHelperManager.getTypeHelper( pFormDataRowKey ); // null == root
546 455 }
547 456
548 457 /**
549 458 * @return true to indicate processing satisfied
550 459 */
551 - protected boolean actionClose( String pSuccessfulTriggeringActionID )
552 - {
460 + protected boolean actionClose( String pSuccessfulTriggeringActionID ) {
553 461 setCloseRequested();
554 462 return true;
555 463 }
  @@ -559,8 +467,7 @@
559 467 *
560 468 * @return true to indicate processing satisfied
561 469 */
562 - protected boolean actionNew( String pSuccessfulTriggeringActionID )
563 - {
470 + protected boolean actionNew( String pSuccessfulTriggeringActionID ) {
564 471 createNewRootObject();
565 472 return initializeUpdates( pSuccessfulTriggeringActionID );
566 473 }
  @@ -571,8 +478,7 @@
571 478 *
572 479 * @return true to indicate processing satisfied
573 480 */
574 - protected boolean actionCommit( String pSuccessfulTriggeringActionID )
575 - {
481 + protected boolean actionCommit( String pSuccessfulTriggeringActionID ) {
576 482 commit();
577 483 return hasErrors() || initializeUpdates( pSuccessfulTriggeringActionID );
578 484 }
  @@ -584,11 +490,9 @@
584 490 *
585 491 * @return true to indicate processing satisfied
586 492 */
587 - protected boolean actionDone( String pSuccessfulTriggeringActionID )
588 - {
493 + protected boolean actionDone( String pSuccessfulTriggeringActionID ) {
589 494 commit();
590 - if ( hasErrors() )
591 - {
495 + if ( hasErrors() ) {
592 496 return true;
593 497 }
594 498 setCloseRequested();
  @@ -601,27 +505,20 @@
601 505 *
602 506 * @return true to indicate processing satisfied
603 507 */
604 - public boolean actionReload( String pSuccessfulTriggeringActionID )
605 - {
606 - if ( !hasRootObject() )
607 - {
508 + public boolean actionReload( String pSuccessfulTriggeringActionID ) {
509 + if ( !hasRootObject() ) {
608 510 return true;
609 511 }
610 - if ( mIsNewRootObject )
611 - {
512 + if ( mIsNewRootObject ) {
612 513 createNewRootObject();
613 - }
614 - else
615 - {
514 + } else {
616 515 reloadExistingRootObject();
617 516 }
618 517 return initializeUpdates( pSuccessfulTriggeringActionID );
619 518 }
620 519
621 - protected boolean initializeUpdates( String pSuccessfulTriggeringActionID )
622 - {
623 - if ( hasRootObject() )
624 - {
520 + protected boolean initializeUpdates( String pSuccessfulTriggeringActionID ) {
521 + if ( hasRootObject() ) {
625 522 setFullUpdate();
626 523 setSuccessfulTriggeringActionIDIfNotSet( pSuccessfulTriggeringActionID );
627 524 mInstanceHelperManager.resetAllInstanceHelpers();
  @@ -630,31 +527,23 @@
630 527 return true;
631 528 }
632 529
633 - protected void commit()
634 - {
635 - if ( hasRootObject() )
636 - {
637 - try
638 - {
530 + protected void commit() {
531 + if ( hasRootObject() ) {
532 + try {
639 533 LLcommit(); // commit what we've got
640 534 }
641 - catch ( ConcurrentModificationException e )
642 - {
535 + catch ( ConcurrentModificationException e ) {
643 536 addError( ERR_COMMIT_OUT_OF_DATE_DATA );
644 537 return;
645 538 }
646 - catch ( RuntimeException e )
647 - {
539 + catch ( RuntimeException e ) {
648 540 LOGGER.warn.log( e, "Attempt to commit backing Root Object failed" );
649 - if ( e instanceof DisplayableException )
650 - {
541 + if ( e instanceof DisplayableException ) {
651 542 DisplayableException zDE = (DisplayableException) e;
652 543 String zParam = rootTypeResolveError( zDE.getToResolveIdentifier(), //
653 544 (Object[]) zDE.getParams() );
654 545 addError( ERR_COMMIT_FAILED, zParam );
655 - }
656 - else
657 - {
546 + } else {
658 547 addError( ERR_COMMIT_FAILED );
659 548 }
660 549 return;
  @@ -663,25 +552,21 @@
663 552 }
664 553 }
665 554
666 - protected void createNewRootObject()
667 - {
555 + protected void createNewRootObject() {
668 556 mIsNewRootObject = true;
669 557 String zRootObjectKey = LLnewRootObject();
670 558 setRootObjectKey( zRootObjectKey );
671 559 }
672 560
673 - protected void reloadExistingRootObject()
674 - {
561 + protected void reloadExistingRootObject() {
675 562 mIsNewRootObject = false;
676 563 LLreloadExistingRootObject();
677 564 mInteractionHelper.clearUpdatedData();
678 565 }
679 566
680 - protected void loadExistingRootObject( String pNewRootObjectKey )
681 - {
567 + protected void loadExistingRootObject( String pNewRootObjectKey ) {
682 568 mIsNewRootObject = false;
683 - if ( LLloadExistingRootObject( pNewRootObjectKey ) )
684 - {
569 + if ( LLloadExistingRootObject( pNewRootObjectKey ) ) {
685 570 setRootObjectKey( pNewRootObjectKey );
686 571 }
687 572 }
  @@ -689,46 +574,36 @@
689 574 /**
690 575 * Either load the appropriate Root Object based on pKey, or create one if pKey was null
691 576 */
692 - protected void LLsetRootObjectTo( String pKey )
693 - {
694 - if ( pKey == null )
695 - {
577 + protected void LLsetRootObjectTo( String pKey ) {
578 + if ( pKey == null ) {
696 579 createNewRootObject();
697 - }
698 - else
699 - {
580 + } else {
700 581 loadExistingRootObject( pKey );
701 582 }
702 583 }
703 584
704 - protected void LLdispose()
705 - {
585 + protected void LLdispose() {
706 586 }
707 587
708 588 /**
709 589 * @return true to indicate processing satisfied
710 590 */
711 - protected boolean LLrawValueUpdated( FormDataRowKey pFormDataRowKey, String pAttributeReference, Serializable pNewValue )
712 - {
591 + protected boolean LLrawValueUpdated( FormDataRowKey pFormDataRowKey, String pAttributeReference, Serializable pNewValue ) {
713 592 return false;
714 593 }
715 594
716 - protected void initializationPayloadAvailable( Serializable pInitializationPayload )
717 - {
595 + protected void initializationPayloadAvailable( Serializable pInitializationPayload ) {
718 596 }
719 597
720 - protected ExternalizationInterface augment( ExternalizationInterface pExternalizationInterface )
721 - {
598 + protected ExternalizationInterface augment( ExternalizationInterface pExternalizationInterface ) {
722 599 return pExternalizationInterface;
723 600 }
724 601
725 - protected InterceptingProxyExternalization proxy( ExternalizationInterface pExternalizationInterface )
726 - {
602 + protected InterceptingProxyExternalization proxy( ExternalizationInterface pExternalizationInterface ) {
727 603 return new InterceptingProxyExternalization( pExternalizationInterface );
728 604 }
729 605
730 - protected Serializable getFormRenderedServicePeerXtra()
731 - {
606 + protected Serializable getFormRenderedServicePeerXtra() {
732 607 return null;
733 608 }
734 609