Can anyone add to this module to make it a custom edit ?

It is currently a custom edit as it sits in my build but I cannot get the 
activate handler to execute.

And blue in the face

@At("/{0}/{1}/edit")
public class MyDomainObjectEdit
{
    @Inject
    private ContextValueEncoder contextValueEncoder;

    @Inject
    private Messages messages;

    @Inject
    private PersistenceService persistenceService;

    @Inject
    private DescriptorService descriptorService;

    @Inject
    private PageRenderLinkSource pageRenderLinkSource;

    @Property(write = false)
    private Class beanType = MyDomainObject.class;

    @Property
    private Object bean;

    @OnEvent(EventConstants.ACTIVATE)
    Object activate(Class clazz, String id)
    {

        if (clazz == null)
            return Utils.new404(messages);

        this.bean = contextValueEncoder.toValue(clazz, id);
        this.beanType = clazz;

        if (bean == null)
            return Utils.new404(messages);

        return null;
    }

    @CleanupRender
    void cleanup()
    {
        bean = null;
        beanType = null;
    }

    /**
     * This tells Tapestry to put type & id into the URL, making it
     * bookmarkable.
     */
    @OnEvent(EventConstants.PASSIVATE)
    Object[] passivate()
    {
        return new Object[]
        { beanType, bean };
    }

    @Log
    @CommitAfter
    @OnEvent(EventConstants.SUCCESS)
    Link success()
    {
        persistenceService.save(bean);
        return back();
    }

    @OnEvent("cancel")
    Link back()
    {
        return pageRenderLinkSource.createPageRenderLinkWithContext(Show.class, 
beanType, bean);
    }

    public String getListAllLinkMessage()
    {
        return TynamoMessages.listAll(messages, beanType);
    }

    public String getTitle()
    {
        return TynamoMessages.edit(messages, beanType);
    }

}

                                          

Reply via email to