Skip to content

Commit

Permalink
Added lots of things
Browse files Browse the repository at this point in the history
  • Loading branch information
svkhare committed Sep 23, 2019
1 parent 19b0c14 commit 20f06c8
Show file tree
Hide file tree
Showing 10 changed files with 252 additions and 2 deletions.
1 change: 0 additions & 1 deletion common.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
apply plugin: 'java'
apply plugin: 'base'

sourceCompatibility = 1.8

Expand Down
7 changes: 7 additions & 0 deletions components/flights/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apply from: "../../common.gradle"

dependencies {
compile("org.springframework.boot:spring-boot-starter-web:$springBootVersion")
compile("org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion")
compile('commons-lang:commons-lang:2.4')
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package com.pcf.tripit.flights;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
public class Flight implements Serializable {

private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;

private String airlinesName;
private String flightNumber;
private String arrival;
private String departure;
private int cost;
boolean booked;

public Flight() {

}

public Flight(String airlinesName, String flightNumber, String arrival, String departure, int cost, boolean booked) {
this.airlinesName = airlinesName;
this.flightNumber = flightNumber;
this.arrival = arrival;
this.departure = departure;
this.cost = cost;
this.booked = booked;
}

public long getId() {
return id;
}

public void setId(long id) {
this.id = id;
}

public String getAirlinesName() {
return airlinesName;
}

public void setAirlinesName(String airlinesName) {
this.airlinesName = airlinesName;
}

public String getFlightNumber() {
return flightNumber;
}

public void setFlightNumber(String flightNumber) {
this.flightNumber = flightNumber;
}

public String getArrival() {
return arrival;
}

public void setArrival(String arrival) {
this.arrival = arrival;
}

public String getDeparture() {
return departure;
}

public void setDeparture(String departure) {
this.departure = departure;
}

public int getCost() {
return cost;
}

public void setCost(int cost) {
this.cost = cost;
}

public boolean isBooked() {
return booked;
}

public void setBooked(boolean booked) {
this.booked = booked;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.pcf.tripit.flights;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/flights")

public class FlightController {

private FlightRepository flightRepository;

public FlightController(FlightRepository flightRepository) {
this.flightRepository = flightRepository;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.pcf.tripit.flights;

import org.springframework.data.repository.CrudRepository;

public interface FlightRepository extends CrudRepository<Flight, Long> {

}
7 changes: 7 additions & 0 deletions components/hotels/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apply from: "../../common.gradle"

dependencies {
compile("org.springframework.boot:spring-boot-starter-web:$springBootVersion")
compile("org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion")
compile('commons-lang:commons-lang:2.4')
}
94 changes: 94 additions & 0 deletions components/hotels/src/main/java/com/pcf/tripit/hotels/Hotel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package com.pcf.tripit.hotels;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
public class Hotel {

private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;

private String hotelName;
private String hotelAddress;
private String hotelCity;
private String capacity;
private String available;
private int price;

public Hotel() {
}

public Hotel(String hotelName, String hotelAddress, String hotelCity, String capacity, String available, int price) {
this.hotelName = hotelName;
this.hotelAddress = hotelAddress;
this.hotelCity = hotelCity;
this.capacity = capacity;
this.available = available;
this.price = price;
}

public long getId() {
return id;
}

public void setId(long id) {
this.id = id;
}

public String getHotelName() {
return hotelName;
}

public void setHotelName(String hotelName) {
this.hotelName = hotelName;
}

public String getHotelAddress() {
return hotelAddress;
}

public void setHotelAddress(String hotelAddress) {
this.hotelAddress = hotelAddress;
}

public String getHotelCity() {
return hotelCity;
}

public void setHotelCity(String hotelCity) {
this.hotelCity = hotelCity;
}

public String getCapacity() {
return capacity;
}

public void setCapacity(String capacity) {
this.capacity = capacity;
}

public String getAvailable() {
return available;
}

public void setAvailable(String available) {
this.available = available;
}

public int getPrice() {
return price;
}

public void setPrice(int price) {
this.price = price;
}
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.pcf.tripit.hotels;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/hotels")

public class HotelController {

private HotelRepository hotelRepository;

public HotelController(HotelRepository hotelRepository) {
this.hotelRepository = hotelRepository;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.pcf.tripit.hotels;

import org.springframework.data.repository.CrudRepository;

public interface HotelRepository extends CrudRepository<Hotel, Long> {
}
4 changes: 3 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
rootProject.name = 'tripit'
include "applications:tripit"
include "applications:tripit"
include "components:flights"
include "components:hotels"

0 comments on commit 20f06c8

Please sign in to comment.