Class ModelImport<M extends IModel>

  • Type Parameters:
    M - the specific type of model
    Direct Known Subclasses:
    ProjectImport

    public class ModelImport<M extends IModel>
    extends java.lang.Object
    Defines model imports and related restrictions.
    Author:
    Holger Eichelberger
    • Field Detail

      • resolved

        private M extends IModel resolved
      • name

        private java.lang.String name
      • isConflict

        private boolean isConflict
    • Constructor Detail

      • ModelImport

        ModelImport()
        Constructor for serialization.
      • ModelImport

        public ModelImport​(java.lang.String name)
        Creates an unrestricted script import.
        Parameters:
        name - The name of the project to be imported.
      • ModelImport

        public ModelImport​(java.lang.String name,
                           boolean isConflict,
                           IVersionRestriction restriction)
        Creates a model import instance.
        Parameters:
        name - the name of the model to be import
        isConflict - does this object represent a conflict or an import
        restriction - the version restriction (or null if absent)
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns the name of the model to be imported.
        Returns:
        Name of the import
      • isConflict

        public boolean isConflict()
        Does this object represent an import or a conflict.
        Returns:
        true in case of a conflict, false in case of an import
      • setRestrictions

        public void setRestrictions​(IVersionRestriction restriction)
        Setter for setting the version restrictions.
        Parameters:
        restriction - the version restriction to this import or null if absent.
      • getResolved

        public M getResolved()
        Returns the resolved model instance.
        Returns:
        the resolved instance
      • isResolved

        public boolean isResolved()
        Returns whether the related model was already resolved.
        Returns:
        true if it was resolved, false else
      • setResolved

        public void setResolved​(M resolved)
                         throws ModelManagementException
        Defines the resolved model instance.
        Parameters:
        resolved - the resolved instance or null
        Throws:
        ModelManagementException - in case of violated model access restrictions
      • evaluateRestrictions

        public boolean evaluateRestrictions​(IRestrictionEvaluationContext context,
                                            Version version)
                                     throws RestrictionEvaluationException
        Evaluates the restrictions against version.
        Parameters:
        context - the output context (interpreted by the respective implementation, e.g., an output visitor in order to continue with the actual indentation, may be null but then false will always be the result)
        version - the version to evaluate against
        Returns:
        true if the restrictions are fulfilled (also if none restrictions were given), false if the restrictions were not fulfilled
        Throws:
        RestrictionEvaluationException - in case of evaluation problems
      • getVersionRestriction

        public IVersionRestriction getVersionRestriction()
        Returns the version restriction.
        Returns:
        the version restriction (may be null)
      • copyVersionRestriction

        public IVersionRestriction copyVersionRestriction​(M model)
                                                   throws RestrictionEvaluationException
        Copies the version restriction.
        Parameters:
        model - the model to instantiate the copied version restriction for
        Returns:
        the copied version restriction or null if no restriction was specified before
        Throws:
        RestrictionEvaluationException - in case of type/structural problems