Class ModelImport<M extends IModel>
- java.lang.Object
-
- net.ssehub.easy.basics.modelManagement.ModelImport<M>
-
- Type Parameters:
M- the specific type of model
- Direct Known Subclasses:
ProjectImport
public class ModelImport<M extends IModel> extends java.lang.ObjectDefines model imports and related restrictions.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private booleanisConflictprivate java.lang.Stringnameprivate Mresolvedprivate IVersionRestrictionrestriction
-
Constructor Summary
Constructors Constructor Description ModelImport()Constructor for serialization.ModelImport(java.lang.String name)Creates an unrestricted script import.ModelImport(java.lang.String name, boolean isConflict, IVersionRestriction restriction)Creates a model import instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IVersionRestrictioncopyVersionRestriction(M model)Copies the version restriction.booleanevaluateRestrictions(IRestrictionEvaluationContext context, Version version)Evaluates the restrictions againstversion.java.lang.StringgetName()Returns the name of the model to be imported.MgetResolved()Returns the resolved model instance.IVersionRestrictiongetVersionRestriction()Returns the version restriction.booleanisConflict()Does this object represent an import or a conflict.booleanisResolved()Returns whether the related model was already resolved.voidsetResolved(M resolved)Defines the resolved model instance.voidsetRestrictions(IVersionRestriction restriction)Setter for setting the version restrictions.
-
-
-
Field Detail
-
name
private java.lang.String name
-
restriction
private IVersionRestriction restriction
-
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 importisConflict- does this object represent a conflict or an importrestriction- 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:
truein case of a conflict,falsein case of an import
-
setRestrictions
public void setRestrictions(IVersionRestriction restriction)
Setter for setting the version restrictions.- Parameters:
restriction- the version restriction to this import ornullif 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:
trueif it was resolved,falseelse
-
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 againstversion.- 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:
trueif the restrictions are fulfilled (also if none restrictions were given),falseif 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
-
-