Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 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();
 }
Esempio n. 3
0
 public Food getFood() {
   if (food == null) {
     return null;
   }
   return food.getFood();
 }