LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.data
Class LyResponse

java.lang.Object
  extended by leon.data.LyResponse

public final class LyResponse
extends java.lang.Object

This class implements a response to an operation requested on a data source.

Supported operations are : create, set, delete, load, count, save.

The status of the response is used to know : if the operation has been completed (COMPLETED), if it has not been sent yet (PENDING), if there is no result yet (RUNNING), or if an error occured (ERROR).

Depending on the requested operation, the result can be simple or multiple.

If an error occurs, the response contains an error message which indicates the origin of the error.

See Also:
LyDataSource

Nested Class Summary
static class LyResponse.Operation
          Operation types.
static class LyResponse.Status
          Response statuses.
 
Field Summary
static java.lang.String __VERSION
          File version
 
Constructor Summary
LyResponse(LyResponse.Operation operation, LyClass cls)
          Constructs a response concerning the given operation type.
 
Method Summary
 void addResponse(java.lang.Object object, LyValueSet values)
          Adds a new response for the given object in this response.
 boolean contains(LyObject object)
          Checks if an object is contained in responses list.
 boolean deleteLinkedObjects()
          Checks if linked objects are deleted or not.
 void deleteLinkedObjects(boolean deleteLinkedObjects)
          Modified of the _deleteLinkedObjects property.
 void enableReloading(boolean reloading)
          Sets whether the response allows existing objects to be reloaded.
 java.lang.String getError()
          Gets error message of the response.
 LyResponseListener getListener()
          Gets the listener which sent the request to the data source.
 LyObjectList getObjects()
          Gets a copy of the list of objects in the response.
 LyObjectList getObjects(boolean distinctValues)
          Gets a copy of the list of objects in the response.
 LyResponse.Operation getOperation()
          Gets the operation type of the response.
 java.lang.Object getResponse(int idx)
          Get the object of this response at the given position.
 int getSize()
          Gets the number of available responses.
 java.util.Vector<LyDataSourceListener> getSkippedListeners()
          Method to get listeners that don't need to be notified of an event following this response.
 LyResponse.Status getStatus()
          Gets the status of the response.
 LyValueSet getValues(int idx)
          Get the values set of this response at the given position.
 boolean hasDistinctValues()
          Checks if the response has distincted values or not.
 boolean isCounted()
          Checks if the response is counted.
 boolean isFiltered()
          Checks if the response is filtered.
 boolean isFullLoad()
          Checks if the response is a ful load.
 boolean isLocal()
          Check if the operation is local or not.
 boolean isNotified()
          Check if the response is a notification one.
 boolean isPaginated()
          Checks if the response is paginated.
 boolean isPartial()
          Checks if the response is partial.
 boolean isPartialNotification()
          Checks if the response manages partial notifications of loaded objects.
 boolean isRefresh()
          Check if the operation is refreshed or not.
 boolean isReloadingEnabled()
          Checks if the response allows existing objects to be reloaded.
 boolean isSorted()
          Checks if the response is sorted.
 void setCounted(boolean counted)
          Sets whether this response is counted or not.
 void setDistinctValues(boolean distinctValues)
          Sets whether this response has distinct values or not.
 void setError(java.lang.String error)
          Sets the error message of the response.
 void setFiltered(boolean filtered)
          Sets whether this response is filtered or not.
 void setFullLoad(boolean fullLoad)
          Sets whether this response is a full loading or not.
 void setListener(LyResponseListener listener)
          Sets the listener of this response.
 void setLocal(boolean local)
          Set whether this operation is local or not.
 void setNotified(boolean notified)
          Set whether this response is a notification or not.
 void setPaginated(boolean paginated)
          Sets whether this response is paginated or not.
 void setPartial(boolean partial)
          Sets whether this response is partial or not.
 void setPartialNotification(boolean partialNotification)
          Sets whether this response manages partial notifications of loaded objects.
 void setRefresh(boolean refresh)
          Set whether this operation is refresh or not.
 void setSorted(boolean sorted)
          Sets whether this response is sorted or not.
 void setStatus(LyResponse.Status status)
          Sets the status of the response.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
