Interface ModelContext

  • All Known Implementing Classes:
    ModelContextImpl, ModelContextRecordingMetadata

    public interface ModelContext
    A ModelContext is a reference to a set of interconnected Propertyset instances forming a model or several models. A ModelContext can be persisted with JsonPropertysetPersister#persist(java.io.File, ModelContext) and restored with JsonPropertysetPersister#restore(java.io.File, ModelContext). A ModelContext will keep track of the last modification time of each Propertyset and when merging two ModelContexts all Propertysets will be merged, and when merging each Propertyset, the Propertyset with the newest modification date will win in case of conflict.
    • Method Detail

      • listAllAspects

        Collection<Propertyset> listAllAspects()
        List all of the Propertyset instances with ids that contain aspect descriptions in this context. Aspect definitons follow a structure similar to JSON schemas.
        Returns:
        a collection of Propertyset instances containing aspect definitions.
      • findObjectsOfAspect

        Collection<Propertyset> findObjectsOfAspect​(Propertyset aspect)
        Find all of the Propertyset instances that have had a particular aspect applied to it. If the aspect is a base object for other aspects, propertysets matching the child aspects will also be returned.
        Parameters:
        aspect - the aspect to find propertysets matching
        Returns:
        a collection of Propertyset instances
      • getLastmodifieddate

        Date getLastmodifieddate​(Propertyset propertyset)
        Get the last modified date and time of a propertyset.
        Parameters:
        propertyset - the Propertyset to find the last modified time for
        Returns:
        date and time of the last modification for the propertyset, or null if no modification date could be found
      • logError

        void logError​(String message,
                      Object fileOrStream,
                      Exception e)
        Log an error situation that resulted in a caught exception.
        Parameters:
        message - a human readable message explaining where the error occurred
        fileOrStream - a File or stream involved in the error, null if not relevant
        e - the exception caught by the code logging the error