Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF FORMS] Rule Based Enablement TreeMasterDetail View(I have two view defined for entity user and task, want to add rule in the task view based on user entity.)
[EMF FORMS] Rule Based Enablement TreeMasterDetail View [message #1404206] Wed, 30 July 2014 12:43 Go to next message
Ranjeeth Rajendran is currently offline Ranjeeth RajendranFriend
Messages: 17
Registered: July 2009
Junior Member
REG: Rule Based Enablement TreeMasterDetail View

I have two view defined for entity user and task, want to add rule in the task view based on user entity.

* user.view contains the layout for user.
* task.view contains the layout for the task.

Q: How to define a rule in task view based on user active status feature path domain model reference.
example- rule to enable/disable the fields in the task view based on active status of user rule.
PS: User entity is the parent container for task.
index.php/fa/18705/0/

[Updated on: Wed, 30 July 2014 14:30]

Report message to a moderator

Re: [EMF FORMS] Rule Based Enablement TreeMasterDetail View [message #1404324 is a reply to message #1404206] Thu, 31 July 2014 09:02 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,

I assume that tasks are contained in the entity user? Domain Model
references currently do not allow to reference parent elements, if they
would, then rules would probably work as expected. A work around would
be to add a derived feature to the entity task, which returns the
desired state and also handles the case, when a task does not have a
user as parent.

best regards

Jonas


Am 30.07.2014 14:43, schrieb Ranjeeth Rajendran:
> REG: Rule Based Enablement TreeMasterDetail View
>
> I have two view defined for entity user and task, want to add rule in the task view based on user entity.
>
> * user.view contains the layout for user.
> * task.view contains the layout for the task.
>
> Q: How to define a rule in task view based on user active status feature path domain model reference.
> example- rule to enable/disable the fields in the task view based on active status of user rule.
>
Re: [EMF FORMS] Rule Based Enablement TreeMasterDetail View [message #1404334 is a reply to message #1404324] Thu, 31 July 2014 10:02 Go to previous messageGo to next message
Ranjeeth Rajendran is currently offline Ranjeeth RajendranFriend
Messages: 17
Registered: July 2009
Junior Member
Hello Jonas,

Yes, the tasks are contained in the entity user.

I understand that currently its not possible to define rules based on parent entity. and work around you suggested with derived model will have huge impact in our case where we have a very larger set of domain model.

Please find attached the xps for few cases.

Should i raise a BR?

Thanks,
Ranjeeth
  • Attachment: Case.xps
    (Size: 362.08KB, Downloaded 144 times)
Re: [EMF FORMS] Rule Based Enablement TreeMasterDetail View [message #1404433 is a reply to message #1404334] Fri, 01 August 2014 11:39 Go to previous messageGo to next message
Ranjeeth Rajendran is currently offline Ranjeeth RajendranFriend
Messages: 17
Registered: July 2009
Junior Member
Was cracking a bit on the inner-working of EMF Forms, and noticed that each view is independent of context(meaning doesn't know about the ancestor/descendant view & model). I see this as a huge set back as the view's are not contextually aware.

I made slight modification in the class which looks like a workaround for me, although am not sure 100%(still don't have 100% knowledge about the EMF Forms Architecture yet)

I Tried to copy the root model(am not referring to the root eclass model of view)
ViewModelFileExtensionsManager#createView() 

	/**
	 * @param eObject The {@link EObject} to create a view for
	 * @return a view model for the given eObject
	 */
	public VView createView(EObject eObject) {
		final EObject rootObject = EcoreUtil.getRootContainer(eObject, true);
		final List<EObject> list = new ArrayList<EObject>(2);
		list.add(rootObject);
		list.add(map.get(eObject.eClass()));
		final Collection<EObject> collection = EcoreUtil.copyAll(list);
		for (final EObject eObject2 : collection) {
			if (eObject2 instanceof VView) {
				return (VView) eObject2;
			}
		}
		return EcoreUtil.copy(map.get(eObject.eClass()));
	}


Tried to modify the task.view and place a rule in the task.view which has Task root eclass.

      <attachments xsi:type="org.eclipse.emf.ecp.view.rule.model:ShowRule" hide="true">
        <condition xsi:type="org.eclipse.emf.ecp.view.rule.model:LeafCondition" expectedValue="ACED0005737200116A6176612E6C616E672E426F6F6C65616ECD207280D59CFAEE0200015A000576616C7565787001">
          <domainModelReference xsi:type="org.eclipse.emf.ecp.view.model:FeaturePathDomainModelReference">
            <domainModelEFeature xsi:type="ecore:EAttribute" href="http://eclipse/org/emf/ecp/makeithappen/model/task#//User/active"/>
          </domainModelReference>
        </condition>
      </attachments>

[Updated on: Fri, 01 August 2014 11:40]

Report message to a moderator

Re: [EMF FORMS] Rule Based Enablement TreeMasterDetail View [message #1404725 is a reply to message #1404433] Tue, 05 August 2014 10:09 Go to previous messageGo to next message
Maximilian Koegel is currently offline Maximilian KoegelFriend
Messages: 253
Registered: July 2009
Senior Member
Hi,

in the current development version of EMFForms there is a String Object
Map in the ViewModelContext which you can use to pass custom context
into other renderers downstream. Maybe this is more suitable to solve
your problem.

Best regards,
Maximilian


Am 01.08.2014 13:39, schrieb Ranjeeth Rajendran:
> Was cracking a bit on the inner-working of EMF Forms, and noticed that
> each view is independent of context(meaning doesn't know about the
> ancestor/descendant view & model). I see this as a huge set back as the
> view's are not contextually aware.
>
> I made slight modification in the class which looks like a workaround
> for me, although am not sure 100%(still don't have 100% knowledge about
> the EMF Forms Architecture yet)
>
> I Tried to copy the root model(am not referring to the root eclass model
> of view)
>
> ViewModelFileExtensionsManager#createView()
> /**
> * @param eObject The {@link EObject} to create a view for
> * @return a view model for the given eObject
> */
> public VView createView(EObject eObject) {
> final EObject rootObject = EcoreUtil.getRootContainer(eObject,
> true);
> final List<EObject> list = new ArrayList<EObject>(2);
> list.add(rootObject);
> list.add(map.get(eObject.eClass()));
> final Collection<EObject> collection = EcoreUtil.copyAll(list);
> for (final EObject eObject2 : collection) {
> if (eObject2 instanceof VView) {
> return (VView) eObject2;
> }
> }
> return EcoreUtil.copy(map.get(eObject.eClass()));
> }
>
>
> Tried to modify the task.view and place a rule in the task.view which
> has task as root eclass.
>
>
> <attachments
> xsi:type="org.eclipse.emf.ecp.view.rule.model:ShowRule" hide="true">
> <condition
> xsi:type="org.eclipse.emf.ecp.view.rule.model:LeafCondition"
> expectedValue="ACED0005737200116A6176612E6C616E672E426F6F6C65616ECD207280D59CFAEE0200015A000576616C7565787001">
>
> <domainModelReference
> xsi:type="org.eclipse.emf.ecp.view.model:FeaturePathDomainModelReference">
> <domainModelEFeature xsi:type="ecore:EAttribute"
> href="http://eclipse/org/emf/ecp/makeithappen/model/task#//User/active"/>
> </domainModelReference>
> </condition>
> </attachments>
>


--
Maximilian Kögel

Get Professional Eclipse Support: http://eclipsesource.com/munich
Re: [EMF FORMS] Rule Based Enablement TreeMasterDetail View [message #1405037 is a reply to message #1404725] Wed, 06 August 2014 12:23 Go to previous messageGo to next message
Ranjeeth Rajendran is currently offline Ranjeeth RajendranFriend
Messages: 17
Registered: July 2009
Junior Member
Hello Maximilian,

Thanks you for your response.

w.r.t the viewmodelcontext i think you are talking about current development stream BR ID: 441107

Will the issue also address propagating something completely out of model?
ex-
I have a model say task.ecore and account.ecore, which are two different model completely independent and without any relationship with each others.

  • account.ecore represents the security module for authentication/authorization
  • task.ecore represents task system which is to be presented in UI, but will have to apply some rules based on the authorization/roles from account.ecore.

Thank you,
Ranjeeth
Re: [EMF FORMS] Rule Based Enablement TreeMasterDetail View [message #1405531 is a reply to message #1405037] Thu, 07 August 2014 15:01 Go to previous message
Maximilian Koegel is currently offline Maximilian KoegelFriend
Messages: 253
Registered: July 2009
Senior Member
Hi Ranjeeth,

there is different options to tackle the problem you have been
describing over the course of this thread. Proposed solutions include
using a derived feature, the view model context and a custom condition
or preprocessing your view model before rendering to cut off view model
parts that are affected by access control rules. In the context of this
newsgroup and limited time I cannot judge which solution is the best
solution for your problem. To go further I can offer you professional
support (see signature) in case you would like to get detailed help with
finding a good solution very efficiently.

Best regards,
Maximilian

--
Maximilian Kögel

Get Professional EMFForms Support: http://eclipsesource.com/munich

Am 06.08.2014 14:23, schrieb Ranjeeth Rajendran:
> Hello Maximilian,
>
> Thanks you for your response.
>
> w.r.t the viewmodelcontext i think you are talking about current
> development stream BR ID: 441107
>
> Will the issue also address propagating something completely out of model?
> ex-
> I have a model say task.ecore and account.ecore, which are two different
> model completely independent and without any relationship with each others.
>
> account.ecore represents the security module for
> authentication/authorization
> task.ecore represents task system which is to be presented in UI, but
> will have to apply some rules based on the authorization/roles from
> account.ecore.
>
> Thank you,
> Ranjeeth
Previous Topic:[EEF] Suppress/filter properties in runtime
Next Topic:[EEF] AdvancedEObjectFlatComboViewer single contaiment
Goto Forum:
  


Current Time: Thu Apr 18 19:10:14 GMT 2024

Powered by FUDForum. Page generated in 0.01847 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top