Publish and change location action

67 views
Skip to first unread message

Heike Franosch

unread,
Dec 22, 2021, 10:01:46 AM12/22/21
to Magnolia User Mailing List
Hi,

I need a chained action to publish deleted content and change afterwards to a certain page.
Something like that:
$type: chainedAction
actions:
  publish:
    $type: jcrCommandAction
    command: publish  
  changeLocation:
    class: com.xxx.ChangeToSpecificLocationActionDefinition
icon: icon-publish

The class ChangeToSpecificLocationAction[Definition] extends ReopenPageAction.
The method execute sets the specific node in the ValueContext:
super.getValueContext().set(node);
super.execute();

In principle it works, but I get an Exception on changing the location:
java.lang.NullPointerException: null  at info.magnolia.pages.app.detail.extension.PageTitleView.lambda$null$0(PageTitleView.java:53) ~[magnolia-pages-app-6.2.12.jar:?]
The PageTitleView seems not to have access to the same ValueContext, the node
within is null.

Is there a way to prevent this exception?
Thanks for any help,
Heike

Roman Kovařík

unread,
Dec 23, 2021, 3:59:57 AM12/23/21
to Magnolia User Mailing List, hfgm...@gmail.com
  Hello,
 
In principle it works, but I get an Exception on changing the location:
java.lang.NullPointerException: null  at info.magnolia.pages.app.detail.extension.PageTitleView.lambda$null$0(PageTitleView.java:53) ~[magnolia-pages-app-6.2.12.jar:?]
The PageTitleView seems not to have access to the same ValueContext, the node
within is null.
 
 Are you sure it's the node which is null? Could you maybe attach a complete stacktrace?
 I can see pageEditorStatus.getPageTitle() can return null if the page is deleted and then toUpperCase() could  throw the NPE.


Is there a way to prevent this exception?
 
You should be able to provide a custom impl of PageTitleView.

Hope that helps
Roman

Heike Franosch

unread,
Dec 23, 2021, 6:42:41 AM12/23/21
to Magnolia User Mailing List, roman....@magnolia-cms.com, Heike Franosch
Hi,

valueContext in PageTitleView is:
ValueContext [current -> null]
That's probably the page I just deleted and not the one he should open instead.

I already thought about a custom PageTitleView, but don't know how to configure it in Magnolia.
Do I just define a decorator for extendsionViews -> title?

Thanks for your help so far :-)
Heike

--
Stacktrace all above filters:
23.12.2021 12:32:43 ERROR info.magnolia.ui.framework.ContextProperty$Impl - http-nio-8080-exec-9 -- Failed to dispatch context property change: null

