Hello,
They was no problem with map processor, we can convert it to a service
call with the same result.
Example currently on party we have :
<simple-method short-description="Create Contact"
method-name="createContact">...
<call-map-processor processor-name="person"
in-map-name="parameters" out-map-name="personCtx"
xml-resource="component://party/minilang/party/PartyMapProcs.xml"/>
<call-service service-name="createPerson" in-map-name="personCtx">
and
<simple-map-processor name="person">
<process field="firstName">
<copy/>
<not-empty>
<fail-property resource="PartyUiLabels"
property="PartyFirstNameMissing"/>
</not-empty>
</process>
<process field="lastName">
<copy/>
<not-empty>
<fail-property resource="PartyUiLabels"
property="PartyLastNameMissingError"/>
</not-empty>
</process>
</simple-map-processor>
We can convert it to :
<service name="processMapInterface" ...>
<attribute name="inputMap" type="java.util.Map" mode="IN"/>
<attribute name="outputMap" type="java.util.Map" mode="OUT"/>
</service>
<service name="processMapPerson" engine="simple" auth="false"
location="groovy://pathTo/PartyProcessMap.groovy"
invoke="person">
<implements service="processMapInterface"/>
</service>
groovy map processor:
def person {
Map result = success()
Map outputMap = [:]
if (! inputMap) return error(label from: 'PartyUiLabels' text:
'PartyValuesMissingError')
if (inputMap.lastName) outputMap.lastName = inputMap.lastName
else return error(label from: 'PartyUiLabels' text:
'PartyLastNameMissingError')
result.outputMap = outputMap
return result
}
groovy origin service:
Map personCtxResult = run service: 'processMapPerson' with:
[inputMap: parameters]
run service: 'createPerson' with: personCtxResult.outMap
But if the code is too long we can simplify by DSL (as draft idea):
groovy map processor:
def person {
map name: person
map copy: lastName failed: label('PartyUiLabels',
'PartyLastNameMissingError')
map copy: firstName to: name
person.toName = "${lastName}. ${firstName}."
return map close
}
groovy origin service:
Map personCtx = map process: processMapPerson with: parameters
run service: 'createPerson' with: persontCtx
Nicolas
On 07/02/2018 09:35, Rishi Solanki wrote:
Jacques,
As far as I remember when you raised this in past, and no proposal on how
to replace it.
As simple map processor is used for mapping and validation, So I think we
should take a pause on it and let the remaining minilang to groovy complete.
>From my side having simple map processor in minilang (we could also use
XML) should be fine for now. And we can discuss/think/propose on the
alternative ways of doing the same once solution is in place and we agree,
then we can decide weather to remove old way or keep it.
I see similar approach in other projects and they keep supporting both ways
to invoke validation methods for a while.
Best,
Rishi Solanki
Sr Manager, Enterprise Software Development
HotWax Systems Pvt. Ltd.
Direct: +91-9893287847
http://www.hotwaxsystems.com
www.hotwax.co
On Wed, Feb 7, 2018 at 2:57 AM, Jacques Le Roux <
[email protected]> wrote:
Hi,
I recently see some activity to replace the minilang by Groovy and that's
great.
There is though a question I asked 2 times[1][2] without any answers. It's
about the Simple Map Processor Mini-Language:
https://cwiki.apache.org/confluence/pages/viewpage.action?
pageId=50233697#Mini-LanguageGuide(Version1-Deprecated)-TheS
impleMapProcessorMini-Language
Shall we keep it as is or replace it, and then by what? Is there already a
plan for that? I saw none I'm not wrong.
[1] http://markmail.org/message/z63ff7s7hgm4rb3e
[2] https://s.apache.org/Nm9B
Jacques