integrating alfresco with portals

63
#SummitNow Integrating Alfresco with portals 6 th November 2013 Piergiorgio Lucidi

Upload: piergiorgio-lucidi

Post on 17-May-2015

1.665 views

Category:

Technology


7 download

DESCRIPTION

An overview about some of the possible ways to implement Portlets for integrating Alfresco in your own portal.

TRANSCRIPT

Page 1: Integrating Alfresco with Portals

#SummitNow

Integrating Alfresco with portals6th November 2013Piergiorgio Lucidi

Page 2: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Piergiorgio Lucidi• Open Source ECM Specialist at Sourcesense• Alfresco Trainer / Engineer / Wiki Gardener /

Star• Alfresco Global Moderator of the italian forum• Author / Technical Reviewer at Packt Publishing• PMC Member / Mentor at Apache Software

Foundation• Project Leader in the JBoss Community

Page 3: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Overview• Introducing portals• Introducing standard portlets• Implementing portlets• Alfresco Web Services API• Spring WebScripts• OpenCMIS• Spring Surf

Page 4: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Overview• Introducing portals• Introducing standard portlets• Implementing portlets• Alfresco Web Services API• Spring WebScripts• OpenCMIS• Spring Surf

Page 5: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Introducing portalsAn overview about the basics and the standards of portals

Page 6: Integrating Alfresco with Portals

#SummitNow

#SummitNow

What is a portal?A portal is a web application focused on• Creating dynamic website• Page-centric approach• Aggregation of contents• Enterprise Services

Page 7: Integrating Alfresco with Portals

#SummitNow

#SummitNow

What is a portal?A portal is a web application focused on• Creating dynamic website• user oriented and extremely dynamic

fragments

• Page-centric approach• Aggregation of contents• Enterprise Services

Page 8: Integrating Alfresco with Portals

#SummitNow

#SummitNow

What is a portal?A portal is a web application focused on• Creating dynamic website• Page-centric approach• Each page hosts presentation layer apps• Portlets• Apps (wrapping using bridge framework)• Gadgets (based on XML and JavaScript)

• Aggregation of contents• Enterprise Services

Page 9: Integrating Alfresco with Portals

#SummitNow

#SummitNow

What is a portal?A portal is a web application focused on• Creating dynamic website• Page-centric approach• Aggregation of contents• Enterprise Services

Page 10: Integrating Alfresco with Portals

#SummitNow

#SummitNow

What is a portal?A portal is a web application focused on• Creating dynamic website• Page-centric approach• Aggregation of contents• Enterprise Services• Authentication• Authorization• Personalization• Export / Import• APIs for integrations

Page 11: Integrating Alfresco with Portals

#SummitNow

#SummitNow

What is a portal?

Page 12: Integrating Alfresco with Portals

#SummitNow

#SummitNow

What is a portal?A portlet is an application that contains specific business logic• Provides a fragment of content• The output depends on user permissions

• Potentially the fragment could be dynamic for each user

• A permission can be given for• The entire portal• Page• Portlet

Page 13: Integrating Alfresco with Portals

#SummitNow

#SummitNow

What is a portal?An app is a wrapper of a portlet and it can be implemented using• Pure Java• JSF• Spring MVC• Spring WebScripts• GWT• Struts• So on…

Page 14: Integrating Alfresco with Portals

#SummitNow

#SummitNow

What is a portal? – User roles

Page 15: Integrating Alfresco with Portals

#SummitNow

#SummitNow

What is a portlet container?A portlet container is a runtime framework

• Manages the execution of portlet requests• Provides user session mechanism

• Check permissions for different scope levels• Portal• Page• Portlet

• Implements JSR-286 Java Portlet Specification 2.0• Can be embedded in any JEE application

• Portlet requests can be executed against non-web contexts• The web context is a detail!

Page 16: Integrating Alfresco with Portals

#SummitNow

#SummitNow

What is a portlet container?

Portal A• Portlet 1• Portlet 2• Portlet 3

Portal B• Portlet 4• Portlet 5

Portal C• Portlet 6

Page 17: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Why use a portal?You may want a portal for

• Creating custom and dynamic websites• Providing personalized contents• Providing features for personalizing sections• Integrating different systems with a unique frontend• Providing valuable services for your customers/users

• Private access• Profiled informations• E-commerce• Advanced editing• Enterprise Content Management (ECM)

Page 18: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Why use a portal with AlfrescoPortal aggregates corporate apps and contents Agile developmentDecoupling responsabilitiesFragments can be managed by Alfresco

• Records Management• Content and Document Management• Web Publishing• BPM

The portal is responsible for presentation• Portlets will present contents managed by Alfresco

Portlets are based on Enterprise Java standards!!!

Page 19: Integrating Alfresco with Portals

