LIFERAY DEVELOPER CONFERENCE
Using the Recycle Bin in
your applications
Giving a second chance to your content
Julio Camarero @juliocamarero
Sergio González @sgonzalezortiz
#LRDevCon2013
demo
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Adding Recycle
Bin to your app
30 min
millions of users
easy
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
* Entities (service builder)
* Assets (helps)
* Indexed Entities
(see later talk)
* Workflow (helps)
Prerequisites
https://github.com/juliocamarero/jukebox
demo
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Moving entries to the
Recycle Bin
Step 1
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Set trash-enabled=true in Service Builder
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Set trash-enabled=true in Service Builder
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Set trash-enabled=true in Service Builder
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Implement TrashHandlers
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
and define it in liferay-portlet.xml
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Service methods moveSongToTrash()
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Service methods moveSongToTrash()
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Service methods moveSongToTrash()
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
... called from Action (MVC Portlet)
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
... called from Action (MVC Portlet)
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
... called from Action (MVC Portlet)
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
... called from Action (MVC Portlet)
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
... Used from the UI
demo
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
trashRenderer
Implement your own and define it in in liferay-portlet.xml
OR
Reuse AssetRenderer
demo
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Restoring entries
from the Recycle Bin
Step 2
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Restore from trash
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Restore from trash
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Restore from trash
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Restore from trash
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Restore from trash
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Restore from trash
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Apply to trashHandler
Implement restoreTrashEntry method by calling to the new
service method
demo
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Upss.... (undo)
Step 3
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
... the code to restore the song...
the code to display the taglib...
demo
the code to display the taglib...
demo
the code to display the taglib...
demo
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Moving/restoring
albums to the
Recycle Bin
Step 4
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Container-model=true in Service Builder
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Container-model=true in Service Builder
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Container-model=true in Service Builder
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Special care with containers
Methods moveDependentsToTrash and
restoreDependentsFromTrash
1. Update status of the song
2. Add trashVersion entity (instead of trashEntry)
3. Update asset visibility
4. Reindex the new entity
demo
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Resolving conflicts
Step 5
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
1. Rename on removal (TrashUtil.getTrashTitle)
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
1. Rename on removal (TrashUtil.getTrashTitle)
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
1. Rename on removal (TrashUtil.getTrashTitle)
2. Restore name on restoral (TrashUtil.getOriginalTitle)
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
1. Rename on removal (TrashUtil.getTrashTitle)
2. Restore name on restoral (TrashUtil.getOriginalTitle)
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
1. Rename on removal (TrashUtil.getTrashTitle)
2. Restore name on restoral (TrashUtil.getOriginalTitle)
3. Put the name logic on the trashRenderer
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
1. Rename on removal (TrashUtil.getTrashTitle)
2. Restore name on restoral (TrashUtil.getOriginalTitle)
3. Put the name logic on the trashRenderer
4. Implement 2 methods in the trashHandler:
checkDuplicateTrashEntry / updateTitle
demo
LIFERAY DEVELOPER CONFERENCE 2013DEV
CON
LIFERAY
Thank you!
@juliocamarero
@sergiogonzalez
julio.camarero@liferay.com
sergio.gonzalez@liferay.com
if you liked it, vote in the app :)

Using the Recycle Bin Framework in Liferay 6.2