GithubHelp home page GithubHelp logo

react.js-java-gcp's Introduction

Introduction

This document outlines the software solution provided for the following problem statement:

The goal is to retrieve data from Google Cloud Storage (GCS) and display it in a table. The table should have the following columns: id, name, status, description, delta, and createdOn. It should also have the following features: free text search by name, filtering by status value, pagination with 20 entries per page, and the ability to sort rows by id, name, and createdOn.

To achieve this, the backend system will make API calls to GCS and handle any necessary data manipulation. The frontend will then make REST API calls to the backend to retrieve the transformed data, which will be displayed in the table. Caching the data in the backend is not a requirement.

Overall, this software solution aims to provide an easy-to-use interface for accessing and interacting with data stored in GCS.

Solution

This software solution was designed to retrieve JSON data from Google Cloud Storage (GCS) and apply searching and pagination in order to display it in the frontend application. In order to simplify and optimize the process, the GCS location was treated as an HTTP location and the data was read over HTTPS.

Several technologies were utilized in the development of this solution, including Java and Spring Boot for the web server, Spring Data Commons for pagination, Google Guava, Jackson Databind, and React with Redux and Axios for the frontend.

Overall, this solution aims to provide a efficient and effective means of accessing and interacting with data stored in GCS, while leveraging a range of modern technologies to facilitate the process.

Solution Architecture

This software solution was developed with the following design principles in mind, which aim to improve code quality and handle design complexity effectively:

Single Responsibility Principle (SRP)
Open/Closed Principle (OCP)
Liskov Substitution Principle (LSP)
Interface Segregation Principle (ISP)
Dependency Inversion Principle (DIP)

The application contains a GET endpoint that is capable of returning data from Google Cloud Storage (GCS). This endpoint accepts three different request parameters to manipulate the data: name, status, and page. Users can perform free text searches by entity name and filter results by status. The endpoint also provides pagination capabilities to allow for effective data display on the frontend.

The solution was designed as follows: Picture11

Data Controller

Data controller is responsible for exposing API to the user. There is a single API as of now which will accept name as key parameter to free text search, status as filtering parameter and page as pagination parameter. if user does not pass the searching parameter or filtering parameter and its values, API will be returning entire dataset with 20 elements per page.

http://localhost:8080/data/search?name=a http://localhost:8080/data/search?name=a&status=COMPLETED http://localhost:8080/data/search?name=a&status=COMPLETED&page=1

Data Service

Data Service is responsible for retrieving data from google cloud storage and perform the searching and filtering operations. Data service is being used pure http connections in order to read the file from GCS bucket which will avoid the complex implementations.

Pagination Service

Java does not accept JSON files as a data source, which means that Java Persistence API (JPA) cannot be used for pagination. As a result, a native pagination algorithm was implemented using the pageable component provided by Java. This algorithm splits the JSON list into multiple pages and returns the specified page.

The pagination parameters, such as the number of elements per page, can be customized. The Util class includes a page size parameter that allows developers to change the page size as needed. This implementation is similar to how pagination is implemented in JPA and other pagination methods. Overall, the pagination service aims to provide an efficient means of navigating large datasets stored in GCS.

Operations

Get Data Search by Name (free text search) Picture12

Get Data Filter By Status Picture13

Get Data Switch Page Picture14

Get Data by Name, Status and Page Picture15

Get All Data Picture16

As above screenshots depict, even though parameters are not passing to the API, it will be returning all the dataset in several pages.

All the possible exceptions were handled with try catch statements which will help to keep the application up and running all the time even though exception occurred. It increases the stability and availability of the system.

Flow Diagram

Application flow as below, Picture17

react.js-java-gcp's People

Contributors

maher-rj avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.