package com.amos.project4.controllers;

import java.util.ArrayList;

import com.amos.project4.models.Client;
import com.amos.project4.models.ClientDAO;
import com.amos.project4.views.SearchParameters;

public class ClientController extends AbstractController implements ClientControllerInterface{
	
	private ClientDAO clientDAO;
	SearchParameters search;

	public ClientController() {
		super();
		clientDAO = ClientDAO.getClientDAOInstance();
		search = new SearchParameters();
	}

	@Override
	public ArrayList<Client> getAllClients() {
		if(this.evt_object != null){
			search = (SearchParameters) this.evt_object;
		}		
		return new ArrayList<Client>(clientDAO.getAllFilteredClients(search));
	}

	@Override
	public boolean addClient(Client client) {		
		return clientDAO.addClient(client);
	}

	@Override
	public boolean updateClient(Client oldClient, Client newClient) {
		return clientDAO.updateClient(newClient);
	}

	@Override
	public boolean deleteClient(Client client) {
		return clientDAO.deleteClient(client);
	}
	
	public void setSearch(SearchParameters search) {
		this.search = search;
	}
}

@@ -1,8 +1,765 @@
+/*%0A * %0A * This file is part of the software project %22Social Media and Datev%22.%0A *%0A * This program is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU Affero General Public License as%0A * published by the Free Software Foundation, either version 3 of the%0A * License, or (at your option) any later version.%0A *%0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU Affero General Public License for more details.%0A *%0A * You should have received a copy of the GNU Affero General Public%0A * License along with this program. If not, see%0A * %3Chttp://www.gnu.org/licenses/%3E.%0A */%0A %0A 
 package 

Update ClientController.java