

% add the PATH to retrieve cls and sty beamer styles files
\makeatletter
\providecommand*{\input@path}{}
\edef\input@path{{../../support/beamer/}\input@path}% prepend
\makeatother

% \documentclass{pharoslides}
% \documentclass[aspectratio=169]{pharoslides} % format 16/9
\documentclass[withvideo]{pharoslides} % format 16/9 + incrustation video

\graphicspath{{./figures/}{../}{../../support/beamer/imgs/}}

%Information to be included in the title page:
\title{Seaside: A Glance at MetaData and REST}
\subtitle{}
\author{Damien Cassou, Stéphane Ducasse and Luc Fabresse}
\institute{http://stephane.ducasse.free.fr}
\date{}
\slidesid{W4S10}

\begin{document}

\frame[plain]{\titlepage}



\begin{frame}[fragile]

\frametitle{Magritte: Taking Advantages of MetaData}

\begin{itemize}
\item Describe once
\item Generate many times
\item No more manually created forms
\item Seaside component automatic generation
\end{itemize}
\end{frame}



\begin{frame}[fragile]

\frametitle{Address}


\begin{center}
\includegraphics[width=1.0\textwidth]{figures/Address.png}\end{center}

\end{frame}



\begin{frame}[fragile]

\frametitle{Address Description}


\begin{center}
\includegraphics[width=1.2\textwidth]{figures/AddressDescription.png}\end{center}

\end{frame}



\begin{frame}[fragile]

\frametitle{Describe}

\begin{listing}{}
Address >> descriptionStreet
   ^ MAStringDescription new
        autoAccessor: #street;
        label: 'Street';
        priority: 100

Address >> descriptionPlz
   ^ MANumberDescription new
        autoAccessor: #plz;
        priority: 200; label: 'PLZ';
        beRequired;
        min: 1000; 
        max: 9999
\end{listing}
\end{frame}



\begin{frame}[fragile]

\frametitle{Interpret}

\begin{listing}{}
anAddress description do: [ :description |
   Transcript
       show: description label; show: ':'; tab;
       show: (description toString: (anAddress readUsing: description));
       cr ]
\end{listing}

\begin{listing}{}
Street:	Schutzenmattstrasse
PLZ:	3012
Place:	Bern
Canton:	Bern
\end{listing}
\end{frame}



\begin{frame}[fragile]

\frametitle{Generate Forms}

\begin{listing}{}
self call: (anAddress asComponent addValidatedForm; yourself)
\end{listing}


\begin{center}
\includegraphics[width=0.35\textwidth]{figures/AddressForms.png}\end{center}

\end{frame}



\begin{frame}[fragile]

\frametitle{Generate Automatic Reports}


\begin{center}
\includegraphics[width=1.0\textwidth]{figures/Seaside-Quuve2.jpg}\end{center}

\end{frame}



\begin{frame}[fragile]

\frametitle{Seaside-REST}

\begin{itemize}
\item Smooth and easy integration
\item Annotation of domain objects
\item Natural conversion
\end{itemize}
\end{frame}



\begin{frame}[fragile]

\frametitle{Filter Definition}

\begin{listing}{}
WARestfulFilter subclass: #TBRestfulFilter
	instanceVariableNames: ''
	classVariableNames: ''
	package: 'TinyBlog-REST'
\end{listing}

\begin{listing}{}
TBApplicationRootComponent class >> initialize
	   "self initialize"
	   | app |
	   app := WAAdmin register: self asApplicationAt: 'TinyBlog'.
	   app
	      addLibrary: JQDeploymentLibrary;
	      addLibrary: JQUiDeploymentLibrary;
	      addLibrary: TBSDeploymentLibrary.
	   app addFilter: TBRestfulFilter new.
\end{listing}
\end{frame}



\begin{frame}[fragile]

\frametitle{Getting All Blogs}


\begin{center}
\includegraphics[width=1.0\textwidth]{figures/RESTlistAll.png}\end{center}

\end{frame}



\begin{frame}[fragile]

\frametitle{Getting All blogs}

\begin{listing}{}
TBRestfulFilter >> listAll
  <get>
  <produces: 'text/json'>

  ^ String streamContents: [ :astream | 
  		TBBlog current allBlogPosts
			do: [ :each | each javascriptOn: stream ]
			separatedBy: [ stream << ',' ] ] 
\end{listing}
\end{frame}



\begin{frame}[fragile]

\frametitle{Finding a Blog}


\begin{center}
\includegraphics[width=1.0\textwidth]{figures/RestPost.png}\end{center}

\end{frame}



\begin{frame}[fragile]

\frametitle{Finding a Blog}

\begin{listing}{}
TBRestfulFilter >> post: title
  <get>
  <path: 'post/{title}'>
  <produces: 'text/json'>
  | post |
  post := TBBlog current postWithTitle: title.
  post ifNil: [ ^ self notFound ]. 
  ^ String streamContents: [ :astream | 
         post javascriptOn: astream ]
\end{listing}
\end{frame}



\begin{frame}[fragile]

\frametitle{With Search}

\begin{listing}{}
TBRestfulFilter >> search: title
   <get>
   <path: 'search?title={title}'>
   <produces: 'text/json'>
   | post |
   post := TBBlog current postWithTitle: title.
   post ifNil: [ ^ self notFound ]. 
   ^ String streamContents: [ :astream | 
		post javascriptOn: astream attributes: #(title category date text) ]
\end{listing}

\begin{listing}{}
http://localhost:8080/TinyBlog/search?title=Welcome%20in%20TinyBlog
\end{listing}
\end{frame}



\begin{frame}[fragile]

\frametitle{Conclusion}

\begin{itemize}
\item Seaside supports the other REST API (Delete, Post, Get,...)
\item Seaside coupled with Magritte offers a really powerful combination
\item REST is nicely integrated in Seaside-REST
\item Have a look at Teapot for another REST solution
\end{itemize}
\end{frame}




% \setlength{\textwidth}{\originaltextwidth}
\setbeamertemplate{background canvas}{\insertBorderForHandout}

\begin{frame}[plain]

\begin{minipage}{\originaltextwidth}
\centering
\large


\vspace{2em}

A course by

\vspace{1em}

\hspace{-20px}\includegraphics[height=32px]{inriaLogo}\hspace{3em}\raisebox{7px}{and}\hspace{3em}\raisebox{-6px}{\includegraphics[height=30px]{logoutop}}

\vspace{2em}

in collaboration with

\vspace{1em}

\includegraphics[height=40px]{unisciellogo}\hskip 1.5em%
\raisebox{5px}{\includegraphics[height=30px]{unitlogo}}\hskip 2em%
\raisebox{8px}{\includegraphics[height=24px]{univLilleLogo}}\hskip 2em%
\raisebox{3px}{\includegraphics[height=29px]{logo-IMT}}\hskip 2em%
\raisebox{1px}{\includegraphics[height=32px]{minesDouaiLogo}}

\vspace{2.5em}

\includegraphics[width=50px]{by-nc-nd} \tiny \hskip 0.5em \raisebox{5px}{Inria 2016}

\medskip

\tiny
Except where otherwise noted, this work is licensed under CC BY-NC-ND 3.0 France

\url{https://creativecommons.org/licenses/by-nc-nd/3.0/fr/} 

\end{minipage}
\end{frame}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
