Class ModelList<M extends Model>

java.lang.Object
com.onenetwork.platform.data.model.ModelList<M>

public class ModelList<M extends Model>
extends java.lang.Object
Contains a list of Models to be used in conjunction with the write* methods of ModelDataService.
  • Constructor Summary

    Constructors 
    Constructor Description
    ModelList()
    Constructs a new empty ModelList.
    ModelList​(java.lang.String customModelName, java.lang.String actionName, java.util.Collection<M> models)
    Constructs a new ModelList with the given custom model name, action name & models (To be used when you want to work with Models of a specific type from an SPT.)
    ModelList​(java.lang.String customModelName, java.lang.String actionName, M... models)
    Constructs a new ModelList with the given custom model name, action name & models.
    ModelList​(java.lang.String actionName, java.util.Collection<M> models)
    Constructs a new ModelList with the given action name & models.
    ModelList​(java.lang.String actionName, M... models)
    Constructs a new ModelList with the given action name & models.
  • Method Summary

    Modifier and Type Method Description
    java.lang.String getActionName()
    Returns the action name from MPT or SPT which is to be invoked to perform the write operation.
    java.lang.String getCustomModelName()
    Returns the name of the custom model from the SPT which should be used.
    java.util.List<StatusMessage> getErrors()
    If there are any Errors on the individual Models (and their children) in the list, returns those.
    StatusMessage getListError()
    After a write operation is called, this returns any "top level" error on the ModelList which applies to all Models underneath.
    java.util.List<M> getModels()
    Returns the List of Models to be written - these must be top level Models, not child levels
    java.lang.Long getValueChainId()
    Returns the ValueChainId for the Models - if omitted, the calling PlatformUserContext value chain id will be used.
    void setActionName​(java.lang.String value)
    Sets the action name from MPT or SPT which is to be invoked to perform the write operation.
    void setCustomModelName​(java.lang.String value)
    Sets the name of the custom model from the SPT which should be used.
    void setListError​(StatusMessage value)
    Sets the "top level" error on the ModelList which applies to all Models underneath .
    void setListError​(java.lang.String msg, java.lang.Object... args)  
    void setValueChainId​(long value)
    Sets the ValueChainId for the Models - if omitted, the calling PlatformUserContext value chain id will be used.
    java.lang.String toString()  
    java.lang.String toXML()
    Returns an XML representation of this ModelList.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ModelList

      public ModelList()
      Constructs a new empty ModelList. You must populate it with at least actionName and one Model before use.
    • ModelList

      @SafeVarargs public ModelList​(java.lang.String actionName, M... models)
      Constructs a new ModelList with the given action name & models. (To be used when you want to work with the "default type" for the given Models, without consideration of possible SPT customizations.)
      Parameters:
      actionName - action name (from MPT or SPT)
      models - models to be written - must be top level models (not child levels)
    • ModelList

      public ModelList​(java.lang.String actionName, java.util.Collection<M> models)
      Constructs a new ModelList with the given action name & models. (To be used when you want to work with the "default type" for the given Models, without consideration of possible SPT customizations.)
      Parameters:
      actionName - action name (from MPT or SPT)
      models - models to be written - must be top level models (not child levels)
    • ModelList

      @SafeVarargs public ModelList​(java.lang.String customModelName, java.lang.String actionName, M... models)
      Constructs a new ModelList with the given custom model name, action name & models. (To be used when you want to work with Models of a specific type from an SPT.)
      Parameters:
      customModelName - name of the custom model in the SPT, or can be left null to use the default (see getCustomModelName()
      actionName - action name (from MPT or SPT)
      models - models to be written - must be top level models (not child levels)
    • ModelList

      public ModelList​(java.lang.String customModelName, java.lang.String actionName, java.util.Collection<M> models)
      Constructs a new ModelList with the given custom model name, action name & models (To be used when you want to work with Models of a specific type from an SPT.)
      Parameters:
      customModelName - name of the custom model in the SPT, or can be left null to use the default (see getCustomModelName()
      actionName - action name (from MPT or SPT)
      models - models to be written - must be top level models (not child levels)
  • Method Details

    • getValueChainId

      public java.lang.Long getValueChainId()
      Returns the ValueChainId for the Models - if omitted, the calling PlatformUserContext value chain id will be used.
    • setValueChainId

      public void setValueChainId​(long value)
      Sets the ValueChainId for the Models - if omitted, the calling PlatformUserContext value chain id will be used.
    • getCustomModelName

      public java.lang.String getCustomModelName()
      Returns the name of the custom model from the SPT which should be used. If not supplied, and the actions is a module create action, defaults to "Standard ", for example "Standard ZBKS.Book" for model "Book" in module with prefix ZBKS.
    • setCustomModelName

      public void setCustomModelName​(java.lang.String value)
      Sets the name of the custom model from the SPT which should be used. See getCustomModelName()
    • getActionName

      public java.lang.String getActionName()
      Returns the action name from MPT or SPT which is to be invoked to perform the write operation.
    • setActionName

      public void setActionName​(java.lang.String value)
      Sets the action name from MPT or SPT which is to be invoked to perform the write operation.
    • getErrors

      public java.util.List<StatusMessage> getErrors()
      If there are any Errors on the individual Models (and their children) in the list, returns those. Else returns the list-level error if non-null. Else returns an empty collection.

      Useful for checking whether any errors occurred during write, for example:

       if (modelList.getErrors().size() > 0) {  ... report errors.../ }
       
    • getListError

      public StatusMessage getListError()
      After a write operation is called, this returns any "top level" error on the ModelList which applies to all Models underneath. This does not include errors for the Models in the list itself.
    • setListError

      public void setListError​(StatusMessage value)
      Sets the "top level" error on the ModelList which applies to all Models underneath .
    • getModels

      public java.util.List<M> getModels()
      Returns the List of Models to be written - these must be top level Models, not child levels
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • setListError

      public void setListError​(java.lang.String msg, java.lang.Object... args)
    • toXML

      public java.lang.String toXML()
      Returns an XML representation of this ModelList. To convert XML to a Model, see XMLService.