cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco + Flex

gzunigainfo2000
Champ in-the-making
Champ in-the-making
Hello, im working with flex and i want to use the webservice of alfresco.
i have the following code that works with the flex-sdk alfresco.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mxSmiley Frustratedcript>
   <![CDATA[
      import mx.rpc.http.HTTPService;
      import mx.collections.ArrayCollection;
      import org.alfresco.framework.service.webscript.FailureEvent;
      import mx.controls.Alert;
      import org.alfresco.framework.service.webscript.WebScriptService;
      import org.alfresco.framework.service.webscript.SuccessEvent;
      import mx.rpc.AsyncToken;
      
      public var _ticketSmiley Frustratedtring = "esto da error";
      public var webservice:WebScriptService;
      //
      private function load():void
      {
         //http://127.0.0.1:8080/alfresco/faces/jsp/dashboards/container.jsp
         //http://myserver:8080/alfresco/service/api/login
         var urlxSmiley Frustratedtring = "http://localhost:8080/alfresco/service/api/login";
         webservice = new WebScriptService(urlx,WebScriptService.GET,onLoginSuccess,onLoginFaulire,false);
         var paramSmiley Surprisedbject = new Object();
         param.u = "admin";
         param.pw = "admin";
         webservice.execute(param);

      }
      public function onLoginSuccess(eventSmiley FrustrateduccessEvent):void
      {
         this._ticket = event.result.ticket;
      }
      public function onLoginFaulire(event:FailureEvent):void
      {
         var codeSmiley Frustratedtring = event.fault.faultCode;
         var messageSmiley Frustratedtring = event.fault.faultString;
         var detailsSmiley Frustratedtring = event.fault.faultDetail;
         
         Alert.show(code);
         Alert.show(message);
         Alert.show(details);
      }
   
      public function verticket():void
      {
         Alert.show(this._ticket);
      }
   ]]>
</mxSmiley Frustratedcript>

<mx:Text id="text" text=""/>
<mx:Button label="llamar a alfresco" click="load()" x="158" y="185"/>
<mx:Button  label="ver el ticket" click="verticket()" x="431" y="185"/>
</mx:Application>



This code gives me the ticket (nike sign) from alfresco.
I would like to know how i can do a search to bring the files that alfresco has.
i have the application of alfresco installed and with the same i called a pair of files.

HOW CAN I DO TO BRING AND SHOW THOSE FILES ON FLEX?


thank you.
21 REPLIES 21

stevereiner
Champ in-the-making
Champ in-the-making
You could use flexspaces and/or components (see org/integratedsemantics/flexspaces/component/search/* area for search) from flexspaces which also uses the flex sdk to access webscript / http / rest  "web services". To also use a mix of soap based "web services", additional  caringorm delegate classes could be added (see org/integratedsemantics/flexspaces/control/delegate/* area) with the flex WebService classes instead of the HTTPService class used by the alfresco "flex sdk" micro framework

http://forge.alfresco.com/projects/flexspaces/

Steve Reiner
http://www.integratedsemantics.org
http://www.integratedsemantics.com

gzunigainfo2000
Champ in-the-making
Champ in-the-making
Hi steve,

from svn i downloaded the flex-sdk and some examples, with this i could generate my application but its
giving me an error on the generation of the xml.

Im working with a tomcat from the application from alfresco.

Where can i download the tomcat for flex???

thank you for responing before.


Gonzalo.

stevereiner
Champ in-the-making
Champ in-the-making
Gonzalo,

1. The tomcat that comes with the alfreco installer will work with flex just fine.
2. If you are having problems with flex code from the ace module, note that is dependent on custom content models/code from the knowledge-base module
(see webscripts api forum  http://forums.alfresco.com/en/viewforum.php?f=36 and search on ace or flex)
3. If you are trying to use e4x result format xml see my modifications to the alfresco flex sdk (in flexspaces project in the forge in the org/alfresco/framework/service/webscript/WebScriptService.as)

Steve

gzunigainfo2000
Champ in-the-making
Champ in-the-making
Steve,

Already I could have done a search in flex with the following webscript that contains alfresco.
(http: // 192.168.1.245:8080/alfresco/service/sea rch/keyword.rss).

Now I have loaded a file in alfresco with attributes and what I want to do is realize is a search throu these attributes.
For it I want to create my own (proper)  webscript to be able to realize this search, my question is, how can I fulfil or create this webscript of search for attributes and if you have an example it would be very VERY usefull for me.

Thank You Very Much.



Gonzalo.

stevereiner
Champ in-the-making
Champ in-the-making
Gonzalo,

You can use the search webscript in flexspaces ( integratedsemantics/search/search.get.desc.xml )    that takes a lucene query   flexspaces/search?lucenequery={luceneFormatQuery}  and look in http://wiki.alfresco.com/wiki/Search#Finding_nodes_by_text_property_values  to learn the lucene query syntax for attributes/properties

Steve

gzunigainfo2000
Champ in-the-making
Champ in-the-making
Thanks you for responding before, thanks to your webscript examples, i could make my own webscripts examples, thanks again.

A have another question if you dont mind again…


I have a webscript that shows me results of a search, this webscripts give-shows me the URL(link) of an archive to download.

The problem that i have is that when i do click on the URL , the URL asks me an Autentification (user and pass).

How can i EVOID this Autentification when i do a click on that URL(link) of an archive to download.

Like a Single Sing On.



Thanks master steve.

stevereiner
Champ in-the-making
Champ in-the-making
Gonzalo,

Add the ticket returned from the login webscript  as an arg on view / download urls
downloadUrl = downloadUrl + "?alf_ticket=" + ticket;

Steve

gzunigainfo2000
Champ in-the-making
Champ in-the-making
Dear Steve

I want to create users in my application Flex and do a massive download of files.

Is there a possibility of creating this webscripts?

the URL that you sent me of the search was very useful, if you have a login URL and massive download it would be very useful to read and expand my knowledgement.


Thank you.


Gonzalo.

stevereiner
Champ in-the-making
Champ in-the-making
Gonzalo

create user
alfresco 3.0 has a add person webscript in <installdir>/tomcat/webapps/alfresco/web-inf/classes/alfresco/templates/webscripts/org/alfresco/repository/person/people.post.*
(note this is a json webscript, would need to change to xml to use with flex, or use a http://code.google.com/p/as3corelib/
for json support)

massive download
webscript side
http://forge.alfresco.com/projects/flexspaces/
see flexspaces integratesemantics/folderlist/folderlist.get.* webscript for download urls (see viewurl field in folderlist.getxml.ftl )

flex+browser
With regular in-browser flex you download with a browse dialog for each file with FileReference download() (not so good for massive downloads)
See flexpaces src/org/integratedsemantics/flexspaces/control/command/ui/DownloadUICommand.as

flex+AIR
Adobe AIR has some features that would make this easier to do:
1. flash.filesystem.File has a browseForDirectory() to browse for a directory to download to
2.  given a File object for a local filesystem dir you can write files to it
flexspaces+air has a "make available offline" feature in its tools menu for downloading multiple selected files in the repository
see download code in src/org/integratedsemantics/flexspacesair/control/command/AirMakeAvailOfflineUICommand.as

Steve