public synchronized XMLNode toXML(boolean export) { XMLNode node = toXML(); if (export && (food.getSource() == Datasources.getUserFoods())) { if (food.getFood() instanceof Recipe) { node.addChild(((Recipe) food.getFood()).toXML(export)); } else { node.addChild(food.getFood().toXML()); } } return node; }
private FoodProxy addToUserFoodsIfMissing(String source, Food f) { FoodDataSource allegedSource = Datasources.getSource(source); if (allegedSource != null) { FoodProxy f2 = allegedSource.getFoodProxy(f.getSourceUID()); if (f2 != null) { if (f2.getFood().equals(f)) { return f2; } } } // TODO: scan all foods for identical matches first! Datasources.getUserFoods().addFood(f); return f.getProxy(); }
public Food getFood() { if (food == null) { return null; } return food.getFood(); }