File version

See Also:
Constant Field Values
Constructor Detail

LyResponse

public LyResponse(LyResponse.Operation operation,
                  LyClass cls)
Constructs a response concerning the given operation type.

Parameters:
operation - Type of operation.
cls - The class of the operation.
Method Detail

getOperation

public LyResponse.Operation getOperation()
Gets the operation type of the response.

Returns:
Operation type of this response.

getStatus

public LyResponse.Status getStatus()
Gets the status of the response.

Returns:
Status of this response.

getListener

public LyResponseListener getListener()
Gets the listener which sent the request to the data source.

Returns:
Listener of this response.

getError

public java.lang.String getError()
Gets error message of the response.

Returns:
Error message.
Throws:
java.lang.IllegalStateException - If the response has not the error status.

isSorted

public boolean isSorted()
Checks if the response is sorted. For a load request, responses given take into account the sort that was requested.

Returns:
True if responses were sorted, false otherwise.

isFiltered

public boolean isFiltered()
Checks if the response is filtered. For a load request, responses given take into account the filter that was specified.

Returns:
True if responses were filtered, false otherwise.

isCounted

public boolean isCounted()
Checks if the response is counted. For a load request, responses given take into account the number of responses that was requested.

Returns:
True if responses were counted, false otherwise.

hasDistinctValues

public boolean hasDistinctValues()
Checks if the response has distincted values or not. For a load request, responses may contain duplicate values depending of the capacity of the provider.

Returns:
True if responses contains distincted values , false otherwise.

isPartial

public boolean isPartial()
Checks if the response is partial.

Returns:
True if responses is partial, false otherwise.

isFullLoad

public boolean isFullLoad()
Checks if the response is a ful load.

Returns:
True if responses is a full load, false otherwise.

isNotified

public boolean isNotified()
Check if the response is a notification one.

Returns:
true if the response is a notification, false otherwise.

isLocal

public boolean isLocal()
Check if the operation is local or not.

Returns:
true if the operation is local, false otherwise.

isRefresh

public boolean isRefresh()
Check if the operation is refreshed or not.

Returns:
true if the operation is refresh, false otherwise.

deleteLinkedObjects

public boolean deleteLinkedObjects()
Checks if linked objects are deleted or not.

Returns:
True if deleted, false otherwise.

getSize

public int getSize()
Gets the number of available responses.

Returns:
Number of available responses.

getResponse

public java.lang.Object getResponse(int idx)
Get the object of this response at the given position.

Parameters:
idx - Index of the requested object.
Returns:
Object at the given index.
Throws:
java.lang.IllegalStateException - If the response is still pending (not sent).
java.lang.IndexOutOfBoundsException - If index is negative or greater or equals to the number of available responses.

getValues

public LyValueSet getValues(int idx)
Get the values set of this response at the given position.

Parameters:
idx - Index of the requested values set.
Returns:
Values set at the given index. May be null.
Throws:
java.lang.IllegalStateException - If the response is still pending (not sent).
java.lang.IndexOutOfBoundsException - If index is negative or greater or equals to the number of available responses.

getObjects

public LyObjectList getObjects()
Gets a copy of the list of objects in the response. This methods makes a copy of the list an calling this method may be slower than getResponse.

Returns:
The object list
Throws:
java.lang.IllegalStateException - If the response is still pending (not sent).
See Also:
getResponse(int)

getObjects

public LyObjectList getObjects(boolean distinctValues)
Gets a copy of the list of objects in the response. This methods makes a copy of the list an calling this method may be slower than getResponse.

Parameters:
distinctValues - Boolean indicating if distinct values are requested.
Returns:
The object list
Throws:
java.lang.IllegalStateException - If the response is still pending (not sent).
See Also:
getResponse(int)

contains

public boolean contains(LyObject object)
Checks if an object is contained in responses list.

Parameters:
object - Checked object.
Returns:
True if the given object is contained in this response.

setListener

public void setListener(LyResponseListener listener)
Sets the listener of this response.

