Liferay in action : the official guide to Liferay Portal development

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): Rich Sezov
Publisher: Manning
Year: 2012

Language: English
Pages: 378
City: Shelter Island, NY
Tags: Библиотека;Компьютерная литература;Java;

Liferay in Action......Page 1
brief contents......Page 6
contents......Page 8
foreword......Page 14
preface......Page 16
acknowledgments......Page 18
Who should read this book......Page 21
Roadmap......Page 22
Code conventions and downloads......Page 23
About the author......Page 24
about the cover illustration......Page 25
Part 1 Working with Liferay and portlets......Page 26
1 The Liferay difference......Page 28
1.1 The Java portal promise: from disappointment to fulfillment......Page 29
1.1.1 The Java portal disappointment......Page 31
1.1.2 Liferay keeps the Java portal promises......Page 33
1.2 Getting to know Liferay......Page 34
1.2.1 Liferay is an application aggregator......Page 35
1.2.2 Liferay is a content manager......Page 37
1.2.3 Liferay is a collaboration tool......Page 39
1.2.4 Liferay is anything you want it to be and any way you want it to look......Page 40
1.2.5 What has this little exercise accomplished?......Page 42
1.3.1 The high-level view......Page 43
1.3.3 Configuring a portlet’s scope......Page 45
1.4 Getting around in Liferay......Page 48
1.4.3 Manage menu......Page 49
1.5 Imagining your site in Liferay......Page 51
1.5.1 Asking the right questions......Page 52
1.6 Summary......Page 53
2 Getting started with the Liferay development platform......Page 55
2.1 Installing Liferay and the Plugins SDK......Page 56
2.1.1 Installing the Java SDK......Page 57
2.1.2 Installing a Liferay bundle......Page 58
2.2.2 Setting up a database......Page 60
2.2.3 Connecting Liferay to the SQL database......Page 62
2.3.1 Installing Ant......Page 63
2.3.3 Configuring the Plugins SDK......Page 64
2.3.4 Configuring a non-Tomcat application server......Page 66
2.4 Developing a portlet plugin......Page 67
2.4.2 Deploying the Hello World plugin......Page 68
2.5 Making Hello World into Hello You......Page 70
2.5.1 Anatomy of a portlet project......Page 71
2.5.2 Configuring Hello You......Page 72
2.5.3 Portlet initialization and implementing View mode......Page 74
2.5.4 URLs in portals are different......Page 77
2.5.5 Implementing Edit mode......Page 78
2.6 Deploying and testing your portlet......Page 82
2.6.1 Changing the portlet’s category and name......Page 83
2.6.2 Telling Liferay about a renamed portlet......Page 85
2.7 Summary......Page 86
Part 2 Writing applications on Liferay’s platform......Page 88
3.1 Introducing Inkwell: a case study......Page 90
3.1.1 Company profile: Inkwell......Page 91
3.1.3 Inkwell’s high-level portal design......Page 92
3.1.4 Inkwell portal phase 1 requirements......Page 93
3.2.1 A blueprint of the portlet......Page 94
3.2.2 Designing the database tables......Page 95
3.3 Generating DB code with Service Builder......Page 97
3.3.1 Filling a definite need......Page 98
3.3.2 Creating the service.xml file......Page 100
3.3.3 Running Service Builder......Page 102
3.4.1 Why layering is important......Page 103
3.4.2 Using two layers for persistence......Page 104
3.4.3 Implementing the DTO layer......Page 105
3.5.1 Defining table relationships......Page 109
3.5.2 Sharing services......Page 112
3.5.3 Adding registered users and their products......Page 113
3.6 Summary......Page 115
4 MVC the Liferay way......Page 116
4.1 Using Model-View-Controller......Page 117
4.1.1 Edit mode? What Edit mode?......Page 118
4.1.2 MVC according to Liferay......Page 120
4.2 Configuring the portlet project......Page 121
4.2.1 Defining portlets in your deployment descriptors......Page 122
4.2.2 Having one location for JSP dependencies......Page 124
4.3.1 Getting started with AlloyUI tag libraries......Page 127
4.3.2 Providing feedback and messages......Page 130
4.3.3 Translating messages to multiple languages......Page 133
4.3.4 Validating user-submitted forms......Page 134
4.3.6 Using the search container to present your data......Page 136
4.3.7 Editing and deleting data......Page 139
4.3.9 Pointing to the permissions configuration......Page 141
4.3.10 Configuring Liferay permissions......Page 142
4.4 Generating different field types with AlloyUI taglibs......Page 145
4.4.1 Generating date pickers......Page 146
4.4.2 Selecting data with AlloyUI taglibs......Page 147
4.5 Using Liferay’s MVC makes your portlets simpler......Page 149
4.6 Summary......Page 151
5 Designing your site with themes and layout templates......Page 153
5.1 Understanding themes and their structure......Page 154
5.1.2 Deconstructing a theme......Page 156
5.2 Understanding theme markup, CSS, and JavaScript......Page 157
5.2.1 How markup works in a theme......Page 158
5.2.2 Using CSS in themes......Page 159
5.2.3 Using JavaScript in themes......Page 160
5.3.1 You get components......Page 161
5.3.2 You get good design......Page 162
5.3.3 Using Liferay custom JavaScript......Page 163
5.4.1 Limiting themes by company......Page 165
5.4.2 Modifying the default paths......Page 166
5.4.4 Conditional settings......Page 167
5.4.6 Color schemes......Page 169
5.5.1 Using Liferay’s styling conventions......Page 171
5.5.2 Using Liferay’s CSS coding conventions......Page 173
5.6.1 Creating layout template projects......Page 174
5.6.2 Anatomy of a layout template......Page 175
5.8 Summary......Page 177
6 Making your site social......Page 179
6.1 Social networking: why is it important?......Page 180
6.1.2 Expanding your reach beyond your own site......Page 181
6.1.3 Creating a dynamic, more positive user experience......Page 182
6.3 Understanding Liferay’s social features......Page 183
6.3.3 Sending social requests......Page 184
6.4 Using profile pages......Page 185
6.4.1 Identifying a portlet......Page 186
6.4.2 Defining content for public and private pages......Page 187
6.5.2 Coding for relationships......Page 189
6.6 Implementing social activities in your portlets......Page 192
6.6.1 Adding an activity in the service layer......Page 193
6.6.2 Giving the Activities portlet an interpretation of a custom activity......Page 197
6.7 Summary......Page 200
7 Enabling user collaboration......Page 201
7.1 Building a collaborative app: a slogan contest......Page 203
7.2 Adding assets to your applications......Page 204
7.2.1 Adding assets with entities......Page 205
7.2.2 Using asset renderers to publish your data......Page 209
7.3 Running your data through a workflow......Page 213
7.3.1 Understanding the flow of Liferay workflow......Page 214
7.3.2 Workflow-enabling your services......Page 215
7.3.3 Handily handling workflow......Page 216
7.3.4 Portal-wide language properties......Page 218
7.4.1 Choosing between tags and categories......Page 221
7.4.2 A tag for tags and a tag for categories......Page 222
7.5 Adding discussions and ratings......Page 224
7.6 Creating custom queries using SQL......Page 225
7.6.1 Crafting your query......Page 226
7.6.2 Making your own finder......Page 227
7.6.3 Displaying custom columns in a search container......Page 229
7.7 Summary......Page 231
Part 3 Customizing Liferay......Page 234
8 Hooks......Page 236
8.1 What is a hook?......Page 237
8.1.2 Hook basics......Page 238
8.2 What hooks can customize......Page 239
8.2.1 Customizing portal properties......Page 240
8.2.2 Customizing portal event properties......Page 241
8.2.4 Customizing language properties......Page 242
8.2.5 Customizing JSP files......Page 243
8.2.6 Customizing services......Page 244
8.3 Hooks in action: customizing Inkwell’s shopping cart......Page 246
8.3.1 Generating a service layer in a hook......Page 248
8.3.2 Creating the configuration file......Page 250
8.3.3 Overriding Liferay’s service......Page 252
8.3.4 Overriding the Shopping portlet’s interface......Page 255
8.3.5 Expandos, ServiceContext, and tokens, oh my!......Page 256
8.3.6 Presenting the new interface to end users......Page 260
8.4 Summary......Page 264
9 Extending Liferay effectively......Page 266
9.1 Introducing Ext plugins......Page 268
9.1.1 Anatomy of an Ext plugin......Page 269
9.1.2 How Ext works......Page 270
9.1.3 The Ext strategy......Page 271
9.1.4 Deploying Ext plugins......Page 272
9.2.1 Struts 101......Page 274
9.2.2 Modifying a core portlet action......Page 276
9.2.3 Other extension points for the Ext plugin......Page 277
9.3 Delivering a page, Liferay style......Page 278
9.3.1 Struts? Again?......Page 279
9.3.2 Layers and layers......Page 280
9.4.1 Practices for developing applications......Page 282
9.4.2 Practices for customizing Liferay......Page 283
9.4.3 Deciding if you need Ext......Page 284
9.5 Summary......Page 286
10 A tour of Liferay APIs......Page 288
10.1 Making URLs friendly......Page 290
10.1.1 Declaring the mapper......Page 291
10.1.2 Making the unfriendly URL friendly......Page 292
10.1.3 Passing parameters with friendly URLs......Page 293
10.2.1 Conventions instead of configuration......Page 295
10.2.2 Implementing an ActionCommand......Page 296
10.3 Filtering content at the view level......Page 297
10.4.1 Building the service.xml file......Page 298
10.4.2 Wiring the data source up with Spring......Page 300
10.5 Sending messages over Liferay’s message bus......Page 302
10.5.1 Configuring the bus to send your messages......Page 303
10.5.2 Implementing the sender and the listener......Page 305
10.6 Scheduling jobs......Page 306
10.7 Indexing and search......Page 307
10.7.1 Indexing your data......Page 308
10.7.2 Searching your data......Page 312
10.8 Summary......Page 317
appendix A Liferay and IDEs......Page 320
A.1 Eclipse......Page 321
A.1.1 Eclipse and workspaces......Page 322
A.1.2 Server runtime......Page 323
A.1.3 Setting up a plugin project......Page 325
A.1.5 Debugging and deploying......Page 327
A.2.1 Getting started with Liferay IDE......Page 328
A.2.2 Adding runtimes......Page 329
A.2.3 Working with the Plugins SDK......Page 330
A.2.4 Creating and importing projects......Page 331
A.3.1 Server runtime......Page 332
A.3.2 Setting up a project......Page 334
A.3.4 Project settings......Page 336
B.1 Portlets as fragments of a web page......Page 337
B.3 Understanding the structure of a portlet......Page 339
C.1 History of the portlet specification......Page 341
C.1.2 Portlet 2.0: a bit of a reboot......Page 342
C.2 Portlets conversing about baseball......Page 343
C.3 Creating and refactoring the project......Page 344
C.4.2 Identifying the event receiver......Page 346
C.5 Structuring the Pitcher portlet......Page 347
C.6 Structuring the Catcher portlet......Page 349
C.7.1 liferay-portlet.xml......Page 351
C.7.2 liferay-display.xml......Page 352
C.9 Some notes about events......Page 353
appendix D How to contribute to Liferay......Page 356
D.2 Taking advantage of community programs......Page 358
D.4 Contributing bug reports and feature suggestions......Page 359
E.1 Reviewing document handling in Liferay......Page 360
E.1.1 Connecting to repositories in 6.0 and below......Page 361
E.1.2 Storing and retrieving documents: the low-level API......Page 362
E.1.3 Limitations of the Document Library in 6.0 and below......Page 363
E.2 Managing documents in Liferay 6.1......Page 364
E.2.2 Using the Document Library Application API......Page 366
A......Page 368
D......Page 369
H......Page 370
L......Page 371
O......Page 372
P......Page 373
S......Page 374
U......Page 375
Y......Page 376
Liferay in Action-back......Page 378