use of EmployeeDefs.AEmployeeException.ParamIDAlreadyExists in project SmartCity-Market by TechnionYP5777.
the class Worker method removeProductPackageFromStore.
@Override
public void removeProductPackageFromStore(ProductPackage p) throws InvalidParameter, CriticalError, EmployeeNotConnected, ProductNotExistInCatalog, AmountBiggerThanAvailable, ProductPackageDoesNotExist, ConnectionFailure {
log.info("Creating removeProductPackageFromStore command wrapper with product package: " + p);
String serverResponse = sendRequestWithRespondToServer(new CommandWrapper(getClientId(), CommandDescriptor.REMOVE_PRODUCT_PACKAGE_FROM_STORE, Serialization.serialize(p)).serialize());
CommandWrapper commandDescriptor = getCommandWrapper(serverResponse);
try {
resultDescriptorHandler(commandDescriptor.getResultDescriptor());
} catch (InvalidCommandDescriptor | EmployeeAlreadyConnected | AuthenticationError | ProductAlreadyExistInCatalog | ProductStillForSale | WorkerAlreadyExists | ParamIDAlreadyExists | ParamIDDoesNotExist | WorkerDoesNotExist | IngredientStillInUse | ManfacturerStillInUse ¢) {
log.fatal("Critical bug: this command result isn't supposed to return here");
throw new CriticalError();
}
log.info("removeProductPackageFromStore command succeed.");
}
use of EmployeeDefs.AEmployeeException.ParamIDAlreadyExists in project SmartCity-Market by TechnionYP5777.
the class Manager method getAllManufacturers.
@Override
public List<Manufacturer> getAllManufacturers() throws InvalidParameter, CriticalError, EmployeeNotConnected, ConnectionFailure {
log.info("Creating getAllManufacturers command wrapper");
String serverResponse = sendRequestWithRespondToServer((new CommandWrapper(getClientId(), CommandDescriptor.GET_ALL_MANUFACTURERS, 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 ¢) {
log.fatal("Critical bug: this command result isn't supposed to return here");
throw new CriticalError();
}
log.info("getAllManufacturers command succeed.");
return new Gson().fromJson(commandDescriptor.getData(), new TypeToken<List<Manufacturer>>() {
}.getType());
}
Aggregations