Parameters:
listener - Listener of this response.
Throws:
java.lang.IllegalStateException - If this response has already a listener.

setSorted

public void setSorted(boolean sorted)
Sets whether this response is sorted or not. This method is used by data providers to indicate if the sort could be done on the physical layer.

Parameters:
sorted - True if the response is sorted, false otherwise.

setFiltered

public void setFiltered(boolean filtered)
Sets whether this response is filtered or not. This method is used by data providers to indicate if the filter could be applied on the physical layer.

Parameters:
filtered - True if the response is filtered, false otherwise.

setNotified

public void setNotified(boolean notified)
Set whether this response is a notification or not. This method is used by the event decoder when loading an object.

Parameters:
notified - true if the response is a notification.

setLocal

public void setLocal(boolean local)
Set whether this operation is local or not. This method is used by the object source for local operations.

Parameters:
local - true if the operation is local.

setRefresh

public void setRefresh(boolean refresh)
Set whether this operation is refresh or not. This method is used by the object source for refresh operations.

Parameters:
refresh - true if the operation is refresh.

deleteLinkedObjects

public void deleteLinkedObjects(boolean deleteLinkedObjects)
Modified of the _deleteLinkedObjects property.

Parameters:
deleteLinkedObjects - a list of LyObject

setCounted

public void setCounted(boolean counted)
Sets whether this response is counted or not. This method is used by data providers to indicate if the count could be done on the physical layer.

Parameters:
counted - True if the response is counted, false otherwise.

setDistinctValues

public void setDistinctValues(boolean distinctValues)
Sets whether this response has distinct values or not. This method is used by data providers to indicate if the physical layer can distinct values or not for a LOAD request.

Parameters:
distinctValues - True if the response has distinct values, false otherwise.

setPartial

public void setPartial(boolean partial)
Sets whether this response is partial or not.

Parameters:
partial - True if the response is partial, false otherwise.

setFullLoad

public void setFullLoad(boolean fullLoad)
Sets whether this response is a full loading or not.

Parameters:
fullLoad - True if the response is a full loading, false otherwise.

setStatus

public void setStatus(LyResponse.Status status)
Sets the status of the response.

Parameters:
status - New status of this response.
Throws:
java.lang.IllegalArgumentException - If the given status is unknown.

setError

public void setError(java.lang.String error)
Sets the error message of the response.

Parameters:
error - New error message.

addResponse

public void addResponse(java.lang.Object object,
                        LyValueSet values)
Adds a new response for the given object in this response.

Parameters:
object - Object concerned by the response.
values - List of values changed on the given object (may be null).
Throws:
java.lang.IllegalStateException - If the status of this response is pending.
java.lang.IllegalStateException - If the status of this response is error and the given object is not null.

getSkippedListeners

public java.util.Vector<LyDataSourceListener> getSkippedListeners()
Method to get listeners that don't need to be notified of an event following this response.

Returns:
List of listeners that don't need to be notified.

isPaginated

public boolean isPaginated()
Checks if the response is paginated. This method is used to check if pagination was done on the physical layer.

Returns:
True if responses were paginated, false otherwise.

setPaginated

public void setPaginated(boolean paginated)
Sets whether this response is paginated or not. This method is used by data providers to indicate if the pagination could be done on the physical layer.

Parameters:
paginated - True if the response is paginated, false otherwise.

isReloadingEnabled

public boolean isReloadingEnabled()
Checks if the response allows existing objects to be reloaded.

Returns:
True if reloading is enabled, false otherwise.

enableReloading

public void enableReloading(boolean reloading)
Sets whether the response allows existing objects to be reloaded.


isPartialNotification

public boolean isPartialNotification()
Checks if the response manages partial notifications of loaded objects.

Returns:
True if responses manages partial notifications of loaded objects, false otherwise.

setPartialNotification

public void setPartialNotification(boolean partialNotification)
Sets whether this response manages partial notifications of loaded objects.

Parameters:
partialNotification - True if the response manages partial notifications of loaded objects, false otherwise.

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com