You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Erik de Hair <er...@pocos.nl> on 2014/11/19 14:15:18 UTC

suppress contributed action in one of the related entities only

Hi,

In a service I have an action with a few parameters. I don't want this 
action to show up in the entity page for only of these parameters. I 
tried to add to action to the json-layout file and hide it there with no 
effect.

Is it possible to suppress a contributed action in only one of the 
parameter entities?

Met vriendelijke groet,

Erik de Hair

-- 
Pocos bv
Croy 9c - 5653 LC Eindhoven
Telefoon: 088 0100 700 - Fax: 088 0100 799
http://www.pocos.nl/ - http://www.sipo.nl/
K.v.K. nummer: 17097024
Follow Pocos bv 
<https://twitter.com/intent/follow?original_referer=https%3A%2F%2Ftwitter.com%2Fabout%2Fresources%2Fbuttons&region=follow_link&screen_name=Pocosbv&source=followbutton&variant=2.0>

Aanmelden van incidenten en/of changes graag via servicedesk@pocos.nl 
<ma...@pocos.nl>

Re: suppress contributed action in one of the related entities only

Posted by Martin Grigorov <mg...@apache.org>.
On Nov 19, 2014 5:12 PM, "Erik de Hair" <er...@pocos.nl> wrote:
>
> Hi,
>
> The method in my entity class is as follows:

The signature looks fine.
I think the problem is that both methods are in different classes. Try by
moving the hide method in the service.

>
> public boolean hideAddPhoneNumbers(PortalCompany owningCompany,
AbstractArticle phoneNumberArticle,
>             PhoneNumberGrid gridNumber, AbstractSelectableNumberElement
numberElement)
>     {
>         return true;
>     }
>
> I also tried
>
> public boolean hideAddPhoneNumbers()
> {
>     return true;
> }
>
> The signature of the method in the service is
>
> public FixedPhoneNumberSubscription addPhoneNumbers(PortalCompany
owningCompany,
>             AbstractArticle phoneNumberArticle,
>             PhoneNumberGrid gridNumber,
>             AbstractSelectableNumberElement numberElement)
>
>
> Erik
>
> <ma...@pocos.nl>
>
> On 11/19/2014 03:37 PM, Martin Grigorov wrote:
>>
>> Hi,
>>
>> On Wed, Nov 19, 2014 at 4:20 PM, Erik de Hair <er...@pocos.nl> wrote:
>>
>>> Hi Martin,
>>>
>>>   I think you need to add method hideXyz() as explained at
>>>>
>>>> http://isis.apache.org/how-tos/how-to-02-030-How-to-hide-an-action.html
>>>>
>>> By adding a hide to the repository I can only hide it everywhere or
>>> nowhere but I can't choose to pop up at certain entities only. At
least, I
>>> don't know how to do that.
>>>
>>> When I add a hideXXX() to the entity where I want to hide the action,
Isis
>>> complains about an orphaned method because the method doesn't exist at
the
>>> entity itself.
>>
>>
>> Please share the method's code. The log is misleading. Most probably the
>> method signature is not correct.
>>
>> it should be :
>> - public
>> - returning boolean
>> - the name should be hide[TheCamelCasedActionName](the, same, parameters,
>> as, the, action, method)
>> - the impl should use all available information to decide whether to
return
>> true or false
>>
>>
>>>
>>> Erik
>>>
>>>
>>>
>>>
>

Re: suppress contributed action in one of the related entities only

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Ah, good point.

I need to update the LayoutMetadataReaderUsingJson class to write out in
the new format (ie equivalent to the @XxxLayout annotations).  will try to
do in the next day or so.

thx
Dan


On 6 January 2015 at 13:25, Erik de Hair <e....@pocos.nl> wrote:

> My layout file has:
>
> "actions": {
>     ...
>     "runAs": {
>       "named": {
>         "value": "Run As"
>       },
>       "actionLayout": {
>          "cssClass": "btn-warn",
>          "hidden": "EVERYWHERE"
>        }
>     },
>
> But in the generated layout file the actionLayout part is gone:
>
> "actions": {
>     ...
>     "runAs": {
>       "named": {
>         "value": "Run As"
>       }
>     },
>
>
> On 01/05/2015 10:56 AM, Erik de Hair wrote:
>
>> Hi Dan,
>>
>> Is this compatible with Isis 1.7.0? The action isn't hidden and the
>> css-class isn't rendered for the button after I add this to the layout-file.
>>
>> Erik
>>
>> n 12/05/2014 06:36 PM, Dan Haywood wrote:
>>
>>> now also documented on the website, see
>>> http://isis.apache.org/more-advanced-topics/How-to-
>>> suppress-contributions.html
>>> .
>>>
>>> On 5 December 2014 at 14:09, Dan Haywood <da...@haywood-associates.co.uk>
>>> wrote:
>>>
>>>  Bit of a delay on this, but anyway... the good news is that it IS
>>>> possible
>>>> to suppress a contributed action on one parameter but not another.
>>>>
>>>> I've updated the kitchen sink app [1] to show how
>>>>
>>>> In the "contrib" package there are three entities:
>>>> * Person  [2]
>>>> * Preference  [3]
>>>> * FoodStuff  [4]
>>>>
>>>> eg Mary LIKEs Apple, Mungo HATEs Banana, Midge LOVEs Oranges
>>>>
>>>> Neither Person nor FoodStuff knows about Preferences; the Preference is
>>>> the tuple that associates the two together.
>>>>
>>>> The PreferenceContributions [5] service provides:
>>>> * "likes" - contributed collection to Person
>>>> * "firstLove" - contributed property to Person
>>>> * "addPreference" - contributed action to both Person and FoodStuff
>>>> - "removePreference" - contributed action to both Person and FoodStuff
>>>>
>>>> However, although "addPreference" and "removePreference" *are*
>>>> contributed
>>>> to all parameter types, this can be hidden using the .layout.json
>>>> file.  In
>>>> FoodStuff,layout.json [6] we have:
>>>>
>>>>
>>>>    "actions": {
>>>>      ...
>>>>      "removePreference": {
>>>>        "actionLayout": {
>>>>          "cssClass": "btn-warn",
>>>>          "hidden": "EVERYWHERE"
>>>>        }
>>>>      }
>>>>    }
>>>>
>>>> which means that the "removePreference" action cannot be seen when
>>>> viewing
>>>> a FoodStuff entity.
>>>>
>>>> I'll add this stuff to our website for future reference.
>>>>
>>>> Cheers
>>>> Dan
>>>>
>>>>
>>>> [1] https://github.com/isisaddons/isis-app-kitchensink
>>>> [2]
>>>> https://github.com/isisaddons/isis-app-kitchensink/blob/
>>>> master/dom/src/main/java/org/isisaddons/app/kitchensink/
>>>> dom/contrib/contributee/Person.java#L41-41
>>>> [3]
>>>> https://github.com/isisaddons/isis-app-kitchensink/blob/
>>>> master/dom/src/main/java/org/isisaddons/app/kitchensink/
>>>> dom/contrib/contributed/Preference.java#L42-42
>>>> [4]
>>>> https://github.com/isisaddons/isis-app-kitchensink/blob/
>>>> master/dom/src/main/java/org/isisaddons/app/kitchensink/
>>>> dom/contrib/contributee/FoodStuff.java#L41-41
>>>> [5]
>>>> https://github.com/isisaddons/isis-app-kitchensink/blob/
>>>> master/dom/src/main/java/org/isisaddons/app/kitchensink/
>>>> dom/contrib/contributed/PreferenceContributions.java#L31-31
>>>> [6]
>>>> https://github.com/isisaddons/isis-app-kitchensink/blob/
>>>> master/dom/src/main/java/org/isisaddons/app/kitchensink/
>>>> dom/contrib/contributee/FoodStuff.layout.json#L57-57
>>>>
>>>>
>>>>
>>>> https://github.com/isisaddons/isis-app-kitchensink/blob/
>>>> master/dom/src/main/java/org/isisaddons/app/kitchensink/
>>>> dom/contrib/contributed/PreferenceContributions.java#L62-62
>>>>
>>>> On 19 November 2014 at 15:27, Jeroen van der Wal <je...@stromboli.it>
>>>> wrote:
>>>>
>>>>  As to your question if you prevent something being contributed on only
>>>>> one
>>>>> of the parameter classes: In the metamodel there's no way to specify
>>>>> that
>>>>> but you could try to hide the contribution in the layout.json file.
>>>>>
>>>>> something like
>>>>>
>>>>> "actions":{
>>>>>     "yourAction": {
>>>>>        "hidden":{}
>>>>>     }
>>>>> }
>>>>>
>>>>> or
>>>>>
>>>>> "actions":{
>>>>>     "yourAction": {
>>>>>        "hidden":{"where":"ALWAYS" }
>>>>>     }
>>>>> }
>>>>>
>>>>> Can you check if this works?
>>>>>
>>>>> On Wed, Nov 19, 2014 at 4:15 PM, Jeroen van der Wal <
>>>>> jeroen@stromboli.it>
>>>>> wrote:
>>>>>
>>>>>  Hi Erik,
>>>>>>
>>>>>> You have to repeat the same parameters on the hideXxx method as the
>>>>>>
>>>>> method
>>>>>
>>>>>> that you're trying to hide.
>>>>>>
>>>>>> HTH
>>>>>>
>>>>>> On Wed, Nov 19, 2014 at 4:09 PM, Erik de Hair <er...@pocos.nl> wrote:
>>>>>>
>>>>>>  Hi,
>>>>>>>
>>>>>>> The method in my entity class is as follows:
>>>>>>>
>>>>>>> public boolean hideAddPhoneNumbers(PortalCompany owningCompany,
>>>>>>> AbstractArticle phoneNumberArticle,
>>>>>>>              PhoneNumberGrid gridNumber,
>>>>>>> AbstractSelectableNumberElement
>>>>>>> numberElement)
>>>>>>>      {
>>>>>>>          return true;
>>>>>>>      }
>>>>>>>
>>>>>>> I also tried
>>>>>>>
>>>>>>> public boolean hideAddPhoneNumbers()
>>>>>>> {
>>>>>>>      return true;
>>>>>>> }
>>>>>>>
>>>>>>> The signature of the method in the service is
>>>>>>>
>>>>>>> public FixedPhoneNumberSubscription addPhoneNumbers(PortalCompany
>>>>>>> owningCompany,
>>>>>>>              AbstractArticle phoneNumberArticle,
>>>>>>>              PhoneNumberGrid gridNumber,
>>>>>>>              AbstractSelectableNumberElement numberElement)
>>>>>>>
>>>>>>>
>>>>>>> Erik
>>>>>>>
>>>>>>> <ma...@pocos.nl>
>>>>>>>
>>>>>>> On 11/19/2014 03:37 PM, Martin Grigorov wrote:
>>>>>>>
>>>>>>>  Hi,
>>>>>>>>
>>>>>>>> On Wed, Nov 19, 2014 at 4:20 PM, Erik de Hair <er...@pocos.nl>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>   Hi Martin,
>>>>>>>>
>>>>>>>>>    I think you need to add method hideXyz() as explained at
>>>>>>>>>
>>>>>>>>>  http://isis.apache.org/how-tos/how-to-02-030-How-to-hide-
>>>>>>>>>> an-action.html
>>>>>>>>>>
>>>>>>>>>>   By adding a hide to the repository I can only hide it
>>>>>>>>>> everywhere or
>>>>>>>>>>
>>>>>>>>> nowhere but I can't choose to pop up at certain entities only. At
>>>>>>>>> least, I
>>>>>>>>> don't know how to do that.
>>>>>>>>>
>>>>>>>>> When I add a hideXXX() to the entity where I want to hide the
>>>>>>>>> action,
>>>>>>>>> Isis
>>>>>>>>> complains about an orphaned method because the method doesn't exist
>>>>>>>>>
>>>>>>>> at
>>>>>
>>>>>> the
>>>>>>>>> entity itself.
>>>>>>>>>
>>>>>>>>>  Please share the method's code. The log is misleading. Most
>>>>>>>> probably
>>>>>>>>
>>>>>>> the
>>>>>
>>>>>> method signature is not correct.
>>>>>>>>
>>>>>>>> it should be :
>>>>>>>> - public
>>>>>>>> - returning boolean
>>>>>>>> - the name should be hide[TheCamelCasedActionName](the, same,
>>>>>>>> parameters,
>>>>>>>> as, the, action, method)
>>>>>>>> - the impl should use all available information to decide whether to
>>>>>>>> return
>>>>>>>> true or false
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>  Erik
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>
>>
>>
>

Re: suppress contributed action in one of the related entities only

Posted by Erik de Hair <e....@pocos.nl>.
My layout file has:

"actions": {
     ...
     "runAs": {
       "named": {
         "value": "Run As"
       },
       "actionLayout": {
          "cssClass": "btn-warn",
          "hidden": "EVERYWHERE"
        }
     },

But in the generated layout file the actionLayout part is gone:

"actions": {
     ...
     "runAs": {
       "named": {
         "value": "Run As"
       }
     },

On 01/05/2015 10:56 AM, Erik de Hair wrote:
> Hi Dan,
>
> Is this compatible with Isis 1.7.0? The action isn't hidden and the 
> css-class isn't rendered for the button after I add this to the 
> layout-file.
>
> Erik
>
> n 12/05/2014 06:36 PM, Dan Haywood wrote:
>> now also documented on the website, see
>> http://isis.apache.org/more-advanced-topics/How-to-suppress-contributions.html 
>>
>> .
>>
>> On 5 December 2014 at 14:09, Dan Haywood <da...@haywood-associates.co.uk>
>> wrote:
>>
>>> Bit of a delay on this, but anyway... the good news is that it IS 
>>> possible
>>> to suppress a contributed action on one parameter but not another.
>>>
>>> I've updated the kitchen sink app [1] to show how
>>>
>>> In the "contrib" package there are three entities:
>>> * Person  [2]
>>> * Preference  [3]
>>> * FoodStuff  [4]
>>>
>>> eg Mary LIKEs Apple, Mungo HATEs Banana, Midge LOVEs Oranges
>>>
>>> Neither Person nor FoodStuff knows about Preferences; the Preference is
>>> the tuple that associates the two together.
>>>
>>> The PreferenceContributions [5] service provides:
>>> * "likes" - contributed collection to Person
>>> * "firstLove" - contributed property to Person
>>> * "addPreference" - contributed action to both Person and FoodStuff
>>> - "removePreference" - contributed action to both Person and FoodStuff
>>>
>>> However, although "addPreference" and "removePreference" *are* 
>>> contributed
>>> to all parameter types, this can be hidden using the .layout.json 
>>> file.  In
>>> FoodStuff,layout.json [6] we have:
>>>
>>>
>>>    "actions": {
>>>      ...
>>>      "removePreference": {
>>>        "actionLayout": {
>>>          "cssClass": "btn-warn",
>>>          "hidden": "EVERYWHERE"
>>>        }
>>>      }
>>>    }
>>>
>>> which means that the "removePreference" action cannot be seen when 
>>> viewing
>>> a FoodStuff entity.
>>>
>>> I'll add this stuff to our website for future reference.
>>>
>>> Cheers
>>> Dan
>>>
>>>
>>> [1] https://github.com/isisaddons/isis-app-kitchensink
>>> [2]
>>> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/Person.java#L41-41 
>>>
>>> [3]
>>> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/Preference.java#L42-42 
>>>
>>> [4]
>>> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/FoodStuff.java#L41-41 
>>>
>>> [5]
>>> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/PreferenceContributions.java#L31-31 
>>>
>>> [6]
>>> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/FoodStuff.layout.json#L57-57 
>>>
>>>
>>>
>>>
>>> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/PreferenceContributions.java#L62-62 
>>>
>>>
>>> On 19 November 2014 at 15:27, Jeroen van der Wal <je...@stromboli.it>
>>> wrote:
>>>
>>>> As to your question if you prevent something being contributed on 
>>>> only one
>>>> of the parameter classes: In the metamodel there's no way to 
>>>> specify that
>>>> but you could try to hide the contribution in the layout.json file.
>>>>
>>>> something like
>>>>
>>>> "actions":{
>>>>     "yourAction": {
>>>>        "hidden":{}
>>>>     }
>>>> }
>>>>
>>>> or
>>>>
>>>> "actions":{
>>>>     "yourAction": {
>>>>        "hidden":{"where":"ALWAYS" }
>>>>     }
>>>> }
>>>>
>>>> Can you check if this works?
>>>>
>>>> On Wed, Nov 19, 2014 at 4:15 PM, Jeroen van der Wal 
>>>> <je...@stromboli.it>
>>>> wrote:
>>>>
>>>>> Hi Erik,
>>>>>
>>>>> You have to repeat the same parameters on the hideXxx method as the
>>>> method
>>>>> that you're trying to hide.
>>>>>
>>>>> HTH
>>>>>
>>>>> On Wed, Nov 19, 2014 at 4:09 PM, Erik de Hair <er...@pocos.nl> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> The method in my entity class is as follows:
>>>>>>
>>>>>> public boolean hideAddPhoneNumbers(PortalCompany owningCompany,
>>>>>> AbstractArticle phoneNumberArticle,
>>>>>>              PhoneNumberGrid gridNumber, 
>>>>>> AbstractSelectableNumberElement
>>>>>> numberElement)
>>>>>>      {
>>>>>>          return true;
>>>>>>      }
>>>>>>
>>>>>> I also tried
>>>>>>
>>>>>> public boolean hideAddPhoneNumbers()
>>>>>> {
>>>>>>      return true;
>>>>>> }
>>>>>>
>>>>>> The signature of the method in the service is
>>>>>>
>>>>>> public FixedPhoneNumberSubscription addPhoneNumbers(PortalCompany
>>>>>> owningCompany,
>>>>>>              AbstractArticle phoneNumberArticle,
>>>>>>              PhoneNumberGrid gridNumber,
>>>>>>              AbstractSelectableNumberElement numberElement)
>>>>>>
>>>>>>
>>>>>> Erik
>>>>>>
>>>>>> <ma...@pocos.nl>
>>>>>>
>>>>>> On 11/19/2014 03:37 PM, Martin Grigorov wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> On Wed, Nov 19, 2014 at 4:20 PM, Erik de Hair <er...@pocos.nl> 
>>>>>>> wrote:
>>>>>>>
>>>>>>>   Hi Martin,
>>>>>>>>    I think you need to add method hideXyz() as explained at
>>>>>>>>
>>>>>>>>> http://isis.apache.org/how-tos/how-to-02-030-How-to-hide-
>>>>>>>>> an-action.html
>>>>>>>>>
>>>>>>>>>   By adding a hide to the repository I can only hide it 
>>>>>>>>> everywhere or
>>>>>>>> nowhere but I can't choose to pop up at certain entities only. At
>>>>>>>> least, I
>>>>>>>> don't know how to do that.
>>>>>>>>
>>>>>>>> When I add a hideXXX() to the entity where I want to hide the 
>>>>>>>> action,
>>>>>>>> Isis
>>>>>>>> complains about an orphaned method because the method doesn't 
>>>>>>>> exist
>>>> at
>>>>>>>> the
>>>>>>>> entity itself.
>>>>>>>>
>>>>>>> Please share the method's code. The log is misleading. Most 
>>>>>>> probably
>>>> the
>>>>>>> method signature is not correct.
>>>>>>>
>>>>>>> it should be :
>>>>>>> - public
>>>>>>> - returning boolean
>>>>>>> - the name should be hide[TheCamelCasedActionName](the, same,
>>>>>>> parameters,
>>>>>>> as, the, action, method)
>>>>>>> - the impl should use all available information to decide 
>>>>>>> whether to
>>>>>>> return
>>>>>>> true or false
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Erik
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>
>
>


Re: suppress contributed action in one of the related entities only

Posted by Erik de Hair <e....@pocos.nl>.
Hi Dan,

Is this compatible with Isis 1.7.0? The action isn't hidden and the 
css-class isn't rendered for the button after I add this to the layout-file.

Erik

n 12/05/2014 06:36 PM, Dan Haywood wrote:
> now also documented on the website, see
> http://isis.apache.org/more-advanced-topics/How-to-suppress-contributions.html
> .
>
> On 5 December 2014 at 14:09, Dan Haywood <da...@haywood-associates.co.uk>
> wrote:
>
>> Bit of a delay on this, but anyway... the good news is that it IS possible
>> to suppress a contributed action on one parameter but not another.
>>
>> I've updated the kitchen sink app [1] to show how
>>
>> In the "contrib" package there are three entities:
>> * Person  [2]
>> * Preference  [3]
>> * FoodStuff  [4]
>>
>> eg Mary LIKEs Apple, Mungo HATEs Banana, Midge LOVEs Oranges
>>
>> Neither Person nor FoodStuff knows about Preferences; the Preference is
>> the tuple that associates the two together.
>>
>> The PreferenceContributions [5] service provides:
>> * "likes" - contributed collection to Person
>> * "firstLove" - contributed property to Person
>> * "addPreference" - contributed action to both Person and FoodStuff
>> - "removePreference" - contributed action to both Person and FoodStuff
>>
>> However, although "addPreference" and "removePreference" *are* contributed
>> to all parameter types, this can be hidden using the .layout.json file.  In
>> FoodStuff,layout.json [6] we have:
>>
>>
>>    "actions": {
>>      ...
>>      "removePreference": {
>>        "actionLayout": {
>>          "cssClass": "btn-warn",
>>          "hidden": "EVERYWHERE"
>>        }
>>      }
>>    }
>>
>> which means that the "removePreference" action cannot be seen when viewing
>> a FoodStuff entity.
>>
>> I'll add this stuff to our website for future reference.
>>
>> Cheers
>> Dan
>>
>>
>> [1] https://github.com/isisaddons/isis-app-kitchensink
>> [2]
>> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/Person.java#L41-41
>> [3]
>> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/Preference.java#L42-42
>> [4]
>> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/FoodStuff.java#L41-41
>> [5]
>> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/PreferenceContributions.java#L31-31
>> [6]
>> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/FoodStuff.layout.json#L57-57
>>
>>
>>
>> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/PreferenceContributions.java#L62-62
>>
>> On 19 November 2014 at 15:27, Jeroen van der Wal <je...@stromboli.it>
>> wrote:
>>
>>> As to your question if you prevent something being contributed on only one
>>> of the parameter classes: In the metamodel there's no way to specify that
>>> but you could try to hide the contribution in the layout.json file.
>>>
>>> something like
>>>
>>> "actions":{
>>>     "yourAction": {
>>>        "hidden":{}
>>>     }
>>> }
>>>
>>> or
>>>
>>> "actions":{
>>>     "yourAction": {
>>>        "hidden":{"where":"ALWAYS" }
>>>     }
>>> }
>>>
>>> Can you check if this works?
>>>
>>> On Wed, Nov 19, 2014 at 4:15 PM, Jeroen van der Wal <je...@stromboli.it>
>>> wrote:
>>>
>>>> Hi Erik,
>>>>
>>>> You have to repeat the same parameters on the hideXxx method as the
>>> method
>>>> that you're trying to hide.
>>>>
>>>> HTH
>>>>
>>>> On Wed, Nov 19, 2014 at 4:09 PM, Erik de Hair <er...@pocos.nl> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> The method in my entity class is as follows:
>>>>>
>>>>> public boolean hideAddPhoneNumbers(PortalCompany owningCompany,
>>>>> AbstractArticle phoneNumberArticle,
>>>>>              PhoneNumberGrid gridNumber, AbstractSelectableNumberElement
>>>>> numberElement)
>>>>>      {
>>>>>          return true;
>>>>>      }
>>>>>
>>>>> I also tried
>>>>>
>>>>> public boolean hideAddPhoneNumbers()
>>>>> {
>>>>>      return true;
>>>>> }
>>>>>
>>>>> The signature of the method in the service is
>>>>>
>>>>> public FixedPhoneNumberSubscription addPhoneNumbers(PortalCompany
>>>>> owningCompany,
>>>>>              AbstractArticle phoneNumberArticle,
>>>>>              PhoneNumberGrid gridNumber,
>>>>>              AbstractSelectableNumberElement numberElement)
>>>>>
>>>>>
>>>>> Erik
>>>>>
>>>>> <ma...@pocos.nl>
>>>>>
>>>>> On 11/19/2014 03:37 PM, Martin Grigorov wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> On Wed, Nov 19, 2014 at 4:20 PM, Erik de Hair <er...@pocos.nl> wrote:
>>>>>>
>>>>>>   Hi Martin,
>>>>>>>    I think you need to add method hideXyz() as explained at
>>>>>>>
>>>>>>>> http://isis.apache.org/how-tos/how-to-02-030-How-to-hide-
>>>>>>>> an-action.html
>>>>>>>>
>>>>>>>>   By adding a hide to the repository I can only hide it everywhere or
>>>>>>> nowhere but I can't choose to pop up at certain entities only. At
>>>>>>> least, I
>>>>>>> don't know how to do that.
>>>>>>>
>>>>>>> When I add a hideXXX() to the entity where I want to hide the action,
>>>>>>> Isis
>>>>>>> complains about an orphaned method because the method doesn't exist
>>> at
>>>>>>> the
>>>>>>> entity itself.
>>>>>>>
>>>>>> Please share the method's code. The log is misleading. Most probably
>>> the
>>>>>> method signature is not correct.
>>>>>>
>>>>>> it should be :
>>>>>> - public
>>>>>> - returning boolean
>>>>>> - the name should be hide[TheCamelCasedActionName](the, same,
>>>>>> parameters,
>>>>>> as, the, action, method)
>>>>>> - the impl should use all available information to decide whether to
>>>>>> return
>>>>>> true or false
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Erik
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>


Re: suppress contributed action in one of the related entities only

Posted by Martin Grigorov <mg...@apache.org>.
On Mon, Dec 15, 2014 at 12:21 PM, Dan Haywood <da...@haywood-associates.co.uk>
wrote:
>
> On 13 December 2014 at 13:17, Martin Grigorov <mg...@apache.org>
> wrote:
> >
> > There is a Markdown broken link at the middle of the page content:
> >
> > ...
> > I just committed a change in the .md file but I still don't see the
> change
> > at
> >
> >
> http://isis.apache.org/more-advanced-topics/How-to-suppress-contributions.html
> > .
> > Maybe it takes some time ...
> >
> >
>
> You need to publish as well as just commit ... sounds like you might've
> omitted that step?
>
> log onto: https://cms.apache.org/redirect?uri=http://isis.apache.org/
>
> using your apache account; do an update at the trunk directory, then
> publish.
>

This was something new to me! Thanks!


>
>
> Cheers
> Dan
>
> >
> >
>

Re: suppress contributed action in one of the related entities only

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
On 13 December 2014 at 13:17, Martin Grigorov <mg...@apache.org> wrote:
>
> There is a Markdown broken link at the middle of the page content:
>
> ...
> I just committed a change in the .md file but I still don't see the change
> at
>
> http://isis.apache.org/more-advanced-topics/How-to-suppress-contributions.html
> .
> Maybe it takes some time ...
>
>

You need to publish as well as just commit ... sounds like you might've
omitted that step?

log onto: https://cms.apache.org/redirect?uri=http://isis.apache.org/

using your apache account; do an update at the trunk directory, then
publish.


Cheers
Dan

>
>

Re: suppress contributed action in one of the related entities only

Posted by Martin Grigorov <mg...@apache.org>.
There is a Markdown broken link at the middle of the page content:

which is accomplished using this [fragment](
https://github.com/isisaddons/isis-app-kitchensink/blob/d4fd4e8b799af42c343b7e451bbf6f5d218869a1/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/Person.layout.json#L44-L61
) in the Person.layout.json file:

There are other similar links in the page and they render fine. I guess it
is the URL fragment that confuses the Markdown parser.

I just committed a change in the .md file but I still don't see the change
at
http://isis.apache.org/more-advanced-topics/How-to-suppress-contributions.html
.
Maybe it takes some time ...

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Dec 5, 2014 at 7:36 PM, Dan Haywood <da...@haywood-associates.co.uk>
wrote:
>
> now also documented on the website, see
>
> http://isis.apache.org/more-advanced-topics/How-to-suppress-contributions.html
> .
>
> On 5 December 2014 at 14:09, Dan Haywood <da...@haywood-associates.co.uk>
> wrote:
>
> > Bit of a delay on this, but anyway... the good news is that it IS
> possible
> > to suppress a contributed action on one parameter but not another.
> >
> > I've updated the kitchen sink app [1] to show how
> >
> > In the "contrib" package there are three entities:
> > * Person  [2]
> > * Preference  [3]
> > * FoodStuff  [4]
> >
> > eg Mary LIKEs Apple, Mungo HATEs Banana, Midge LOVEs Oranges
> >
> > Neither Person nor FoodStuff knows about Preferences; the Preference is
> > the tuple that associates the two together.
> >
> > The PreferenceContributions [5] service provides:
> > * "likes" - contributed collection to Person
> > * "firstLove" - contributed property to Person
> > * "addPreference" - contributed action to both Person and FoodStuff
> > - "removePreference" - contributed action to both Person and FoodStuff
> >
> > However, although "addPreference" and "removePreference" *are*
> contributed
> > to all parameter types, this can be hidden using the .layout.json file.
> In
> > FoodStuff,layout.json [6] we have:
> >
> >
> >   "actions": {
> >     ...
> >     "removePreference": {
> >       "actionLayout": {
> >         "cssClass": "btn-warn",
> >         "hidden": "EVERYWHERE"
> >       }
> >     }
> >   }
> >
> > which means that the "removePreference" action cannot be seen when
> viewing
> > a FoodStuff entity.
> >
> > I'll add this stuff to our website for future reference.
> >
> > Cheers
> > Dan
> >
> >
> > [1] https://github.com/isisaddons/isis-app-kitchensink
> > [2]
> >
> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/Person.java#L41-41
> > [3]
> >
> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/Preference.java#L42-42
> > [4]
> >
> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/FoodStuff.java#L41-41
> > [5]
> >
> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/PreferenceContributions.java#L31-31
> > [6]
> >
> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/FoodStuff.layout.json#L57-57
> >
> >
> >
> >
> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/PreferenceContributions.java#L62-62
> >
> > On 19 November 2014 at 15:27, Jeroen van der Wal <je...@stromboli.it>
> > wrote:
> >
> >> As to your question if you prevent something being contributed on only
> one
> >> of the parameter classes: In the metamodel there's no way to specify
> that
> >> but you could try to hide the contribution in the layout.json file.
> >>
> >> something like
> >>
> >> "actions":{
> >>    "yourAction": {
> >>       "hidden":{}
> >>    }
> >> }
> >>
> >> or
> >>
> >> "actions":{
> >>    "yourAction": {
> >>       "hidden":{"where":"ALWAYS" }
> >>    }
> >> }
> >>
> >> Can you check if this works?
> >>
> >> On Wed, Nov 19, 2014 at 4:15 PM, Jeroen van der Wal <
> jeroen@stromboli.it>
> >> wrote:
> >>
> >> > Hi Erik,
> >> >
> >> > You have to repeat the same parameters on the hideXxx method as the
> >> method
> >> > that you're trying to hide.
> >> >
> >> > HTH
> >> >
> >> > On Wed, Nov 19, 2014 at 4:09 PM, Erik de Hair <er...@pocos.nl> wrote:
> >> >
> >> >> Hi,
> >> >>
> >> >> The method in my entity class is as follows:
> >> >>
> >> >> public boolean hideAddPhoneNumbers(PortalCompany owningCompany,
> >> >> AbstractArticle phoneNumberArticle,
> >> >>             PhoneNumberGrid gridNumber,
> AbstractSelectableNumberElement
> >> >> numberElement)
> >> >>     {
> >> >>         return true;
> >> >>     }
> >> >>
> >> >> I also tried
> >> >>
> >> >> public boolean hideAddPhoneNumbers()
> >> >> {
> >> >>     return true;
> >> >> }
> >> >>
> >> >> The signature of the method in the service is
> >> >>
> >> >> public FixedPhoneNumberSubscription addPhoneNumbers(PortalCompany
> >> >> owningCompany,
> >> >>             AbstractArticle phoneNumberArticle,
> >> >>             PhoneNumberGrid gridNumber,
> >> >>             AbstractSelectableNumberElement numberElement)
> >> >>
> >> >>
> >> >> Erik
> >> >>
> >> >> <ma...@pocos.nl>
> >> >>
> >> >> On 11/19/2014 03:37 PM, Martin Grigorov wrote:
> >> >>
> >> >>> Hi,
> >> >>>
> >> >>> On Wed, Nov 19, 2014 at 4:20 PM, Erik de Hair <er...@pocos.nl>
> wrote:
> >> >>>
> >> >>>  Hi Martin,
> >> >>>>
> >> >>>>   I think you need to add method hideXyz() as explained at
> >> >>>>
> >> >>>>> http://isis.apache.org/how-tos/how-to-02-030-How-to-hide-
> >> >>>>> an-action.html
> >> >>>>>
> >> >>>>>  By adding a hide to the repository I can only hide it everywhere
> or
> >> >>>> nowhere but I can't choose to pop up at certain entities only. At
> >> >>>> least, I
> >> >>>> don't know how to do that.
> >> >>>>
> >> >>>> When I add a hideXXX() to the entity where I want to hide the
> action,
> >> >>>> Isis
> >> >>>> complains about an orphaned method because the method doesn't exist
> >> at
> >> >>>> the
> >> >>>> entity itself.
> >> >>>>
> >> >>>
> >> >>> Please share the method's code. The log is misleading. Most probably
> >> the
> >> >>> method signature is not correct.
> >> >>>
> >> >>> it should be :
> >> >>> - public
> >> >>> - returning boolean
> >> >>> - the name should be hide[TheCamelCasedActionName](the, same,
> >> >>> parameters,
> >> >>> as, the, action, method)
> >> >>> - the impl should use all available information to decide whether to
> >> >>> return
> >> >>> true or false
> >> >>>
> >> >>>
> >> >>>
> >> >>>> Erik
> >> >>>>
> >> >>>>
> >> >>>>
> >> >>>>
> >> >>>>
> >> >>
> >> >
> >>
> >
> >
>

Re: suppress contributed action in one of the related entities only

Posted by Erik de Hair <e....@pocos.nl>.
Thanks, Dan. I'll give it a try.

Erik


On 12/05/2014 06:36 PM, Dan Haywood wrote:
> now also documented on the website, see
> http://isis.apache.org/more-advanced-topics/How-to-suppress-contributions.html
> .
>
> On 5 December 2014 at 14:09, Dan Haywood <da...@haywood-associates.co.uk>
> wrote:
>
>> Bit of a delay on this, but anyway... the good news is that it IS possible
>> to suppress a contributed action on one parameter but not another.
>>
>> I've updated the kitchen sink app [1] to show how
>>
>> In the "contrib" package there are three entities:
>> * Person  [2]
>> * Preference  [3]
>> * FoodStuff  [4]
>>
>> eg Mary LIKEs Apple, Mungo HATEs Banana, Midge LOVEs Oranges
>>
>> Neither Person nor FoodStuff knows about Preferences; the Preference is
>> the tuple that associates the two together.
>>
>> The PreferenceContributions [5] service provides:
>> * "likes" - contributed collection to Person
>> * "firstLove" - contributed property to Person
>> * "addPreference" - contributed action to both Person and FoodStuff
>> - "removePreference" - contributed action to both Person and FoodStuff
>>
>> However, although "addPreference" and "removePreference" *are* contributed
>> to all parameter types, this can be hidden using the .layout.json file.  In
>> FoodStuff,layout.json [6] we have:
>>
>>
>>    "actions": {
>>      ...
>>      "removePreference": {
>>        "actionLayout": {
>>          "cssClass": "btn-warn",
>>          "hidden": "EVERYWHERE"
>>        }
>>      }
>>    }
>>
>> which means that the "removePreference" action cannot be seen when viewing
>> a FoodStuff entity.
>>
>> I'll add this stuff to our website for future reference.
>>
>> Cheers
>> Dan
>>
>>
>> [1] https://github.com/isisaddons/isis-app-kitchensink
>> [2]
>> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/Person.java#L41-41
>> [3]
>> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/Preference.java#L42-42
>> [4]
>> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/FoodStuff.java#L41-41
>> [5]
>> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/PreferenceContributions.java#L31-31
>> [6]
>> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/FoodStuff.layout.json#L57-57
>>
>>
>>
>> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/PreferenceContributions.java#L62-62
>>
>> On 19 November 2014 at 15:27, Jeroen van der Wal <je...@stromboli.it>
>> wrote:
>>
>>> As to your question if you prevent something being contributed on only one
>>> of the parameter classes: In the metamodel there's no way to specify that
>>> but you could try to hide the contribution in the layout.json file.
>>>
>>> something like
>>>
>>> "actions":{
>>>     "yourAction": {
>>>        "hidden":{}
>>>     }
>>> }
>>>
>>> or
>>>
>>> "actions":{
>>>     "yourAction": {
>>>        "hidden":{"where":"ALWAYS" }
>>>     }
>>> }
>>>
>>> Can you check if this works?
>>>
>>> On Wed, Nov 19, 2014 at 4:15 PM, Jeroen van der Wal <je...@stromboli.it>
>>> wrote:
>>>
>>>> Hi Erik,
>>>>
>>>> You have to repeat the same parameters on the hideXxx method as the
>>> method
>>>> that you're trying to hide.
>>>>
>>>> HTH
>>>>
>>>> On Wed, Nov 19, 2014 at 4:09 PM, Erik de Hair <er...@pocos.nl> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> The method in my entity class is as follows:
>>>>>
>>>>> public boolean hideAddPhoneNumbers(PortalCompany owningCompany,
>>>>> AbstractArticle phoneNumberArticle,
>>>>>              PhoneNumberGrid gridNumber, AbstractSelectableNumberElement
>>>>> numberElement)
>>>>>      {
>>>>>          return true;
>>>>>      }
>>>>>
>>>>> I also tried
>>>>>
>>>>> public boolean hideAddPhoneNumbers()
>>>>> {
>>>>>      return true;
>>>>> }
>>>>>
>>>>> The signature of the method in the service is
>>>>>
>>>>> public FixedPhoneNumberSubscription addPhoneNumbers(PortalCompany
>>>>> owningCompany,
>>>>>              AbstractArticle phoneNumberArticle,
>>>>>              PhoneNumberGrid gridNumber,
>>>>>              AbstractSelectableNumberElement numberElement)
>>>>>
>>>>>
>>>>> Erik
>>>>>
>>>>> <ma...@pocos.nl>
>>>>>
>>>>> On 11/19/2014 03:37 PM, Martin Grigorov wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> On Wed, Nov 19, 2014 at 4:20 PM, Erik de Hair <er...@pocos.nl> wrote:
>>>>>>
>>>>>>   Hi Martin,
>>>>>>>    I think you need to add method hideXyz() as explained at
>>>>>>>
>>>>>>>> http://isis.apache.org/how-tos/how-to-02-030-How-to-hide-
>>>>>>>> an-action.html
>>>>>>>>
>>>>>>>>   By adding a hide to the repository I can only hide it everywhere or
>>>>>>> nowhere but I can't choose to pop up at certain entities only. At
>>>>>>> least, I
>>>>>>> don't know how to do that.
>>>>>>>
>>>>>>> When I add a hideXXX() to the entity where I want to hide the action,
>>>>>>> Isis
>>>>>>> complains about an orphaned method because the method doesn't exist
>>> at
>>>>>>> the
>>>>>>> entity itself.
>>>>>>>
>>>>>> Please share the method's code. The log is misleading. Most probably
>>> the
>>>>>> method signature is not correct.
>>>>>>
>>>>>> it should be :
>>>>>> - public
>>>>>> - returning boolean
>>>>>> - the name should be hide[TheCamelCasedActionName](the, same,
>>>>>> parameters,
>>>>>> as, the, action, method)
>>>>>> - the impl should use all available information to decide whether to
>>>>>> return
>>>>>> true or false
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Erik
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>


Re: suppress contributed action in one of the related entities only

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
now also documented on the website, see
http://isis.apache.org/more-advanced-topics/How-to-suppress-contributions.html
.

On 5 December 2014 at 14:09, Dan Haywood <da...@haywood-associates.co.uk>
wrote:

> Bit of a delay on this, but anyway... the good news is that it IS possible
> to suppress a contributed action on one parameter but not another.
>
> I've updated the kitchen sink app [1] to show how
>
> In the "contrib" package there are three entities:
> * Person  [2]
> * Preference  [3]
> * FoodStuff  [4]
>
> eg Mary LIKEs Apple, Mungo HATEs Banana, Midge LOVEs Oranges
>
> Neither Person nor FoodStuff knows about Preferences; the Preference is
> the tuple that associates the two together.
>
> The PreferenceContributions [5] service provides:
> * "likes" - contributed collection to Person
> * "firstLove" - contributed property to Person
> * "addPreference" - contributed action to both Person and FoodStuff
> - "removePreference" - contributed action to both Person and FoodStuff
>
> However, although "addPreference" and "removePreference" *are* contributed
> to all parameter types, this can be hidden using the .layout.json file.  In
> FoodStuff,layout.json [6] we have:
>
>
>   "actions": {
>     ...
>     "removePreference": {
>       "actionLayout": {
>         "cssClass": "btn-warn",
>         "hidden": "EVERYWHERE"
>       }
>     }
>   }
>
> which means that the "removePreference" action cannot be seen when viewing
> a FoodStuff entity.
>
> I'll add this stuff to our website for future reference.
>
> Cheers
> Dan
>
>
> [1] https://github.com/isisaddons/isis-app-kitchensink
> [2]
> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/Person.java#L41-41
> [3]
> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/Preference.java#L42-42
> [4]
> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/FoodStuff.java#L41-41
> [5]
> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/PreferenceContributions.java#L31-31
> [6]
> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/FoodStuff.layout.json#L57-57
>
>
>
> https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/PreferenceContributions.java#L62-62
>
> On 19 November 2014 at 15:27, Jeroen van der Wal <je...@stromboli.it>
> wrote:
>
>> As to your question if you prevent something being contributed on only one
>> of the parameter classes: In the metamodel there's no way to specify that
>> but you could try to hide the contribution in the layout.json file.
>>
>> something like
>>
>> "actions":{
>>    "yourAction": {
>>       "hidden":{}
>>    }
>> }
>>
>> or
>>
>> "actions":{
>>    "yourAction": {
>>       "hidden":{"where":"ALWAYS" }
>>    }
>> }
>>
>> Can you check if this works?
>>
>> On Wed, Nov 19, 2014 at 4:15 PM, Jeroen van der Wal <je...@stromboli.it>
>> wrote:
>>
>> > Hi Erik,
>> >
>> > You have to repeat the same parameters on the hideXxx method as the
>> method
>> > that you're trying to hide.
>> >
>> > HTH
>> >
>> > On Wed, Nov 19, 2014 at 4:09 PM, Erik de Hair <er...@pocos.nl> wrote:
>> >
>> >> Hi,
>> >>
>> >> The method in my entity class is as follows:
>> >>
>> >> public boolean hideAddPhoneNumbers(PortalCompany owningCompany,
>> >> AbstractArticle phoneNumberArticle,
>> >>             PhoneNumberGrid gridNumber, AbstractSelectableNumberElement
>> >> numberElement)
>> >>     {
>> >>         return true;
>> >>     }
>> >>
>> >> I also tried
>> >>
>> >> public boolean hideAddPhoneNumbers()
>> >> {
>> >>     return true;
>> >> }
>> >>
>> >> The signature of the method in the service is
>> >>
>> >> public FixedPhoneNumberSubscription addPhoneNumbers(PortalCompany
>> >> owningCompany,
>> >>             AbstractArticle phoneNumberArticle,
>> >>             PhoneNumberGrid gridNumber,
>> >>             AbstractSelectableNumberElement numberElement)
>> >>
>> >>
>> >> Erik
>> >>
>> >> <ma...@pocos.nl>
>> >>
>> >> On 11/19/2014 03:37 PM, Martin Grigorov wrote:
>> >>
>> >>> Hi,
>> >>>
>> >>> On Wed, Nov 19, 2014 at 4:20 PM, Erik de Hair <er...@pocos.nl> wrote:
>> >>>
>> >>>  Hi Martin,
>> >>>>
>> >>>>   I think you need to add method hideXyz() as explained at
>> >>>>
>> >>>>> http://isis.apache.org/how-tos/how-to-02-030-How-to-hide-
>> >>>>> an-action.html
>> >>>>>
>> >>>>>  By adding a hide to the repository I can only hide it everywhere or
>> >>>> nowhere but I can't choose to pop up at certain entities only. At
>> >>>> least, I
>> >>>> don't know how to do that.
>> >>>>
>> >>>> When I add a hideXXX() to the entity where I want to hide the action,
>> >>>> Isis
>> >>>> complains about an orphaned method because the method doesn't exist
>> at
>> >>>> the
>> >>>> entity itself.
>> >>>>
>> >>>
>> >>> Please share the method's code. The log is misleading. Most probably
>> the
>> >>> method signature is not correct.
>> >>>
>> >>> it should be :
>> >>> - public
>> >>> - returning boolean
>> >>> - the name should be hide[TheCamelCasedActionName](the, same,
>> >>> parameters,
>> >>> as, the, action, method)
>> >>> - the impl should use all available information to decide whether to
>> >>> return
>> >>> true or false
>> >>>
>> >>>
>> >>>
>> >>>> Erik
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>
>> >
>>
>
>

Re: suppress contributed action in one of the related entities only

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Bit of a delay on this, but anyway... the good news is that it IS possible
to suppress a contributed action on one parameter but not another.

I've updated the kitchen sink app [1] to show how

In the "contrib" package there are three entities:
* Person  [2]
* Preference  [3]
* FoodStuff  [4]

eg Mary LIKEs Apple, Mungo HATEs Banana, Midge LOVEs Oranges

Neither Person nor FoodStuff knows about Preferences; the Preference is the
tuple that associates the two together.

The PreferenceContributions [5] service provides:
* "likes" - contributed collection to Person
* "firstLove" - contributed property to Person
* "addPreference" - contributed action to both Person and FoodStuff
- "removePreference" - contributed action to both Person and FoodStuff

However, although "addPreference" and "removePreference" *are* contributed
to all parameter types, this can be hidden using the .layout.json file.  In
FoodStuff,layout.json [6] we have:


  "actions": {
    ...
    "removePreference": {
      "actionLayout": {
        "cssClass": "btn-warn",
        "hidden": "EVERYWHERE"
      }
    }
  }

which means that the "removePreference" action cannot be seen when viewing
a FoodStuff entity.

I'll add this stuff to our website for future reference.

Cheers
Dan


[1] https://github.com/isisaddons/isis-app-kitchensink
[2]
https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/Person.java#L41-41
[3]
https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/Preference.java#L42-42
[4]
https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/FoodStuff.java#L41-41
[5]
https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/PreferenceContributions.java#L31-31
[6]
https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/FoodStuff.layout.json#L57-57


https://github.com/isisaddons/isis-app-kitchensink/blob/master/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/PreferenceContributions.java#L62-62

On 19 November 2014 at 15:27, Jeroen van der Wal <je...@stromboli.it>
wrote:

> As to your question if you prevent something being contributed on only one
> of the parameter classes: In the metamodel there's no way to specify that
> but you could try to hide the contribution in the layout.json file.
>
> something like
>
> "actions":{
>    "yourAction": {
>       "hidden":{}
>    }
> }
>
> or
>
> "actions":{
>    "yourAction": {
>       "hidden":{"where":"ALWAYS" }
>    }
> }
>
> Can you check if this works?
>
> On Wed, Nov 19, 2014 at 4:15 PM, Jeroen van der Wal <je...@stromboli.it>
> wrote:
>
> > Hi Erik,
> >
> > You have to repeat the same parameters on the hideXxx method as the
> method
> > that you're trying to hide.
> >
> > HTH
> >
> > On Wed, Nov 19, 2014 at 4:09 PM, Erik de Hair <er...@pocos.nl> wrote:
> >
> >> Hi,
> >>
> >> The method in my entity class is as follows:
> >>
> >> public boolean hideAddPhoneNumbers(PortalCompany owningCompany,
> >> AbstractArticle phoneNumberArticle,
> >>             PhoneNumberGrid gridNumber, AbstractSelectableNumberElement
> >> numberElement)
> >>     {
> >>         return true;
> >>     }
> >>
> >> I also tried
> >>
> >> public boolean hideAddPhoneNumbers()
> >> {
> >>     return true;
> >> }
> >>
> >> The signature of the method in the service is
> >>
> >> public FixedPhoneNumberSubscription addPhoneNumbers(PortalCompany
> >> owningCompany,
> >>             AbstractArticle phoneNumberArticle,
> >>             PhoneNumberGrid gridNumber,
> >>             AbstractSelectableNumberElement numberElement)
> >>
> >>
> >> Erik
> >>
> >> <ma...@pocos.nl>
> >>
> >> On 11/19/2014 03:37 PM, Martin Grigorov wrote:
> >>
> >>> Hi,
> >>>
> >>> On Wed, Nov 19, 2014 at 4:20 PM, Erik de Hair <er...@pocos.nl> wrote:
> >>>
> >>>  Hi Martin,
> >>>>
> >>>>   I think you need to add method hideXyz() as explained at
> >>>>
> >>>>> http://isis.apache.org/how-tos/how-to-02-030-How-to-hide-
> >>>>> an-action.html
> >>>>>
> >>>>>  By adding a hide to the repository I can only hide it everywhere or
> >>>> nowhere but I can't choose to pop up at certain entities only. At
> >>>> least, I
> >>>> don't know how to do that.
> >>>>
> >>>> When I add a hideXXX() to the entity where I want to hide the action,
> >>>> Isis
> >>>> complains about an orphaned method because the method doesn't exist at
> >>>> the
> >>>> entity itself.
> >>>>
> >>>
> >>> Please share the method's code. The log is misleading. Most probably
> the
> >>> method signature is not correct.
> >>>
> >>> it should be :
> >>> - public
> >>> - returning boolean
> >>> - the name should be hide[TheCamelCasedActionName](the, same,
> >>> parameters,
> >>> as, the, action, method)
> >>> - the impl should use all available information to decide whether to
> >>> return
> >>> true or false
> >>>
> >>>
> >>>
> >>>> Erik
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>
> >
>

Re: suppress contributed action in one of the related entities only

Posted by Jeroen van der Wal <je...@stromboli.it>.
As to your question if you prevent something being contributed on only one
of the parameter classes: In the metamodel there's no way to specify that
but you could try to hide the contribution in the layout.json file.

something like

"actions":{
   "yourAction": {
      "hidden":{}
   }
}

or

"actions":{
   "yourAction": {
      "hidden":{"where":"ALWAYS" }
   }
}

Can you check if this works?

On Wed, Nov 19, 2014 at 4:15 PM, Jeroen van der Wal <je...@stromboli.it>
wrote:

> Hi Erik,
>
> You have to repeat the same parameters on the hideXxx method as the method
> that you're trying to hide.
>
> HTH
>
> On Wed, Nov 19, 2014 at 4:09 PM, Erik de Hair <er...@pocos.nl> wrote:
>
>> Hi,
>>
>> The method in my entity class is as follows:
>>
>> public boolean hideAddPhoneNumbers(PortalCompany owningCompany,
>> AbstractArticle phoneNumberArticle,
>>             PhoneNumberGrid gridNumber, AbstractSelectableNumberElement
>> numberElement)
>>     {
>>         return true;
>>     }
>>
>> I also tried
>>
>> public boolean hideAddPhoneNumbers()
>> {
>>     return true;
>> }
>>
>> The signature of the method in the service is
>>
>> public FixedPhoneNumberSubscription addPhoneNumbers(PortalCompany
>> owningCompany,
>>             AbstractArticle phoneNumberArticle,
>>             PhoneNumberGrid gridNumber,
>>             AbstractSelectableNumberElement numberElement)
>>
>>
>> Erik
>>
>> <ma...@pocos.nl>
>>
>> On 11/19/2014 03:37 PM, Martin Grigorov wrote:
>>
>>> Hi,
>>>
>>> On Wed, Nov 19, 2014 at 4:20 PM, Erik de Hair <er...@pocos.nl> wrote:
>>>
>>>  Hi Martin,
>>>>
>>>>   I think you need to add method hideXyz() as explained at
>>>>
>>>>> http://isis.apache.org/how-tos/how-to-02-030-How-to-hide-
>>>>> an-action.html
>>>>>
>>>>>  By adding a hide to the repository I can only hide it everywhere or
>>>> nowhere but I can't choose to pop up at certain entities only. At
>>>> least, I
>>>> don't know how to do that.
>>>>
>>>> When I add a hideXXX() to the entity where I want to hide the action,
>>>> Isis
>>>> complains about an orphaned method because the method doesn't exist at
>>>> the
>>>> entity itself.
>>>>
>>>
>>> Please share the method's code. The log is misleading. Most probably the
>>> method signature is not correct.
>>>
>>> it should be :
>>> - public
>>> - returning boolean
>>> - the name should be hide[TheCamelCasedActionName](the, same,
>>> parameters,
>>> as, the, action, method)
>>> - the impl should use all available information to decide whether to
>>> return
>>> true or false
>>>
>>>
>>>
>>>> Erik
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>

Re: suppress contributed action in one of the related entities only

Posted by Jeroen van der Wal <je...@stromboli.it>.
Hi Erik,

You have to repeat the same parameters on the hideXxx method as the method
that you're trying to hide.

HTH

On Wed, Nov 19, 2014 at 4:09 PM, Erik de Hair <er...@pocos.nl> wrote:

> Hi,
>
> The method in my entity class is as follows:
>
> public boolean hideAddPhoneNumbers(PortalCompany owningCompany,
> AbstractArticle phoneNumberArticle,
>             PhoneNumberGrid gridNumber, AbstractSelectableNumberElement
> numberElement)
>     {
>         return true;
>     }
>
> I also tried
>
> public boolean hideAddPhoneNumbers()
> {
>     return true;
> }
>
> The signature of the method in the service is
>
> public FixedPhoneNumberSubscription addPhoneNumbers(PortalCompany
> owningCompany,
>             AbstractArticle phoneNumberArticle,
>             PhoneNumberGrid gridNumber,
>             AbstractSelectableNumberElement numberElement)
>
>
> Erik
>
> <ma...@pocos.nl>
>
> On 11/19/2014 03:37 PM, Martin Grigorov wrote:
>
>> Hi,
>>
>> On Wed, Nov 19, 2014 at 4:20 PM, Erik de Hair <er...@pocos.nl> wrote:
>>
>>  Hi Martin,
>>>
>>>   I think you need to add method hideXyz() as explained at
>>>
>>>> http://isis.apache.org/how-tos/how-to-02-030-How-to-hide-an-action.html
>>>>
>>>>  By adding a hide to the repository I can only hide it everywhere or
>>> nowhere but I can't choose to pop up at certain entities only. At least,
>>> I
>>> don't know how to do that.
>>>
>>> When I add a hideXXX() to the entity where I want to hide the action,
>>> Isis
>>> complains about an orphaned method because the method doesn't exist at
>>> the
>>> entity itself.
>>>
>>
>> Please share the method's code. The log is misleading. Most probably the
>> method signature is not correct.
>>
>> it should be :
>> - public
>> - returning boolean
>> - the name should be hide[TheCamelCasedActionName](the, same, parameters,
>> as, the, action, method)
>> - the impl should use all available information to decide whether to
>> return
>> true or false
>>
>>
>>
>>> Erik
>>>
>>>
>>>
>>>
>>>
>

Re: suppress contributed action in one of the related entities only

Posted by Erik de Hair <er...@pocos.nl>.
Hi,

The method in my entity class is as follows:

public boolean hideAddPhoneNumbers(PortalCompany owningCompany, 
AbstractArticle phoneNumberArticle,
             PhoneNumberGrid gridNumber, AbstractSelectableNumberElement 
numberElement)
     {
         return true;
     }

I also tried

public boolean hideAddPhoneNumbers()
{
     return true;
}

The signature of the method in the service is

public FixedPhoneNumberSubscription addPhoneNumbers(PortalCompany 
owningCompany,
             AbstractArticle phoneNumberArticle,
             PhoneNumberGrid gridNumber,
             AbstractSelectableNumberElement numberElement)


Erik

<ma...@pocos.nl>
On 11/19/2014 03:37 PM, Martin Grigorov wrote:
> Hi,
>
> On Wed, Nov 19, 2014 at 4:20 PM, Erik de Hair <er...@pocos.nl> wrote:
>
>> Hi Martin,
>>
>>   I think you need to add method hideXyz() as explained at
>>> http://isis.apache.org/how-tos/how-to-02-030-How-to-hide-an-action.html
>>>
>> By adding a hide to the repository I can only hide it everywhere or
>> nowhere but I can't choose to pop up at certain entities only. At least, I
>> don't know how to do that.
>>
>> When I add a hideXXX() to the entity where I want to hide the action, Isis
>> complains about an orphaned method because the method doesn't exist at the
>> entity itself.
>
> Please share the method's code. The log is misleading. Most probably the
> method signature is not correct.
>
> it should be :
> - public
> - returning boolean
> - the name should be hide[TheCamelCasedActionName](the, same, parameters,
> as, the, action, method)
> - the impl should use all available information to decide whether to return
> true or false
>
>
>>
>> Erik
>>
>>
>>
>>


Re: suppress contributed action in one of the related entities only

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Wed, Nov 19, 2014 at 4:20 PM, Erik de Hair <er...@pocos.nl> wrote:

> Hi Martin,
>
>  I think you need to add method hideXyz() as explained at
>> http://isis.apache.org/how-tos/how-to-02-030-How-to-hide-an-action.html
>>
>
> By adding a hide to the repository I can only hide it everywhere or
> nowhere but I can't choose to pop up at certain entities only. At least, I
> don't know how to do that.
>
> When I add a hideXXX() to the entity where I want to hide the action, Isis
> complains about an orphaned method because the method doesn't exist at the
> entity itself.


Please share the method's code. The log is misleading. Most probably the
method signature is not correct.

it should be :
- public
- returning boolean
- the name should be hide[TheCamelCasedActionName](the, same, parameters,
as, the, action, method)
- the impl should use all available information to decide whether to return
true or false


>
>
> Erik
>
>
>
>

Re: suppress contributed action in one of the related entities only

Posted by Erik de Hair <er...@pocos.nl>.
Hi Martin,

> I think you need to add method hideXyz() as explained at
> http://isis.apache.org/how-tos/how-to-02-030-How-to-hide-an-action.html

By adding a hide to the repository I can only hide it everywhere or 
nowhere but I can't choose to pop up at certain entities only. At least, 
I don't know how to do that.

When I add a hideXXX() to the entity where I want to hide the action, 
Isis complains about an orphaned method because the method doesn't exist 
at the entity itself.

Erik




Re: suppress contributed action in one of the related entities only

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

I think you need to add method hideXyz() as explained at
http://isis.apache.org/how-tos/how-to-02-030-How-to-hide-an-action.html
and
http://isis.apache.org/more-advanced-topics/how-to-08-010-Hiding,-disabling-or-validating-for-specific-users-or-roles.html


Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Wed, Nov 19, 2014 at 3:15 PM, Erik de Hair <er...@pocos.nl> wrote:

>  Hi,
>
> In a service I have an action with a few parameters. I don't want this
> action to show up in the entity page for only of these parameters. I tried
> to add to action to the json-layout file and hide it there with no effect.
>
> Is it possible to suppress a contributed action in only one of the
> parameter entities?
>
> Met vriendelijke groet,
>
> Erik de Hair
>
> --
> Pocos bv
> Croy 9c - 5653 LC Eindhoven
> Telefoon: 088 0100 700 - Fax: 088 0100 799
> http://www.pocos.nl/ - http://www.sipo.nl/
> K.v.K. nummer: 17097024
> [image: Follow Pocos bv]
> <https://twitter.com/intent/follow?original_referer=https%3A%2F%2Ftwitter.com%2Fabout%2Fresources%2Fbuttons&region=follow_link&screen_name=Pocosbv&source=followbutton&variant=2.0>
>
> Aanmelden van incidenten en/of changes graag via servicedesk@pocos.nl
>