Mule数据编织问题何时出现问题

时间:2016-03-05 03:17:46

标签: mule

在Dataweave转换中需要有关when条件的帮助。我的数据编织变换器在输出java对象中填充电子邮件地址。输入电子邮件地址来自流量变量。我想仅在电子邮件存储在流量变量中时才对输出对象进行水合。

下面是我的代码,如果我尝试添加when条件,则会抛出错误。任何人都可以帮助这个条件逻辑吗?

maintainContactInformationData: {
        effectiveDate: flowVars.currentDate,
        workerContactInformationData: {
            emailAddressData: [{
                emailAddress: flowVars.email ,
                usageData: [{
                    typeData: [{
                        primary: true,
                        typeReference: {
                            ID: [{
                                type: "Communication_Usage_Type_ID",
                                value: "WORK"
                            } as :object {
                                class : "com.workday.hr.CommunicationUsageTypeObjectIDType"
                            }]
                        } as :object {
                            class : "com.workday.hr.CommunicationUsageTypeObjectType"
                        }
                    } as :object {
                        class : "com.workday.hr.CommunicationUsageTypeDataType"
                    }]
                } as :object {
                    class : "com.workday.hr.CommunicationMethodUsageInformationDataType"
                }]  
            } as :object {
                class : "com.workday.hr.EmailAddressInformationDataType"
            }] when flowVars.email != null,

1 个答案:

答案 0 :(得分:1)

如果您希望仅在设置电子邮件变量时将emailAddressData添加到输出中。你应该把它包括在括号中......

(emailAddressData: logic to get) when flowVars.email? And flowVars.email != ""