Merge branch 'master' of ssh://maggioni.xyz:2222/praticamentetilde/tesiMaturita
This commit is contained in:
commit
ecab59c534
2 changed files with 127 additions and 3 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -243,5 +243,3 @@ TSWLatexianTemp*
|
||||||
|
|
||||||
# outputs that are not the thesis
|
# outputs that are not the thesis
|
||||||
*.pdf
|
*.pdf
|
||||||
!/english.pdf
|
|
||||||
!/italian.pdf
|
|
||||||
|
|
128
main.tex
128
main.tex
|
@ -658,7 +658,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*) }
|
||||||
|
|
||||||
|
|
||||||
|
@ -698,7 +698,133 @@ public abstract class CRUDUtils {
|
||||||
|
|
||||||
\begin{it}
|
\begin{it}
|
||||||
\subsubsection{\textit{restaurant} -- lato client}
|
\subsubsection{\textit{restaurant} -- lato client}
|
||||||
|
La parte client della libreria \textit{restaurant} è implementata con il
|
||||||
|
linguaggio \textit{TypeScript}, un'estensione di \textit{Javascript}
|
||||||
|
che aggiunge tipizzazione statica, i classici costrutti della programmazione
|
||||||
|
ad oggetti, nonchè il supporto alle generiche. Segue il listato dell'interfaccia della
|
||||||
|
classe \textit{RESTService}, la quale contiene metodi statici per comunicare
|
||||||
|
con il server asincronamente tramite istanze di classi-entità, cioè classi
|
||||||
|
figlie della classe astratta \textit{Table}.
|
||||||
\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 the 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
|
||||||
|
* @param {any} keyData - the primary key fields and their values in
|
||||||
|
* a JS Object, plus the 'id' field of type string
|
||||||
|
* that goes in the end bit of the request
|
||||||
|
* path
|
||||||
|
* @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