#SummitNow

#SummitNow

What is a dashboard?

Page 20: Integrating Alfresco with Portals

#SummitNow

#SummitNow

How a portal worksThe portlet container (PC) retrieves the portlet deployment descriptor (PDD) from all the applications deployed in the Java container (JSE or JEE)

• web-app.war• WEB-INF• portlet.xml• web.xml

• Deployment Descriptors (DD) are used in many Enterprise Java components

Page 21: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Overview• Introducing portals• Developing standard portlets• Implementing portlets• Alfresco Web Services API• Spring WebScripts• OpenCMIS• Spring Surf

Page 22: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Developing standard portletsA quick tour about how to implement standard portlets

Page 23: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Developing standard portletsYou can use the GenericPortlet abstract class for overriding the following methods:

• processAction• doView• doEdit• doHelp• doHeaders• init• destroy

Page 24: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Standard portlets – Demo

Page 25: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Overview• Introducing portals• Developing standard portlets• Implementing portlets• Alfresco Web Services API• Spring WebScripts• OpenCMIS• Spring Surf

Page 26: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Portlets with Alfresco WS APIA quick tour about how to implement portlets invoking Alfresco with Web Services API (SOAP)

Page 27: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Web Services API - Services• Authentication: login and logout• Repository: query and model manipulation• Content: content manipulation• Authoring: collaborative content creation• Classification: apply classifications and categories• Access Control: roles, permissions & ownership• Action: manages actions and rules• Administration: user management, export & import• Dictionary: model descriptions

Page 28: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Content Manipulation Language

Page 29: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Web Services API - SearchThe only query language supported is LuceneNotice that use have to use the RepositoryService to search contents: there is no SearchService -> Query method

Page 30: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Search portlet – iterating results

Page 31: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Search portlet

Page 32: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Overview• Introducing portals• Developing standard portlets• Implementing portlets• Alfresco Web Services API• Spring WebScripts• OpenCMIS• Spring Surf

Page 33: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Portlets with Spring WebScriptsA quick tour about how to implement portlets exposing your WebScripts in the portlet descriptor of Alfresco

Page 34: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Spring WebScriptsAlfresco Web Scripts use a lightweight Model View Controller (MVC) style framework.

Page 35: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Components of a WebScriptThere are 3 main components of a web script:• Descriptor• Controller (optional if exists an FTL template)

• JavaScript server side (Mozilla Rhino)• Subgroup of the Java API• You can extend it!!!

• Template• FTL (optional if request and response are

managed by Java)• Java Action (AbstractWebScript)

Page 36: Integrating Alfresco with Portals

#SummitNow

#SummitNow

WebScript DescriptorThe descriptor file uses the following naming convention which provides additional information to Alfresco:

helloworld.get.desc.xml

The content of the descriptor file:

Page 37: Integrating Alfresco with Portals

#SummitNow

#SummitNow

WebScript ControllerThe controller script is an optional component written in JavaScript or Java, which does the actual work.

Page 38: Integrating Alfresco with Portals

#SummitNow

#SummitNow

WebScript TemplateThe WebScript template is the output template for displaying the content to user agents or applications.The output format can be based on many formats:• HTML• ATOM• XML• RSS

Page 39: Integrating Alfresco with Portals

#SummitNow

#SummitNow

WebScriptPortletWrapper for exposing a WebScript as a portlet, you need to set these two parameters:• scriptUrl

• The URL exposed by the involved WebScript• Authenticator factory

• jsr168.webclient• Based on cookie

• Jsr168• Based on the portal session

Page 40: Integrating Alfresco with Portals

#SummitNow

#SummitNow

WebScriptPortlet - Descriptor

Page 41: Integrating Alfresco with Portals

#SummitNow

#SummitNow

WebScriptPortlet – SearchThe search object is exposed for executing queries:For XPath expression use ISO9075 to encode paths

