use of EmployeeDefs.AEmployeeException.WorkerAlreadyExists in project SmartCity-Market by TechnionYP5777.
the class Manager method editManufacturer.
@Override
public void editManufacturer(Manufacturer m) throws InvalidParameter, CriticalError, EmployeeNotConnected, ConnectionFailure, ParamIDDoesNotExist {
log.info("Creating editManufacturer command wrapper with Manufacturer: " + m);
String serverResponse = sendRequestWithRespondToServer((new CommandWrapper(getClientId(), CommandDescriptor.EDIT_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 | ManfacturerStillInUse ¢) {
log.fatal("Critical bug: this command result isn't supposed to return here");
throw new CriticalError();
}
log.info("editManufacturer command succeed.");
}
use of EmployeeDefs.AEmployeeException.WorkerAlreadyExists in project SmartCity-Market by TechnionYP5777.
the class Manager method removeProductFromCatalog.
@Override
public void removeProductFromCatalog(SmartCode c) throws InvalidParameter, CriticalError, EmployeeNotConnected, ProductNotExistInCatalog, ProductStillForSale, ConnectionFailure {
log.info("Creating removeProductFromCatalog command wrapper with barcode: " + c.getBarcode());
String serverResponse = sendRequestWithRespondToServer((new CommandWrapper(getClientId(), CommandDescriptor.REMOVE_PRODUCT_FROM_CATALOG, Serialization.serialize(c))).serialize());
CommandWrapper commandDescriptor = getCommandWrapper(serverResponse);
try {
resultDescriptorHandler(commandDescriptor.getResultDescriptor());
} catch (InvalidCommandDescriptor | EmployeeAlreadyConnected | AuthenticationError | AmountBiggerThanAvailable | ProductPackageDoesNotExist | ProductAlreadyExistInCatalog | WorkerAlreadyExists | ParamIDAlreadyExists | ParamIDDoesNotExist | WorkerDoesNotExist | IngredientStillInUse | ManfacturerStillInUse ¢) {
log.fatal("Critical bug: this command result isn't supposed to return here");
throw new CriticalError();
}
log.info("removeProductFromCatalog command succeed.");
}
use of EmployeeDefs.AEmployeeException.WorkerAlreadyExists in project SmartCity-Market by TechnionYP5777.
the class Manager method editProductFromCatalog.
@Override
public void editProductFromCatalog(CatalogProduct p) throws InvalidParameter, CriticalError, EmployeeNotConnected, ProductNotExistInCatalog, ConnectionFailure {
log.info("Creating editProductFromCatalog command wrapper with product: " + p);
String serverResponse = sendRequestWithRespondToServer((new CommandWrapper(getClientId(), CommandDescriptor.EDIT_PRODUCT_FROM_CATALOG, Serialization.serialize(p))).serialize());
CommandWrapper commandDescriptor = getCommandWrapper(serverResponse);
try {
resultDescriptorHandler(commandDescriptor.getResultDescriptor());
} catch (InvalidCommandDescriptor | EmployeeAlreadyConnected | AuthenticationError | ProductStillForSale | AmountBiggerThanAvailable | ProductPackageDoesNotExist | ProductAlreadyExistInCatalog | WorkerAlreadyExists | ParamIDAlreadyExists | ParamIDDoesNotExist | WorkerDoesNotExist | IngredientStillInUse | ManfacturerStillInUse ¢) {
log.fatal("Critical bug: this command result isn't supposed to return here");
throw new CriticalError();
}
log.info("editProductFromCatalog command succeed.");
}
use of EmployeeDefs.AEmployeeException.WorkerAlreadyExists in project SmartCity-Market by TechnionYP5777.
the class ManageEmployeesTab method finishBtnPressed.
@FXML
void finishBtnPressed(ActionEvent __) {
try {
manager.registerNewWorker(new Login(userTxt.getText(), passTxt.getText(), new ForgotPasswordData(securityCombo.getSelectionModel().getSelectedItem(), securityAnswerTxt.getText())));
} catch (InvalidParameter | CriticalError | EmployeeNotConnected | ConnectionFailure | WorkerAlreadyExists e) {
log.fatal(e);
log.debug(StackTraceUtil.getStackTrace(e));
e.showInfoToUser();
}
createEmployeesList();
enableRemoveButton();
}
use of EmployeeDefs.AEmployeeException.WorkerAlreadyExists 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.");
}
Aggregations