1 回答
TA贡献1790条经验 获得超9个赞
因为我的建议对你有用。让我将评论改写为答案。
不幸的是,无法过滤SAP OData V2 服务端点的扩展实体。回退策略是直接查询实体集合 ( leaf ) 中的“已过滤”项目并运行额外的 OData 请求以遍历到您的原始实体 ( root )。
在您的情况下,我建议直接查询, 以通过AddressIdAddressEmailAddress解析BusinessPartnerAddress。下一步是通过businessPartner字段来解析,例如BusinessPartner
public List<BusinessPartner> getBusinessPartnersByEmail(
@Nonnull BusinessPartnerService service,
@Nonnull String email
)
throws ODataException
{
List<AddressEmailAddress> emailAddresses = service
.getAllAddressEmailAddress()
.filter(AddressEmailAddress.SEARCH_EMAIL_ADDRESS.eq(email))
.execute();
List<BusinessPartnerAddress> addresses = new LinkedList<>();
for( AddressEmailAddress emailAddress : emailAddresses ) {
addresses.addAll(
service
.getAllBusinessPartnerAddress()
.filter(BusinessPartnerAddress.ADDRESS_ID.eq(emailAddress.getAddressID()))
.execute());
}
List<BusinessPartner> businessPartners = new LinkedList<>();
for( BusinessPartnerAddress address : addresses ) {
businessPartners.add(service.getBusinessPartnerByKey(address.getBusinessPartner()).execute());
}
return businessPartners;
}
添加回答
举报