Aggiunti listati restaurant lato server
This commit is contained in:
parent
59335ae3f7
commit
ca752971c2
2 changed files with 219 additions and 0 deletions
BIN
italian.pdf
BIN
italian.pdf
Binary file not shown.
219
main.tex
219
main.tex
|
@ -6,6 +6,7 @@
|
|||
\end{en}
|
||||
|
||||
\usepackage{blindtext}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage[pdftex]{graphicx}
|
||||
\usepackage{scrlayer-scrpage}
|
||||
|
@ -15,6 +16,8 @@
|
|||
\usepackage[backend=biber]{biblatex}
|
||||
\usepackage{pgfgantt}
|
||||
\usepackage{pgffor}
|
||||
\usepackage{listings}
|
||||
\usepackage{lmodern}
|
||||
|
||||
\bibliography{bibliography}
|
||||
|
||||
|
@ -42,6 +45,21 @@
|
|||
\ihead[]{\mdtitle}
|
||||
\cfoot[\pagemark]{\pagemark}
|
||||
|
||||
% listings configuration
|
||||
\begin{it}
|
||||
\renewcommand{\lstlistingname}{Listato}
|
||||
\renewcommand{\lstlistlistingname}{Lista dei listati}
|
||||
\end{it}
|
||||
\lstset{
|
||||
basicstyle=\small\ttfamily,
|
||||
frame=shadowbox,
|
||||
rulesepcolor=\color{black},
|
||||
columns=fullflexible,
|
||||
commentstyle=\color{gray},
|
||||
keywordstyle=\bfseries,
|
||||
escapeinside={\%*}{*)}
|
||||
}
|
||||
|
||||
\begin{document}
|
||||
|
||||
% first page
|
||||
|
@ -216,6 +234,206 @@
|
|||
|
||||
\begin{it}
|
||||
\subsubsection{\textit{restaurant} -- lato server}
|
||||
\begin{lstlisting}[caption=Interfaccia della classe \textit{JsonProducer}, label=jsonprd-java, language=Java]
|
||||
/**
|
||||
* Something that generates JSON responses
|
||||
*/
|
||||
public abstract class JsonProducer {
|
||||
|
||||
protected static final Logger log = %*\ldots*);
|
||||
|
||||
protected static final Gson GSON;
|
||||
|
||||
/**
|
||||
* Generates a json response with status 200 containing an object
|
||||
*
|
||||
* @param o the contents of the response
|
||||
* @return JSON response
|
||||
*/
|
||||
protected Response jsonResponse(Object o) { %*\ldots*) }
|
||||
|
||||
/**
|
||||
* Generates a json response with custom status containing an object
|
||||
*
|
||||
* @param o the contents of the response
|
||||
* @param status status of the response
|
||||
* @return JSON response
|
||||
*/
|
||||
protected Response jsonResponse(Object o, int status) { %*\ldots*) }
|
||||
|
||||
/**
|
||||
* Generates a json response containing a library standard error
|
||||
*
|
||||
* @param error the error
|
||||
* @return JSON error response
|
||||
*/
|
||||
protected Response jsonErrResponse(Error error) { %*\ldots*) }
|
||||
|
||||
/**
|
||||
* Generates a json response containing a custom error
|
||||
*
|
||||
* @param error the error
|
||||
* @return JSON error response
|
||||
*/
|
||||
protected Response jsonErrResponse(ErrorDetails error) { %*\ldots*) }
|
||||
|
||||
/**
|
||||
* Generates an error response if the parameter given as argument
|
||||
* is null or an empty string
|
||||
*
|
||||
* @param s parameter
|
||||
* @param propName parameter name, used in the error description
|
||||
* @return JSON error response or null if the parameter is valid
|
||||
*/
|
||||
protected Response require(Object s, String propName) { %*\ldots*) }
|
||||
}
|
||||
\end{lstlisting}
|
||||
\begin{lstlisting}[caption=Interfaccia della classe \textit{ReadableRESTController}, label=rdbrest-java, language=Java]
|
||||
/**
|
||||
* A REST Controller only readable
|
||||
* @param <T> The readable entity class
|
||||
*/
|
||||
public abstract class ReadableRESTController<T extends Readable,
|
||||
U extends PrimaryKey<T>> extends JsonProducer {
|
||||
|
||||
/**
|
||||
* Interface used to carry a function capable of filtering a list
|
||||
* of entities after it has been retrieved from the database
|
||||
*
|
||||
* @param <T> The readable entity class
|
||||
*/
|
||||
public interface ListFilter<T extends Readable> {
|
||||
List<T> filter(List<T> toFilter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the class of the readable entity. Used as parameter for
|
||||
* CRUDUtils
|
||||
*
|
||||
* @return the class of the readable entity
|
||||
*/
|
||||
protected abstract Class<T> getBeanClass();
|
||||
|
||||
protected final Logger log = %*\ldots*);
|
||||
|
||||
/**
|
||||
* Returns a response with a standard unfiltered, unpaginated list
|
||||
* of entities
|
||||
*
|
||||
* @return JSON response, success or not
|
||||
*/
|
||||
protected Response list() { %*\ldots*) }
|
||||
|
||||
/**
|
||||
* Returns a list of entities, customizable in many ways
|
||||
*
|
||||
* @param filter map of names of fields and their values which must
|
||||
* be equal in the fetched entities (null accepted if
|
||||
* not used)
|
||||
* @param otherFilter list of additional filters (Hibernate Criterion
|
||||
* objects, null accepted if not used)
|
||||
* @param order order of the entities (Hibernate Order, null accepted
|
||||
* if not used)
|
||||
* @param afterDb implementation of interface containing a function
|
||||
* capable of filtering a list of entities (null accepted
|
||||
* if not used)
|
||||
* @param page the page number to fetch (starts at 1, null accepted
|
||||
* if not used)
|
||||
* @return JSON response, success or not
|
||||
*/
|
||||
protected Response list(Map<String, Object> filter,
|
||||
List<Criterion> otherFilter, Order order,
|
||||
ListFilter<T> afterDb, Integer page) { %*\ldots*) }
|
||||
|
||||
/**
|
||||
* Returns a response with a single entity given its primary key
|
||||
*
|
||||
* @param filterOne map of names of columns and their values containing
|
||||
* the primary key
|
||||
* @return JSON response, success or not
|
||||
*/
|
||||
protected Response get(Map<String, Object> filterOne) { %*\ldots*) }
|
||||
|
||||
/**
|
||||
* Returns a response with a single entity given its primary key
|
||||
*
|
||||
* @param pk the primary key
|
||||
* @return JSON response, success or not
|
||||
*/
|
||||
protected Response get(PrimaryKey<T> pk) { %*\ldots*) }
|
||||
|
||||
/**
|
||||
* Returns the existing primary keys given a set of primary keys sent
|
||||
* as a JSON array
|
||||
*
|
||||
* @param requestBody the request body with JSON data
|
||||
* @return JSON array of the existing primary keys or error response
|
||||
*/
|
||||
protected Response existing(InputStream requestBody) { %*\ldots*) }
|
||||
}
|
||||
\end{lstlisting}
|
||||
\begin{lstlisting}[caption=Interfaccia della classe \textit{CRUDRESTController}, label=crudrest-java, language=Java]
|
||||
/**
|
||||
* A REST Controller readable and writable
|
||||
* @param <T> The readable and writable entity class
|
||||
*/
|
||||
public abstract class CRUDRESTController<T extends CRUDable, U extends
|
||||
PrimaryKey<T>> extends ReadableRESTController<T, U> {
|
||||
|
||||
/**
|
||||
* A standard edit route body. Edits an entity and returns a JSON
|
||||
* response, both on success and on error.
|
||||
*
|
||||
* @param filterOne map containing columns and relative values of the
|
||||
* primary key of the entity to edit
|
||||
* @param form request data containing the fields to edit
|
||||
* @return JSON response, positive or negative
|
||||
*/
|
||||
protected Response edit(Map<String, Object> filterOne,
|
||||
MultivaluedMap<String, String> form) { %*\ldots*) }
|
||||
|
||||
/**
|
||||
* A standard edit route body. Edits an entity and returns a JSON
|
||||
* response, both on success and on error.
|
||||
*
|
||||
* @param pKey the entity primary key
|
||||
* @param form request data containing the fields to edit
|
||||
* @return JSON response, positive or negative
|
||||
*/
|
||||
protected Response edit(PrimaryKey<T> pKey,
|
||||
MultivaluedMap<String, String> form) { %*\ldots*) }
|
||||
|
||||
/**
|
||||
* A standard delete route body. Deletes an entity and returns a JSON
|
||||
* response, both on success and on error.
|
||||
*
|
||||
* @param pKey the entity primary key
|
||||
* @return JSON response, positive or negative
|
||||
*/
|
||||
protected Response delete(PrimaryKey<T> pKey) { %*\ldots*) }
|
||||
|
||||
/**
|
||||
* A standard delete route body. Deletes an entity and returns a JSON
|
||||
* response, both on success and on error.
|
||||
*
|
||||
* @param filterOne map containing columns and relative values of the
|
||||
* primary key of the entity to delete
|
||||
* @return JSON response, positive or negative
|
||||
*/
|
||||
protected Response delete(Map<String, Object> filterOne) { %*\ldots*) }
|
||||
|
||||
/**
|
||||
* A standard create route body. Creates an entity and returns a JSON
|
||||
* response, both on success and on error.
|
||||
*
|
||||
* @param form request data containing the entity column values
|
||||
* @return JSON response, positive or negative
|
||||
*/
|
||||
protected Response create(MultivaluedMap<String, String> form) { %*\ldots*) }
|
||||
|
||||
%*\ldots*)
|
||||
}
|
||||
\end{lstlisting}
|
||||
\end{it}
|
||||
|
||||
\begin{it}
|
||||
|
@ -425,6 +643,7 @@ Le fasi del progetto, di cui le date di inizio e di fine sono indicate nel diagr
|
|||
\pagenumbering{gobble}
|
||||
|
||||
\listoffigures
|
||||
\lstlistoflistings
|
||||
\printbibliography
|
||||
|
||||
\end{document}
|
||||
|
|
Reference in a new issue