<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Help in creating documents in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/help-in-creating-documents/m-p/80111#M24823</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure, you'll create a project using the Alfresco SDK. That will give you a Maven-based source code structure that will allow you to compile an AMP (Alfresco Module Package) that you will deploy to your WAR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A service is just a class that is responsible for some specific operation. There are many many examples of this pattern, but here is a simple one that is easy to get your head around:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/conexiam/alfresco-acl-templates" title="https://github.com/conexiam/alfresco-acl-templates" rel="nofollow noopener noreferrer"&gt;GitHub - Conexiam/alfresco-acl-templates: Facilitates the creation of multiple named Access Control Lists (ACLs) express…&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's a source code project for a repository-tier AMP that does one thing: Retrieves and applies "ACL templates" on a given node. The actual service class implementation is &lt;A class="link-titled" href="https://github.com/Conexiam/alfresco-acl-templates/blob/master/acl-templates-repo/src/main/java/com/conexiam/acl/templates/service/AclTemplateServiceImpl.java" title="https://github.com/Conexiam/alfresco-acl-templates/blob/master/acl-templates-repo/src/main/java/com/conexiam/acl/templates/service/AclTemplateServiceImpl.java" rel="nofollow noopener noreferrer"&gt;alfresco-acl-templates/AclTemplateServiceImpl.java at master · Conexiam/alfresco-acl-templates · GitHub&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you'd create an AutoNumberService.java class where your autonumbering logic would reside. It might have a method called getNextNumber() or something like that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you'd also create a DocumentGenerationService.java class where your doc generation logic would reside. It might have a document called resolvePlaceholders(Map&amp;lt;String, Object&amp;gt; placeholderMap, NodeRef nodeRef) or something like that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course each of these might be worthy of being in completely separate projects/separate AMP files, but that's up to you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, you'll create something like DocumentNumberActionExecuter.java that will be your custom rule action. It will leverage both of these services to actually perform the action on a document when it is added to a folder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this is new to you I'd recommend working through &lt;A href="http://ecmarchitect.com/alfresco-developer-series" rel="nofollow noopener noreferrer"&gt;my tutorials&lt;/A&gt;. If you have problems, create a new post with the specifics and someone will help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Apr 2018 17:06:20 GMT</pubDate>
    <dc:creator>jpotts</dc:creator>
    <dc:date>2018-04-05T17:06:20Z</dc:date>
    <item>
      <title>Help in creating documents</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/help-in-creating-documents/m-p/80106#M24818</link>
      <description>Hello everyone, I am new to Alfresco and I am working on a project in which I have to create a folder where all the stored files are going to be of the same format (word or pdf) and each file must have the same name only differentiated by a number. This number represents the document number and must</description>
      <pubDate>Wed, 04 Apr 2018 21:41:24 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/help-in-creating-documents/m-p/80106#M24818</guid>
      <dc:creator>franksant13</dc:creator>
      <dc:date>2018-04-04T21:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help in creating documents</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/help-in-creating-documents/m-p/80107#M24819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe a&amp;nbsp;first approach could be something like this:&lt;/P&gt;&lt;P&gt;- Define a content rule on&amp;nbsp;an specific folder&lt;/P&gt;&lt;P&gt;- On create document, this rule will execute a script.&lt;/P&gt;&lt;P&gt;This script return number of documents of&amp;nbsp;the folder and change de name of document to: "samename_returnedvalue"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;¿The number of document should be in the text of document or like a property?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;clv&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2018 09:37:31 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/help-in-creating-documents/m-p/80107#M24819</guid>
      <dc:creator>calvo</dc:creator>
      <dc:date>2018-04-05T09:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help in creating documents</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/help-in-creating-documents/m-p/80108#M24820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your response my friend.&lt;/P&gt;&lt;P&gt;I need to have the document number in the text of the document. It is not necesary to have it as a property.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know any tutorial to help me starting with usign scripts in alfresco?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2018 14:43:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/help-in-creating-documents/m-p/80108#M24820</guid>
      <dc:creator>franksant13</dc:creator>
      <dc:date>2018-04-05T14:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Help in creating documents</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/help-in-creating-documents/m-p/80109#M24821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are three parts to your question.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, automatically generating a document number. To do that, consider writing a "service" class that is responsible for handing out document numbers. It's up to you whether you store the number in a database or somewhere in the repository. Many people prefer to just write a little JSON document in the Data Dictionary that tracks document numbers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next, you want to insert the number into the content of a file. This is tricky because if you are dealing with a variety of binary file formats, you'll potentially need an API for each one. You also need a way to specify where in the file the document number will be placed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you could simplify your requirement to a specific file type that would help. For example, if you were to only need to insert the doc number into Word documents, you could use &lt;A class="link-titled" href="https://www.docx4java.org/trac/docx4j" title="https://www.docx4java.org/trac/docx4j" rel="nofollow noopener noreferrer"&gt;docx4j&lt;/A&gt;. I like docx4j because it is easy to do simple things like create a document template that has a placeholder, then send key-values to the API to replace the placeholders with the values. You can place this logic in a general "doc generation" service class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Last, how you actually trigger the generation and insertion. As Jose mentioned, a rule is probably the best approach here. The rule should probably invoke a Java-based rule action class that leverages the autonumber service and the "doc generation" service mentioned above.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2018 16:44:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/help-in-creating-documents/m-p/80109#M24821</guid>
      <dc:creator>jpotts</dc:creator>
      <dc:date>2018-04-05T16:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help in creating documents</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/help-in-creating-documents/m-p/80110#M24822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your response... can you please be a litlle more specific in how to do the "Service" in the first part. Im new in Alfresco.&lt;/P&gt;&lt;P&gt;For the other parts of your response i think i am only going to use word files to avoid the problems you describe.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2018 16:57:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/help-in-creating-documents/m-p/80110#M24822</guid>
      <dc:creator>franksant13</dc:creator>
      <dc:date>2018-04-05T16:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Help in creating documents</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/help-in-creating-documents/m-p/80111#M24823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure, you'll create a project using the Alfresco SDK. That will give you a Maven-based source code structure that will allow you to compile an AMP (Alfresco Module Package) that you will deploy to your WAR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A service is just a class that is responsible for some specific operation. There are many many examples of this pattern, but here is a simple one that is easy to get your head around:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/conexiam/alfresco-acl-templates" title="https://github.com/conexiam/alfresco-acl-templates" rel="nofollow noopener noreferrer"&gt;GitHub - Conexiam/alfresco-acl-templates: Facilitates the creation of multiple named Access Control Lists (ACLs) express…&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's a source code project for a repository-tier AMP that does one thing: Retrieves and applies "ACL templates" on a given node. The actual service class implementation is &lt;A class="link-titled" href="https://github.com/Conexiam/alfresco-acl-templates/blob/master/acl-templates-repo/src/main/java/com/conexiam/acl/templates/service/AclTemplateServiceImpl.java" title="https://github.com/Conexiam/alfresco-acl-templates/blob/master/acl-templates-repo/src/main/java/com/conexiam/acl/templates/service/AclTemplateServiceImpl.java" rel="nofollow noopener noreferrer"&gt;alfresco-acl-templates/AclTemplateServiceImpl.java at master · Conexiam/alfresco-acl-templates · GitHub&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So you'd create an AutoNumberService.java class where your autonumbering logic would reside. It might have a method called getNextNumber() or something like that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you'd also create a DocumentGenerationService.java class where your doc generation logic would reside. It might have a document called resolvePlaceholders(Map&amp;lt;String, Object&amp;gt; placeholderMap, NodeRef nodeRef) or something like that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course each of these might be worthy of being in completely separate projects/separate AMP files, but that's up to you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, you'll create something like DocumentNumberActionExecuter.java that will be your custom rule action. It will leverage both of these services to actually perform the action on a document when it is added to a folder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this is new to you I'd recommend working through &lt;A href="http://ecmarchitect.com/alfresco-developer-series" rel="nofollow noopener noreferrer"&gt;my tutorials&lt;/A&gt;. If you have problems, create a new post with the specifics and someone will help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2018 17:06:20 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/help-in-creating-documents/m-p/80111#M24823</guid>
      <dc:creator>jpotts</dc:creator>
      <dc:date>2018-04-05T17:06:20Z</dc:date>
    </item>
  </channel>
</rss>

