forked from openfoodfacts/openfoodfacts-androidapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes Issue openfoodfacts#2069: downloaded offline_product_data zip f…
…ile and stored in the database.
- Loading branch information
1 parent
d5dbe07
commit 5b2d6a1
Showing
5 changed files
with
407 additions
and
2 deletions.
There are no files selected for viewing
98 changes: 98 additions & 0 deletions
98
app/src/main/java/openfoodfacts/github/scrachx/openfood/models/OfflineProduct.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package openfoodfacts.github.scrachx.openfood.models; | ||
|
||
import com.opencsv.bean.CsvBindByName; | ||
|
||
import org.greenrobot.greendao.annotation.Entity; | ||
import org.greenrobot.greendao.annotation.Generated; | ||
import org.greenrobot.greendao.annotation.Id; | ||
import org.greenrobot.greendao.annotation.Index; | ||
|
||
@Entity(indexes = { | ||
@Index(value = "barcode", unique = true) | ||
}) | ||
public class OfflineProduct { | ||
|
||
@Id | ||
private Long id; | ||
@CsvBindByName(column = "product_name") | ||
private String title; | ||
@CsvBindByName(column = "brands") | ||
private String brands; | ||
@CsvBindByName(column = "code") | ||
private String barcode; | ||
@CsvBindByName(column = "quantity") | ||
private String quantity; | ||
@CsvBindByName(column = "nutrition_grade_fr") | ||
private String nutritionGrade; | ||
|
||
public OfflineProduct(String title, String brands, String barcode, String quantity, String nutritionGrade) { | ||
this.title = title; | ||
this.brands = brands; | ||
this.barcode = barcode; | ||
this.quantity = quantity; | ||
this.nutritionGrade = nutritionGrade; | ||
} | ||
|
||
@Generated(hash = 524339296) | ||
public OfflineProduct(Long id, String title, String brands, String barcode, String quantity, | ||
String nutritionGrade) { | ||
this.id = id; | ||
this.title = title; | ||
this.brands = brands; | ||
this.barcode = barcode; | ||
this.quantity = quantity; | ||
this.nutritionGrade = nutritionGrade; | ||
} | ||
|
||
@Generated(hash = 1425505421) | ||
public OfflineProduct() { | ||
} | ||
|
||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
public void setTitle(String title) { | ||
this.title = title; | ||
} | ||
|
||
public String getBrands() { | ||
return brands; | ||
} | ||
|
||
public void setBrands(String brands) { | ||
this.brands = brands; | ||
} | ||
|
||
public String getBarcode() { | ||
return barcode; | ||
} | ||
|
||
public void setBarcode(String barcode) { | ||
this.barcode = barcode; | ||
} | ||
|
||
public Long getId() { | ||
return this.id; | ||
} | ||
|
||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
public String getQuantity() { | ||
return quantity; | ||
} | ||
|
||
public void setQuantity(String quantity) { | ||
this.quantity = quantity; | ||
} | ||
|
||
public String getNutritionGrade() { | ||
return nutritionGrade; | ||
} | ||
|
||
public void setNutritionGrade(String nutritionGrade) { | ||
this.nutritionGrade = nutritionGrade; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.