java.lang.NullPointerException: null
        at info.magnolia.pages.app.detail.extension.PageTitleView.lambda$null$0(PageTitleView.java:53) ~[magnolia-pages-app-6.2.12.jar:?]
        at java.util.Optional.map(Optional.java:215) ~[?:1.8.0_292]
        at info.magnolia.pages.app.detail.extension.PageTitleView.lambda$new$1(PageTitleView.java:53) ~[magnolia-pages-app-6.2.12.jar:?]
        at info.magnolia.ui.ValueContext.lambda$observe$2(ValueContext.java:86) ~[magnolia-ui-framework-6.2.13.jar:?]
        at info.magnolia.ui.framework.ContextProperty$Impl.lambda$observe$5(ContextProperty.java:195) ~[magnolia-ui-framework-6.2.13.jar:?]
        at io.reactivex.internal.subscribers.LambdaSubscriber.onNext(LambdaSubscriber.java:65) ~[rxjava-2.2.18.jar:?]
        at io.reactivex.internal.operators.flowable.FlowableMap$MapSubscriber.onNext(FlowableMap.java:68) ~[rxjava-2.2.18.jar:?]
        at io.reactivex.internal.operators.flowable.FlowableOnBackpressureLatest$BackpressureLatestSubscriber.drain(FlowableOnBackpressureLatest.java:129) ~[rxjava-2.2.18.jar:?]
        at io.reactivex.internal.operators.flowable.FlowableOnBackpressureLatest$BackpressureLatestSubscriber.onNext(FlowableOnBackpressureLatest.java:68) ~[rxjava-2.2.18.jar:?]
        at io.reactivex.internal.operators.flowable.FlowableFromObservable$SubscriberObserver.onNext(FlowableFromObservable.java:54) ~[rxjava-2.2.18.jar:?]
        at io.reactivex.internal.util.NotificationLite.accept(NotificationLite.java:246) ~[rxjava-2.2.18.jar:?]
        at io.reactivex.subjects.BehaviorSubject$BehaviorDisposable.test(BehaviorSubject.java:569) ~[rxjava-2.2.18.jar:?]
        at io.reactivex.subjects.BehaviorSubject$BehaviorDisposable.emitNext(BehaviorSubject.java:564) ~[rxjava-2.2.18.jar:?]
        at io.reactivex.subjects.BehaviorSubject.onNext(BehaviorSubject.java:268) ~[rxjava-2.2.18.jar:?]
        at info.magnolia.ui.framework.ContextProperty$Impl.doSet(ContextProperty.java:250) ~[magnolia-ui-framework-6.2.13.jar:?]
        at info.magnolia.ui.framework.ContextProperty$Impl.set(ContextProperty.java:234) ~[magnolia-ui-framework-6.2.13.jar:?]
        at info.magnolia.ui.framework.ContextProperty$Wrapper.set(ContextProperty.java:127) ~[magnolia-ui-framework-6.2.13.jar:?]
        at info.magnolia.ui.ValueContext.set(ValueContext.java:74) ~[magnolia-ui-framework-6.2.13.jar:?]
        at info.magnolia.ui.ValueContext.set(ValueContext.java:78) ~[magnolia-ui-framework-6.2.13.jar:?]
        at info.magnolia.pages.app.detail.PageEditorStatus.lambda$setSelectedElement$2(PageEditorStatus.java:151) ~[magnolia-pages-app-6.2.12.jar:?]
        at com.machinezoo.noexception.CheckedExceptionHandler.run(CheckedExceptionHandler.java:1709) [noexception-1.4.4.jar:?]
        at info.magnolia.pages.app.detail.PageEditorStatus.setSelectedElement(PageEditorStatus.java:139) [magnolia-pages-app-6.2.12.jar:?]
        at info.magnolia.pages.app.detail.PageEditorPresenter.onElementSelect(PageEditorPresenter.java:180) [magnolia-pages-app-6.2.12.jar:?]
        at info.magnolia.ui.vaadin.editor.PageEditor$1.selectPage(PageEditor.java:64) [magnolia-pages-editor-widget-6.2.12.jar:6.2.12]
        at sun.reflect.GeneratedMethodAccessor639.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_292]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_292]
        at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:155) [vaadin-server-8.14.1.jar:8.14.1]
        at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:116) [vaadin-server-8.14.1.jar:8.14.1]
        at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:442) [vaadin-server-8.14.1.jar:8.14.1]
        at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:407) [vaadin-server-8.14.1.jar:8.14.1]
        at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:275) [vaadin-server-8.14.1.jar:8.14.1]
        at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:91) [vaadin-server-8.14.1.jar:8.14.1]
        at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40) [vaadin-server-8.14.1.jar:8.14.1]
        at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1637) [vaadin-server-8.14.1.jar:8.14.1]
        at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:464) [vaadin-server-8.14.1.jar:8.14.1]
        at info.magnolia.admincentral.AdmincentralServlet.service(AdmincentralServlet.java:119) [magnolia-admincentral-6.2.13.jar:?]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) [servlet-api.jar:4.0.FR]

Roman Kovařík

unread,
Dec 27, 2021, 2:40:05 AM12/27/21
to Magnolia User Mailing List, hfgm...@gmail.com, Roman Kovařík
I already thought about a custom PageTitleView, but don't know how to configure it in Magnolia.
Do I just define a decorator for extendsionViews -> title?

You can do a hotfix or even better define a decorator so you don't have to hotfix manually on every instance.

/my-light-module/decorations/pages-app/apps/pages-app/pages-app.yaml:

subApps:
  detail:
    extensionViews:
     title:
       class: my.custom.PageTitleViewDefinition
 
 Roman

Heike Franosch

unread,
Jan 3, 2022, 4:05:44 AM1/3/22
to Magnolia User Mailing List, roman....@magnolia-cms.com, Heike Franosch
Hi Roman,

thanks, works fine.

You are really doing a great job here :-)
Heike

Reply all
Reply to author
Forward
0 new messages