Monday, April 25, 2011

Alfresco Developer Guide







Table of Contents
Preface 1
Chapter 1: The Alfresco Platform 7
Alfresco in the Real World 7
Basic Document Management 8
Web Content Management 11
Content Authoring Tools 11
Separation of Presentation from Content 11
Systematic Publication or Deployment 12
Alfresco WCM Example 12
Custom Content-Centric Applications 14
Example Used throughout This Book 16
Alfresco Architecture 18
High-Level Architecture 18
Add-Ons 19
Open Source Components 19
Major Standards and Protocols Supported 21
Customizing Alfresco 22
Basic Customization 22
Dashlets 22
Custom Views 23
Rules and Rule Actions 24
Simple Workflow 24
Advanced Customization 25
Examples of Advanced Customizations 25
Extend the Content Model 25
Perform Automatic Operations on Content 26
Customize the Web Client 26
Create a RESTful API 26
Streamline Complex Business Processes with Advanced Workflows 27
Get Your Web sites under Control 27
Integrate with Other Systems 27
Dusting Off Your Toolbox 28
What about Adobe Flex? 29
Understanding Alfresco's Editions 29
Significant Feature Differences 30
What's Used in This Book 30
Summary 30
Chapter 2: Getting Started with Alfresco 33
Obtaining the SDK 34
Step-by-Step: Building Alfresco from Source 34
Setting up the SDK in Eclipse 35
Step-by-Step: Imprting the SDK into Eclipse 35
Extending Alfresco 37
Understanding the Extension Mechanism 38
Standard Java Web Application Files 38
Framework Files 39
Packaging and Deploying Customizations 47
Separating Server-Specific Customizations 48
Step-by-Step: Packaging and Deploying a Simple Customization 49
Taking a Look at the Build File 52
Troubleshooting 52
Log4j 52
Step-by-Step: Debugging from within Eclipse 53
Node Browser 56
Starting Over 56
Summary 57
Chapter 3: Working with Content Models 59
Defining SomeCo's Content Model 59
Step-by-Step: Starting the Custom Content Model with Custom Types 60
Types 62
Step-by-Step: Adding Properties to Types 62
Properties and Property Types 64
Constraints 64
Step-by-Step: Relating Types with Associations 65
Associations 66
Step-by-Step: Adding Aspects to the Content Model 67
Aspects 69
Step-by-Step: Finishing up the Model 70
Modeling Summary 71
Custom Behavior 72
Modeling Best Practices 73
Out of the Box Models 75
Configuring the UI 76
Step-by-Step: Adding Properties to the Property Sheet 76
Externalizing Display Labels 79
Making Properties Read-Only 79
Step-by-Step: Adding Types and Aspects to WebClient Dropdowns 80
Step-by-Step: Adding Properties and Types to Advanced Search 83
Step-by-Step: Setting Externalized Label Values 85
Setting up Additional Locales 86
Working with Content Programmatically 86
Step-by-Step: Creating Content with JavaScript 86
Leveraging Root Objects 87
Knowing When to Save Documents 87
Using JavaScript for Batch Manipulation 88
Writing Content to the Content Property 88
Creating Content with Java Web Services 88
Step-by-Step: Run SomeCoDataCreator Class to Create Content 92
Creating Content with PHP Web Services 92
Creating Associations 94
Searching for Content 96
Step-by-Step: Run SomeCoDataQueries Class to See Lucene Example 98
Deleting Content 100
Step-by-Step: Running SomeCoDataCleaner Class to Delete Content 101
Summary 102
Chapter 4: Handling Content Automatically with Actions,
Behaviors, Transformers, and Extractors 103
Encapsulating Content Operations in Actions 103
Step-by-Step: Creating a Basic Action 104
Hiding the Action from End Users 109
Creating Actions that Require User-Specified Parameters 109
Step-by-Step: Creating an Action that Accepts Parameters 110
Incorporating Parameter Values in the Action Description 117
Specifying Parameters when Code Executes an Action 117
Binding Logic to Custom Types with Behaviors 117
Step-by-Step: Writing a Simple Behavior in Java 118
Binding to Multiple Types/Aspects 121
Frequency 121
Figuring Out to Which Policies to Bind 122
Step-by-Step: Writing a Simple Behavior in JavaScript 123
Binding Behavior to Child Types 124
Step-by-Step: Writing a User Ratings Calculator 125
Step-by-Step: Testing the New Rating Behavior 130
Handling Deleted Ratings 132
Extracting Metadata from Files 134
Customizing Metadata Extractors 134
Step-by-step: Customizing the Metadata Mapping 134
Overriding the Default Mapping 137
Leveraging Out of the box Metadata Extractors 138
Digging into an Extractor Class 138
Step-by-Step: Customizing a Metadata Extractor Class 138
Transforming Content from One Format to Another 140
Step-by-Step: Writing a Custom Transformer 141
Summary 145
Chapter 5: Customizing the Web Client User Interface 147
Knowing When to Customize Alfresco's Web Client and When to
Write Your Own 148
Adding New Menu Items with UI Actions 149
Step-by-Step: Adding a Simple UI Action 149
Showing/Hiding the Label 153
Leveraging Out of the Box Examples 154
Using Other Types of UI Actions 154
Step-by-Step: Adding a UI Action to Set the Web Flag 155
Restricting the UI Action by Permission 161
Writing Action Evaluators to Show/Hide UI Actions 161
Step-by-Step: Evaluating Whether or Not to Show the Set Web Flag UI
Actions 162
Changing How the Web Client Renders Data with Custom
Component Renderers 165
Step-by-Step: Making a Text Field a Specific Size 166
What Just Happened 170
Overriding the Generator for All Properties 170
Step-by-Step: Changing the Status Field on the Details Page to Display
as a Stoplight Indicator 170
Overriding and Customizing Components 177
Creating Custom Dialogs 178
Step-by-Step: Creating a Dialog to Execute Scripts 178
Passing the Context to the Dialog 184
Understanding the JSP 184
Enabling and Disabling the OK Button 185
Creating Custom Wizards 186
Step-by-Step: Stubbing Out the Wizard 187
Step-by-Step: Finishing Out the Wizard 196
Adding Conditions to Wizard Step Pages 209
Receiving Interview Feedback via Email 210
Persisting Interviewer Choices 210
Copying Alfresco's Code into Your Customizations 211
Customizing Web Client JSP Pages 211
Overriding Navigation Rules with Type-specific Settings 211
Summary 213
Chapter 6: Exposing Content through a RESTful API with
Web Scripts 215
Introducing the Web Script Framework 216
Step-by-Step: Hello World Web Script 217
What Just Happened? 218
Following the Model-View-Controller Pattern 218
Adding Controller Logic 219
Configuring the Web Script 220
Specifying the HTTP Method 220
Specifying Arguments 221
Specifying the Response Format 222
Deploying Web Scripts 223
Building Solutions with the Web Script Framework 223
Planning the SomeCo Whitepapers and Ratings API 224
Retrieving Data with Web Scripts 225
Step-by-Step: Writing a Web Script to List Whitepapers 226
Debugging 232
Fast Facts 232
Organizing Web Scripts 233
Overriding Web Scripts 233
Choosing a URL 234
Choosing between the Repository and the File System 234
Step-by-Step: Retrieving the Rating for a Whitepaper 235
Specifying Optional Arguments 237
Handling Errors 238
Writing Java-Backed Web Scripts 240
Step-by-Step: Writing a Java-Backed Web Script to
Handle Ratings Posts 241
Using the Correct ID for Web Script Beans 247
Using both Java and JavaScript for Controller Logic 247
Wiring a Web Script to UI Widgets 248
Step-by-Step: Using a Widget to Post Ratings 249
Implementing the Delete Ratings Link 253
Adding the Web Script Calls to SomeCo's Whitepaper Web Page 253
Making Other Types of Content "Rateable" 258
Dealing with the Cross-Domain Scripting Limitation 258
Handling Form Data 259
Step-by-Step: Implementing a Form-Based Hello World 259
Step-by-Step: Using File Upload in a Multipart Request 261
Customizing the Web Client with Web Scripts 263
Step-by-Step: Running a Web Script as a Dashlet 263
Understanding Web Script Runtimes 265
Advanced Web Scripts 265
Running Web Scripts as JSR-168 Portlets 265
Dealing with Web Script Authentication 269
Controlling Web Script Cache 270
Executing Remote Web Scripts 271
Refactoring the Rating Service 272
Summary 276
Chapter 7: Advanced Workflow 279
What is a Workflow? 280
Workflow Options 281
Creating Process Definitions 283
Step-by-Step: Creating a Hello World Process Definition 283
Organizing Processes 286
Using the jBPM Graphical Process Designer 286
Step-by-Step: Using jBPM Process Designer to Create and Deploy
Processes 287
Tokens 292
Node Types 293
Versioning Process Definitions 293
Deploying Dependencies 294
Using Alternative Deployment Methods 294
Wiring a Process to the Alfresco UI 295
Step-by-Step: Grabbing the Hello World Argument from the User 296
Understanding Workflow-Specific Content Models 301
Assigning Tasks to Users and Groups 303
Step-by-Step: Creating the Initial Whitepaper Submission Workflow 304
Controlling What Actions Can Be Taken from the
Task Management Dialog 312
Enabling the Workflow Initiator to Select Users and Groups 313
Adding Logic to Workflows with Actions and Process Variables 316
Storing Data in Process Variables 316
Step-by-Step: Adding Logic to the Whitepaper Submission Workflow 317
Using Java Classes for Decisions 319
Getting Access to the Content in the Workflow 320
Selecting the Right Event for Your Logic 320
Using ForEachFork 320
Using the Workflow API 323
Step-by-Step: Implementing Third-Party Review 323
Using a Task-Node Instead of a State 333
Making the Third-Party Review More Robust 333
Using Timers 334
Step-by-Step: Adding a Timer to the Third-Party Review 334
Understanding Timer Syntax 336
Debugging Workflows 337
Comparing Alfresco Workflow Options 338
Summary 339
Chapter 8: Web Content Management 341
Understanding the Difference between Alfresco DM and
Alfresco WCM 342
Obtaining Alfresco WCM 344
Step-by-Step: Installing Alfresco WCM 344
Creating Web Projects 345
Step-by-Step: Creating the SomeCo Web Project 346
What Just Happened 347
Playing Nicely in the Sandbox 348
Inviting Users 349
Mounting Sandboxes via CIFS 350
Virtualization and Layering 351
Creating Web Forms 353
Step-by-Step: Creating a SomeCo Press Release Web Form 354
Mapping XML Schema Types to Web Form Controls 362
Localizing Web Forms with Labels and Alerts 364
Generating XSD Dynamically 365
Step-by-Step: Creating a Press Release Index Page 367
Making Changes to an Existing Web Form 371
Using Web Forms Outside the WCM User Interface 371
Deploying Content 372
Step-by-Step: Deploying Content Using the File System Receiver (FSR) 372
Setting the FSR Target User and Password 377
Viewing Deployment Reports 377
Deploying to Test Servers 378
Enabling Deployment Targets for Auto Deploy 379
Step-by-Step: Deploying to an Alfresco System Receiver (ASR) 380
Performing Post-Deployment Processing 381
Step-by-Step: Running Post-Deployment Code in an FSR Deployment 381
Handling Deletes 382
Step-by-Step: Implementing ASR Deployment Callbacks 383
Modifying and Creating WCM Workflows 385
Using Launch Dates, Expiration Dates, and Link Checking 386
Launch Dates 387
Expiration Dates 388
Link Checking 389
Step-by-Step: Creating a No-Approval Workflow for Job Postings 390
Working with the AVM API 402
Step-by-Step: Writing a Web Script to Query AVMNodes 402
Step-by-Step: Writing a Web Script to Trigger Deployments 407
Implementing a Web Script for Submit 417
Using the AVM Console 417
Summary 418
Chapter 9: Security 419
Authenticating and Synchronizing with LDAP 419
Step-by-Step: Setting Up a Local OpenLDAP Server 420
Step-by-Step: Configuring Alfresco to Authenticate against LDAP 423
Step-by-Step: Configuring Chaining 425
Step-by-Step: Synchronizing LDAP with Alfresco 428
Handling Large Directories 431
Setting Up Single Sign-On (SSO) 431
Step-by-Step: Implementing SSO 432
Logging Out 437
Step-by-Step: Configuring CAS to Use LDAP for Authentication 438
Working with Security Services 440
Securing the Admin User 440
Granting Additional Users Admin Rights 440
Step-by-Step: Making tpublisher1 an Admin 441
Creating Users and Groups Programmatically 442
Step-by-Step: Creating Users and Groups through the API 444
Understanding Permission Definitions 445
Permission Groups 446
Permissions 447
Permission Sets 448
Step-by-Step: Setting Up A Portal Publisher Custom Role 449
Global Permissions 454
Mapping Permissions to Methods 454
Summary 455
Appendix A: API Reference and Examples 457
Foundation API Public Services 457
ActionService 458
ActivityService (3.0 Labs) 458
AttributeService 458
AuditService 459
AuthenticationService 459
AuthorityService 459
AVMService 460
AVMLockingService 460
AVMSyncService 460
CategoryService 460
CheckOutCheckInService 461
ConfigurableService 461
ContentUsageService (3.0 Labs) 461
ContentService 461
CopyService 462
CrossRepositoryCopyService 462
DeploymentService 462
DescriptorService 462
DictionaryService 463
EditionService 463
EmailService 463
ExporterService 463
FileFolderService 464
ImprterService 464
LinkValidationService 464
LockService 464
MailService 465
MimetypeService 465
ModuleService 465
MultilingualContentService 465
NamespaceService 466
NodeService 466
OwnableService 466
PermissionService 466
PersonService 467
RegistryService 467
RepoAdminService (3.0 Labs) 467
RepositoryExporterService 468
RuleService 468
SearchService 468
ScriptService 468
SiteService (3.0 Labs) 469
TaggingService (3.0 Labs) 469
TemplateService 469
ThumbnailService (3.0 Labs) 469
TransactionService 470
VersionService 470
WorkflowService 470
Lucene Queries 470
Basic Lucene Syntax 471
Property Search 472
Proximity Search 472
Range Search 473
Field Search 473
JavaScript 476
Root Objects 477
JavaScript API 478
API Examples 494
Create a Node 495
Perform a Search 495
Persist Content 496
Add an Aspect 496
Set a Property 497
Set Permissions 498
Start a Workflow 498
Appendix B: Alfresco Configuration Reference 501
Actions 501
Actions Available in both Enterprise and Labs 502
Actions Available in Labs Only 504
Web Client Config Elements 505
Conditional Configuration Elements 505
Unconditional Configuration Elements 506
Action Groups 507
Core Web Client Action Groups 507
Forums-Related UI Action Groups 508
Workflow-Related Action Groups 509
WCM-Related Action Groups 510
Metadata Extractors 510
Transformers 512
Graphical View of the Alfresco Content Model 513
System Model 515
User Model 516
Content Model 517
App Model 518
BPM Model 519
Workflow Model 520
WCM Model 520
WCM App Model 521
WCM Workflow Model 522
Index 523


Another Software Engineering Books
Another Web Programming Books
Download

No comments:

Post a Comment

Related Posts with Thumbnails

Put Your Ads Here!