All Implemented Interfaces:
DataExceptionContributor, JsonSerializable, RecordSerializable, XmlSerializable, Serializable

public class DataMappingResult extends DataMappingObject
The outcome of mapping one record with a DataMapping: the target record plus any failed condition, field mapping exceptions and schema validation results.
See Also:
  • Constructor Details

    • DataMappingResult

      public DataMappingResult()
  • Method Details

    • getSource

      public Record getSource()
      Returns the source record, which a DataMapping only sets when it has a source entity.
    • setSource

      public DataMappingResult setSource(Record source)
      Sets the source record (a DataMapping only sets it when it has a source entity).
    • getSourceAsJson

      public String getSourceAsJson()
    • getTarget

      public Record getTarget()
      Returns the mapped record, or null if a condition or the source entity validation failed.
    • setTarget

      public DataMappingResult setTarget(Record target)
      Sets the mapped record (left null when a condition or the source entity validation failed).
    • getTargetAsJson

      public String getTargetAsJson()
    • getFailedCondition

      public LogicalExpression getFailedCondition()
      Returns the first mapping condition that was false, or null if none failed.
    • setFailedCondition

      public DataMappingResult setFailedCondition(LogicalExpression failedCondition)
      Sets the mapping condition that was false, which stops the record from being mapped.
    • getConditionFailedSource

      public String getConditionFailedSource()
      Returns the expression text of the failed condition, or null if none failed.
    • getExceptions

      public Map<String,Throwable> getExceptions(boolean create)
      Returns the exceptions thrown by field mappings, keyed by target field name, creating the map first if create is true (otherwise null when none were recorded).
    • getExceptions

      public Map<String,Throwable> getExceptions()
      Returns the exceptions thrown by field mappings, keyed by target field name, or null if none were recorded.
    • hasExceptions

      public boolean hasExceptions()
    • logExceptions

      public DataMappingResult logExceptions()
      Prints each field mapping exception and its stack trace to standard error.
    • logExceptions

      public DataMappingResult logExceptions(PrintStream printStream)
    • getErrors

      public List<ValidationMessage> getErrors()
      Returns the source and target entity validation errors combined, or an empty list if there are none.
    • getSourceEntityResult

      public ValidationResult getSourceEntityResult()
      Returns the result of validating the source record against the mapping's source entity, or null if it was not validated.
    • setSourceEntityResult

      public DataMappingResult setSourceEntityResult(ValidationResult sourceEntityResult)
      Sets the result of validating the source record against the mapping's source entity.
    • getTargetEntityResult

      public ValidationResult getTargetEntityResult()
      Returns the result of validating the target record against the mapping's target entity, or null if it was not validated.
    • setTargetEntityResult

      public DataMappingResult setTargetEntityResult(ValidationResult targetEntityResult)
      Sets the result of validating the target record against the mapping's target entity.
    • getTargetValidationResult

      @Deprecated public ValidationResult getTargetValidationResult()
      Deprecated.
    • setTargetValidationResult

      @Deprecated public DataMappingResult setTargetValidationResult(ValidationResult targetValidationResult)
      Deprecated.
    • hasSourceValidationErrors

      public boolean hasSourceValidationErrors()
    • hasTargetValidationErrors

      public boolean hasTargetValidationErrors()
    • hasValidationErrors

      public boolean hasValidationErrors()
    • logValidationErrors

      public DataMappingResult logValidationErrors()
      Prints the field name and message of each validation error to standard error.
    • logValidationErrors

      public DataMappingResult logValidationErrors(PrintStream printStream)
    • getDataMappingResult

      public static DataMappingResult getDataMappingResult(Record record)
      Returns the result attached to the record by setDataMappingResult(Record, DataMappingResult), or null if there is none.
    • setDataMappingResult

      public static void setDataMappingResult(Record record, DataMappingResult result)
      Attaches the result to the record as a session property; does nothing if the record is null.