On 7 December 2014 at 11:19, GESCONSULTOR - Óscar Bou <
[email protected]> wrote:
> Hi to all.
>
> Is there a way to hide an object service programmatically (i.e., using a
> hide() method) ?
>
> The only way I know is the @Hidden annotation.
>
>
There isn't currently any built-in method for this, no. You can find this
out by looking for facets that implement HidingInteractionAdvisor.
But on way the requirement can be supported is using the event bus, eg
adding this to the SimpleObjects service will hide the service (because all
of its actions are hidden):
@Programmatic
@PostConstruct
public void postConstruct() {
eventBusService.register(this);
}
@Programmatic
@Subscribe
public void on(final ActionInteractionEvent<?> ev) {
switch(ev.getPhase()) {
case HIDE:
if(SimpleObjects.class.isAssignableFrom(ev.getSource().getClass())) {
ev.hide();
}
break;
}
}
@javax.inject.Inject
private EventBusService eventBusService;
Given we have such flexible support, I'm not certain we need any additional
special supporting methods. What do you think?
HTH
Dan
> Same way, both them could be disabled (on Services it would mean all
> actions would be disabled).
>
> And also, for objects they could be programmatically validated.
>
> It could be also useful for per-instance security.
>
>
> Is it currently available?
> If not, could it be a good idea to create a facet for hide(), disable(),
> validate() methods ?
>
> Thanks,
>
> Oscar
>
>
>
>