use of SMExceptions.CommonExceptions.CriticalError in project SmartCity-Market by TechnionYP5777.
the class ManageCatalogProductDetailsTab method addManuPressed.
void addManuPressed() {
try {
manager.addManufacturer(new Manufacturer(0, newManu.getText()));
} catch (InvalidParameter | CriticalError | EmployeeNotConnected | ConnectionFailure | ParamIDAlreadyExists e) {
log.fatal(e);
log.debug(StackTraceUtil.getStackTrace(e));
e.showInfoToUser();
}
selectedManu.clear();
createManufacturerList();
enableButtons();
enableAddButtons();
}
use of SMExceptions.CommonExceptions.CriticalError in project SmartCity-Market by TechnionYP5777.
the class Manager method removeWorker.
@Override
public void removeWorker(String s) throws InvalidParameter, CriticalError, EmployeeNotConnected, ConnectionFailure, WorkerDoesNotExist {
log.info("Creating removeWorker command wrapper with username: " + s);
String serverResponse = sendRequestWithRespondToServer((new CommandWrapper(getClientId(), CommandDescriptor.REMOVE_WORKER, Serialization.serialize(s))).serialize());
CommandWrapper commandDescriptor = getCommandWrapper(serverResponse);
try {
resultDescriptorHandler(commandDescriptor.getResultDescriptor());
} catch (InvalidCommandDescriptor | EmployeeAlreadyConnected | AuthenticationError | ProductStillForSale | AmountBiggerThanAvailable | ProductPackageDoesNotExist | ProductAlreadyExistInCatalog | ProductNotExistInCatalog | ParamIDAlreadyExists | ParamIDDoesNotExist | WorkerAlreadyExists | IngredientStillInUse | ManfacturerStillInUse ¢) {
log.fatal("Critical bug: this command result isn't supposed to return here");
throw new CriticalError();
}
log.info("removeWorker command succeed.");
}
use of SMExceptions.CommonExceptions.CriticalError in project SmartCity-Market by TechnionYP5777.
the class Manager method editIngredient.
@Override
public void editIngredient(Ingredient w) throws InvalidParameter, CriticalError, EmployeeNotConnected, ConnectionFailure, ParamIDDoesNotExist {
log.info("Creating editIngredient command wrapper with Ingredient: " + w);
String serverResponse = sendRequestWithRespondToServer((new CommandWrapper(getClientId(), CommandDescriptor.EDIT_INGREDIENT, Serialization.serialize(w))).serialize());
CommandWrapper commandDescriptor = getCommandWrapper(serverResponse);
try {
resultDescriptorHandler(commandDescriptor.getResultDescriptor());
} catch (InvalidCommandDescriptor | EmployeeAlreadyConnected | AuthenticationError | ProductStillForSale | AmountBiggerThanAvailable | ProductPackageDoesNotExist | ProductAlreadyExistInCatalog | ProductNotExistInCatalog | WorkerAlreadyExists | ParamIDAlreadyExists | WorkerDoesNotExist | IngredientStillInUse | ManfacturerStillInUse ¢) {
log.fatal("Critical bug: this command result isn't supposed to return here");
throw new CriticalError();
}
log.info("editIngredient command succeed.");
}
use of SMExceptions.CommonExceptions.CriticalError in project SmartCity-Market by TechnionYP5777.
the class Manager method removeManufacturer.
@Override
public void removeManufacturer(Manufacturer m) throws InvalidParameter, CriticalError, EmployeeNotConnected, ConnectionFailure, ParamIDDoesNotExist, ManfacturerStillInUse {
log.info("Creating removeManufacturer command wrapper with Manufacturer: " + m);
String serverResponse = sendRequestWithRespondToServer((new CommandWrapper(getClientId(), CommandDescriptor.REMOVE_MANUFACTURER, Serialization.serialize(m))).serialize());
CommandWrapper commandDescriptor = getCommandWrapper(serverResponse);
try {
resultDescriptorHandler(commandDescriptor.getResultDescriptor());
} catch (InvalidCommandDescriptor | EmployeeAlreadyConnected | AuthenticationError | ProductStillForSale | AmountBiggerThanAvailable | ProductPackageDoesNotExist | ProductAlreadyExistInCatalog | ProductNotExistInCatalog | WorkerAlreadyExists | ParamIDAlreadyExists | WorkerDoesNotExist | IngredientStillInUse ¢) {
log.fatal("Critical bug: this command result isn't supposed to return here");
throw new CriticalError();
}
log.info("removeManufacturer command succeed.");
}
use of SMExceptions.CommonExceptions.CriticalError in project SmartCity-Market by TechnionYP5777.
the class Manager method getAllIngredients.
@Override
public List<Ingredient> getAllIngredients() throws InvalidParameter, CriticalError, ConnectionFailure {
log.info("Creating getAllIngredients command wrapper");
String serverResponse = sendRequestWithRespondToServer((new CommandWrapper(getClientId(), CommandDescriptor.GET_ALL_INGREDIENTS, Serialization.serialize(""))).serialize());
CommandWrapper commandDescriptor = getCommandWrapper(serverResponse);
try {
resultDescriptorHandler(commandDescriptor.getResultDescriptor());
} catch (InvalidCommandDescriptor | EmployeeAlreadyConnected | AuthenticationError | ProductStillForSale | AmountBiggerThanAvailable | ProductPackageDoesNotExist | ProductAlreadyExistInCatalog | ProductNotExistInCatalog | WorkerAlreadyExists | ParamIDAlreadyExists | ParamIDDoesNotExist | WorkerDoesNotExist | IngredientStillInUse | ManfacturerStillInUse | EmployeeNotConnected ¢) {
log.fatal("Critical bug: this command result isn't supposed to return here");
throw new CriticalError();
}
log.info("getAllIngredients command succeed.");
return new Gson().fromJson(commandDescriptor.getData(), new TypeToken<List<Ingredient>>() {
}.getType());
}
Aggregations