Giter VIP home page Giter VIP logo

streamlined2 / finalproject Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 370 KB

Basic web application to model car renting business process. Sticks to MVC architecture pattern where central front controller servlet consumes user requests, converts them to actions/commands, processes data and demonstrates result as JSP/JSTL web forms.

Java 99.92% CSS 0.08%
java jsp mvc servlet jee jdbc tomcat i18n sql mockito

finalproject's Introduction

FinalProject

Application architecture.

Controller.

The application uses single servlet FCServlet as front controller to handle each user request. Controller delegates user form navigation to FormDispatcher which determines next form by checking transition rule map TransitionRuleMap. Authenticated user, current form and taken action objects are used as map key to search for next user form. Concrete descendants of Form class (part of Controller component) fetch and initialize data that are to be rendered by Java server pages, map user actions to Action objects that change data and set session/request attributes that contain intermediate results.

Auxiliary servlet filter AuthFilter helps to prevent mistakes should JSP page contain link to some external resource and doesn't take control back to controller servlet.

Action class is common ancestor for ClientAction, ManagerAction, AdminAction which correspond to acceptable user roles represented by Client, Manager, Admin classes. Every action is checked against user permissions before its execution (User.checkPermission(action)).

User session attributes are cleared by CleanSessionListener every time the session expires for security reasons.

View.

The application avoids using scriptlets and builds view layer as set of JSP pages with standard JSTL tags and custom tags for table view (TableViewTag), select/option element (OptionSelectorTag) and tag files for small interface elements (such as logout button, order option, locale selection, etc). Every page usually contains of one or more HTML forms that are to be submitted when user presses button. Submitted parameters then would be analyzed by assigned Form subclass (which is part of Controller component) and converted into appropriate Action objects and data to operate on.

Model.

Model component consists of abstract class Entity (root of entity class hierarchy), composite natural key class NaturalKeyEntity, domain entity class Car, set of document classes LeaseOrder, OrderReview, CarReview, Invoice (LeaseInvoice, MaintenanceInvoice), that represent internal state of enterprise business process, and set of user role classes User (Client, Manager, Admin). Entities are operated upon by generic DAO EntityManager with aid of Inspector class which employes Java Reflection API. StatementBuilder helps to build SQL statements for entity fetching, creation, modification and deletion.

Employed design patterns:

Model-View-Controller, Front controller, Action/Command, Observer, Singleton, Generic DAO.

P.S. It helps to recall principles of final state machine paradigm to understand and explain user interface form dispatching. Forms are states of such FSM automaton and actions help to make transitions between forms.

finalproject's People

Contributors

streamlined2 avatar

Watchers

 avatar

Forkers

0x0juanm

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.