diff --git a/english.pdf b/english.pdf deleted file mode 100644 index 6474754..0000000 Binary files a/english.pdf and /dev/null differ diff --git a/italian.pdf b/italian.pdf deleted file mode 100644 index 1ee335f..0000000 Binary files a/italian.pdf and /dev/null differ diff --git a/main.tex b/main.tex index 8039909..a553a34 100644 --- a/main.tex +++ b/main.tex @@ -35,7 +35,7 @@ \end{en} \def\mdauthor{Claudio Maggioni} \def\mddate{\today} -\def\mdrevision{5} +\def\mdrevision{6} % header and footer style \clearscrheadfoot @@ -281,9 +281,9 @@ di successo che in errore. \end{itemize} - Seguono le interfaccie delle classi \textit{CRUDUtils}, \textit{JsonProducer}, + Seguono le interfacce delle classi \textit{CRUDUtils}, \textit{JsonProducer}, \textit{ReadableRESTController} e \textit{CRUDRESTController}, complete di - Javadoc. + Javadoc (in inglese, come presente nei sorgenti originali). \end{it} \begin{lstlisting}[caption=Interfaccia della classe \textit{JsonProducer}, label={lst:jsonprd-java}, language=Java] @@ -505,6 +505,138 @@ public abstract class CRUDRESTController}. Di conseguenza, le classi ``entità'' che estendono CRUDable + possono essere usate per operazioni di scrittura, come quelle implementate + da \textit{CRUDRESTController}. +\end{it} + +\begin{lstlisting}[caption=Interfaccia della classe \textit{CRUDUtils}, label={lst:crudutils-java}, language=Java] + +/** + * Database access class. Access statically + */ +public abstract class CRUDUtils { + + /** + * Interface containing a function able to generate an Hibernate Query + * object and execute it by getting a generic response given the + * session + * + * @param the response type + */ + public interface HBMInteraction { + T execute(Session s); + } + + /** + * Interface containing a function able to generate an Hibernate Query + * object and execute it by getting a list of rows given the session + */ + public interface HBMQuery extends HBMInteraction> { + List execute(Session s); + } + + /** + * Number of items on a single page. Used when pagination is requested + */ + public static final int ITEMSPERPAGE = %*\ldots*); + + %*\ldots*) + + private static final Logger log = %*\ldots*); + + /** + * Save a writable entity on the database + * + * @param o the entity to save + * @param type of the entity. Must be readable and writable + * @return boolean true = success, false = error + */ + public static boolean persist(final T o) { %*\ldots*) } + + /** + * Delete a writable entity on the database + * + * @param toDelete the entity to delete + * @param type of the entity. Must be readable and writable + * @return boolean true = success, false = error + */ + public static boolean delete(final T toDelete) + { %*\ldots*) } + + %*\ldots*) + + /** + * Execute a query which returns data of a generic type + * + * @param query HBMInteraction implementation + * @param The returning type + * @return the data + */ + public static T executeHBMInteraction(HBMInteraction query) + { %*\ldots*) } + + /** + * Get a list of entities + * + * @param tClass class of the entities + * @param restrictions map of names of fields and their values which + * must be equal in the fetched entities + * (null accepted if not used) + * @param criteria list of additional filters (Hibernate Criterion + * objects, null accepted if not used) + * @param entity type. Must be readable + * @param o order of the entities (Hibernate Order, null accepted if + * not used) + * @param page the page number to fetch (starts at 1, null accepted if + * not used) + * @return the list of entities + */ + public static List get(Class tClass, + Map restrictions, List criteria, + Order[] o, Integer page) { %*\ldots*) } + + /** + * Get a list of entities + * + * @param tClass class of the entities + * @param entity type. Must be readable + * @return the list of entities + */ + public static List get(Class tClass) { %*\ldots*) } + + + /** + * Get a single entity + * + * @param tClass class of the entities + * @param restrictions map of names of fields and their values which + * must be equal in the fetched entities + * (null accepted if not used) + * @param entity type. Must be readable + * @return the list of entities + */ + public static T getOne(Class tClass, + Map restrictions) { %*\ldots*) } + + /** + * Get a single entity + * + * @param tClass class of the entities + * @param pk the primary key object of the entity + * @param entity type. Must be readable and contain a primary key + * object + * @return the list of entities + */ + public static T getOne(Class tClass, + PrimaryKey pk) { %*\ldots*) } +} +\end{lstlisting} + \begin{it} Oltre a quanto mostrato, \textit{restaurant} contiene vari metodi utilità per la gestione di file \texttt{.properties}, per la validazione dei dati in