Class MockDSExportSettings

All Implemented Interfaces:
HasHandlers

public class MockDSExportSettings extends DataClass
Settings used to control the export or serialization of a DataSource by Reify.getMockDS().
  • Constructor Details

    • MockDSExportSettings

      public MockDSExportSettings()
    • MockDSExportSettings

      public MockDSExportSettings(JavaScriptObject jsObj)
  • Method Details

    • getOrCreateRef

      public static MockDSExportSettings getOrCreateRef(JavaScriptObject jsObj)
    • setCriteria

      public MockDSExportSettings setCriteria(Criteria criteria)
      The criteria used to fetch the records returned as part of the export or serialization.
      Parameters:
      criteria - New criteria value. Default value is null
      Returns:
      MockDSExportSettings instance, for chaining setter calls
    • getCriteria

      public Criteria getCriteria()
      The criteria used to fetch the records returned as part of the export or serialization.
      Returns:
      Current criteria value. Default value is null
    • setDropEmptyFields

      public MockDSExportSettings setDropEmptyFields(boolean dropEmptyFields)
      When true, fields whose values are null or undefined in every fetched record are completely omitted from the exported MockDataSource ? both the field declaration and the corresponding record property are dropped. This produces a compact schema containing only fields that carry actual data, which is ideal for reporting demos and other contexts where schema noise should be minimized.

      Primary-key and foreign-key fields are always retained regardless of data content, since they are structurally required.

      This setting is stronger than hideEmptyFields: when both are true, dropEmptyFields takes precedence and empty fields are removed rather than merely demoted to detail:true.

      Parameters:
      dropEmptyFields - New dropEmptyFields value. Default value is false
      Returns:
      MockDSExportSettings instance, for chaining setter calls
      See Also:
    • getDropEmptyFields

      public boolean getDropEmptyFields()
      When true, fields whose values are null or undefined in every fetched record are completely omitted from the exported MockDataSource ? both the field declaration and the corresponding record property are dropped. This produces a compact schema containing only fields that carry actual data, which is ideal for reporting demos and other contexts where schema noise should be minimized.

      Primary-key and foreign-key fields are always retained regardless of data content, since they are structurally required.

      This setting is stronger than hideEmptyFields: when both are true, dropEmptyFields takes precedence and empty fields are removed rather than merely demoted to detail:true.

      Returns:
      Current dropEmptyFields value. Default value is false
      See Also:
    • setFollowFKDepth

      public MockDSExportSettings setFollowFKDepth(int followFKDepth)
      When non-zero, automatically discovers DataSources reachable from the explicitly requested DataSources via foreignKey relationships, up to this many hops. A value of 1 adds DataSources directly referenced by a foreignKey on any requested DataSource; a value of 2 additionally adds DataSources referenced by those, and so on.

      This is useful when exporting a set of interlinked DataSources and you want to automatically include all related DataSources without enumerating them manually. The traversal walks both directions: from a field's foreignKey to the target DataSource, and from a target DataSource back to any DataSource that references it. Self-referential (tree) FKs are not counted as a hop.

      Parameters:
      followFKDepth - New followFKDepth value. Default value is 0
      Returns:
      MockDSExportSettings instance, for chaining setter calls
    • getFollowFKDepth

      public int getFollowFKDepth()
      When non-zero, automatically discovers DataSources reachable from the explicitly requested DataSources via foreignKey relationships, up to this many hops. A value of 1 adds DataSources directly referenced by a foreignKey on any requested DataSource; a value of 2 additionally adds DataSources referenced by those, and so on.

      This is useful when exporting a set of interlinked DataSources and you want to automatically include all related DataSources without enumerating them manually. The traversal walks both directions: from a field's foreignKey to the target DataSource, and from a target DataSource back to any DataSource that references it. Self-referential (tree) FKs are not counted as a hop.

      Returns:
      Current followFKDepth value. Default value is 0
    • setFormat

      public MockDSExportSettings setFormat(MockDSExportFormat format)
      Determines the format emitted by Reify.getMockDS().
      Parameters:
      format - New format value. Default value is "xmlMockDS"
      Returns:
      MockDSExportSettings instance, for chaining setter calls
    • getFormat

      public MockDSExportFormat getFormat()
      Determines the format emitted by Reify.getMockDS().
      Returns:
      Current format value. Default value is "xmlMockDS"
    • setHideEmptyFields

      public MockDSExportSettings setHideEmptyFields(boolean hideEmptyFields)
      When true, fields whose values are null or undefined in every fetched record are automatically marked detail:true in the exported MockDataSource. This keeps structurally important fields (primary keys and foreign keys) visible regardless of data content, while demoting columns that carry no data so they don't clutter default views.

      See also dropEmptyFields to fully remove empty fields from the exported schema and record data.

      Parameters:
      hideEmptyFields - New hideEmptyFields value. Default value is false
      Returns:
      MockDSExportSettings instance, for chaining setter calls
      See Also:
    • getHideEmptyFields

      public boolean getHideEmptyFields()
      When true, fields whose values are null or undefined in every fetched record are automatically marked detail:true in the exported MockDataSource. This keeps structurally important fields (primary keys and foreign keys) visible regardless of data content, while demoting columns that carry no data so they don't clutter default views.

      See also dropEmptyFields to fully remove empty fields from the exported schema and record data.

      Returns:
      Current hideEmptyFields value. Default value is false
      See Also:
    • setIncludeCustomSimpleTypes

      public MockDSExportSettings setIncludeCustomSimpleTypes(boolean includeCustomSimpleTypes)
      Whether to include custom-defined SimpleTypes.
      Parameters:
      includeCustomSimpleTypes - New includeCustomSimpleTypes value. Default value is false
      Returns:
      MockDSExportSettings instance, for chaining setter calls
    • getIncludeCustomSimpleTypes

      public boolean getIncludeCustomSimpleTypes()
      Whether to include custom-defined SimpleTypes.
      Returns:
      Current includeCustomSimpleTypes value. Default value is false
    • setIncludeFKs

      public MockDSExportSettings setIncludeFKs(boolean includeFKs)
      Should foreign key relationships be included in the export or serialization of the DataSource?
      Parameters:
      includeFKs - New includeFKs value. Default value is true
      Returns:
      MockDSExportSettings instance, for chaining setter calls
    • getIncludeFKs

      public boolean getIncludeFKs()
      Should foreign key relationships be included in the export or serialization of the DataSource?
      Returns:
      Current includeFKs value. Default value is true
    • setIncludeFrom

      public MockDSExportSettings setIncludeFrom(boolean includeFrom)
      Should DataSourceField.includeFrom declarations be preserved in the exported MockDataSource? When true, the export reconstructs includeFrom paths from the server-resolved field metadata so the clientOnly DataSource can resolve cross-DS field lookups at runtime.
      Parameters:
      includeFrom - New includeFrom value. Default value is true
      Returns:
      MockDSExportSettings instance, for chaining setter calls
      See Also:
    • getIncludeFrom

      public boolean getIncludeFrom()
      Should DataSourceField.includeFrom declarations be preserved in the exported MockDataSource? When true, the export reconstructs includeFrom paths from the server-resolved field metadata so the clientOnly DataSource can resolve cross-DS field lookups at runtime.
      Returns:
      Current includeFrom value. Default value is true
      See Also:
    • setIncludeImageFields

      public MockDSExportSettings setIncludeImageFields(boolean includeImageFields)
      Should image fields be included in the export or serialization of the DataSource? They are excluded by default since the stored paths are unlikely to be correct when placed in any other environment, such as Reify.
      Parameters:
      includeImageFields - New includeImageFields value. Default value is false
      Returns:
      MockDSExportSettings instance, for chaining setter calls
    • getIncludeImageFields

      public boolean getIncludeImageFields()
      Should image fields be included in the export or serialization of the DataSource? They are excluded by default since the stored paths are unlikely to be correct when placed in any other environment, such as Reify.
      Returns:
      Current includeImageFields value. Default value is false
    • setLocalFKsOnly

      public MockDSExportSettings setLocalFKsOnly(boolean localFKsOnly)
      When true, foreign-key declarations whose target DataSource is not in the set of DataSources being exported are automatically stripped from the output. This prevents the exported file from containing dangling FK references to DataSources that do not exist at runtime, which would cause inner-join filtering to silently drop records and generate console warnings.

      This is a convenient alternative to manually enumerating many omitRelations entries when the export set is a small subset of a large interconnected schema.

      Parameters:
      localFKsOnly - New localFKsOnly value. Default value is false
      Returns:
      MockDSExportSettings instance, for chaining setter calls
      See Also:
    • getLocalFKsOnly

      public boolean getLocalFKsOnly()
      When true, foreign-key declarations whose target DataSource is not in the set of DataSources being exported are automatically stripped from the output. This prevents the exported file from containing dangling FK references to DataSources that do not exist at runtime, which would cause inner-join filtering to silently drop records and generate console warnings.

      This is a convenient alternative to manually enumerating many omitRelations entries when the export set is a small subset of a large interconnected schema.

      Returns:
      Current localFKsOnly value. Default value is false
      See Also:
    • setMaxTreeRoots

      public MockDSExportSettings setMaxTreeRoots(int maxTreeRoots)
      When a self-referential foreign\n key is detected, an exploratory fetch counts the root nodes before committing to tree-style multi-level fetching. If there are more root nodes than maxTreeRoots, the DataSource is exported as a flat table with the standard numRows limit instead.

      This prevents unbounded queries on DataSources where a self-FK is not a true tree hierarchy. Common cases include an orders table where most orders are roots (not created from a quotation), or an employees table where a "referred by" self-FK yields thousands of unlinked root nodes.

      Set to null to disable the exploratory check entirely.

      Parameters:
      maxTreeRoots - New maxTreeRoots value. Default value is 500
      Returns:
      MockDSExportSettings instance, for chaining setter calls
      See Also:
    • getMaxTreeRoots

      public int getMaxTreeRoots()
      When a self-referential foreign\n key is detected, an exploratory fetch counts the root nodes before committing to tree-style multi-level fetching. If there are more root nodes than maxTreeRoots, the DataSource is exported as a flat table with the standard numRows limit instead.

      This prevents unbounded queries on DataSources where a self-FK is not a true tree hierarchy. Common cases include an orders table where most orders are roots (not created from a quotation), or an employees table where a "referred by" self-FK yields thousands of unlinked root nodes.

      Set to null to disable the exploratory check entirely.

      Returns:
      Current maxTreeRoots value. Default value is 500
      See Also:
    • setNonTreeDataSources

      public MockDSExportSettings setNonTreeDataSources(String... nonTreeDataSources)
      IDs of DataSources that should not be treated as tree DataSources despite having self-referential foreign\n keys. Self-FKs on these DataSources are preserved in the exported schema but do not trigger the automatic multi-level tree fetching that normally occurs when a self-FK is detected.

      Use this when a self-referential FK represents a data relationship rather than a parent-child hierarchy ? for example, a sales order referencing the quotation it was created from, or an employee referencing the colleague who referred them. In these cases, tree fetching would issue an unbounded root-node query covering most of the table.

      See also maxTreeRoots, which detects these cases automatically without requiring you to enumerate DataSources.

      Parameters:
      nonTreeDataSources - New nonTreeDataSources value. Default value is null
      Returns:
      MockDSExportSettings instance, for chaining setter calls
      See Also:
    • getNonTreeDataSources

      public String[] getNonTreeDataSources()
      IDs of DataSources that should not be treated as tree DataSources despite having self-referential foreign\n keys. Self-FKs on these DataSources are preserved in the exported schema but do not trigger the automatic multi-level tree fetching that normally occurs when a self-FK is detected.

      Use this when a self-referential FK represents a data relationship rather than a parent-child hierarchy ? for example, a sales order referencing the quotation it was created from, or an employee referencing the colleague who referred them. In these cases, tree fetching would issue an unbounded root-node query covering most of the table.

      See also maxTreeRoots, which detects these cases automatically without requiring you to enumerate DataSources.

      Returns:
      Current nonTreeDataSources value. Default value is null
      See Also:
    • setNumLevels

      public MockDSExportSettings setNumLevels(int numLevels)
      The number of levels of nodes to include, for DataSources that define a tree relationship between fields by declaring a foreignKey on one field that refers to another from that same DataSource.
      Parameters:
      numLevels - New numLevels value. Default value is 3
      Returns:
      MockDSExportSettings instance, for chaining setter calls
      See Also:
    • getNumLevels

      public int getNumLevels()
      The number of levels of nodes to include, for DataSources that define a tree relationship between fields by declaring a foreignKey on one field that refers to another from that same DataSource.
      Returns:
      Current numLevels value. Default value is 3
      See Also:
    • setNumRows

      public MockDSExportSettings setNumRows(int numRows)
      The number of rows of data to include, if more meet the criteria.
      Parameters:
      numRows - New numRows value. Default value is 20
      Returns:
      MockDSExportSettings instance, for chaining setter calls
    • getNumRows

      public int getNumRows()
      The number of rows of data to include, if more meet the criteria.
      Returns:
      Current numRows value. Default value is 20
    • setOmitRelations

      public MockDSExportSettings setOmitRelations(String... omitRelations)
      Foreign key relationships to exclude from the dependency graph that determines fetch order and relation criteria. Omitted FKs do not generate dependency-chain fetch criteria, but FK declarations are still preserved in the exported schema so that DataSourceField.foreignDisplayField and DataSourceField.displayField can resolve display values at runtime from the related MockDataSource's cacheData. To fully strip FK declarations for DataSources not in the export set, use localFKsOnly instead.

      Entries can use either of two formats:

      • targetDS.targetField – omits every FK that references that target, from any DataSource. Use this for lookup/reference tables whose broad criteria would dilute the dependency chain.
      • sourceDS.sourceField – omits only the named field's FK on the named DataSource, leaving other DataSources' references to the same target intact. Use this to break circular FK dependencies.
      Parameters:
      omitRelations - New omitRelations value. Default value is null
      Returns:
      MockDSExportSettings instance, for chaining setter calls
      See Also:
    • getOmitRelations

      public String[] getOmitRelations()
      Foreign key relationships to exclude from the dependency graph that determines fetch order and relation criteria. Omitted FKs do not generate dependency-chain fetch criteria, but FK declarations are still preserved in the exported schema so that DataSourceField.foreignDisplayField and DataSourceField.displayField can resolve display values at runtime from the related MockDataSource's cacheData. To fully strip FK declarations for DataSources not in the export set, use localFKsOnly instead.

      Entries can use either of two formats:

      • targetDS.targetField – omits every FK that references that target, from any DataSource. Use this for lookup/reference tables whose broad criteria would dilute the dependency chain.
      • sourceDS.sourceField – omits only the named field's FK on the named DataSource, leaving other DataSources' references to the same target intact. Use this to break circular FK dependencies.
      Returns:
      Current omitRelations value. Default value is null
      See Also:
    • setPerDSCriteria

      public MockDSExportSettings setPerDSCriteria(Map perDSCriteria)
      An object mapping DataSource IDs to Criteria that should be applied when fetching records for that DataSource. The criteria are combined with any global Criteria and any relation-derived criteria using DataSource.combineCriteria().

      For tree DataSources, per-DS criteria are applied to every level of the tree fetch. To restrict only which roots are fetched while allowing unrestricted child expansion, use treeRoots instead.

      Parameters:
      perDSCriteria - New perDSCriteria value. Default value is null
      Returns:
      MockDSExportSettings instance, for chaining setter calls
      See Also:
    • getPerDSCriteria

      public Map getPerDSCriteria()
      An object mapping DataSource IDs to Criteria that should be applied when fetching records for that DataSource. The criteria are combined with any global Criteria and any relation-derived criteria using DataSource.combineCriteria().

      For tree DataSources, per-DS criteria are applied to every level of the tree fetch. To restrict only which roots are fetched while allowing unrestricted child expansion, use treeRoots instead.

      Returns:
      Current perDSCriteria value. Default value is null
      See Also:
    • setRequestProperties

      public MockDSExportSettings setRequestProperties(DSRequest... requestProperties)
      The properties that will be specified on the DSRequest when fetching records. You can pass an array of different request properties matching the length of the dsNames param of Reify.getMockDS() or Reify.showMockDS() if you want the fetch for each DataSource made with different properties.
      Parameters:
      requestProperties - New requestProperties value. Default value is null
      Returns:
      MockDSExportSettings instance, for chaining setter calls
    • getRequestProperties

      public DSRequest[] getRequestProperties()
      The properties that will be specified on the DSRequest when fetching records. You can pass an array of different request properties matching the length of the dsNames param of Reify.getMockDS() or Reify.showMockDS() if you want the fetch for each DataSource made with different properties.
      Returns:
      Current requestProperties value. Default value is null
    • setRequestProperties

      public MockDSExportSettings setRequestProperties(DSRequest requestProperties)
      The properties that will be specified on the DSRequest when fetching records. You can pass an array of different request properties matching the length of the dsNames param of Reify.getMockDS() or Reify.showMockDS() if you want the fetch for each DataSource made with different properties.
      Parameters:
      requestProperties - New requestProperties value. Default value is null
      Returns:
      MockDSExportSettings instance, for chaining setter calls
    • getRequestPropertiesAsDSRequest

      public DSRequest getRequestPropertiesAsDSRequest()
      The properties that will be specified on the DSRequest when fetching records. You can pass an array of different request properties matching the length of the dsNames param of Reify.getMockDS() or Reify.showMockDS() if you want the fetch for each DataSource made with different properties.
      Returns:
      Current requestProperties value. Default value is null
    • setRootCriteriaOnly

      public MockDSExportSettings setRootCriteriaOnly(boolean rootCriteriaOnly)
      For DataSources that define a tree relationship between fields by declaring a foreignKey on one field that refers to another from that same DataSource, should criteria be applied only to the root node? If false, the criteria will be applied to all nodes.
      Parameters:
      rootCriteriaOnly - New rootCriteriaOnly value. Default value is false
      Returns:
      MockDSExportSettings instance, for chaining setter calls
      See Also:
    • getRootCriteriaOnly

      public boolean getRootCriteriaOnly()
      For DataSources that define a tree relationship between fields by declaring a foreignKey on one field that refers to another from that same DataSource, should criteria be applied only to the root node? If false, the criteria will be applied to all nodes.
      Returns:
      Current rootCriteriaOnly value. Default value is false
      See Also:
    • setSequentialFetching

      public MockDSExportSettings setSequentialFetching(boolean sequentialFetching)
      When true, fetches records from each DataSource one at a time rather than batching all independent fetches into a single queued request. This is recommended when exporting from large production databases where concurrent queries can exhaust connection pools. See the Large Database Export overview for guidance.
      Parameters:
      sequentialFetching - New sequentialFetching value. Default value is false
      Returns:
      MockDSExportSettings instance, for chaining setter calls
      See Also:
    • getSequentialFetching

      public boolean getSequentialFetching()
      When true, fetches records from each DataSource one at a time rather than batching all independent fetches into a single queued request. This is recommended when exporting from large production databases where concurrent queries can exhaust connection pools. See the Large Database Export overview for guidance.
      Returns:
      Current sequentialFetching value. Default value is false
      See Also:
    • setTreeRoots

      public MockDSExportSettings setTreeRoots(Map treeRoots)
      An object mapping DataSource IDs to arrays of primary key values identifying the specific root nodes to include for tree DataSources. Unlike perDSCriteria, which filters every level of the tree, treeRoots restricts only the initial root-level fetch ? child nodes under the specified roots are fetched without the root restriction.

      This is useful when you want a complete subtree under specific known roots. For example, to export only the "Electronics" and "Clothing" product category trees:

          treeRoots: { productCategory: ["electronics", "clothing"] }
        
      Parameters:
      treeRoots - New treeRoots value. Default value is null
      Returns:
      MockDSExportSettings instance, for chaining setter calls
      See Also:
    • getTreeRoots

      public Map getTreeRoots()
      An object mapping DataSource IDs to arrays of primary key values identifying the specific root nodes to include for tree DataSources. Unlike perDSCriteria, which filters every level of the tree, treeRoots restricts only the initial root-level fetch ? child nodes under the specified roots are fetched without the root restriction.

      This is useful when you want a complete subtree under specific known roots. For example, to export only the "Electronics" and "Clothing" product category trees:

          treeRoots: { productCategory: ["electronics", "clothing"] }
        
      Returns:
      Current treeRoots value. Default value is null
      See Also:
    • setValidatorMode

      public MockDSExportSettings setValidatorMode(MockDSExportValidatorMode validatorMode)
      Controls which validators, if any, to include in the fields of the exported MockDataSource. Since MockDataSources are client-only, server-only validators are not exported. Auto-generated validators are also not exported, since they will be recreated based on the type of the field during the import process.
      Parameters:
      validatorMode - New validatorMode value. Default value is "standard"
      Returns:
      MockDSExportSettings instance, for chaining setter calls
    • getValidatorMode

      public MockDSExportValidatorMode getValidatorMode()
      Controls which validators, if any, to include in the fields of the exported MockDataSource. Since MockDataSources are client-only, server-only validators are not exported. Auto-generated validators are also not exported, since they will be recreated based on the type of the field during the import process.
      Returns:
      Current validatorMode value. Default value is "standard"