soap tutorial

adriani.jws.template.wrappers
Class WrapperInformationOut

java.lang.Object
  extended by adriani.jws.template.wrappers.Wrapper
      extended by adriani.jws.template.wrappers.WrapperOut
          extended by adriani.jws.template.wrappers.WrapperInformationOut

public class WrapperInformationOut
extends WrapperOut

The class wrapping the root ADBBean output element representing the results for the getInformation() SOAP method.
In this case the response contains also some metadata (e.g. the status message) and an array of records: each of these records should be wrapped by a single WrapperInformation object.

Hint: compare this class with the WrapperDateOut class, which doesn't store data as an inner records of wrappers, but store data directly into some simple class fields.
Hence the WrapperInformationOut class could be considered the leading example of a wrapper needing to model a SOAP element containing some complex types and/or records.


Field Summary
 
Fields inherited from class adriani.jws.template.wrappers.WrapperOut
details, leadingName, message, MESSAGE_NOK, MESSAGE_OK, MESSAGE_UNSET, MESSAGE_WRONG, NO_DETAILS, records, status, STATUS_OK, STATUS_UNSET, STATUS_WRONG
 
Fields inherited from class adriani.jws.template.wrappers.Wrapper
element, logger, NO_NUMBER, NOT_AVAILABLE, NOT_BIG_INTEGER, UNDEFINED
 
Constructor Summary
WrapperInformationOut()
          Stateless constructor, loading the default values into this wrapper.
WrapperInformationOut(Wrapper[] array)
          Stateful constructor, creating an Wrapper set with the input array.
 
Method Summary
 void forceMessage(java.lang.String message)
          Set a string message in the inner ADBBean element, without checking for validation and overwriting the previous value of the message class attribute (in any).
 void forceStatus(int value)
          Set an integer value in the wrapped ADBBean element, without checking for validation and ignoring the value of the status class attribute.
 void setDefaults()
          Load all the STATIC default values (defined in this class) into the corresponding class attributes, in this case we create one element array with just one WrapperInformation object (set with his default values), then we set the general purposes class fields (i.e.
 boolean validate()
          Validation is performed by the Eclipse's ADBBean objects (e.g.
 
Methods inherited from class adriani.jws.template.wrappers.WrapperOut
getDetails, getMessage, getRecords, getStatus, reset, setDetails, setMessage, setRecords, setStatus
 
Methods inherited from class adriani.jws.template.wrappers.Wrapper
compareSB, getElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WrapperInformationOut

public WrapperInformationOut()
Stateless constructor, loading the default values into this wrapper. This means that all the class attributes are defined, but no ADBBean element is instantiated, because we delegate this task to the validate() method in order to grant loose coupling.

See Also:
setDefaults()

WrapperInformationOut

public WrapperInformationOut(Wrapper[] array)
Stateful constructor, creating an Wrapper set with the input array.

Parameters:
array - the array of Wrapper[]
Method Detail

validate

public boolean validate()
                 throws WrapperFaultOut
Validation is performed by the Eclipse's ADBBean objects (e.g. TownType.setTownType() etc.) If the validation process is successful, the resulting ADBBean object is stored as class field to save computation time, since after validation we expect that the method getElement() should be invoked.

Remark: to grant LOOSE COUPLING to the WSDL, the ADBBean Java classes should be used only within this method and in the forceStatus(), forceMessage() methods, not elsewhere.

Specified by:
validate in class Wrapper
Returns:
true if all the mandatory ADBBean objects have been set correctly
Throws:
WrapperFaultOut

setDefaults

public void setDefaults()
Load all the STATIC default values (defined in this class) into the corresponding class attributes, in this case we create one element array with just one WrapperInformation object (set with his default values), then we set the general purposes class fields (i.e. status and message).

Overrides:
setDefaults in class WrapperOut
See Also:
Wrapper, WrapperOut.forceMessage(String message)

forceStatus

public void forceStatus(int value)
Set an integer value in the wrapped ADBBean element, without checking for validation and ignoring the value of the status class attribute. This method is used when validation fails and it's necessary to set the response status in the status field of the wrapped ADBBean element.

Specified by:
forceStatus in class WrapperOut
Parameters:
value - the response status value

forceMessage

public void forceMessage(java.lang.String message)
Set a string message in the inner ADBBean element, without checking for validation and overwriting the previous value of the message class attribute (in any). This method is used when validation fails and it's necessary to communicate the error in a message field of the wrapped ADBBean element.

Remark: this method MUST be called only after validation, because we want to put all the building logic of the ADBBean structure in the validate() method.

Specified by:
forceMessage in class WrapperOut
Parameters:
message - the validation error message

Build 19/03/2014

Morpheus Technologies - making the Zion software
Copyright © 2009-2014 Morpheus Technologies. All Rights Reserved