Class FoundationObject

java.lang.Object
com.northconcepts.datapipeline.foundations.core.Bean
com.northconcepts.datapipeline.foundations.core.FoundationObject
All Implemented Interfaces:
DataExceptionContributor, JsonSerializable, RecordSerializable, XmlSerializable, Serializable
Direct Known Subclasses:
CalculatedField, DataMappingObject, Dataset, DecisionTableObject, DecisionTreeObject, JdbcConnection, JdbcSchema, PipelineObject, SchemaObject

public abstract class FoundationObject extends Bean
Abstract super-class for DP Foundation classes that require a consistent error handling mechanism.
See Also:
  • Field Details

    • log

      public static final Logger log
    • TIMESTAMP_FORMAT

      protected static final SimpleDateFormat TIMESTAMP_FORMAT
    • internalId

      protected long internalId
    • internalName

      protected String internalName
  • Constructor Details

    • FoundationObject

      public FoundationObject()
  • Method Details

    • resetInternalId

      public static long resetInternalId()
      Restarts the internal ID sequence shared by all instances so the next one created gets ID 1.
    • clone

      protected FoundationObject clone() throws CloneNotSupportedException
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • getInternalId

      public final long getInternalId()
      The auto numbered ID of this instance.
    • getInternalName

      public final String getInternalName()
      The name of this instance (-).
    • addExceptionProperties

      public DataException addExceptionProperties(DataException exception)
      Adds this object's current state to a DataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.
      Specified by:
      addExceptionProperties in interface DataExceptionContributor
      Overrides:
      addExceptionProperties in class Bean
    • exception

      public DataException exception(String message, Throwable exception)
      Converts an exception to a DataException, prefixing the original message with the specified text and adding this endpoint's properties (name-value pairs).

      The returned exception can then be thrown in the normal way.

      If the supplied exception is an instanceof DataException, it will be returned, otherwise it will be nested inside a DataException. In either case the result message will contain the new prefix along with this endpoint properties.

    • exception

      public DataException exception(Throwable exception)
      Converts an exception to a DataException and adds this endpoint's properties (name-value pairs).

      The returned exception can then be thrown in the normal way.

      If the supplied exception is an instanceof DataException, it will be returned, otherwise it will be nested inside a DataException. In either case the result message will contain this endpoint properties.

    • exception

      public DataException exception(String message)
      Creates an exception with the specified message and containing this endpoint's properties (name-value pairs).

      The returned exception can then be thrown in the normal way.

    • assertValid

      public FoundationObject assertValid()
      Throws a DataException if this object is invalid, otherwise returns it; the base implementation checks nothing.
    • assertValid

      protected FoundationObject assertValid(Collection<? extends FoundationObject> objects)
      Calls assertValid() on each of the given objects; a null collection is ignored.