예제 #1
0
 def delete(self, client, var=True):
     if Validate.check_client(self, client) is False:
         raise ServiceError('Invalid input!')
     self._list_clients.delete(client)
     if var == True:
         undo = FunctionCall(self._list_clients.add, client)
         redo = FunctionCall(self._list_clients.delete, client)
         op = Operation(undo, redo)
         return op
예제 #2
0
 def add(self, client):
     # this function will get a client and add it to the list of clients
     if Validate.check_client(self, client) is False:
         raise ServiceError('Invalid input!')
     self._list_clients.add(client)
     undo = FunctionCall(self._list_clients.delete, client)
     redo = FunctionCall(self._list_clients.add, client)
     op = Operation(undo, redo)
     self._undo_controller.recordOperation(op)
예제 #3
0
 def update(self, client, new_name):
     if Validate.check_client(self, client) is False:
         raise ServiceError('Invalid input!')
     client = self.find_client_by_id(client.id)
     old_name = client.name
     client.set_name(new_name)
     self._list_clients.update(client)
     undo = FunctionCall(self.update, client, old_name)
     redo = FunctionCall(self.update, client, new_name)
     op = Operation(undo, redo)
     self._undo_controller.recordOperation(op)
예제 #4
0
 def search(self, client):
     if Validate.check_client(self, client) is False:
         raise ServiceError('Invalid input!')
     return self._list_clients.search(client)