Search in sources :

Example 26 with Ingredient

use of BasicCommonClasses.Ingredient in project SmartCity-Market by TechnionYP5777.

the class CustomerRegistration_IngredientsScreen method updateIngredientsCheckList.

private void updateIngredientsCheckList() {
    ICustomer customer = InjectionFactory.getInstance(Customer.class);
    try {
        ingredientsObservableList.addAll(customer.getAllIngredients());
    } catch (SMException e) {
        log.fatal(e);
        log.debug(StackTraceUtil.getStackTrace(e));
        e.showInfoToUser();
    }
    ingredientsCheckListView.setItems(ingredientsObservableList);
    HashSet<Ingredient> currentAllergans = TempCustomerProfilePassingData.customerProfile.getAllergens();
    if (currentAllergans != null && !currentAllergans.isEmpty())
        updateListViewWithChosenIngreidients(currentAllergans);
}
Also used : Ingredient(BasicCommonClasses.Ingredient) ICustomer(CustomerContracts.ICustomer) SMException(SMExceptions.SMException)

Example 27 with Ingredient

use of BasicCommonClasses.Ingredient in project SmartCity-Market by TechnionYP5777.

the class Serialization method deserializeIngredientHashSet.

public static HashSet<Ingredient> deserializeIngredientHashSet(String hashsetToDeserialize) {
    Gson gson = new Gson();
    Type hashsetType = new TypeToken<HashSet<Ingredient>>() {
    }.getType();
    HashSet<Ingredient> result = gson.fromJson(hashsetToDeserialize, hashsetType);
    return result;
}
Also used : Type(java.lang.reflect.Type) Ingredient(BasicCommonClasses.Ingredient) Gson(com.google.gson.Gson) HashSet(java.util.HashSet)

Aggregations

Ingredient (BasicCommonClasses.Ingredient)27 CriticalError (SQLDatabase.SQLDatabaseException.CriticalError)14 ClientNotConnected (SQLDatabase.SQLDatabaseException.ClientNotConnected)11 Test (org.junit.Test)9 SQLDatabaseConnection (SQLDatabase.SQLDatabaseConnection)8 Location (BasicCommonClasses.Location)6 Manufacturer (BasicCommonClasses.Manufacturer)6 CommandWrapper (ClientServerApi.CommandWrapper)6 IngredientNotExist (SQLDatabase.SQLDatabaseException.IngredientNotExist)6 Gson (com.google.gson.Gson)6 CatalogProduct (BasicCommonClasses.CatalogProduct)5 CriticalError (SMExceptions.CommonExceptions.CriticalError)5 HashSet (java.util.HashSet)5 EmployeeNotConnected (EmployeeDefs.AEmployeeException.EmployeeNotConnected)4 IngredientStillUsed (SQLDatabase.SQLDatabaseException.IngredientStillUsed)4 SQLException (java.sql.SQLException)4 ConnectionFailure (EmployeeDefs.AEmployeeException.ConnectionFailure)3 InvalidParameter (EmployeeDefs.AEmployeeException.InvalidParameter)3 ParamIDAlreadyExists (EmployeeDefs.AEmployeeException.ParamIDAlreadyExists)3 ParamIDDoesNotExist (EmployeeDefs.AEmployeeException.ParamIDDoesNotExist)3