Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to improve Value Mapping Library with a massive download of items? #114

Open
bdbais opened this issue Dec 10, 2024 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@bdbais
Copy link

bdbais commented Dec 10, 2024

I'm taking all value mapping information to send them like a csv with an iFlow and I notice there'snt an api/library/function to do that easly. I've workaround it directly in xslt with xml file downloaded from value mapping artifact, but it's an absurd way :)

We can use an API call without sourceValue (or a special character like asterisk or keyword 'all') to receive a list of [ {sourceAgency,key,value},... ]

example in xslt:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text" encoding="UTF-8"/>

    <xsl:template match="/">
        <xsl:text>AgencySource,SourceValue,AgencyTarget,TargetValue&#10;</xsl:text>
        <xsl:for-each select="//group">
            <xsl:value-of select="entry[1]/agency"/><xsl:text>,</xsl:text>
            <xsl:value-of select="entry[1]/value"/><xsl:text>,</xsl:text>
            <xsl:value-of select="entry[2]/agency"/><xsl:text>,</xsl:text>
            <xsl:value-of select="entry[2]/value"/><xsl:text>&#10;</xsl:text>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>

source data format (directly from value mapping artifact):

<?xml version="1.0" encoding="UTF-8"?>
<vm version="2.0">
    <group id="00266d1e9c4c4555b4feec25ad1cbc44">
        <entry>
            <agency>PayPolicyAgencySource</agency>
            <schema>PayPolicyIdentifierSource</schema>
            <value>HRLYCA</value>
        </entry>
        <entry>
            <agency>PayPolicyAgencyTarget</agency>
            <schema>PayPolicyIdentifierTarget</schema>
            <value>HOURLY-CA</value>
        </entry>
    </group>
    <group id="85f502e663794d27a944e0f8a8cbb00b">
        <entry>
            <agency>PayPolicyAgencySource</agency>
            <schema>PayPolicyIdentifierSource</schema>
            <value>HRLYCN</value>
        </entry>
        <entry>
            <agency>PayPolicyAgencyTarget</agency>
            <schema>PayPolicyIdentifierTarget</schema>
            <value>HOURLY-CANADA</value>
        </entry>
    </group>
    <group id="be4b9e64224d473fa1e75516c9c2bb4f">
        <entry>
            <agency>PayPolicyAgencySource</agency>
            <schema>PayPolicyIdentifierSource</schema>
            <value>HRLYCO</value>
        </entry>
        <entry>
            <agency>PayPolicyAgencyTarget</agency>
            <schema>PayPolicyIdentifierTarget</schema>
            <value>HOURLY-CO</value>
        </entry>
    </group>
</vm>

result:

AgencySource,SourceValue,AgencyTarget,TargetValue
PayPolicyAgencySource,HRLYCA,PayPolicyAgencyTarget,HOURLY-CA
PayPolicyAgencySource,HRLYCN,PayPolicyAgencyTarget,HOURLY-CANADA
PayPolicyAgencySource,HRLYCO,PayPolicyAgencyTarget,HOURLY-CO
PayPolicyAgencySource,HRLSD05,PayPolicyAgencyTarget,HOURLY-SD0.50

I'd like to do the same in groovy with :

def value = valueMapApi.getMappedValue(mapping.sourceAgency, mapping.sourceIdentifier, mapping.sourceValue, mapping.targetAgency, mapping.targetIdentifier)

to

def values = valueMapApi.getMappedAllValues(MappingArtifactName,[sourceAgency[SourceIdentifier]])

[sourceAgency[SourceIdentifier]] are optionals.

values.each{
output += "${mapping.sourceAgency},${mapping.sourceValue},${mapping.targetValue}}"
}

@bdbais bdbais added the enhancement New feature or request label Dec 10, 2024
@bertrandhenkel
Copy link

Hello,

thank you for this valuable input. We will have a deeper look at it and might consider it as Community Content.
BR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants