You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@deltaspike.apache.org by "l.penet@senat.fr" <l....@senat.fr> on 2015/05/19 14:21:53 UTC

Inheritance of static view config

Dear all,

I have some webapps sharing some elements of navigation. They also share 
the same login system, and are configured in SSO.

I tried to mutualise the views defintion using static view config and 
ended with the following, not so pleasant result :


base, common class :

@Folder(name="/")
@View(navigation = View.NavigationMode.REDIRECT, viewParams = 
View.ViewParameterMode.INCLUDE)
public interface PagesCommon extends ViewConfig {
     class Accueil implements PagesCommon { }
     class Login implements PagesCommon { }
}


In a sample webapp :

public interface Pages extends PagesCommon {
     @View(basePath = "/")
     class Organigramme implements Pages { }
     @View(basePath = "/")
     class Personne implements Pages { }
     @View(name = "tous_les_droits", basePath = "/")
     class TousLesDroits implements Pages { }
}

I could not use a syntax such as

@Folder(name="/")
public interface Pages extends PagesCommon {
     class Organigramme implements Pages { }
     class Personne implements Pages { }
     @View(name = "tous_les_droits")
     class TousLesDroits implements Pages { }
}

I get an error then because Pages and PagesCommon try to configure the 
same directory.

Did I miss something or should I fill a feature request ?

Thanks in advance,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|


Re: Inheritance of static view config

Posted by Gerhard Petracek <ge...@gmail.com>.
hi ludovic,

fyi:
you can configure your own implementation of
  org.apache.deltaspike.jsf.api.config.view.Folder$NameBuilder
globally to implement your own rules/conventions/... (or just to adjust the
result of DefaultFolderNameBuilder)
-> you don't have to wait for such an improvement.

regards,
gerhard



2015-05-20 11:18 GMT+02:00 l.penet@senat.fr <l....@senat.fr>:

> On 20/05/2015 11:13, Gerhard Petracek wrote:
>
>> hi ludovic,
>>
>> inheriting folder names that way would break other use-cases and it's also
>> against the overall concept
>> (+ it can lead to more complex path-configs easily as well as to potential
>> clashes in case of multiple interfaces which contain meta-data for the
>> path-name,...).
>>
>> i just used that annotation for the discussion (to be sure that we are
>> talking about the same).
>>
>> we could extend @ViewConfigRoot to support e.g.:
>> @ViewConfigRoot(virtual = true)
>> public interface Pages extends PagesCommon {
>>     //...
>> }
>> for sure that would only work for the root-node.
>> however, all options i've seen so far are more complex than just using
>> @Folder(name="/") (or they would break other use-cases).
>>
> You get the idea.
>
> I think too that it should be usable for any folder.
>
> I will gladly test a new feature if you come to implement it. ;-)
>
>
> Ludovic
> |
> | AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
> |
>
>

Re: Inheritance of static view config

Posted by "l.penet@senat.fr" <l....@senat.fr>.
On 20/05/2015 11:13, Gerhard Petracek wrote:
> hi ludovic,
>
> inheriting folder names that way would break other use-cases and it's also
> against the overall concept
> (+ it can lead to more complex path-configs easily as well as to potential
> clashes in case of multiple interfaces which contain meta-data for the
> path-name,...).
>
> i just used that annotation for the discussion (to be sure that we are
> talking about the same).
>
> we could extend @ViewConfigRoot to support e.g.:
> @ViewConfigRoot(virtual = true)
> public interface Pages extends PagesCommon {
>     //...
> }
> for sure that would only work for the root-node.
> however, all options i've seen so far are more complex than just using
> @Folder(name="/") (or they would break other use-cases).
You get the idea.

I think too that it should be usable for any folder.

I will gladly test a new feature if you come to implement it. ;-)

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|


Re: Inheritance of static view config

Posted by Gerhard Petracek <ge...@gmail.com>.
hi ludovic,

inheriting folder names that way would break other use-cases and it's also
against the overall concept
(+ it can lead to more complex path-configs easily as well as to potential
clashes in case of multiple interfaces which contain meta-data for the
path-name,...).

i just used that annotation for the discussion (to be sure that we are
talking about the same).

we could extend @ViewConfigRoot to support e.g.:
@ViewConfigRoot(virtual = true)
public interface Pages extends PagesCommon {
   //...
}
for sure that would only work for the root-node.
however, all options i've seen so far are more complex than just using
@Folder(name="/") (or they would break other use-cases).

regards,
gerhard



2015-05-20 10:14 GMT+02:00 l.penet@senat.fr <l....@senat.fr>:

