Search in sources :

Example 21 with ParamIDAlreadyExists

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.");
}
Also used : AuthenticationError(EmployeeDefs.AEmployeeException.AuthenticationError) CriticalError(SMExceptions.CommonExceptions.CriticalError) CommandWrapper(ClientServerApi.CommandWrapper) IngredientStillInUse(EmployeeDefs.AEmployeeException.IngredientStillInUse) EmployeeAlreadyConnected(EmployeeDefs.AEmployeeException.EmployeeAlreadyConnected) WorkerDoesNotExist(EmployeeDefs.AEmployeeException.WorkerDoesNotExist) ProductAlreadyExistInCatalog(EmployeeDefs.AEmployeeException.ProductAlreadyExistInCatalog) ProductStillForSale(EmployeeDefs.AEmployeeException.ProductStillForSale) InvalidCommandDescriptor(EmployeeDefs.AEmployeeException.InvalidCommandDescriptor) WorkerAlreadyExists(EmployeeDefs.AEmployeeException.WorkerAlreadyExists) ParamIDAlreadyExists(EmployeeDefs.AEmployeeException.ParamIDAlreadyExists) ParamIDDoesNotExist(EmployeeDefs.AEmployeeException.ParamIDDoesNotExist) ManfacturerStillInUse(EmployeeDefs.AEmployeeException.ManfacturerStillInUse)

Example 22 with ParamIDAlreadyExists

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());
}
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

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