Class ProfileFacadeImpl
- All Implemented Interfaces:
IProfileFacade
IProfileFacade.-
Field Summary
Fields inherited from interface org.modelversioning.emfprofile.IProfileFacade
EMF_PROFILE_APPLICATION_FACTORY, EMF_PROFILE_APPLICATION_PACKAGE, EMF_PROFILE_FACTORY, EMF_PROFILE_PACKAGE, PROFILE_APPLICATION_ECLASS, STEREOTYPE_APPLICATION_APPLIED_TO_REFERENCE, STEREOTYPE_APPLICATION_ECLASS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNestedEObject(EObject container, EReference eReference, EObject eObject) Adds an instance of nested object to the reference of the container.protected voidaddToResource(EObject eObject) Adds the specifiedeObjectto the currently setprofileApplicationResource.apply(Stereotype stereotype, EObject eObject) Applies the specifiedstereotypeto the specifiedeObject.apply(Stereotype stereotype, EObject eObject, Extension extension) Applies the specifiedstereotypeto the specifiedeObjectusing the specifiedextension.apply(StereotypeApplicability stereotypeApplicability, EObject eObject) Applies the specifiedapplicableStereotype.protected StereotypeApplicationcreateStereotypeApplication(Stereotype stereotype) Creates a new instance of of the specifiedStereotype.findOrCreateProfileApplication(Profile profile) Finds or creates a profile application for the specifiedprofile.getApplicableStereotypes(EClass eClass) Returns the list of applicable stereotype for the specified type ineClass.getApplicableStereotypes(EObject eObject) Returns the list of applicable stereotype for the specifiedeObject.getAppliedStereotypes(EObject eObject) Returns all stereotypes currently applied to the specifiedeObject(list ofStereotypeApplications).protected EList<StereotypeApplication>getAppliedStereotypes(EObject eObject, Stereotype stereotype) Returns all stereotypes currently applied to the specifiedeObject(list ofStereotypeApplications) that are of the typestereotype.Returns the list of currently loadedProfiles.When loading profile application resource, this method is used to get a reference toProfileApplicationReturns allStereotypeApplicationshandled by this facade.getStereotypeFeatures(Stereotype stereotype) Returns the list ofEStructuralFeatures that can be set for the specifiedstereotype.getTaggedValue(EObject stereotypeApplication, EStructuralFeature taggedValue) Returns the value of the giventaggedValueof the givenstereotypeApplication.booleanisApplicable(Stereotype stereotype, EObject eObject) Specifies whether thestereotypeis applicable toeObject.booleanisApplicable(Stereotype stereotype, EObject eObject, Extension extension) Specifies whether thestereotypeis applicable toeObjectusing the specifiedextension.voidloadProfile(Profile profile) Loads the specifiedprofile.voidloadProfiles(EList<Profile> profiles) Loads the specifiedprofiles.voidloadProfiles(Resource resource) Loads allProfiles contained by the specifiedresource.voidmakeApplicable(Profile profile) Turns the specifiedprofileinto an applicable profile.voidremoveEObject(EObject eObject) Removes the specifiedEObjectfrom managedProfileApplicationvoidremoveStereotypeApplication(StereotypeApplication stereotypeApplication) Removes the specifiedStereotypeApplication.voidsave()Saves the currently set profile application resource.voidsetProfileApplicationFileAndInitializeResource(IFile profileApplicationFile, ResourceSet resourceSet) Sets theIFilecontaining the profile application and initializes a resource.voidsetProfileApplicationResource(Resource resource) Sets theResourcecontaining the profile application.voidsetTaggedValue(EObject stereotypeApplication, EStructuralFeature taggedValue, Object newValue) Sets the value of the giventaggedValueof thestereotypeApplicationto the new value.voidunload()Unloads this facade.voidunloadProfile(Profile profile) Unloads the specifiedprofile.validateAll(EObject currentlySelectedEObject) Validates the entire profile application.
-
Constructor Details
-
ProfileFacadeImpl
public ProfileFacadeImpl()
-
-
Method Details
-
makeApplicable
Turns the specified
profileinto an applicable profile.This method can be called without being initialized by loading a
Profileof an application.- Specified by:
makeApplicablein interfaceIProfileFacade- Parameters:
profile- to turn into an applicable profile.
-
save
Saves the currently set profile application resource.- Specified by:
savein interfaceIProfileFacade- Throws:
IOException- if writing to file fails.
-
loadProfile
Loads the specifiedprofile.- Specified by:
loadProfilein interfaceIProfileFacade- Parameters:
profile- theProfileto load.
-
unloadProfile
Unloads the specifiedprofile.- Specified by:
unloadProfilein interfaceIProfileFacade- Parameters:
profile- theProfileto unload.
-
loadProfiles
Loads allProfiles contained by the specifiedresource.- Specified by:
loadProfilesin interfaceIProfileFacade- Parameters:
resource- containing the profiles to be loaded.
-
loadProfiles
Loads the specifiedprofiles.- Specified by:
loadProfilesin interfaceIProfileFacade- Parameters:
profiles- theProfiles to be loaded.
-
getLoadedProfiles
Returns the list of currently loadedProfiles.- Specified by:
getLoadedProfilesin interfaceIProfileFacade- Returns:
- the list of currently loaded
Profiles.
-
setProfileApplicationFileAndInitializeResource
public void setProfileApplicationFileAndInitializeResource(IFile profileApplicationFile, ResourceSet resourceSet) throws IOException Sets theIFilecontaining the profile application and initializes a resource.- Specified by:
setProfileApplicationFileAndInitializeResourcein interfaceIProfileFacade- Throws:
IOException- if loading to resource fails.
-
setProfileApplicationResource
Sets theResourcecontaining the profile application.- Specified by:
setProfileApplicationResourcein interfaceIProfileFacade- Parameters:
resource- which contains a profile application- Throws:
IOException- if loading to resource fails.
-
getApplicableStereotypes
Returns the list of applicable stereotype for the specified type ineClass.- Specified by:
getApplicableStereotypesin interfaceIProfileFacade- Parameters:
eClass- to get applicable stereotype for.- Returns:
- the list of applicable
Stereotypes.
-
getApplicableStereotypes
Returns the list of applicable stereotype for the specifiedeObject.- Specified by:
getApplicableStereotypesin interfaceIProfileFacade- Parameters:
eObject- to get applicable stereotype for.- Returns:
- the list of applicable
Stereotypes.
-
isApplicable
Specifies whether thestereotypeis applicable toeObject.- Specified by:
isApplicablein interfaceIProfileFacade- Parameters:
stereotype- to check.eObject- to check.- Returns:
trueif applicable, otherwisefalse.
-
isApplicable
Specifies whether thestereotypeis applicable toeObjectusing the specifiedextension.- Specified by:
isApplicablein interfaceIProfileFacade- Parameters:
stereotype- to check.eObject- to check.extension- the extension to check.- Returns:
trueif applicable, otherwisefalse.
-
apply
public StereotypeApplication apply(StereotypeApplicability stereotypeApplicability, EObject eObject) Applies the specifiedapplicableStereotype.This method is a convenience method for
IProfileFacade.apply(Stereotype, EObject, Extension).- Specified by:
applyin interfaceIProfileFacade- Parameters:
stereotypeApplicability- the applicable stereotype to be applied.eObject- to apply theapplicableStereotypeto.- Returns:
- the created instance of the
Stereotype.
-
apply
Applies the specifiedstereotypeto the specifiedeObject.This method creates a new instance of the specified
Stereotypeand adds it to the currently set profile application resource (cf.#setProfileApplicationResourceAndFile(Resource)). If no resource is currently set, this method throws anIllegalStateException.- Specified by:
applyin interfaceIProfileFacade- Parameters:
stereotype- to apply.eObject- to apply thestereotypeto.- Returns:
- the created instance of the
Stereotype.
-
apply
Applies the specifiedstereotypeto the specifiedeObjectusing the specifiedextension.This method creates a new instance of the specified
Stereotypeand adds it to the currently set profile application resource (cf.#setProfileApplicationResourceAndFile(Resource)). If no resource is currently set, this method throws anIllegalStateException.- Specified by:
applyin interfaceIProfileFacade- Parameters:
stereotype- to apply.eObject- to apply thestereotypeto.extension- the extension to be used for applying the stereotype.- Returns:
- the created instance of the
Stereotype.
-
createStereotypeApplication
Creates a new instance of of the specifiedStereotype.The created instance is {
addToResource(StereotypeApplication)added} to the currently set resource.- Parameters:
stereotype- to create instance for.- Returns:
- created instance.
-
findOrCreateProfileApplication
Finds or creates a profile application for the specifiedprofile.- Specified by:
findOrCreateProfileApplicationin interfaceIProfileFacade- Parameters:
profile- to find or createProfileApplicationfor.- Returns:
- found or created
ProfileApplication.
-
addToResource
Adds the specifiedeObjectto the currently setprofileApplicationResource.If currently no
profileApplicationResourceis set, this method throws anIllegalArgumentException.- Parameters:
eObject- to be added.- Throws:
IllegalArgumentException- ifprofileApplicationResourceis notset.
-
getStereotypeApplications
Returns allStereotypeApplicationshandled by this facade.- Specified by:
getStereotypeApplicationsin interfaceIProfileFacade- Returns:
- all
StereotypeApplications
-
getAppliedStereotypes
Returns all stereotypes currently applied to the specifiedeObject(list ofStereotypeApplications).- Specified by:
getAppliedStereotypesin interfaceIProfileFacade- Parameters:
eObject- to get applied stereotypes for.- Returns:
- the list of
StereotypeApplications.
-
getAppliedStereotypes
protected EList<StereotypeApplication> getAppliedStereotypes(EObject eObject, Stereotype stereotype) Returns all stereotypes currently applied to the specifiedeObject(list ofStereotypeApplications) that are of the typestereotype.- Parameters:
stereotype- the stereotype to filter stereotype applications.eObject- to get applied stereotypes for.- Returns:
- the list of
StereotypeApplications.
-
removeStereotypeApplication
Removes the specifiedStereotypeApplication.- Specified by:
removeStereotypeApplicationin interfaceIProfileFacade- Parameters:
stereotypeApplication- stereotype application to remove.
-
getStereotypeFeatures
Returns the list ofEStructuralFeatures that can be set for the specifiedstereotype.- Specified by:
getStereotypeFeaturesin interfaceIProfileFacade- Parameters:
stereotype- to getEStructuralFeatures for.- Returns:
- the list of settable
EStructuralFeatures.
-
getTaggedValue
Returns the value of the giventaggedValueof the givenstereotypeApplication.If the tagged value is
many-valued, the result will be anEListand each object in the list will bean instance ofthe feature'stype; the list's contents are not affected byresolveargument. Otherwise the result directly will be an instance of the feature's type; if it is aproxy, it is resolved.- Specified by:
getTaggedValuein interfaceIProfileFacade- Parameters:
stereotypeApplication- to get feature value for.taggedValue- the tagged value to fetch.- Returns:
- the value of the given tagged value of the object.
-
setTaggedValue
public void setTaggedValue(EObject stereotypeApplication, EStructuralFeature taggedValue, Object newValue) Sets the value of the giventaggedValueof thestereotypeApplicationto the new value.If the feature is
many-valued, the new value must be anEListand each object in that list must bean instance ofthe feature'stype; the existing contents are cleared and the contents of the new value are added. However, if the new value is the content list itself, or is modified as a side effect of modifying the content list (i.e., if it is a view on the content list), the behavior is undefined and will likely result in simply clearing the list. If the feature is single-valued, the new value directly must be an instance of the feature's type and it becomes the new value of the feature of the object. If the feature isunsettable, the modeled state becomes set; otherwise, the feature may still not consideredsetif the new value is the same as the default.- Specified by:
setTaggedValuein interfaceIProfileFacade- Parameters:
stereotypeApplication- to set feature value.taggedValue- the tagged value to set.newValue- the value to set.
-
unload
public void unload()Unloads this facade.- Specified by:
unloadin interfaceIProfileFacade
-
validateAll
Validates the entire profile application.- Specified by:
validateAllin interfaceIProfileFacade- Parameters:
currentlySelectedEObject- currently selected object. This is used for obtaining the annotated model in case no stereotype application has been created yet.- Returns:
- the validation result.
-
getProfileApplicationResource
- Specified by:
getProfileApplicationResourcein interfaceIProfileFacade
-
getProfileApplications
Description copied from interface:IProfileFacadeWhen loading profile application resource, this method is used to get a reference toProfileApplication- Specified by:
getProfileApplicationsin interfaceIProfileFacade- Returns:
-
removeEObject
Description copied from interface:IProfileFacadeRemoves the specifiedEObjectfrom managedProfileApplication- Specified by:
removeEObjectin interfaceIProfileFacade
-
addNestedEObject
Description copied from interface:IProfileFacadeAdds an instance of nested object to the reference of the container.- Specified by:
addNestedEObjectin interfaceIProfileFacade
-