Nested Bean Mapping

13 views
Skip to first unread message

Jeff Bradley

unread,
May 14, 2021, 1:35:55 PMMay 14
to Smooks Users
I've run into an issue with mapping bean. In the mapping below, the `eqipmentLocation` bean does not get mapped to the property of the `locationInformation` bean, although I have verified it is in the XML and that, if I move the element to a bean higher in the hierarchy, it is mapped (ex. if I move <jb:wiring...> for `eqipmentLocation` to the `shipmentStatus` bean.

Any ideas why `equipmentLocaion` is null after this mapping?

<?xml version="1.0" encoding="UTF-8" ?>
<smooks-resource-list
        xmlns="https://www.smooks.org/xsd/smooks-2.0.xsd"
        xmlns:jb="https://www.smooks.org/xsd/smooks/javabean-1.6.xsd">

    <jb:bean beanId="interchange" class="com.novapath.isd.domain.shipmentdata.Interchange" createOnElement="interchange">
        <jb:value data="authorization-qualifier" property="authorizationQualifier"/>
        <jb:value data="authorization-information" property="authorizationInformation" />
        <jb:value data="security-qualifier" property="securityQualifier" />
        <jb:value data="security-information" property="securityInformation" />
        <jb:value data="sender-qualifier" property="senderQualifier" />
        <jb:value data="sender-id" property="senderId" />
        <jb:value data="receiver-qualifier" property="receiverQualifier" />
        <jb:value data="receiver-id" property="receiverId" />
        <jb:value data="date" property="date" />
        <jb:value data="time" property="time" />
        <jb:value data="repetition-separator" property="repetitionSeparator" />
        <jb:value data="version" property="version" />
        <jb:value data="acknowledgement-requested" property="acknowledgementRequested" />
        <jb:wiring beanIdRef="groups" property="groups" />
    </jb:bean>

    <jb:bean beanId="groups" class="java.util.ArrayList" createOnElement="interchange" retain="true">
        <jb:wiring beanIdRef="group" />
    </jb:bean>

    <jb:bean beanId="group" class="com.novapath.isd.domain.shipmentdata.Group" createOnElement="group">
        <jb:value data="group-code" property="groupCode" />
        <jb:value data="sender-id" property="senderId" />
        <jb:value data="receiver-id" property="receiverId" />
        <jb:value data="date" property="date" />
        <jb:value data="time" property="time" />
        <jb:value data="control-number" property="controlNumber" />
        <jb:value data="agency-code" property="agencyCode" />
        <jb:value data="version" property="version" />
        <jb:wiring beanIdRef="transactionSets" property="shipmentStatuses"/>
    </jb:bean>

    <jb:bean beanId="transactionSets" class="java.util.ArrayList" createOnElement="group" retain="true">
        <jb:wiring beanIdRef="shipmentStatus" />
    </jb:bean>

    <jb:bean beanId="shipmentStatus" class="com.novapath.isd.domain.shipmentdata.ShipmentStatus" createOnElement="shipment-status">
        <jb:value data="identifier-code" property="transactionSetIdentifier" />
        <jb:value data="sequence" property="sequence" />
        <jb:value data="reference-identification" property="referenceIdentification" />
        <jb:value data="shipment-identification-number" property="shipmentIdentificationNumber" />
        <jb:value data="scac" property="scac" />
        <jb:value data="assigned-number" property="assignedNumber" />
        <jb:value data="indicator-code" property="indicatorCode" />
        <jb:value data="reason-code-1" property="reasonCode1" />
        <jb:value data="status-code" property="statusCode" />
        <jb:value data="reason-code-2" property="reasonCode2" />
        <jb:value data="date" property="date" decoder="Date" >
            <jb:decodeParam name="format">yyyyMMdd</jb:decodeParam>
        </jb:value>
        <jb:value data="time" property="time" />
        <jb:value data="time-code" property="timeCode" />
        <jb:value data="weight-qualifier" property="weightQualifier" />
        <jb:value data="weight-unit-code" property="weightUnitCode" />
        <jb:value data="weight" property="weight" decoder="Double" />
        <jb:value data="lading-quantity" property="ladingQuantity" decoder="Double" />
        <jb:wiring beanIdRef="referenceNumbers" property="referenceNumbers" />
        <jb:wiring beanIdRef="locationInformationList" property="locationInformation" />
    </jb:bean>

    <jb:bean beanId="referenceNumbers" class="java.util.ArrayList" createOnElement="shipment-status" retain="true">
        <jb:wiring beanIdRef="referenceNumber" />
    </jb:bean>

    <jb:bean beanId="referenceNumber" class="com.novapath.isd.domain.shipmentdata.ReferenceInformation" createOnElement="reference-number">
        <jb:value data="reference-identification" property="referenceIdentification" />
        <jb:value data="reference-qualifier" property="referenceQualifier" />
    </jb:bean>

    <jb:bean beanId="locationInformationList" class="java.util.ArrayList" createOnElement="location-information" retain="true">
        <jb:wiring beanIdRef="locationInformation" />
    </jb:bean>

    <jb:bean beanId="locationInformation" class="com.novapath.isd.domain.shipmentdata.LocationInformation" createOnElement="party-identification">
        <jb:value data="entity-identifier-code" property="entityIdentifierCode"/>
        <jb:value data="name" property="name" />
        <jb:value data="address-information" property="addressLine1" />
        <jb:value data="city" property="city" />
        <jb:value data="state" property="state" />
        <jb:value data="postal-code" property="postalCode" /><jb:wiring beanIdRef="equipmentLocation" property="equipmentLocation" />

    </jb:bean>

    <jb:bean beanId="equipmentLocation" class="com.novapath.isd.domain.shipmentdata.EquipmentLocation" createOnElement="equipment-location">
        <jb:value data="city" property="city" />
        <jb:value data="state" property="state" />
        <jb:value data="postal-code" property="postalCode" />
        <jb:value data="country" property="country" />
    </jb:bean>

</smooks-resource-list>

Reply all
Reply to author
Forward
0 new messages