Author: danhaywood
Date: Sat Feb 28 16:16:08 2015
New Revision: 1662956
URL: http://svn.apache.org/r1662956
Log:
updating site for contributed actions etc
Added:
isis/site/trunk/content/more-advanced-topics/how-to-suppress-contributions-to-action-parameter.md
- copied, changed from r1660662,
isis/site/trunk/content/more-advanced-topics/How-to-suppress-contributions.md
Removed:
isis/site/trunk/content/more-advanced-topics/How-to-suppress-contributions.md
Modified:
isis/site/trunk/content/more-advanced-topics/how-to-01-062-How-to-decouple-dependencies-using-contributions.md
Modified:
isis/site/trunk/content/more-advanced-topics/how-to-01-062-How-to-decouple-dependencies-using-contributions.md
URL:
http://svn.apache.org/viewvc/isis/site/trunk/content/more-advanced-topics/how-to-01-062-How-to-decouple-dependencies-using-contributions.md?rev=1662956&r1=1662955&r2=1662956&view=diff
==============================================================================
---
isis/site/trunk/content/more-advanced-topics/how-to-01-062-How-to-decouple-dependencies-using-contributions.md
(original)
+++
isis/site/trunk/content/more-advanced-topics/how-to-01-062-How-to-decouple-dependencies-using-contributions.md
Sat Feb 28 16:16:08 2015
@@ -14,9 +14,11 @@ In the `customers` module, we have the `
For both `Customer` and `FixedAsset` (and any other future implementation) we
would want to have some means to add and remove `CommunicationChannel`s).
Rather than having very similar collections and actions in each, we can
implement the requirement by defining the behaviour in the
`communicationChannels` module, through a domain service. It would look
something like:
+ @DomainService(
+ nature=NatureOfService.VIEW_CONTRIBUTIONS_ONLY
+ )
public class CommunicationChannelContributions {
- @NotInServiceMenu
public CommunicationChannelOwner addPostalAddress(
final CommunicationChannelOwner owner,
final @Named("Address line 1") String addressLine1,
@@ -25,17 +27,28 @@ For both `Customer` and `FixedAsset` (an
...
}
- @NotInServiceMenu
- @NotContributed(As.ACTION)
+ @Action(
+ semantics=SemanticsOf.SAFE
+ )
+ @ActionLayout(
+ contributed=Contributed.AS_ASSOCIATION)
+ }
+ @CollectionLayout(
+ render=RenderType.EAGERLY
+ )
public Collection<CommunicationChannel> communicationChannels(
- final CommunicationOwner owner) {
+ final CommunicationChannelOwner owner) {
...
}
- @NotInServiceMenu
- @NotContributed(As.ACTION)
+ @Action(
+ semantics=SemanticsOf.SAFE
+ )
+ @ActionLayout(
+ contributed=Contributed.AS_ASSOCIATION)
+ }
public CommunicationChannel preferredCommunicationChannels(
- final CommunicationOwner owner) {
+ final CommunicationChannelOwner owner) {
...
}
@@ -43,12 +56,11 @@ For both `Customer` and `FixedAsset` (an
The first action, `addPostalAddress` will be rendered seemingly as a regular
action for all implementations of `CommunicationChannelOwner`, but with that
parameter omitted. This is a contributed action.
-The second action - whose implementation will be some repository query to
search for all `CommunicationChannel`s for the given owner - will be rendered
as a collection of the owner; this is a contributed collection. The
`@NotContributed(As.ACTION)` suppresses the action from being contributed as an
action also.
-
-Finally, the third action - that again will be some sort of repository query -
will be rendered as a property o fhte owner; this is a contributed property.
Again, the `@NotContributed(As.ACTION)` suppresses the action from being
contributed as an action also.
+The second action - whose implementation will be some repository query to
search for all `CommunicationChannel`s for the given owner - will be rendered
as a collection of the owner; this is a contributed collection. The
`@ActionLayout(contributed=Contributed.AS_ASSOCIATION)` suppresses the action
from being contributed as an action also. Note that the action must have safe
semantics, specified using `@Action(semantics=SemanticsOf.SAFE)`; otherwise the
rendering of the collection could cause unwanted side-effects. Note also that
it is valid to apply a `@CollectionLayout` annotation; or this could be
specified using a `Xxx.layout.json` file for each contributee (implementing
`CommunicationChannelOwner`).
+Finally, the third action - that again will be some sort of repository query -
will be rendered as a property of hte owner; this is a contributed property.
Again, the action must have safe semantics, specified using
`@Action(semantics=SemanticsOf.SAFE)`. And, again, , the
`@ActionLayout(contributed=Contributed.AS_ASSOCIATION)` suppresses the action
from being contributed as an action also. Analogously to the contributed
collection, a `@PropertyLayout` annotation could be also be specified.
## See also
-For another example of contributions, see [this
page](./how-to-suppress-contributions.html) describing how to suppress
contributions for one action parameter but not another.
+See also: how to [suppress contributions for one action
parameter](./how-to-suppress-contributions-to-action-parameter.html) but not
another.
Copied:
isis/site/trunk/content/more-advanced-topics/how-to-suppress-contributions-to-action-parameter.md
(from r1660662,
isis/site/trunk/content/more-advanced-topics/How-to-suppress-contributions.md)
URL:
http://svn.apache.org/viewvc/isis/site/trunk/content/more-advanced-topics/how-to-suppress-contributions-to-action-parameter.md?p2=isis/site/trunk/content/more-advanced-topics/how-to-suppress-contributions-to-action-parameter.md&p1=isis/site/trunk/content/more-advanced-topics/How-to-suppress-contributions.md&r1=1660662&r2=1662956&rev=1662956&view=diff
==============================================================================
---
isis/site/trunk/content/more-advanced-topics/How-to-suppress-contributions.md
(original)
+++
isis/site/trunk/content/more-advanced-topics/how-to-suppress-contributions-to-action-parameter.md
Sat Feb 28 16:16:08 2015
@@ -5,43 +5,49 @@ If a contributed action has multiple par
While this will often be what you want (or at least harmless), on some
occasions you may want to suppress the contributed
action on one of those parameter types.
-The [kitchen sink app](https://github.com/isisaddons/isis-app-kitchensink)
(part of [isisaddons.org](http://www.isisaddons.org/)
+The [kitchen sink app](https://github.com/isisaddons/isis-app-kitchensink)
(part of [isisaddons.org](http://www.isisaddons.org/), not ASF)
includes an example showing how this can be done.
-In its `contrib` package there are three entities:
+In its `contributee` package there are two entities:
-*
[Person](https://github.com/isisaddons/isis-app-kitchensink/tree/d4fd4e8b799af42c343b7e451bbf6f5d218869a1/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/Person.java)
-*
[Preference](https://github.com/isisaddons/isis-app-kitchensink/tree/d4fd4e8b799af42c343b7e451bbf6f5d218869a1/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/Preference.java)
-*
[FoodStuff](https://github.com/isisaddons/isis-app-kitchensink/tree/d4fd4e8b799af42c343b7e451bbf6f5d218869a1/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/FoodStuff.java)
+*
[Person](https://github.com/isisaddons/isis-app-kitchensink/blob/262e3bc149ac0d82757738339af9683668f44155/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/Person.java)
+*
[FoodStuff](https://github.com/isisaddons/isis-app-kitchensink/blob/262e3bc149ac0d82757738339af9683668f44155/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/FoodStuff.java)
+
+and in its `contributed` package there is one entity:
+
+*
[Preference](https://github.com/isisaddons/isis-app-kitchensink/blob/262e3bc149ac0d82757738339af9683668f44155/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/Preference.java)
eg Mary LIKEs Apple, Mungo HATEs Banana, Midge LOVEs Oranges
Neither `Person` nor `FoodStuff` knows about `Preference`s; the `Preference`
is the tuple that associates the two together.
-The
[PreferenceContributions](https://github.com/isisaddons/isis-app-kitchensink/tree/d4fd4e8b799af42c343b7e451bbf6f5d218869a1/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/PreferenceContributions.java)
service contributes the following:
+The
[PreferenceContributions](https://github.com/isisaddons/isis-app-kitchensink/blob/262e3bc149ac0d82757738339af9683668f44155/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributed/PreferenceContributions.java)
service contributes the following:
* `likes(...)` - a contributed collection to `Person`:
<pre>
- @NotContributed(NotContributed.As.ACTION) // ie contributed as collection
- @NotInServiceMenu
- @ActionSemantics(ActionSemantics.Of.SAFE)
+ @Action(
+ semantics = SemanticsOf.SAFE
+ )
+ @ActionLayout(
+ contributed = Contributed.AS_ASSOCIATION
+ )
public List<FoodStuff> likes(final Person person) { ... }
</pre>
* `firstLove(...)` - contributed property, also to `Person`
<pre>
- @NotContributed(NotContributed.As.ACTION) // ie contributed as property
- @NotInServiceMenu
- @ActionSemantics(ActionSemantics.Of.SAFE)
+ @Action(semantics = SemanticsOf.SAFE)
+ @ActionLayout(
+ contributed = Contributed.AS_ASSOCIATION
+ )
public FoodStuff firstLove(final Person person) { ... }
</pre>
* `addPreference(...)` - a contributed action to both `Person` and `FoodStuff`
<pre>
- @NotInServiceMenu
public Preference addPreference(
final Person person,
final @Named("Type") Preference.PreferenceType preferenceType,
@@ -51,7 +57,6 @@ The [PreferenceContributions](https://gi
* `removePreference(...)` - a contributed action to both `Person` and
`FoodStuff`
<pre>
- @NotInServiceMenu
public Person removePreference(final Person person, final FoodStuff
foodStuff) {
final List<Preference> preferences1 = preferences.listAllPreferences();
for (Preference preference : preferences1) { ... }
@@ -63,7 +68,7 @@ For the `Person` entity, the actions are
<img src="images/suppressing-contributions-person.png" width="800px"/>
-which is accomplished using this <a
href="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">fragment</a>
in the `Person.layout.json` file:
+which is accomplished using this <a
href="https://github.com/isisaddons/isis-app-kitchensink/blob/262e3bc149ac0d82757738339af9683668f44155/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/Person.layout.json#L44-L61">fragment</a>
in the `Person.layout.json` file:
"collections": {
"likes": {
@@ -90,7 +95,7 @@ For the `FoodStuff` entity meanwhile, on
<img src="images/suppressing-contributions-foodstuff.png" width="800px"/>
-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/FoodStuff.layout.json#L48-L59)
in the `FoodStuff.layout.json` file: we have:
+which is accomplished using this
[fragment](https://github.com/isisaddons/isis-app-kitchensink/blob/262e3bc149ac0d82757738339af9683668f44155/dom/src/main/java/org/isisaddons/app/kitchensink/dom/contrib/contributee/FoodStuff.layout.json#L48-L59)
in the `FoodStuff.layout.json` file: we have:
"actions": {
"addPreference": {