use of EmployeeDefs.AEmployeeException.ProductAlreadyExistInCatalog 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