Search in sources :

Example 21 with ProductAlreadyExistInCatalog

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());
}
Also used : AuthenticationError(EmployeeDefs.AEmployeeException.AuthenticationError) ProductNotExistInCatalog(EmployeeDefs.AEmployeeException.ProductNotExistInCatalog) CriticalError(SMExceptions.CommonExceptions.CriticalError) Gson(com.google.gson.Gson) CommandWrapper(ClientServerApi.CommandWrapper) IngredientStillInUse(EmployeeDefs.AEmployeeException.IngredientStillInUse) EmployeeAlreadyConnected(EmployeeDefs.AEmployeeException.EmployeeAlreadyConnected) WorkerDoesNotExist(EmployeeDefs.AEmployeeException.WorkerDoesNotExist) ProductAlreadyExistInCatalog(EmployeeDefs.AEmployeeException.ProductAlreadyExistInCatalog) ProductStillForSale(EmployeeDefs.AEmployeeException.ProductStillForSale) AmountBiggerThanAvailable(EmployeeDefs.AEmployeeException.AmountBiggerThanAvailable) InvalidCommandDescriptor(EmployeeDefs.AEmployeeException.InvalidCommandDescriptor) TypeToken(com.google.gson.reflect.TypeToken) WorkerAlreadyExists(EmployeeDefs.AEmployeeException.WorkerAlreadyExists) ParamIDAlreadyExists(EmployeeDefs.AEmployeeException.ParamIDAlreadyExists) Manufacturer(BasicCommonClasses.Manufacturer) ParamIDDoesNotExist(EmployeeDefs.AEmployeeException.ParamIDDoesNotExist) ManfacturerStillInUse(EmployeeDefs.AEmployeeException.ManfacturerStillInUse) ProductPackageDoesNotExist(EmployeeDefs.AEmployeeException.ProductPackageDoesNotExist)

Aggregations

CommandWrapper (ClientServerApi.CommandWrapper)21 InvalidCommandDescriptor (EmployeeDefs.AEmployeeException.InvalidCommandDescriptor)21 ProductAlreadyExistInCatalog (EmployeeDefs.AEmployeeException.ProductAlreadyExistInCatalog)21 CriticalError (SMExceptions.CommonExceptions.CriticalError)21 AuthenticationError (EmployeeDefs.AEmployeeException.AuthenticationError)20 EmployeeAlreadyConnected (EmployeeDefs.AEmployeeException.EmployeeAlreadyConnected)20 IngredientStillInUse (EmployeeDefs.AEmployeeException.IngredientStillInUse)20 ManfacturerStillInUse (EmployeeDefs.AEmployeeException.ManfacturerStillInUse)20 ProductStillForSale (EmployeeDefs.AEmployeeException.ProductStillForSale)20 WorkerAlreadyExists (EmployeeDefs.AEmployeeException.WorkerAlreadyExists)20 WorkerDoesNotExist (EmployeeDefs.AEmployeeException.WorkerDoesNotExist)20 AmountBiggerThanAvailable (EmployeeDefs.AEmployeeException.AmountBiggerThanAvailable)19 ParamIDAlreadyExists (EmployeeDefs.AEmployeeException.ParamIDAlreadyExists)19 ProductPackageDoesNotExist (EmployeeDefs.AEmployeeException.ProductPackageDoesNotExist)18 ParamIDDoesNotExist (EmployeeDefs.AEmployeeException.ParamIDDoesNotExist)17 ProductNotExistInCatalog (EmployeeDefs.AEmployeeException.ProductNotExistInCatalog)15 EmployeeNotConnected (EmployeeDefs.AEmployeeException.EmployeeNotConnected)3 Gson (com.google.gson.Gson)3 TypeToken (com.google.gson.reflect.TypeToken)3 InvalidParameter (EmployeeDefs.AEmployeeException.InvalidParameter)2