Class ProfileApplicationRegistryImpl
- java.lang.Object
-
- org.modelversioning.emfprofile.application.registry.internal.ProfileApplicationRegistryImpl
-
- All Implemented Interfaces:
ProfileApplicationRegistry
public class ProfileApplicationRegistryImpl extends Object implements ProfileApplicationRegistry
-
-
Field Summary
Fields Modifier and Type Field Description static ProfileApplicationRegistry
INSTANCE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyProfileToModel(String modelId, IFile profileApplicationsFile, Collection<Profile> profiles, ResourceSet resourceSet)
To apply profiles on a modelProfileApplicationDecorator
getProfileApplicationDecoratorOfContainedEObject(String modelId, EObject eObject)
Gets the instance of the @linkProfileApplicationDecorator
that is a parent of the providedEObject
and it searches amongst all profile application decorators for the given model id.Collection<ProfileApplicationDecorator>
getProfileApplications(String modelId)
Returns profile application elements.boolean
hasProfileApplications(String modelId)
Checks if there are any profile applications defined on the given modelled resource.ProfileApplicationDecorator
loadProfileApplicationForModel(String modelId, IFile profileApplicationFile, ResourceSet resourceSet)
Load profile application for model from a file.void
unloadAllProfileApplicationsForModel(String modelId)
Unloads all profile applications for a model.void
unloadProfileApplicationForModel(String modelId, ProfileApplicationDecorator profileApplication)
Unloads profile application for a model.
-
-
-
Field Detail
-
INSTANCE
public static final ProfileApplicationRegistry INSTANCE
-
-
Method Detail
-
applyProfileToModel
public void applyProfileToModel(String modelId, IFile profileApplicationsFile, Collection<Profile> profiles, ResourceSet resourceSet) throws Exception
Description copied from interface:ProfileApplicationRegistry
To apply profiles on a model- Specified by:
applyProfileToModel
in interfaceProfileApplicationRegistry
- Parameters:
modelId
- Generated Id of the opened model's resource in user interface editor.profileApplicationsFile
- file where profile applications are saved.profiles
- collection of profiles that are going to be applied on a model resource.resourceSet
- is optional. If it's not provided, the registry's default resource set will be used instead.- Throws:
Exception
-
loadProfileApplicationForModel
public ProfileApplicationDecorator loadProfileApplicationForModel(String modelId, IFile profileApplicationFile, ResourceSet resourceSet) throws Exception
Description copied from interface:ProfileApplicationRegistry
Load profile application for model from a file. Returnsfalse
if this profile application was already loaded.- Specified by:
loadProfileApplicationForModel
in interfaceProfileApplicationRegistry
resourceSet
- is optional. If it's not provided, the registry's default resource set will be used instead.- Returns:
null
if already loaded, otherwise the loaded profile application.- Throws:
Exception
-
unloadProfileApplicationForModel
public void unloadProfileApplicationForModel(String modelId, ProfileApplicationDecorator profileApplication)
Description copied from interface:ProfileApplicationRegistry
Unloads profile application for a model.- Specified by:
unloadProfileApplicationForModel
in interfaceProfileApplicationRegistry
-
unloadAllProfileApplicationsForModel
public void unloadAllProfileApplicationsForModel(String modelId)
Description copied from interface:ProfileApplicationRegistry
Unloads all profile applications for a model. Removes tracking of model id from registry.- Specified by:
unloadAllProfileApplicationsForModel
in interfaceProfileApplicationRegistry
-
hasProfileApplications
public boolean hasProfileApplications(String modelId)
Description copied from interface:ProfileApplicationRegistry
Checks if there are any profile applications defined on the given modelled resource.- Specified by:
hasProfileApplications
in interfaceProfileApplicationRegistry
- Returns:
-
getProfileApplications
public Collection<ProfileApplicationDecorator> getProfileApplications(String modelId)
Description copied from interface:ProfileApplicationRegistry
Returns profile application elements.- Specified by:
getProfileApplications
in interfaceProfileApplicationRegistry
- Returns:
-
getProfileApplicationDecoratorOfContainedEObject
public ProfileApplicationDecorator getProfileApplicationDecoratorOfContainedEObject(String modelId, EObject eObject)
Description copied from interface:ProfileApplicationRegistry
Gets the instance of the @linkProfileApplicationDecorator
that is a parent of the providedEObject
and it searches amongst all profile application decorators for the given model id.- Specified by:
getProfileApplicationDecoratorOfContainedEObject
in interfaceProfileApplicationRegistry
- Parameters:
modelId
- The string identification of the modelled resource.eObject
- in question- Returns:
ProfileApplicationDecorator
if everything OK,null
if could not find it or any of the parents was alsonull
which would indicate that the eObject was removed together with parent.
-
-