You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Nicolas Malin (Jira)" <ji...@apache.org> on 2022/06/17 13:14:00 UTC

[jira] [Updated] (OFBIZ-12652) Define return user message from controller or context

     [ https://issues.apache.org/jira/browse/OFBIZ-12652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nicolas Malin updated OFBIZ-12652:
----------------------------------
    Attachment: OFBIZ-12652.patch

> Define return user message from controller or context
> -----------------------------------------------------
>
>                 Key: OFBIZ-12652
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-12652
>             Project: OFBiz
>          Issue Type: New Feature
>          Components: framework/webapp
>    Affects Versions: 22.01.01, Upcoming Branch
>            Reporter: Nicolas Malin
>            Assignee: Nicolas Malin
>            Priority: Major
>              Labels: event, message, user-experience
>         Attachments: OFBIZ-12652.patch
>
>
> Currently when you wish return a message to a user after an event request, you need to set it ine the called event.
> for a service in java :
>  
> {code:java}
>   ServiceUtil.returnSuccess("Your service is a success"){code}
>  
>  
> for a service in groovy :
>  
> {code:java}
>   return success("Your service is a success"){code}
>  
>  
> for a Java class :
>  
> {code:java}
>  request.setAttribute("_EVENT_MESSAGE_", "Your service is a success");{code}
>  
>  
> If during an integration, you want to use standard service like createProduct, createPartyRelationship, and need a specific message for users, you need to define you own service.
> For escape this case and increase the service reusability, I propose to implement a new systeme to override the event return by a definition depending the buisness context.
> For that two improvement :
>  # Add new child element to reques-map->response on the controller
>  ## With given the exact value
> {code:java}
> <response name="success" type="request" value="json">              <return-user-message value="Your service is a success"/>
> </response> {code}
>  ## With a flexible expander
> {code:java}
> <response name="success" type="request" value="json">              <return-user-message value="Your service to change is a success"/>
> </response>
> {code}
>  ## With a property
> {code:java}
> <response name="success" type="request" value="json">              <return-user-message ressource="CommonUiLabels" value="CommonSuccessfullyCreated"/>
> </response>
> {code}
>  ## From a context field
> {code:java}
> <response name="success" type="request" value="json">              <return-user-message from-field="mySpecificReturnMessage"/>
> </response>
> {code}
>  # From the context directly sent from the form 
> {code:java}
>  <form name="CallEvent" target="MyEvent" .. >
>      <field name="_CUSTOM_EVENT_MESSAGE_"> <hidden value="Your service to change is a success"/>
>      <field name="_CUSTOM_ERROR_MESSAGE_"> <hidden value="Your service failed"/>{code}
>  
> related thread on dev : https://lists.apache.org/thread/bv46xndbny6phfxycbmbmxs4t2n7jr28



--
This message was sent by Atlassian Jira
(v8.20.7#820007)