> On 19/05/2015 19:32, Gerhard Petracek wrote:
>
>> hi ludovic,
>>
>> what you are asking for would mean something like:
>>
>> @VirtualNode //instead of @Folder(name="/")
>> public interface Pages extends PagesCommon {
>>    //...
>> }
>>
>> so that you have an interface which contains all view-configs, but it gets
>> skipped when it comes to path names.
>>
> Yes.
>
> Or, maybe, rather than adding an annotation, take in account inheritance
> when processing @Folder.
> If class A inherits class B and they both address the same folder, it
> could be ok.
>
>
> Ludovic
> |
> | AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
> |
>
>

Re: Inheritance of static view config

Posted by "l.penet@senat.fr" <l....@senat.fr>.
On 19/05/2015 19:32, Gerhard Petracek wrote:
> hi ludovic,
>
> what you are asking for would mean something like:
>
> @VirtualNode //instead of @Folder(name="/")
> public interface Pages extends PagesCommon {
>    //...
> }
>
> so that you have an interface which contains all view-configs, but it gets
> skipped when it comes to path names.
Yes.

Or, maybe, rather than adding an annotation, take in account inheritance 
when processing @Folder.
If class A inherits class B and they both address the same folder, it 
could be ok.

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|


Re: Inheritance of static view config

Posted by Gerhard Petracek <ge...@gmail.com>.
hi ludovic,

what you are asking for would mean something like:

@VirtualNode //instead of @Folder(name="/")
public interface Pages extends PagesCommon {
  //...
}

so that you have an interface which contains all view-configs, but it gets
skipped when it comes to path names.

regards,
gerhard



2015-05-19 18:58 GMT+02:00 l.penet@senat.fr <l....@senat.fr>:

> On 19/05/2015 17:21, Gerhard Petracek wrote:
>
>> hi ludovic,
>>
>> it sounds like you are using an ear-file which bundles multiple webapps.
>> please provide a bit more details, if you are talking about a different
>> constellation.
>>
> It could have been a solution, but it is not.
>
> I ship one war per app.
>
> I have a base PagesCommon class in a base package.
> This package is a jar dependency of the webapp.
> Pages class is directly in the webapp.
>
> Thanks,
>
>
> Ludovic
> |
> | AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
> |
>
>

Re: Inheritance of static view config

Posted by "l.penet@senat.fr" <l....@senat.fr>.
On 19/05/2015 17:21, Gerhard Petracek wrote:
> hi ludovic,
>
> it sounds like you are using an ear-file which bundles multiple webapps.
> please provide a bit more details, if you are talking about a different
> constellation.
It could have been a solution, but it is not.

I ship one war per app.

I have a base PagesCommon class in a base package.
This package is a jar dependency of the webapp.
Pages class is directly in the webapp.

Thanks,

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|


Re: Inheritance of static view config

Posted by Gerhard Petracek <ge...@gmail.com>.
hi ludovic,

it sounds like you are using an ear-file which bundles multiple webapps.
please provide a bit more details, if you are talking about a different
constellation.

regards,
gerhard



2015-05-19 14:21 GMT+02:00 l.penet@senat.fr <l....@senat.fr>:

> Dear all,
>
> I have some webapps sharing some elements of navigation. They also share
> the same login system, and are configured in SSO.
>
> I tried to mutualise the views defintion using static view config and
> ended with the following, not so pleasant result :
>
>
> base, common class :
>
> @Folder(name="/")
> @View(navigation = View.NavigationMode.REDIRECT, viewParams =
> View.ViewParameterMode.INCLUDE)
> public interface PagesCommon extends ViewConfig {
>     class Accueil implements PagesCommon { }
>     class Login implements PagesCommon { }
> }
>
>
> In a sample webapp :
>
> public interface Pages extends PagesCommon {
>     @View(basePath = "/")
>     class Organigramme implements Pages { }
>     @View(basePath = "/")
>     class Personne implements Pages { }
>     @View(name = "tous_les_droits", basePath = "/")
>     class TousLesDroits implements Pages { }
> }
>
> I could not use a syntax such as
>
> @Folder(name="/")
> public interface Pages extends PagesCommon {
>     class Organigramme implements Pages { }
>     class Personne implements Pages { }
>     @View(name = "tous_les_droits")
>     class TousLesDroits implements Pages { }
> }
>
> I get an error then because Pages and PagesCommon try to configure the
> same directory.
>
> Did I miss something or should I fill a feature request ?
>
> Thanks in advance,
>
> Ludovic
> |
> | AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
> |
>
>