public class ManagedEntity
extends java.lang.Object
A data service parameter that represents the entity corresponding to one record of the datastore handled by the data service. This class can be used as a valid input or output parameter of a data service method. It represents one record of the datastore for which service has been generated. For example, for a SALES_CUSTOMERS table this class will represent a customer record.
A managed entity contains a set of columns usually identified by their names.
These are the Defined Columns. When a column is set to a value, even
a null value, it is considered as defined. A column that is considered as
undefined (because it has been removed using removeColumn
, or
because it was not present in the original resultset) is usually not taken
into account in changes to the datastore behind the
ManagedEntity
. In the case of an RDBMS table for example, the
column should not appear in any INSERT/UPDATE statements, and will take a
default value. Undefined columns correspond to optional elements in a SOAP
envelope that are not defined.
Constructor and Description |
---|
ManagedEntity()
Constructs a new
ManagedEntity object. |
Modifier and Type | Method and Description |
---|---|
void |
assertColsDefined(java.util.List pColumnsName)
Asserts that all columns in the list of column names
pColumnsName have been defined. |
static ManagedEntity |
createFromResultSet(java.sql.ResultSet pResultSet,
java.util.List pColumnsList)
Helper method used to create a
ManagedEntity from a JDBC
ResultSet object.This method creates a new ManagedEntity and sets its
columns' values to those from the ResultSet . |
java.lang.Object |
getColumnValue(java.lang.String pColumnName)
Returns the value of a column specified by its name.
|
java.util.List |
getDefinedColumns()
Returns the list of columns defined for the
ManagedEntity . |
java.util.List |
getDefinedColumns(java.util.List pColumnList)
Returns the columns in
pColumnList that are defined. |
boolean |
isColumnDefined(java.lang.String pColumnName)
Checks whether a column, specified by name, has been defined.
|
void |
removeColumn(java.lang.String pColumnName)
Removes the specified column from the defined columns.
|
void |
setColumnValue(java.lang.String pColumnName,
java.lang.Object pValue)
Sets the value of a column specified by name.
|
java.lang.String |
toString() |
public ManagedEntity()
ManagedEntity
object. This managed entity
has no defined columns .public void assertColsDefined(java.util.List pColumnsName) throws InvalidInputMessageException
pColumnsName
have been defined.pColumnsName
- list of column names.InvalidInputMessageException
- if not all columns have been definedpublic java.util.List getDefinedColumns()
ManagedEntity
.public java.util.List getDefinedColumns(java.util.List pColumnList)
pColumnList
that are defined.pColumnList
- list of columns names to checkpublic boolean isColumnDefined(java.lang.String pColumnName)
pColumnName
- the column namepublic java.lang.Object getColumnValue(java.lang.String pColumnName)
pColumnName
- the column name.isColumnDefined
to check whether the column is
defined or not.setColumnValue(java.lang.String, java.lang.Object)
public void setColumnValue(java.lang.String pColumnName, java.lang.Object pValue)
pColumnName
- the column name.pValue
- the column value.getColumnValue(java.lang.String)
public void removeColumn(java.lang.String pColumnName)
pColumnName
- the column namepublic static ManagedEntity createFromResultSet(java.sql.ResultSet pResultSet, java.util.List pColumnsList) throws java.sql.SQLException
ManagedEntity
from a JDBC
ResultSet
object.ManagedEntity
and sets its
columns' values to those from the ResultSet
. The values of
the columns listed in pColumnsList
are added to the fields
of the ManagedEntity
.pResultSet
- the ResultSet
from which to retrieve the
datapColumnsList
- the list of columns to set in the
ManagedEntity
null
if pResultSet.next()
returns
false; a ManagedEntity
otherwisejava.sql.SQLException
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()