Class RestrictionModel

java.lang.Object
net.sf.jailer.restrictionmodel.RestrictionModel

public class RestrictionModel extends Object
Restricts association-definitions in a DataModel.
Author:
Ralf Wisser
  • Field Details

    • IGNORE

      public static final String IGNORE
      "ignore the association" - restriction.
  • Constructor Details

    • RestrictionModel

      public RestrictionModel(DataModel dataModel, ExecutionContext executionContext)
      Constructor.
      Parameters:
      dataModel - the data-model
      executionContext - the execution context
  • Method Details

    • transpose

      public void transpose()
      Transposes the restriction-model.
    • isTransposed

      public boolean isTransposed()
      Is the restriction-model transposed?
      Returns:
      true if the restriction-model is transposed
    • getRestriction

      public String getRestriction(Association association)
      Gets the restriction (in SQL) for an association.
      Parameters:
      association - the association
      Returns:
      the restriction. null if association is not restricted. IGNORE if association must be ignored.
    • addRestrictionDefinition

      public void addRestrictionDefinition(URL extractionModelURL, Map<String,String> parameters) throws Exception
      Adds restrictions defined in a restriction-file.
      Parameters:
      extractionModelURL - URL of the restriction-file to read
      parameters - apply this parameter-value mapping to all restriction conditions
      Throws:
      Exception
    • addRestrictionDefinition

      public void addRestrictionDefinition(CsvFile csvFile, String fileName, Map<String,String> parameters) throws Exception
      Adds restrictions defined in a restriction-file.
      Parameters:
      csvFile - the CSV file containing the restriction definitions
      fileName - name of the restriction file (for tracking)
      parameters - apply this parameter-value mapping to all restriction conditions
      Throws:
      Exception
    • addRestriction

      public void addRestriction(Association association, String condition, String location, Map<String,String> parameters)
      Adds a restriction to a association.
      Parameters:
      association - the association
      condition - the restriction-condition
      location - location in CSV-file
      parameters - apply this parameter-value mapping to all restriction conditions
    • addRestriction

      public void addRestriction(Association association, String condition, String location, boolean removePreviousRestriction, Map<String,String> parameters)
      Adds a restriction to a association.
      Parameters:
      association - the association
      condition - the restriction-condition
      location - location in CSV-file
      removePreviousRestriction - if true, remove any restriction on the association before adding the new one
      parameters - apply this parameter-value mapping to all restriction conditions
    • toString

      public String toString()
      Stringifies the restriction model.
      Overrides:
      toString in class Object