Giter Site home page Giter Site logo

introsde-2017-assignment-2-server-1's Introduction

introsde-2017-assignment-2-server

1. Identification

2. Project

This is a REST server. The main parts of this server are People and Activities. A student can have a different number of Activities(0 to n), that be stored as the preferred activities of this student. In this server it is possible to perform all the CRUD operations for people, and manage their preferred activities.

2.1. Code

The logical part of the server is divided in model, which is where the entities are placed, the dao which handles with the entities and acts as link between model and the resources which are exposed through out the system.

  • model: In this package are defined the classes People, Activity, ActivityType. Within all these classes are defined the parameters and some useful methods for handling with them. All these are mapped in a SQLite database using the Java Persistence Api. The ActivityTypes class is used in order to make simple handling with activityType objects, and it not mapped on the database.
  • Dao: In this package we have PersonActivityDao which provides the interface to the model, whereby the classes written in the Persistence.xml.
  • Resources: The package where the are contained the classes using to get the requests and retrive the responses to/from the client.
    • The Databaseinit class is mapped on /database path.
    • The PersonCollectionResource class is mapped on /person path and contains the methods for getting all people and for posting a new person.
    • The PersonResource class contatins all the methods (GET, POST, DELETE, PUT) for managing a person and its for handling with its activities.
    • The ActivityTypeResource class is mapped on the /activity_types path and is used for get activity types.

2.2. Task

this server can do the following tasks both in JSON and XML format:

  • 0#: POST /databaseinit, creates 5 new people.
  • 1#: GET /person, lists all the people in the database (wrapped under the root element "people")
  • 2#: GET /person/{id}, gives all the personal information plus related information
  • 3#: PUT /person/{id},updates the personal information of the person identified by {id} (only the person's information, not activity preferences)
  • 4#: POST /person, creates a new person and returns the newly created person with its assigned id (if a activity profile is included, create them for the new person)
  • 5#: DELETE /person/{id},deletes the person identified by {id} from the system
  • 6#: GET /activity_types,returns the list of activity_types your model supports in the following formats:
<activityTypes>
   <activity_type>Sport</activity_type>
<activity_type>Social</activity_type>
</activityTypes>
{
 "activityTypes": [
      "Sport",
      "Social"
  ]
}
  • 7#: GET /person/{id}/{activity_type},returns the list of activities of {activity_type} (e.g. Social) for person identified by {id}
  • 8#: GET /person/{id}/{activity_type}/{activity_id}, returns the activities of {activity_type} (e.g. Social) identified by {activity_id} for person identified by {id}
  • 10#: PUT /person/{id}/{activity_type}/{activity_id}, updates the value for the {activity_type} (e.g., Social) identified by {activity_id}, related to the person identified by {id}
  • 11#: GET /person/{id}/{activity_type}?before={beforeDate}&after={afterDate},returns the activities of {activity_type} (e.g., Social) for person {id} which {start_date} is in the specified range of date. (1 point)

3. Execution

It is possible perform all the request above on the following heroku server

 https://intro2sdeass2.herokuapp.com/sdelab/

4. Additional Notes

Actually the request#9 is not implemented

introsde-2017-assignment-2-server-1's People

Contributors

javekk avatar

Watchers

Giovanni Rafael Vuolo 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.