- Perini Raffaele 196339
- [email protected]
- My Partner: Giovanni Rafael Vuolo
- My Server URL: https://intro2sdeass2.herokuapp.com/sdelab/
- His Server URL: https://assignsde2.herokuapp.com/assign2/
- His Repo Git: https://github.com/chany93/introsde-2017-assignment-2-server
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.
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.
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)
It is possible perform all the request above on the following heroku server
https://intro2sdeass2.herokuapp.com/sdelab/
Actually the request#9 is not implemented