package facadePattern;

public class Statistics {
	private DataFacade facade;

	public Statistics(DataFacade facade) {
		this.facade = facade;
	}

	public void getData(String id) {
		ClientData client = new ClientData();
		String[] allData = this.facade.retrieveData(id);
		client.setPassengerDetails(allData);
		client.setFlightDetails(allData);
		client.setBaggageDetails(allData);
	}
}

 /*
|========================================================================
|------------------------------------------------------------------------
|  The values for the instance variables would 
|  usually be obtained from a database
|  However values have been added for the benfit of this example
|------------------------------------------------------------------------
|========================================================================
*/

public class Passenger {
	private String id;
	private String passengerName = "Billy Bob";
	private String passengerAddress = "New York";
	private String passengerAge = "23";

	public Passenger(String id) {
		this.id = id;
	}

	public String getPassengerName() {
		return this.passengerName;
	}

	public String getPassengerAddress() {
		return this.passengerAddress;
	}

	public String getPassengerAge() {
		return this.passengerAge;
	}
}


public class Flight {
	private String id;
	private String flightNo = "AM676798";
	private String airLine = "JavaAir";
	private String departureTime = "12-11-14  10:43";

	public Flight(String id) {
		this.id = id;
	}

	public String getFlightNo() {
		return this.flightNo;
	}

	public String getAirline() {
		return this.airLine;
	}

	public String getDepartureTime() {
		return this.departureTime;
	}
}

public class Baggage {
	private String id;
	private String amount = "4";
	private String totalWeight = "3KG";
	private String allAccountedFor = "true";

	public Baggage(String id) {
		this.id = id;
	}

	public String getAmount() {
		return this.amount;
	}

	public String getTotalWeight() {
		return this.totalWeight;
	}

	public String getAllAccountedFor() {
		return this.allAccountedFor;
	}
}

public class DataFacade {
	private String[] data = new String[3];

	public DataFacade() {

	}

	public String[] retrieveData(String id) {
		this.data[0] = getPassengerDetails(id);
		this.data[1] = getFlightDetails(id);
		this.data[2] = getBaggageDetails(id);
		return data;
	}

	public String getPassengerDetails(String id) {
		Passenger passenger = new Passenger(id);
		String passengerData = passenger.getPassengerName();
		passengerData += ", " + passenger.getPassengerAddress();
		passengerData += ", " + passenger.getPassengerAge();
		return passengerData;
	}

	public String getFlightDetails(String id) {
		Flight flight = new Flight(id);
		String flightData = flight.getFlightNo();
		flightData += ", " + flight.getAirline();
		flightData += ", " + flight.getDepartureTime();
		return flightData;
	}

	public String getBaggageDetails(String id) {
		Baggage baggage = new Baggage(id);
		String baggageData = baggage.getAmount();
		baggageData += ", " + baggage.getTotalWeight();
		baggageData += ", " + baggage.getAllAccountedFor();
		return baggageData;
	}
}


public class ClientData {

	public void setPassengerDetails(String[] data) {
		System.out.println("Passenger: " + data[0]);
	}

	public void setFlightDetails(String[] data) {
		System.out.println("Flight: " + data[1]);
	}

	public void setBaggageDetails(String[] data) {
		System.out.println("Baggage: " + data[2]);
	}
}


public class FacadeDriver {
	public static void main (String[] args){
		DataFacade data = new DataFacade();
		Statistics statistics = new Statistics(data);
		statistics.getData("WX4983489");
	}
}

@@ -1097,24 +1097,27 @@
 gerName() %7B%0A
+%09%09%0A
 %09%09return thi
@@ -1133,16 +1133,16 @@
 erName;%0A
-
 %09%7D%0A%0A%09pub
@@ -1172,24 +1172,27 @@
 Address() %7B%0A
+%09%09%0A
 %09%09return thi
@@ -1246,24 +1246,27 @@
 ngerAge() %7B%0A
+%09%09%0A
 %09%09return thi
@@ -1533,24 +1533,27 @@
 lightNo() %7B%0A
+%09%09%0A
 %09%09return thi
@@ -1594,24 +1594,27 @@
 Airline() %7B%0A
+%09%09%0A
 %09%09return thi
@@ -1660,24 +1660,27 @@
 ureTime() %7B%0A
+%09%09%0A
 %09%09return thi
@@ -1929,24 +1929,27 @@
 tAmount() %7B%0A
+%09%09%0A
 %09%09return thi
@@ -1992,24 +1992,27 @@
 lWeight() %7B%0A
+%09%09%0A
 %09%09return thi
@@ -2068,16 +2068,19 @@
 For() %7B%0A
+%09%09%0A
 %09%09return
@@ -2367,16 +2367,19 @@
 ls(id);%0A
+%09%09%0A
 %09%09return
@@ -2645,24 +2645,27 @@
 engerAge();%0A
+%09%09%0A
 %09%09return pas
@@ -2893,24 +2893,27 @@
 tureTime();%0A
+%09%09%0A
 %09%09return fli
@@ -3098,24 +3098,24 @@
 alWeight();%0A
-
 %09%09baggageDat
@@ -3156,16 +3156,19 @@
 dFor();%0A
+%09%09%0A
 %09%09return

Clean code