Nuxeo Flex sample code
Content
The Flex Connector comes with a set of sample codes that can be used to understand:
- how to use Nuxeo services,
- how to use Documents provided by Nuxeo.
For that we provide 11 samples:
Basic remoting samples |
Shows how to call remote services and how Java Objects and DocumentModels Marshaling is handled. |
Document API browser sample |
Shows how to use the repository API to browse the content and display documents properties. |
DocumentAPI sample |
Shows how to modify a document. |
Actions sample |
Shows how to use Nuxeo Action service to fetch from server what actions are available in a given context (Document + user). |
Nuxeo Runtime sample |
Shows how to call directly a Nuxeo Runtime Service. |
Flex Login sample |
Shows how you can provide a Flex UI for Login/Logout in Nuxeo. |
Vocabularies sample |
Shows how to use Nuxeo's vocabularies from Flex. |
User management sample |
Searches and modifies a user. |
Tree sample |
Simple demo of the provided Navigation Tree SWC component. |
Document Explorer |
Sample application to show how to build an Explorer using Nuxeo service and Nuxeo reusable SWC components. |
Document API and State Management |
This sample shows how you can manage state on the server side to share some data between several SWF applications. |
When deploying the samples on a Nuxeo instance you can access the samples by 2 ways:
- use the "Flex Samples" tab from within the main UI,
- use the direct link http://server/nuxeo/flexsamples/.
If you don't already have a valid authentication session, using the second option will allow you to login using the Flex login screen.
As you will see, these samples are really simple examples, not a showcase. There are three main reasons for that:
- we are not Flex developers;
- we use bare ActionScript 3 to be sure this will work in any environments. This means:
- no additional framework or components,
- no specific IDE : text editor + command line build;
- we wanted to keep the code as simple as possible.
Getting the samples
If you installed the Samples via the Marketplace to do your tests, and you want to go further and look at the code, you probably want to check out the sources.
Once done you can generate the Eclipse project by running:
Alternatively, you can also get the source JARs from our Maven repository.
Building your Flex client
Nuxeo SWC Libs
The Nuxeo Flex Connector comes with two SWC components:
- nuxeo-platform-ui-flex-client-components.swc that contains the basic ActionScript "tools":
- FlexDocumentModel ActionScript Object,
- Login helpers,
- DocumentTree simple UI component.
- nuxeo-platform-ui-flex-client-components-extra.swc that contains UI components used by the Document Explorer sample.
If you want to call services that input or output DocumentModels, you will need to use the FlexDocumentModel and then use nuxeo-platform-ui-flex-client-components.swc as a dependency.
If you use Maven, you will get the SWC files automatically (see below), otherwise, you can download them from our maven repository.
Building with Maven
Building with Maven is clearly not the only possible solution, but since we are Java developers, this is the solution we choose ![]()
You can use the samples as examples, but basically, in your POM file you should:
- add the dependency on Nuxeo SWC component:
- declare the FlexMojo plugin to build the SWF:
Using Flex Builder
From Flex Builder you can add Nuxeo SWC:
- Click "Project" → "Properies".
- Choose "Flex Builder Path" in left.
- Choose Library in right.
- Click "Add SWC".
- Choose nuxeo-platform-ui-flex-client-components-1.1-5.4.2.swc.
Once done, you can use FlexDocumentModel, Login and DocumentTree in your project.
Data Services Configuration
GraniteDS requires services configuration on both client and server sides. To avoid painful duplication of code, the connector provides two default factories and a default channel.
Default Nuxeo factories
There are two different factories: one to get Seam component and one to get Nuxeo services. These are the two factories you should have to use in your service-config.xml file.
Default channel
This is the default channel you have to use in your service-config.xml file.
Service declaration
Provided Seam components
The FlexConnector comes with a set of Seam components that are dedicated to Flex remoting usage. The samples will show you how to use them.
You can list the available Seam Bean by using Nuxeo Platform Explorer .
The main Seam components are:
Seam component name |
Usage |
Remotable |
|---|---|---|
flexActionService |
High level interface on top of Action Service |
Yes |
flexDocumentManager |
Manages an even scoped CoreSession |
No, Server side only |
flexNavigationContext |
Manages server side state |
No, Server side only |
flexRepositoryService |
High level interface on the CoreSession |
Yes (called flexDocumentManager on the client side) |
flexUserService |
High level interface on the UserManager |
Yes |
flexVocabularyService |
High level interface for the Vocabularies |
Yes |
Roadmap of the Flex Connector
You can keep an eye on the development by using NXFLEX Jira.
The next major release will be 2.0 and will include:
- alignment on GraniteDS 2.2.x,
- support for Automation Services call,
- support for push.