Added listing for restaurant client
This commit is contained in:
parent
e15a5182f2
commit
ba1808d112
2 changed files with 116 additions and 1 deletions
BIN
italian.pdf
BIN
italian.pdf
Binary file not shown.
117
main.tex
117
main.tex
|
@ -606,7 +606,7 @@ public abstract class CRUDUtils {
|
||||||
* @param tClass class of the entities
|
* @param tClass class of the entities
|
||||||
* @param <T> entity type. Must be readable
|
* @param <T> entity type. Must be readable
|
||||||
* @return the list of entities
|
* @return the list of entities
|
||||||
*/
|
*/
|
||||||
public static <T extends Readable> List<T> get(Class<T> tClass) { %*\ldots*) }
|
public static <T extends Readable> List<T> get(Class<T> tClass) { %*\ldots*) }
|
||||||
|
|
||||||
|
|
||||||
|
@ -647,6 +647,121 @@ public abstract class CRUDUtils {
|
||||||
\begin{it}
|
\begin{it}
|
||||||
\subsubsection{\textit{restaurant} -- lato client}
|
\subsubsection{\textit{restaurant} -- lato client}
|
||||||
\end{it}
|
\end{it}
|
||||||
|
\begin{lstlisting}[caption=Interfaccia della classe \textit{RESTService}, label={lst:restservice-ts}, language=Java]
|
||||||
|
export class RESTService {
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read all the pages of an entity in order to save them for offline
|
||||||
|
* readings.
|
||||||
|
*
|
||||||
|
* @param {{ new(): T }} - class of the table to read
|
||||||
|
* @param {any} - key data for the search. Must not contain filters
|
||||||
|
* or a field with key '_page'
|
||||||
|
* @return {Promise<boolean>} boolean promise that resolves when the
|
||||||
|
* reading has been done, true if succesful,
|
||||||
|
* false if not
|
||||||
|
*/
|
||||||
|
public bulkRead<T extends Table>(type: TableStatic, restrictions?: any):
|
||||||
|
Promise<boolean> { ... }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a list of entities. When online and requested without
|
||||||
|
* filters, the list is saved in the offline storage. When offline,
|
||||||
|
* the data from the offline storage is read and filtered accordingly.
|
||||||
|
*
|
||||||
|
* Request criteria regarding directly properties of the entity MUST
|
||||||
|
* have the following format:
|
||||||
|
*
|
||||||
|
* 'attr-' + name_of_property[.nested] [+ '||' + other_property] +
|
||||||
|
* ('-like' | '-eq' | '-flag' | '-gt' | '-lt' | '-gte' | '-lte')
|
||||||
|
*
|
||||||
|
* Multiple field names separed by '||' state that the search must be
|
||||||
|
* done on multiple fields with a logic OR.
|
||||||
|
*
|
||||||
|
* The different suffixes denote different logical criteria. Look up
|
||||||
|
* the documentation of meetsCriteriaFilter*(...) methods in
|
||||||
|
* order to get detailed info on each one.
|
||||||
|
*
|
||||||
|
* @param {{ new(): T }} type - type of the table to read
|
||||||
|
* @param {number} page - number of the page starting at 1 (in offline
|
||||||
|
* mode, a 20 entities slice; in online mode,
|
||||||
|
* as defined by the server). -1 is for no
|
||||||
|
* pagination
|
||||||
|
* @param {any} restrictions - restrictions required by the server,
|
||||||
|
* and filters.
|
||||||
|
* @param {boolean} offline - whether to fetch (true) or not (false)
|
||||||
|
* offline entities to sync. Defaults to true
|
||||||
|
* @return {Promise<T[]>} - promise of the expanded list, unsuccesful
|
||||||
|
* when the storage readings are unsuccesful
|
||||||
|
*/
|
||||||
|
public read<T extends Table>(type: TableStatic, page: number,
|
||||||
|
restrictions?: any, addOffline?: boolean): Promise<T[]> { ... }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asks to the server which entity instances of the ones
|
||||||
|
* saved in the offline storage exist and deletes the
|
||||||
|
* ones that do not exist on the server.
|
||||||
|
*
|
||||||
|
* @param {TableStatic} type - the entity type
|
||||||
|
* @return {Promise<void>} promise rejecting only if an error occurs
|
||||||
|
*/
|
||||||
|
private async existing(type: TableStatic): Promise<void> { ... }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reads a single entity, even in the offline storage if offline.
|
||||||
|
*
|
||||||
|
* @param {{ new(): T }} type - class of the entity to read
|
||||||
|
* @param {any} keyData - the primary key fields and their values
|
||||||
|
* in a JS Object, plus the 'id' field of
|
||||||
|
* type string used in the end bit of the
|
||||||
|
* request path.
|
||||||
|
* @return {Promise<T>} - promise of the element, unsuccesful if
|
||||||
|
* not found.
|
||||||
|
*/
|
||||||
|
public readOne<T extends Table>(type: TableStatic | string,
|
||||||
|
keyData: any): Promise<T> { ... }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates an entity on the server or, if offline, saves it in the
|
||||||
|
* offline sync queue.
|
||||||
|
*
|
||||||
|
* @param {{ new(): T }} type - class of the entity to be saved
|
||||||
|
* @param {T} value - the entity to save
|
||||||
|
* @param {any} keyData - the primary key fields and their values
|
||||||
|
* in a JS Object, plus the 'id' field of
|
||||||
|
* type string used in the end bit of the
|
||||||
|
* request path.
|
||||||
|
* @return {Promise<T>} - promise of the saved element.
|
||||||
|
*/
|
||||||
|
public update<T extends Table>(type: TableStatic | string, value: T,
|
||||||
|
keyData: any): Promise<T> { ... }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an entity on the server or, if offline, saves it in the
|
||||||
|
* offline sync queue.
|
||||||
|
*
|
||||||
|
* @param {{ new(): T }} type - class of the entity to be deleted
|
||||||
|
* @param {string} id - string used in the end bit of the request path.
|
||||||
|
* @param {any} keyData - the primary key fields and their values in
|
||||||
|
* a JS Object
|
||||||
|
* @return {Promise<T>} - promise of the element deleted
|
||||||
|
*/
|
||||||
|
public create<T extends Table>(type: TableStatic | string, value: T):
|
||||||
|
Promise<T> { ... }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes an entity on the server or, if offline, marks it for
|
||||||
|
* deletion in the offline sync queue.
|
||||||
|
*
|
||||||
|
* @param {{ new(): T }} type - class of the entity to be saved
|
||||||
|
* @return {Promise<T>} - promise of the element created.
|
||||||
|
*/
|
||||||
|
public delete<T extends Table>(type: TableStatic | string, keyData: any):
|
||||||
|
Promise<T> { ... }
|
||||||
|
}
|
||||||
|
\end{lstlisting}
|
||||||
|
|
||||||
\begin{it}
|
\begin{it}
|
||||||
\subsection{Stato del progetto}
|
\subsection{Stato del progetto}
|
||||||
|
|
Reference in a new issue