return baseXMLPlanNestedWithLookupChoice("lookup('stock.items', 'itemNum', 'itemName', xmltest.orders.orderStatus) = 'processing'", critNode); //$NON-NLS-1$
}
private static MappingDocument baseXMLPlanNestedWithLookupChoice(String criteria, MappingCriteriaNode defaultNode) {
MappingDocument doc = new MappingDocument(true);
MappingElement root = doc.addChildElement(new MappingElement("Catalogs")); //$NON-NLS-1$
MappingSequenceNode seq1 = root.addSequenceNode(new MappingSequenceNode());
MappingElement cats = seq1.addChildElement(new MappingElement("Catalog")); //$NON-NLS-1$
MappingElement items = cats.addChildElement(new MappingElement("Items")); //$NON-NLS-1$
MappingSequenceNode seq2 = items.addSequenceNode(new MappingSequenceNode());
MappingElement item = seq2.addChildElement(new MappingElement("Item")); //$NON-NLS-1$
item.setSource("xmltest.group.items"); //$NON-NLS-1$
item.setMaxOccurrs(-1);
item.addAttribute(new MappingAttribute("ItemID", "xmltest.group.items.itemNum")); //$NON-NLS-1$ //$NON-NLS-2$
MappingSequenceNode seq3 = item.addSequenceNode(new MappingSequenceNode());
seq3.addChildElement(new MappingElement("Name", "xmltest.group.items.itemName")); //$NON-NLS-1$ //$NON-NLS-2$
seq3.addChildElement(new MappingElement("Quantity", "xmltest.group.items.itemQuantity")); //$NON-NLS-1$ //$NON-NLS-2$
//NESTED STUFF======================================================================
MappingElement suppliers = seq3.addChildElement(new MappingElement("Suppliers")); //$NON-NLS-1$
MappingSequenceNode seq4 = suppliers.addSequenceNode(new MappingSequenceNode());
MappingElement supplier = seq4.addChildElement(new MappingElement("Supplier")); //$NON-NLS-1$
supplier.setSource("xmltest.suppliers"); //$NON-NLS-1$
supplier.setMaxOccurrs(-1);
supplier.addAttribute(new MappingAttribute("SupplierID", "xmltest.suppliers.supplierNum")); //$NON-NLS-1$ //$NON-NLS-2$
MappingSequenceNode seq5 = supplier.addSequenceNode(new MappingSequenceNode());
seq5.addChildElement(new MappingElement("Name","xmltest.suppliers.supplierName")); //$NON-NLS-1$ //$NON-NLS-2$
seq5.addChildElement(new MappingElement("Zip", "xmltest.suppliers.supplierZipCode")); //$NON-NLS-1$ //$NON-NLS-2$
MappingElement ordersWrapper = seq5.addChildElement(new MappingElement("ProcessingOrders")); //$NON-NLS-1$
MappingChoiceNode choice = ordersWrapper.addChoiceNode(new MappingChoiceNode(false));
choice.setSource("xmltest.orders"); //$NON-NLS-1$
choice.setMaxOccurrs(-1);
MappingCriteriaNode crit = choice.addCriteriaNode(new MappingCriteriaNode(criteria, false));
MappingElement order = crit.addChildElement(new MappingElement("Order")); //$NON-NLS-1$
order.addAttribute(new MappingAttribute("OrderID", "xmltest.orders.orderNum")); //$NON-NLS-1$ //$NON-NLS-2$
MappingSequenceNode seq6 = order.addSequenceNode(new MappingSequenceNode());
seq6.addChildElement(new MappingElement("OrderDate", "xmltest.orders.orderDate")); //$NON-NLS-1$ //$NON-NLS-2$
seq6.addChildElement(new MappingElement("OrderQuantity", "xmltest.orders.orderQty")); //$NON-NLS-1$ //$NON-NLS-2$
choice.addCriteriaNode(defaultNode);
//NESTED STUFF======================================================================
return doc;
}