class staticbo.shared. DataPortalContext
            Source: shared/
Provides the context for custom data portal actions.
Properties
new DataPortalContext(dao, properties[, getValue][, setValue])
Creates a new data context object. Warning: Data context objects are created in models internally. They are intended only to make publicly available the context for custom data portal actions.
Parameters
| Name | Type | Optional | Description | 
|---|---|---|---|
| 
                       dao  | 
                    
                       object  | 
                    
                       
  | 
                    
                       The data access object of the current model.  | 
                  
| 
                       properties  | 
                    
                       Array of bo.shared.PropertyInfo  | 
                    
                       
  | 
                    
                       An array of property definitions.  | 
                  
| 
                       getValue  | 
                    
                       Yes  | 
                    
                       A function that returns the current value of a property.  | 
                  |
| 
                       setValue  | 
                    
                       Yes  | 
                    
                       A function that changes the current value of a property.  | 
                  
- Throws
 - 
                
Argument error: The dao argument must be an object.
 - 
                
Argument error: The properties must be an array of PropertyInfo objects, or a single PropertyInfo object or null.
 - 
                
Argument error: The getValue argument must be a function.
 - 
                
Argument error: The setValue argument must be a function.
 
Properties
read-onlyconnection
                 object
              The connection object for the data source.
read-onlydao
                 object
              The data access object of the current model.
read-onlyisSelfDirty
                 boolean
              Indicates whether the current model itself has been changed.
read-onlylocale
                 string
              The current locale.
read-onlyproperties
                 Array of bo.shared.PropertyInfo
              Array of property definitions that may appear on the data transfer object.
read-onlyuser
                 bo.system.UserInfo
              The current user.
Methods
getValue(propertyName) → any type
Gets the current value of a model property.
Parameter
| Name | Type | Optional | Description | 
|---|---|---|---|
| 
                         propertyName  | 
                      
                         string  | 
                      
                         
  | 
                      
                         The name of the property.  | 
                    
- Throws
 - 
                  
Argument error: The name must be a non-empty string.
 - 
                  
Argument error: The model has no property with the given name.
 - 
                  
Model error: Cannot read the properties of a collection.
 - Returns
 - 
                  
any typeThe value of the model property. 
setState([connection][, isSelfDirty]) → bo.shared.DataPortalContext
Sets the current state of the model.
Parameters
| Name | Type | Optional | Description | 
|---|---|---|---|
| 
                         connection  | 
                      
                         object  | 
                      
                         Yes  | 
                      
                         The current connection for the data store.  | 
                    
| 
                         isSelfDirty  | 
                      
                         boolean  | 
                      
                         Yes  | 
                      
                         Indicates whether the current model itself has been changed.  | 
                    
- Returns
 - 
                  
bo.shared.DataPortalContextThe data context object itself. 
setValue(propertyName, value)
Sets the current value of a model property.
Parameters
| Name | Type | Optional | Description | 
|---|---|---|---|
| 
                         propertyName  | 
                      
                         string  | 
                      
                         
  | 
                      
                         The name of the property.  | 
                    
| 
                         value  | 
                      
                         any type  | 
                      
                         
  | 
                      
                         The new value of the property.  | 
                    
- Throws
 - 
                  
Argument error: The name must be a non-empty string.
 - 
                  
Argument error: The model has no property with the given name.
 - 
                  
Model error: Cannot write the properties of a collection.