cancel
Showing results for 
Search instead for 
Did you mean: 

Few questions on Afresco Repo - templates and rules

mtl22
Champ in-the-making
Champ in-the-making
Hello,

Currently we are in the process of evaluation of Alfresco Explorer and Repo.

Based on Webinars, Wiki, and other docs I found out that some of features we need may be missing.
My post is to make sure that my supposes are right/wrong.

1. I'm aware that there is a extensible template engine in Alfresco Repo.
Is there a build-in functionality that will let third-party app pass data to one Repo Foundation Services, and base on PDF templete(ArcoForm) stored in Repo create real PDF document ?
In case of no, how painful the extension will be. Assuming we will use java iText lib, in other words what have to be done ?

2. I'm aware of spaces and rules that can be applied to incoming content.
Assuming that someone drop in the XLS file to repo basing on content of this file I would like to create arbitrary number of different files i.e new file for each row in XLS.
I believe that there is now out of the box solution for this, and we will need to create customized rule for content. So the question is it feasible and what have to be done ?

Kind Regards,

Michal
4 REPLIES 4

iblanco
Confirmed Champ
Confirmed Champ
Well, I'm afraid I can't give an easy answer to your question, but I'll try to share my experience.

Alfresco is very well suited to extend to your needs but gaining the sufficient expertise to do it easily is quite a hard task.

You can create scripts to execute actions using a quite reasonable Javascript API and that is quite easy, but if this approach does not fit your needs you'll have to code actions or behaviours in Java using the repositories complete API. If you are a Java expert this shouldn't be such a deal but it takes some time to understand and "be fluent" in Alfresco's mechanism's for extending it ( this book is a "must read" in this case: http://www.amazon.com/Alfresco-Developer-Guide-Jeff-Potts/dp/1847193110 ).

Once you have the required action (functionality) coded in an action exposing it through the webscript REST API or applying it as a rule should be quite an easy job.

I developed an action that extracted a multipage Tiff from a multipart file, another action that applied some aspects to a node an "attached" a signed package to it and an action that extracted some XML data. It took me a couple of months (not completeley working on this) but it was my learning process and I'm not a Java guru.

I hope this gives you a little approach.

Bye.

tejaswini
Champ in-the-making
Champ in-the-making
hi iblanco.,
    good morning.
    as u had worked in this i am willing to know something from u.
    1) i am able to get the node name,is and refrence also. noe if i want to read the content of the particular node e.g. that's a pdf how i can do that?
    what i thought is we should have ServiceRegistry from that we have to get get ContentServices than ContentReader and the InputStream etc…but how to get the ServiceRegistry???
   its really eargent.
   thanks….

invictus9
Champ in-the-making
Champ in-the-making
2. I'm aware of spaces and rules that can be applied to incoming content.
Assuming that someone drop in the XLS file to repo basing on content of this file I would like to create arbitrary number of different files i.e new file for each row in XLS.
I believe that there is now out of the box solution for this, and we will need to create customized rule for content. So the question is it feasible and what have to be done ?

I have done exactly this. Well, not exactly.

I exported the Excel file into a tab-separated value file.

I defined the content type to have properties that mapped from each column of the Excel sheet. Mostly I used 'text' type, but there was a date field and a numeric field, and several fields that had constraints on them. You will need to test out your content type before proceeding further.

Then, I wrote a Javascript file, putting it in the Data Dictionary/Scripts folder. I invoked the script on the tab-separated value file, and the script proceeded to create all of the individual nodes from each row of the file. The script itself is about 120 lines long, mostly doing sanity checks on the input data. There are about 15 lines of overhead, such as logging. Consult the Javascript API documentation on the wiki.

iblanco
Confirmed Champ
Confirmed Champ
tejaswini, I don't understand your question very weel but that's how I read the content of a node:


      FileFolderService fileFolderService = serviceRegistry
            .getFileFolderService();
      ContentReader rawXML = fileFolderService.getReader(actionedUponNodeRef);
      rawXML.setMimetype("text/xml");
      input = rawXML.getContentInputStream();

In my case this is an ActionExecuter class (a Java action for Alfresco) and "serviceRegistry" is inyected in the bean definition.

   
        <!– Parse LegalSnapScan generated XML –>
   <bean id="legal-xml-parser" class="es.binovo.alfresco.action.ParseLegalXMLActionExecuter" parent="action-executer">
      <property name="companyHomePath">
            <value>/${spaces.company_home.childname}</value>
        </property>
      <property name="publicAction">
         <value>true</value>
      </property>
      <property name="serviceRegistry">
            <ref bean="ServiceRegistry"></ref>
        </property>
        <property name="storeUrl">
            <value>${spaces.store}</value>
        </property>
        <!–  TODO depende de storeUrl, por eso lo ponemos despues, quiza exista una forma mejor de expresar esto –>
        <property name="invoiceTemplatePath">
           <value>/Data Dictionary/Presentation Templates/invoice.ftl</value>
        </property>
   </bean>

I hope this helps you in some way.