diff --git a/pom.xml b/pom.xml index 9c59df4..9be4f31 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ jar easy-notes - Rest API for a Simple Note Taking Application + Rest API for a WareHouse Box Tracking org.springframework.boot diff --git a/src/main/java/com/example/easynotes/controller/BoxTrackingController.java b/src/main/java/com/example/easynotes/controller/BoxTrackingController.java new file mode 100644 index 0000000..f7489b4 --- /dev/null +++ b/src/main/java/com/example/easynotes/controller/BoxTrackingController.java @@ -0,0 +1,296 @@ +package com.example.easynotes.controller; + +import com.example.easynotes.exception.ResourceNotFoundException; +import com.example.easynotes.model.Box; +import com.example.easynotes.model.BoxEvent; +import com.example.easynotes.model.BoxState; +import com.example.easynotes.model.Location; +import com.example.easynotes.repository.BoxEventRepository; +import com.example.easynotes.repository.BoxRepository; +import com.example.easynotes.repository.BoxStateRepository; +import com.examples.box.initialData.InitialData; +import com.examples.box.initialData.ResultData; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +import org.springframework.http.ResponseEntity; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Created by DeepankarShukla. + */ +@CrossOrigin +@RestController +@RequestMapping("/api") +public class BoxTrackingController { + + private static final Logger LOG = LoggerFactory.getLogger(BoxTrackingController.class); + + @Autowired + BoxEventRepository boxEventRepository; + + @Autowired + BoxRepository boxRepository; + + @Autowired + BoxStateRepository boxStateRepository; + + @GetMapping("/boxes") + public List getAllBoxEvents() { + return boxEventRepository.findAll(); + } + + @GetMapping("/boxStates") + public List getAllBoxStates() { + return boxStateRepository.findAll(); + } + + @PostMapping("/updateBoxes") + public BoxEvent createBoxEvent(@Valid @RequestBody BoxEvent boxEvent) { + if (!StringUtils.isEmpty(boxEvent.getToBox())) { + List boxStates = boxStateRepository.findBoxState(boxEvent.getFromBox()); + + if (!org.springframework.util.CollectionUtils.isEmpty(boxStates)) { + for (BoxState state : boxStates) { + + String insertionState = state.getInsertionState(); + if (boxEvent.getPackageType().equalsIgnoreCase("P")) { + if (insertionState.endsWith(boxEvent.getFromBox())) { + insertionState = insertionState + "<" + boxEvent.getToBox(); + state.setInsertionState(insertionState); + + } else { + return createErrorData("Box is alredy inside another box"); + } + + } else { + if (state.getInsertionState().contains(boxEvent.getToBox())) { + List lastElement = Arrays.asList(insertionState.split("<")); + if (lastElement.get(lastElement.size() - 1).equalsIgnoreCase(boxEvent.getToBox())) { + insertionState = insertionState.replaceAll("<" + boxEvent.getToBox(), ""); + } else { + return createErrorData( + "Box Can not be removed as this box is not inside mentioned box"); + } + updateRequestBoxLocations(boxEvent); + state.setInsertionState(insertionState); + } else { + return createErrorData("Box Can not be removed"); + } + + } + updateHierarchialBoxLocation(boxEvent, state); + boxStateRepository.save(state); + + } + } else if (boxEvent.getPackageType().equalsIgnoreCase("p")) { + BoxState state = new BoxState(); + state.setInsertionState(boxEvent.getFromBox() + "<" + boxEvent.getToBox()); + updateRequestBoxLocations(boxEvent); + boxStateRepository.save(state); + } else { + return createErrorData("Box Can not be removed"); + } + + } else { + Box frombox = boxRepository.findById(Long.parseLong(boxEvent.getFromBox())) + .orElseThrow(() -> new ResourceNotFoundException("Note", "id", boxEvent.getFromBox())); + frombox.setLocation(boxEvent.getLocation()); + boxRepository.save(frombox); + } + + return boxEventRepository.save(boxEvent); + } + + private BoxEvent createErrorData(String message) { + BoxEvent errorEvent = new BoxEvent(); + errorEvent.setStatus("fail"); + errorEvent.setErrorMessage(message); + return errorEvent; + } + + private void updateRequestBoxLocations(BoxEvent boxEvent) { + Box frombox = boxRepository.findById(Long.parseLong(boxEvent.getFromBox())) + .orElseThrow(() -> new ResourceNotFoundException("Note", "id", boxEvent.getFromBox())); + Box toBox = boxRepository.findById(Long.parseLong(boxEvent.getToBox())) + .orElseThrow(() -> new ResourceNotFoundException("Note", "id", boxEvent.getToBox())); + frombox.setLocation(boxEvent.getLocation()); + toBox.setLocation(boxEvent.getLocation()); + boxRepository.save(frombox); + boxRepository.save(toBox); + } + + private void updateHierarchialBoxLocation(BoxEvent boxEvent, BoxState state) { + List locationUpdateionList = Arrays.asList(state.getInsertionState().split("<")); + for (String originalBox : locationUpdateionList) { + Box originalBoxModel = boxRepository.findById(Long.parseLong(originalBox)) + .orElseThrow(() -> new ResourceNotFoundException("Note", "id", originalBox)); + originalBoxModel.setLocation(boxEvent.getLocation()); + boxRepository.save(originalBoxModel); + } + } + + @PostMapping("/boxState") + public BoxState createBoxState(@Valid @RequestBody BoxState boxState) { + return boxStateRepository.save(boxState); + } + + @GetMapping("/box") + public List getAllBoxes() { + return boxRepository.findAll(); + } + + @GetMapping("/search") + public ResultData search(@RequestParam(value = "boxId", required = false) String boxId, + @RequestParam(value = "timestamp", required = false) String timestamp) { + String pattern = "yyyy-MM-dd HH:mm:ss"; + SimpleDateFormat inputFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern); + List boxEvents = new ArrayList<>(); + List uniqueBoxId = new ArrayList<>(); + if (!StringUtils.isEmpty(boxId)) { + List boxStates = boxStateRepository.findBoxState(boxId); + if (CollectionUtils.isEmpty(boxStates)) { + uniqueBoxId.add(boxId); + } + for (BoxState boxState : boxStates) { + uniqueBoxId.addAll(Arrays.asList(boxState.getInsertionState().split("<"))); + } + } + if (timestamp != null && !StringUtils.isEmpty(boxId)) { + try { + boxEvents = boxEventRepository.findBoxEventsByTimestampAndBoxId( + uniqueBoxId.stream().distinct().collect(Collectors.toList()), inputFormatter.parse(timestamp)); + } catch (ParseException e) { + LOG.info(e.getMessage()); + } + } else if (timestamp != null) { + try { + boxEvents = boxEventRepository.findBoxEventsByTimestamp(inputFormatter.parse(timestamp)); + } catch (ParseException e) { + LOG.info(e.getMessage()); + } + } else if (!StringUtils.isEmpty(boxId)) { + boxEvents = boxEventRepository.findBoxEvents(uniqueBoxId.stream().distinct().collect(Collectors.toList())); + } else { + boxEvents = boxEventRepository.findAll(); + } + return createResultData(boxId, simpleDateFormat, boxEvents); + + } + + private ResultData createResultData(String boxId, SimpleDateFormat simpleDateFormat, List boxEvents) { + ResultData results = new ResultData(); + List resultSummary = new ArrayList<>(); + List boxLocation = new ArrayList<>(); + List emptyBoxlIst = new ArrayList<>(); + for (BoxEvent event : boxEvents) { + String dateString = simpleDateFormat.format(event.getTimestamp()); + + if (StringUtils.isEmpty(event.getToBox())) { + resultSummary.add( + "Box " + event.getFromBox() + " is at " + event.getLocation().toString() + " at " + dateString); + } else if (event.getPackageType().toLowerCase().equalsIgnoreCase("P")) { + + if (!CollectionUtils.isEmpty(boxLocation) + && boxLocation.get(boxLocation.size() - 1).equalsIgnoreCase(event.getFromBox())) { + boxLocation.add(event.getToBox()); + } else { + boxLocation.add(event.getFromBox()); + boxLocation.add(event.getToBox()); + } + resultSummary.add("Box " + event.getFromBox() + " has been put inside Box " + event.getToBox() + " at " + + event.getLocation().toString() + " at " + dateString); + } else { + boxLocation.remove(event.getToBox()); + resultSummary.add("Box " + event.getFromBox() + " has been removed from " + event.getToBox() + " at " + + event.getLocation().toString() + " at " + dateString); + emptyBoxlIst.add(event.getToBox()); + } + } + List boxState = new ArrayList<>(); + + for (int index = 0; index < boxLocation.size() - 1; index++) { + + boxState.add("Box " + boxLocation.get(index) + " is inside Box " + boxLocation.get(index + 1)); + } + for (int index = 0; index < emptyBoxlIst.size(); index++) { + boxState.add("Box " + emptyBoxlIst.get(index) + " is empty"); + } + if (!StringUtils.isEmpty(boxId)) { + Box queriedBox = boxRepository.findById(Long.parseLong(boxId)) + .orElseThrow(() -> new ResourceNotFoundException("Note", "id", boxId)); + results.setCurrentLocation(queriedBox.getLocation()); + } + results.setBoxState(boxState); + results.setActions(resultSummary); + return results; + } + + @PostMapping("/box") + public Box createBox(@Valid @RequestBody Box box) { + return boxRepository.save(box); + } + + @GetMapping("/box/{id}") + public Box getBoxById(@PathVariable(value = "id") Long boxId) { + return boxRepository.findById(boxId).orElseThrow(() -> new ResourceNotFoundException("Note", "id", boxId)); + } + + @GetMapping("/boxes/{id}") + public BoxEvent getBoxEventById(@PathVariable(value = "id") Long boxId) { + return boxEventRepository.findById(boxId).orElseThrow(() -> new ResourceNotFoundException("Note", "id", boxId)); + } + + @PutMapping("/boxes/{id}") + public BoxEvent updateBox(@PathVariable(value = "id") Long boxId, @Valid @RequestBody BoxEvent boxDetails) { + + BoxEvent boxEvent = boxEventRepository.findById(boxId) + .orElseThrow(() -> new ResourceNotFoundException("Note", "id", boxId)); + + return boxEventRepository.save(boxEvent); + + } + + @DeleteMapping("/boxes/{id}") + public ResponseEntity deleteBox(@PathVariable(value = "id") Long boxId) { + BoxEvent boxEvent = boxEventRepository.findById(boxId) + .orElseThrow(() -> new ResourceNotFoundException("Note", "id", boxId)); + + boxEventRepository.delete(boxEvent); + + return ResponseEntity.ok().build(); + } + + @DeleteMapping("/boxesState/{id}") + public ResponseEntity deleteBoxState(@PathVariable(value = "id") Long boxId) { + BoxState boxState = boxStateRepository.findById(boxId) + .orElseThrow(() -> new ResourceNotFoundException("Note", "id", boxId)); + + boxStateRepository.delete(boxState); + + return ResponseEntity.ok().build(); + } + + @GetMapping("/initialData") + public InitialData getInitialData() { + InitialData initialData = new InitialData(); + initialData.setBoxes(boxRepository.findAll()); + initialData.setLocation(Arrays.asList(Location.values())); + return initialData; + } + +} diff --git a/src/main/java/com/example/easynotes/controller/IndexController.java b/src/main/java/com/example/easynotes/controller/IndexController.java index f9c5ea4..9a5172c 100644 --- a/src/main/java/com/example/easynotes/controller/IndexController.java +++ b/src/main/java/com/example/easynotes/controller/IndexController.java @@ -11,6 +11,6 @@ public class IndexController { @GetMapping public String sayHello() { - return "Hello and Welcome to the EasyNotes application. You can create a new Note by making a POST request to /api/notes endpoint."; + return "Hello and Welcome to the Warehouse application. You can create a new Note by making a POST request to /api/notes endpoint."; } } diff --git a/src/main/java/com/example/easynotes/controller/NoteController.java b/src/main/java/com/example/easynotes/controller/NoteController.java deleted file mode 100644 index 52f2ef0..0000000 --- a/src/main/java/com/example/easynotes/controller/NoteController.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.example.easynotes.controller; - -import com.example.easynotes.exception.ResourceNotFoundException; -import com.example.easynotes.model.Note; -import com.example.easynotes.repository.NoteRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.List; - -/** - * Created by rajeevkumarsingh on 27/06/17. - */ -@RestController -@RequestMapping("/api") -public class NoteController { - - @Autowired - NoteRepository noteRepository; - - @GetMapping("/notes") - public List getAllNotes() { - return noteRepository.findAll(); - } - - @PostMapping("/notes") - public Note createNote(@Valid @RequestBody Note note) { - return noteRepository.save(note); - } - - @GetMapping("/notes/{id}") - public Note getNoteById(@PathVariable(value = "id") Long noteId) { - return noteRepository.findById(noteId) - .orElseThrow(() -> new ResourceNotFoundException("Note", "id", noteId)); - } - - @PutMapping("/notes/{id}") - public Note updateNote(@PathVariable(value = "id") Long noteId, - @Valid @RequestBody Note noteDetails) { - - Note note = noteRepository.findById(noteId) - .orElseThrow(() -> new ResourceNotFoundException("Note", "id", noteId)); - - note.setTitle(noteDetails.getTitle()); - note.setContent(noteDetails.getContent()); - - Note updatedNote = noteRepository.save(note); - return updatedNote; - } - - @DeleteMapping("/notes/{id}") - public ResponseEntity deleteNote(@PathVariable(value = "id") Long noteId) { - Note note = noteRepository.findById(noteId) - .orElseThrow(() -> new ResourceNotFoundException("Note", "id", noteId)); - - noteRepository.delete(note); - - return ResponseEntity.ok().build(); - } -} diff --git a/src/main/java/com/example/easynotes/model/Box.java b/src/main/java/com/example/easynotes/model/Box.java new file mode 100644 index 0000000..914dc8c --- /dev/null +++ b/src/main/java/com/example/easynotes/model/Box.java @@ -0,0 +1,39 @@ +package com.example.easynotes.model; + +import javax.persistence.Entity; +import javax.persistence.EntityListeners; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +@Entity +@Table(name = "Box") +@EntityListeners(AuditingEntityListener.class) +public class Box { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private Location location; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Location getLocation() { + return location; + } + + public void setLocation(Location location) { + this.location = location; + } + +} diff --git a/src/main/java/com/example/easynotes/model/BoxEvent.java b/src/main/java/com/example/easynotes/model/BoxEvent.java new file mode 100644 index 0000000..d4eb620 --- /dev/null +++ b/src/main/java/com/example/easynotes/model/BoxEvent.java @@ -0,0 +1,116 @@ +package com.example.easynotes.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import org.hibernate.annotations.CreationTimestamp; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import javax.persistence.*; +import javax.validation.constraints.NotBlank; +import java.util.Date; + +/** + * Created by DeepankarShukla. + */ +@Entity +@Table(name = "BoxEvent") +@EntityListeners(AuditingEntityListener.class) +public class BoxEvent { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(nullable = false, updatable = false) + @CreationTimestamp + private Date timestamp; + + + private Location location; + + private String fromBox; + + private String toBox; + + private String packageType; + + private String state; + + private String status; + + private String errorMessage; + + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + public String getPackageType() { + return packageType; + } + + public void setPackageType(String packageType) { + this.packageType = packageType; + } + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Date getTimestamp() { + return timestamp; + } + + public void setTimestamp(Date timestamp) { + this.timestamp = timestamp; + } + + public Location getLocation() { + return location; + } + + public void setLocation(Location location) { + this.location = location; + } + + public String getFromBox() { + return fromBox; + } + + public void setFromBox(String fromBox) { + this.fromBox = fromBox; + } + + public String getToBox() { + return toBox; + } + + public void setToBox(String toBox) { + this.toBox = toBox; + } + + +} diff --git a/src/main/java/com/example/easynotes/model/BoxState.java b/src/main/java/com/example/easynotes/model/BoxState.java new file mode 100644 index 0000000..153055e --- /dev/null +++ b/src/main/java/com/example/easynotes/model/BoxState.java @@ -0,0 +1,42 @@ +package com.example.easynotes.model; + +import javax.persistence.Entity; +import javax.persistence.EntityListeners; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + + +@Entity +@Table(name = "BoxState") +@EntityListeners(AuditingEntityListener.class) +public class BoxState { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + + private String insertionState; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getInsertionState() { + return insertionState; + } + + public void setInsertionState(String insertionState) { + this.insertionState = insertionState; + } + + +} diff --git a/src/main/java/com/example/easynotes/model/Location.java b/src/main/java/com/example/easynotes/model/Location.java new file mode 100644 index 0000000..0f20ff9 --- /dev/null +++ b/src/main/java/com/example/easynotes/model/Location.java @@ -0,0 +1,8 @@ +package com.example.easynotes.model; + +public enum Location { +Location1, +Location2, +Location3, +Location4; +} \ No newline at end of file diff --git a/src/main/java/com/example/easynotes/model/Note.java b/src/main/java/com/example/easynotes/model/Note.java deleted file mode 100644 index 4f8b6b1..0000000 --- a/src/main/java/com/example/easynotes/model/Note.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.example.easynotes.model; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import org.springframework.data.annotation.CreatedDate; -import org.springframework.data.annotation.LastModifiedDate; -import org.springframework.data.jpa.domain.support.AuditingEntityListener; - -import javax.persistence.*; -import javax.validation.constraints.NotBlank; -import java.util.Date; - -/** - * Created by rajeevkumarsingh on 27/06/17. - */ -@Entity -@Table(name = "notes") -@EntityListeners(AuditingEntityListener.class) -@JsonIgnoreProperties(value = {"createdAt", "updatedAt"}, - allowGetters = true) -public class Note { - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long id; - - @NotBlank - private String title; - - @NotBlank - private String content; - - @Column(nullable = false, updatable = false) - @Temporal(TemporalType.TIMESTAMP) - @CreatedDate - private Date createdAt; - - @Column(nullable = false) - @Temporal(TemporalType.TIMESTAMP) - @LastModifiedDate - private Date updatedAt; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public Date getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(Date createdAt) { - this.createdAt = createdAt; - } - - public Date getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(Date updatedAt) { - this.updatedAt = updatedAt; - } - -} diff --git a/src/main/java/com/example/easynotes/repository/BoxEventRepository.java b/src/main/java/com/example/easynotes/repository/BoxEventRepository.java new file mode 100644 index 0000000..e7a7e45 --- /dev/null +++ b/src/main/java/com/example/easynotes/repository/BoxEventRepository.java @@ -0,0 +1,32 @@ +package com.example.easynotes.repository; + +import com.example.easynotes.model.BoxEvent; +import com.example.easynotes.model.BoxState; + +import java.util.Collection; +import java.util.Date; +import java.util.List; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +/** + * Created by DeepankarShukla. + */ + +@Repository +public interface BoxEventRepository extends JpaRepository { + + @Query("SELECT bv FROM BoxEvent as bv WHERE bv.fromBox in :inParameter or bv.toBox in :inParameter") + List findBoxEvents(@Param("inParameter")Collection inParameter); + + @Query("SELECT bv FROM BoxEvent as bv WHERE bv.timestamp < :timestamp") + List findBoxEventsByTimestamp(@Param("timestamp")Date timestamp); + + @Query("SELECT bv FROM BoxEvent as bv WHERE (bv.fromBox in :inParameter or bv.toBox in :inParameter) and bv.timestamp < :timestamp ") + List findBoxEventsByTimestampAndBoxId(@Param("inParameter")Collection inParameter,@Param("timestamp")Date timestamp); + +} + \ No newline at end of file diff --git a/src/main/java/com/example/easynotes/repository/NoteRepository.java b/src/main/java/com/example/easynotes/repository/BoxRepository.java similarity index 54% rename from src/main/java/com/example/easynotes/repository/NoteRepository.java rename to src/main/java/com/example/easynotes/repository/BoxRepository.java index 4b7b8b3..16f2b5c 100644 --- a/src/main/java/com/example/easynotes/repository/NoteRepository.java +++ b/src/main/java/com/example/easynotes/repository/BoxRepository.java @@ -1,14 +1,14 @@ package com.example.easynotes.repository; -import com.example.easynotes.model.Note; +import com.example.easynotes.model.Box; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; /** - * Created by rajeevkumarsingh on 27/06/17. + * Created by DeepankarShukla. */ @Repository -public interface NoteRepository extends JpaRepository { +public interface BoxRepository extends JpaRepository { } diff --git a/src/main/java/com/example/easynotes/repository/BoxStateRepository.java b/src/main/java/com/example/easynotes/repository/BoxStateRepository.java new file mode 100644 index 0000000..b2bf5aa --- /dev/null +++ b/src/main/java/com/example/easynotes/repository/BoxStateRepository.java @@ -0,0 +1,23 @@ +package com.example.easynotes.repository; + + +import com.example.easynotes.model.BoxState; + +import java.util.List; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +/** + * Created by DeepankarShukla. + */ + +@Repository +public interface BoxStateRepository extends JpaRepository { + + @Query("SELECT bs FROM BoxState as bs WHERE bs.insertionState like %:boxId%") + List findBoxState(@Param("boxId")String boxId); + +} diff --git a/src/main/java/com/examples/box/initialData/InitialData.java b/src/main/java/com/examples/box/initialData/InitialData.java new file mode 100644 index 0000000..6f3e771 --- /dev/null +++ b/src/main/java/com/examples/box/initialData/InitialData.java @@ -0,0 +1,32 @@ +package com.examples.box.initialData; + +import java.util.List; + +import com.example.easynotes.model.Box; +import com.example.easynotes.model.Location; + +public class InitialData { + + private List boxes; + + private List location; + + public List getBoxes() { + return boxes; + } + + public void setBoxes(List boxes) { + this.boxes = boxes; + } + + public List getLocation() { + return location; + } + + public void setLocation(List location) { + this.location = location; + } + + + +} diff --git a/src/main/java/com/examples/box/initialData/ResultData.java b/src/main/java/com/examples/box/initialData/ResultData.java new file mode 100644 index 0000000..6842ee2 --- /dev/null +++ b/src/main/java/com/examples/box/initialData/ResultData.java @@ -0,0 +1,33 @@ +package com.examples.box.initialData; + +import java.util.List; + +import com.example.easynotes.model.Location; + +public class ResultData { + + List actions; + List boxState; + Location currentLocation; + public List getActions() { + return actions; + } + public void setActions(List actions) { + this.actions = actions; + } + public List getBoxState() { + return boxState; + } + public void setBoxState(List boxState) { + this.boxState = boxState; + } + public Location getCurrentLocation() { + return currentLocation; + } + public void setCurrentLocation(Location currentLocation) { + this.currentLocation = currentLocation; + } + + + +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index b0f06a8..3d6a35a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,7 +1,7 @@ ## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties) -spring.datasource.url = jdbc:mysql://localhost:3306/notes_app?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useSSL=false +spring.datasource.url = jdbc:mysql://localhost:3306/warehouse?useConfigs=maxPerformance&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useFastDateParsing=false&createDatabaseIfNotExist=true&useSSL=false spring.datasource.username = root -spring.datasource.password = callicoder +spring.datasource.password = 1234 ## Hibernate Properties