Hi,

I want to cut down the complexity of what I am displaying and had an idea
that I could create an aggregate class and allow the user to click on links
within that class to go to separate pages for editing specific child
classes.

So for example I have a StreetAddress and MailAddress classes, and the
title of these is the contcatenation of the standard 4 fields in an
address. I actually have and Update Street Address and Update Mail Address
actions (buttons), so you don't have to go to a separate page.

So that worked, and thinking to extend the idea for more complex classes, I
did something similar, but in this case I do want to go to the page
rendering of that child object, but I get an error now.

Caused by:
org.apache.isis.core.metamodel.spec.feature.ObjectMember$AuthorizationException:
Not authorized or no such object
    at
org.apache.isis.viewer.wicket.ui.pages.entity.EntityPage.<init>(EntityPage.java:125)
    at
org.apache.isis.viewer.wicket.ui.pages.entity.EntityPage.<init>(EntityPage.java:71)
    at
org.apache.isis.viewer.wicket.ui.pages.entity.EntityPage.<init>(EntityPage.java:83)
    at
org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponseType.toEntityPage(ActionResultResponseType.java:142)
    at
org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponseType.access$200(ActionResultResponseType.java:41)
    at
org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponseType$1.interpretResult(ActionResultResponseType.java:46)
    at
org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponseType.determineAndInterpretResult(ActionResultResponseType.java:154)
    at
org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.executeActionOnTargetAndProcessResults(ActionPanel.java:251)
    at
org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.executeActionAndProcessResults(ActionPanel.java:193)
    at
org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.buildGui(ActionPanel.java:104)
    at
org.apache.isis.viewer.wicket.ui.components.actions.ActionPanel.<init>(ActionPanel.java:82)
    at
org.apache.isis.viewer.wicket.ui.components.actions.ActionPanelFactory.createComponent(ActionPanelFactory.java:49)
    at
org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault.createComponent(ComponentFactoryRegistryDefault.java:128)
    at
org.apache.isis.viewer.wicket.ui.components.widgets.linkandlabel.ActionLinkFactoryAbstract$1.onClick(ActionLinkFactoryAbstract.java:77)
    at
org.apache.wicket.ajax.markup.html.AjaxLink$1.onEvent(AjaxLink.java:86)
    at
org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:124)
    at
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:633)
    ... 43 more

The action that triggers this is as follows.

    @MemberOrder(sequence = "11")
    @Action(semantics = SemanticsOf.IDEMPOTENT)
    public SocialFactors updateSocialFactors() {
        if (socialFactors == null) {
            socialFactors =
container.newTransientInstance(SocialFactors.class);
            socialFactors.participant = this;
            container.persist(socialFactors);
            System.out.print("SF: " + socialFactors.title());
        }
        return socialFactors;
    }

And the SocialFactors class is presently trivial.

package au.com.scds.chats.dom.modules.participant;

import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.VersionStrategy;

import org.apache.isis.applib.DomainObjectContainer;
import org.apache.isis.applib.annotation.BookmarkPolicy;
import org.apache.isis.applib.annotation.DomainObject;
import org.apache.isis.applib.annotation.DomainObjectLayout;

@javax.jdo.annotations.PersistenceCapable(identityType =
IdentityType.DATASTORE)
@javax.jdo.annotations.DatastoreIdentity(strategy =
javax.jdo.annotations.IdGeneratorStrategy.IDENTITY, column = "id")
@javax.jdo.annotations.Version(strategy = VersionStrategy.VERSION_NUMBER,
column = "version")
@DomainObject(objectType = "SOCIAL-FACTORS")
@DomainObjectLayout(bookmarking = BookmarkPolicy.AS_ROOT)
public class SocialFactors {

    Participant participant;

    public String title() {
        return participant.getFullname();
    }


    // {{ injected dependencies
    @javax.inject.Inject
    @SuppressWarnings("unused")
    private DomainObjectContainer container;
    // }}

}

Maybe its the backreference that I want for the parent Participant? This is
so I can display the title of the Participant on its SocialFactors child's
page as part of its title.

Maybe I am trying too hard to hide view complexity in the absence of tabbed
panels?

I image that SocialFactors will contain a few collections, these could be
part of the Participant without having a SocialFactors child.

Maybe I need to use a ViewModel? I will look at that tomorrow.

I'll push this into to Github if anyone is interested to take a look.

https://github.com/Stephen-Cameron-Data-Services/isis-chats

Reply via email to