var luceneQuery = “PATH:\”/app:company_home/cm:”+search.ISO9075(“Bookstore orders”)+”/*\””;

var ordersResults = search.luceneSearch(luceneQuery);model.results = ordersResults;

Page 42: Integrating Alfresco with Portals

#SummitNow

#SummitNow

WebScriptPortlet – Get detailsvar id = args.id;if(id!=null && id!=“”){

var node = utils.getNodeFromString(id);

model.node = node;} else { status.code = 400; status.message = “id must be not null"; status.redirect = true;}

Page 43: Integrating Alfresco with Portals

#SummitNow

#SummitNow

WebScriptPortlet – Demo

Page 44: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Overview• Introducing portals• Developing standard portlets• Implementing portlets• Alfresco Web Services API• Spring WebScripts• OpenCMIS• Spring Surf

Page 45: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Portlets with OpenCMISA quick tour about how to implement portlets using OpenCMIS

Page 46: Integrating Alfresco with Portals

#SummitNow

#SummitNow

CMIS – Domain ModelData ModelRepositoryObjectCMIS Query

Associated services Common elementsRepository servicesNavigation servicesObject ServicesMulti-filing servicesDiscovery, versioning, relationship, policy and ACL services

Page 47: Integrating Alfresco with Portals

#SummitNow

#SummitNow

OpenCMIS – Repository• Contains set of data entities• getRepositories() for given endpoint• get repository capabilities

Page 48: Integrating Alfresco with Portals

#SummitNow

#SummitNow

OpenCMIS – Object• Used to model typed

objects• Four base types:• Document Object• Folder Object

• Relationship

object• Policy object

• Object ID

• Object properties• Version, ACL• Content Stream• Renditions

Page 49: Integrating Alfresco with Portals

#SummitNow

#SummitNow

OpenCMIS – ServicesRepository services: used to discover information about the repository

Navigation services: used to traverse the CMIS repository folder hierarchy

Objects services: used to manipulate the repository contents with a CRUD interface

Discovery services: used to search for query-able objects within repository

 

Page 50: Integrating Alfresco with Portals

#SummitNow

#SummitNow

OpenCMIS Client API• Client-side Java library that implements

the CMIS specification• object-oriented way• AtomPub or SOAP protocols• Binding selected with getRepositories()

method on SessionFactory object

Page 51: Integrating Alfresco with Portals

#SummitNow

#SummitNow

OpenCMIS Client API - AtomPub//AtomPub binding // default factory implementationSessionFactory factory = SessionFactoryImpl.newInstance();Map<String, String> parameter = new HashMap<String, String>(); // user credentialsparameter.put(SessionParameter.USER, "admin");parameter.put(SessionParameter.PASSWORD, "admin"); // connection settingsparameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());parameter.put(SessionParameter. ATOMPUB_URL, "http://cmis.alfresco.com/cmisatom");parameter.put(SessionParameter.REPOSITORY_ID,

"84ccfe80-b325-4d79-ab4d-080a4bdd045b") // create sessionSession session = factory.createSession(parameter);

Page 52: Integrating Alfresco with Portals

#SummitNow

#SummitNow

OpenCMIS Client API - SearchString myType = "my:documentType";

// get the query name of cmis:objectIdObjectType type = session.getTypeDefinition(myType);PropertyDefinition<?> objectIdPropDef = type.getPropertyDefinitions().get(PropertyIds.OBJECT_ID);String objectIdQueryName = objectIdPropDef.getQueryName();

String queryString = "SELECT " + objectIdQueryName + " FROM " + type.getQueryName();

// execute queryItemIterable<QueryResult> results = session.query(queryString, false);

for (QueryResult qResult : results) { String objectId = qResult.getPropertyValueByQueryName(objectIdQueryName); Document doc = (Document) session.getObject(session.createObjectId(objectId));}

Page 53: Integrating Alfresco with Portals

#SummitNow

#SummitNow

OpenCMIS - Demo

Page 54: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Overview• Introducing portals• Developing standard portlets• Implementing portlets• Alfresco Web Services API• Spring WebScripts• OpenCMIS• Spring Surf

Page 55: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Portlets with Spring SurfA quick tour about how to implement portlets exposing your Surf components

Page 56: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Spring Surf• MVC framework• Scriptable• RESTful• Page-centric• Page

• Components• Embeds Spring WebScripts

Page 57: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Spring Surf – Process loading

Page 58: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Spring Surf – Regions

Page 59: Integrating Alfresco with Portals

#SummitNow

#SummitNow

ProxyPortlet• Allows to expose as a portlet any bits of

Share• scriptUrl• Page• Component / WebScript

• Each WebScript inside Share is a Presentation WebScript that needs to invoke against the repo:• a Data WebScript• CMIS AtomPub binding

Page 60: Integrating Alfresco with Portals

#SummitNow

#SummitNow

ProxyPortlet – How it works1. The portal starts to render the portlet page2. Share starts to render the Surf page (only 1 component)3. Share starts to render the component4. Share invokes Alfresco using REST calls5. Share connector get the user session from

request.getRemoteUser() and set the user as authenticated in Alfresco (external authentication)

6. Alfresco executes the WebScripts7. The returned JSON will be parsed by Share to render the

FTL template for the portlet8. Share ends to render the Surf page9. The portal finishes to render the portlet

Page 61: Integrating Alfresco with Portals

#SummitNow

#SummitNow

ProxyPortlet – Search

Page 62: Integrating Alfresco with Portals

#SummitNow

#SummitNow

Thank you

@pjlucidi

[email protected]

Page 63: Integrating Alfresco with Portals

#SummitNow