isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Haywood <...@haywood-associates.co.uk>
Subject Re: HiddenFacet wrong behavior
Date Fri, 28 Aug 2015 18:11:30 GMT
Thanks, but bit sure I can work it out from this info.

If you could do an example using simpleapp (upload to github) that would be
great.

Thx, Dan
On 28 Aug 2015 19:04, "Nacho Cánovas Rejón" <n.canovas@gesconsultor.com>
wrote:

> The code that produces me this is like this:
>
> *Code where I receive the action
>
> *objectSpecification.getObjectActions(Contributed.INCLUDED)
>
>
> *Action Contributed (I dont't use param contributed as you in this case)*
>
> @Action(hidden = Where.EVERYWHERE)
>     public <E extends MO> E findBySingletonProperty(final Class<E> ofType,
> final String entityParamName, final Object object) {
>      .....
> }
>
>
> If you can't reproduce with this information, I'll try one case on
> SimpleApp more specific.
>
> Thanks
>
> El 28/08/2015 a las 18:48, Dan Haywood escribió:
>
>> Hi Nacho,
>>
>> thanks for this, though I'm having trouble trying to replicate.
>>
>>
>> For example, in the todoapp [1] there's a contributed action on ToDoItem:
>>
>> @DomainService(nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY)
>> public class ToDoItemAnalysisContributions {
>>
>>      @ActionLayout(contributed = Contributed.AS_ACTION)
>>      @Action(
>>              semantics = SemanticsOf.SAFE
>>      )
>>      public ToDoItemsByCategoryViewModel analyseCategory(final ToDoItem
>> item) {
>>          return toDoAppAnalysis.toDoItemsForCategory(item.getCategory());
>>      }
>>      ...
>> }
>>
>>
>> if I change this to:
>>
>>      @ActionLayout(contributed = Contributed.AS_ACTION)
>>      @Action(
>>              hidden = Where.EVERYWHERE,
>>              semantics = SemanticsOf.SAFE
>>      )
>>      public ToDoItemsByCategoryViewModel analyseCategory(final ToDoItem
>> item) { ... }
>>
>> then the action is hidden on ToDoItem.
>>
>> ~~~
>>
>> Can you give me an example that demonstrates the issue (either the todoapp
>> or based on simpleapp?)
>>
>> Thanks
>> Dan
>>
>> [1] https://github.com/isisaddons/isis-app-todoapp
>>
>>
>>
>>
>> On 28 August 2015 at 14:07, Nacho Cánovas Rejón <
>> n.canovas@gesconsultor.com>
>> wrote:
>>
>> Hi again Dan.
>>>
>>> I updated all annotations and is one behavior with Hidden not
>>> contemplated.
>>>
>>> Actions, properties and collections declares well a HidenFacet with their
>>> own annotation, but the problem is when we try to get HidenFacet from a
>>> Contributed Action, it always returns "is not hide".
>>>
>>> I show you why:
>>>
>>> These are facets declared from some action:
>>>
>>> {interface
>>>
>>> org.apache.isis.core.metamodel.facets.actions.defaults.ActionDefaultsFacet=ActionDefaultsFacetNone[type=ActionDefaultsFacet],
>>> interface
>>>
>>> org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionDomainEventFacet=ActionDomainEventFacetForActionAnnotation[interaction=Validating;Disabling;Hiding,type=ActionDomainEventFacet],
>>> interface
>>>
>>> org.apache.isis.core.metamodel.facets.all.named.NamedFacet=NamedFacetTranslated[type=NamedFacet],
>>> interface
>>>
>>> org.apache.isis.core.metamodel.facets.actions.position.ActionPositionFacet=ActionPositionFacetFallback[type=ActionPositionFacet,position=BELOW],
>>> interface
>>>
>>> org.apache.isis.core.runtime.authorization.standard.AuthorizationFacet=AuthorizationFacetImpl[interaction=Disabling;Hiding,type=AuthorizationFacet],
>>> interface
>>>
>>> org.apache.isis.core.metamodel.facets.object.hidden.HiddenObjectFacet=HiddenObjectFacetViaMethod[interaction=Hiding,type=HiddenObjectFacet],
>>> interface
>>>
>>> org.apache.isis.core.metamodel.facets.all.help.HelpFacet=HelpFacetNone[type=HelpFacet,null],
>>> interface
>>>
>>> *org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet=HiddenFacetForActionAnnotation[interaction=Hiding,,when=Always;
>>> where =Everywhere]*, interface
>>>
>>> org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacet=ActionInvocationFacetWrapTransaction[type=ActionInvocationFacet]
>>> -->
>>>
>>> ActionInvocationFacetForDomainEventFromActionAnnotation[type=ActionInvocationFacet,method=public
>>> com.xms.framework.api.domain.model.isis.AbstractMultiTenantObject
>>>
>>> com.xms.framework.api.domain.model.isis.AbstractSingletonMultiTenantObjectRepositoryAndFactory.findBySingletonProperty(java.lang.Class,java.lang.String,java.lang.Object)],
>>> interface
>>>
>>> org.apache.isis.core.metamodel.facets.actions.semantics.ActionSemanticsFacet=ActionSemanticsFacetForActionAnnotation[type=ActionSemanticsFacet],
>>> class
>>>
>>> org.apache.isis.core.metamodel.facets.actions.action.hidden.HiddenFacetForActionAnnotation=HiddenFacetForActionAnnotation[interaction=Hiding,,when=Always;
>>> where =Everywhere], interface
>>>
>>> org.apache.isis.core.metamodel.facets.object.bookmarkpolicy.BookmarkPolicyFacet=BookmarkPolicyFacetFallback[type=BookmarkPolicyFacet],
>>> interface
>>>
>>> org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet=DescribedAsFacetOnMemberDerivedFromType[type=DescribedAsFacet,""],
>>> interface
>>>
>>> org.apache.isis.core.metamodel.facets.param.choices.ActionChoicesFacet=ActionChoicesFacetNone[type=ActionChoicesFacet]}
>>>
>>> And these are declared by some contributed action (same action as I wrote
>>> up).
>>>
>>> {interface
>>>
>>> org.apache.isis.core.metamodel.facets.actions.defaults.ActionDefaultsFacet=ActionDefaultsFacetNone[type=ActionDefaultsFacet],
>>> interface
>>>
>>> org.apache.isis.core.metamodel.facets.all.named.NamedFacet=NamedFacetTranslated[type=NamedFacet],
>>> interface
>>>
>>> org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionDomainEventFacet=ActionDomainEventFacetForActionAnnotation[interaction=Validating;Disabling;Hiding,type=ActionDomainEventFacet],
>>> interface
>>>
>>> org.apache.isis.core.metamodel.facets.actions.position.ActionPositionFacet=ActionPositionFacetFallback[type=ActionPositionFacet,position=BELOW],
>>> interface
>>>
>>> org.apache.isis.core.runtime.authorization.standard.AuthorizationFacet=AuthorizationFacetImpl[interaction=Disabling;Hiding,type=AuthorizationFacet],
>>> interface
>>>
>>> org.apache.isis.core.metamodel.facets.all.help.HelpFacet=HelpFacetNone[type=HelpFacet,null],
>>> interface
>>>
>>> org.apache.isis.core.metamodel.facets.object.hidden.HiddenObjectFacet=HiddenObjectFacetViaMethod[interaction=Hiding,type=HiddenObjectFacet],
>>> interface
>>>
>>> org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInvocationFacet=ActionInvocationFacetWrapTransaction[type=ActionInvocationFacet]
>>> -->
>>>
>>> ActionInvocationFacetForDomainEventFromActionAnnotation[type=ActionInvocationFacet,method=public
>>> com.xms.framework.api.domain.model.isis.AbstractMultiTenantObject
>>>
>>> com.xms.framework.api.domain.model.isis.AbstractSingletonMultiTenantObjectRepositoryAndFactory.findBySingletonProperty(java.lang.Class,java.lang.String,java.lang.Object)],
>>> interface
>>>
>>> org.apache.isis.core.metamodel.facets.actions.semantics.ActionSemanticsFacet=ActionSemanticsFacetForActionAnnotation[type=ActionSemanticsFacet],
>>> class
>>>
>>> org.apache.isis.core.metamodel.facets.actions.action.hidden.HiddenFacetForActionAnnotation=HiddenFacetForActionAnnotation[interaction=Hiding,,when=Always;
>>> where =Everywhere], interface
>>>
>>> org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet=DescribedAsFacetOnMemberDerivedFromType[type=DescribedAsFacet,""],
>>> interface
>>>
>>> org.apache.isis.core.metamodel.facets.object.bookmarkpolicy.BookmarkPolicyFacet=BookmarkPolicyFacetFallback[type=BookmarkPolicyFacet],
>>> interface
>>>
>>> org.apache.isis.core.metamodel.facets.param.choices.ActionChoicesFacet=ActionChoicesFacetNone[type=ActionChoicesFacet]}
>>>
>>> Only is the difference I wrote you bold.
>>>
>>> The problem is on constructor of ObjectActionContributee
>>> (FacetUtil.copyFacets(serviceAction.getFacetedMethod(), facetHolder);),
>>> because when this method is executed, removes HiddenFacet because is also
>>> repeated on HiddenFacetForActionAnnotation, and we can't get the class
>>> well
>>> for "contributedAction.isAlwaysHidden()", because it can't find
>>> HiddenFacet(instead we can get HiddenFacetForActionAnnotation) from map
>>> defined on FacetHolderImpl.
>>>
>>> The way I see, is that are two ways to fix this.
>>>
>>> - Get custom Hide facet for each type (action, property, collection) in
>>> order to avoid a standard HideFacet on "isAlwaysHidden" method.
>>> - Change copy facets method.
>>>
>>> I did second fix, but I don't know concepts too well and I it's a bit
>>> dirty correction.
>>>
>>> *FacetHolderImpl*
>>>
>>> private void addFacet(final Class<? extends Facet> facetType, final Facet
>>> facet) {
>>>
>>> to
>>>
>>> public void addFacet(final Class<? extends Facet> facetType, final Facet
>>> facet) {
>>>
>>> and add
>>>
>>> public Map<Class<? extends Facet>, Facet> getFacetsByClass() {
>>>      return this.facetsByClass;
>>> }
>>> *
>>> **FacetUtil*
>>>
>>> public static void copyFacets(final FacetHolder source, final FacetHolder
>>> target) {
>>>      List<Facet> facets =
>>> source.getFacets(org.apache.isis.applib.filter.Filters.<Facet>any());
>>>      for (Facet facet : facets) {
>>>          target.addFacet(facet);
>>>      }
>>> }
>>>
>>> to
>>>
>>> public static void copyFacets(final FacetHolder source, final FacetHolder
>>> target) {
>>>      if (FacetHolderImpl.class.isInstance(source) &&
>>> FacetHolderImpl.class.isInstance(target)) {
>>>          for (final Entry<Class<? extends Facet>, Facet> entry :
>>> ((FacetHolderImpl) source).getFacetsByClass().entrySet()) {
>>>              ((FacetHolderImpl) target).addFacet(entry.getKey(),
>>> entry.getValue());
>>>          }
>>>      } else {
>>>          final List<Facet> facets =
>>> source.getFacets(org.apache.isis.applib.filter.Filters.<Facet> any());
>>>          for (final Facet facet : facets) {
>>>              target.addFacet(facet);
>>>          }
>>>      }
>>> }
>>>
>>> Best regards, Nacho.
>>>
>>> --
>>> Ignacio Cánovas Rejón
>>> Tel. 902 900 231
>>> Fax  96 353 19 09
>>> n.canovas@gesconsultor.com
>>> www.gesconsultor.com
>>>
>>> Este mensaje y los ficheros anexos son confidenciales. Los mismos
>>> contienen información reservada que no puede ser difundida. Si usted ha
>>> recibido este correo por error, tenga la amabilidad de eliminarlo de su
>>> sistema y avisar al remitente mediante reenvío a su dirección
>>> electrónica;
>>> no deberá copiar el mensaje ni divulgar su contenido a ninguna persona.
>>>
>>> Su dirección de correo electrónico junto a sus datos personales constan
>>> en
>>> un fichero titularidad de GESDATOS SOFTWARE S.L. cuya finalidad es la de
>>> mantener el contacto con Ud. Si quiere saber de qué información
>>> disponemos
>>> de Ud., modificarla, y en su caso, cancelarla, puede hacerlo enviando un
>>> escrito al efecto, acompañado de una fotocopia de su D.N.I. a la
>>> siguiente
>>> dirección: GESDATOS SOFTWARE S.L. Av. Cortes Valencianas 50-1º-C, C.P.
>>> 46015 de Valencia. Asimismo, es su responsabilidad comprobar que este
>>> mensaje o sus archivos adjuntos no contengan virus informáticos, y en
>>> caso
>>> que los tuvieran eliminarlos.
>>>
>>>
>>>
>>> ---
>>> El software de antivirus Avast ha analizado este correo electrónico en
>>> busca de virus.
>>> http://www.avast.com
>>>
>>>
>
> --
> Ignacio Cánovas Rejón
> Tel. 902 900 231
> Fax  96 353 19 09
> n.canovas@gesconsultor.com
> www.gesconsultor.com
>
> Este mensaje y los ficheros anexos son confidenciales. Los mismos
> contienen información reservada que no puede ser difundida. Si usted ha
> recibido este correo por error, tenga la amabilidad de eliminarlo de su
> sistema y avisar al remitente mediante reenvío a su dirección electrónica;
> no deberá copiar el mensaje ni divulgar su contenido a ninguna persona.
>
> Su dirección de correo electrónico junto a sus datos personales constan en
> un fichero titularidad de GESDATOS SOFTWARE S.L. cuya finalidad es la de
> mantener el contacto con Ud. Si quiere saber de qué información disponemos
> de Ud., modificarla, y en su caso, cancelarla, puede hacerlo enviando un
> escrito al efecto, acompañado de una fotocopia de su D.N.I. a la siguiente
> dirección: GESDATOS SOFTWARE S.L. Av. Cortes Valencianas 50-1º-C, C.P.
> 46015 de Valencia. Asimismo, es su responsabilidad comprobar que este
> mensaje o sus archivos adjuntos no contengan virus informáticos, y en caso
> que los tuvieran eliminarlos.
>
>
>
> ---
> El software de antivirus Avast ha analizado este correo electrónico en
> busca de virus.
> http://www.avast.com
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message