<?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: Model constraints from a config file in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/model-constraints-from-a-config-file/m-p/303130#M256260</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Hardik,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for the reply, it certainly helped. However I am unable to get the data out of the file, if I run the class as a standalone data is retrieved; which led me to suspecting that my path is not conforming to the Alfresco standard.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I place the jar file in the Alfresco/lib folder, and the text file is inside the jar under this structure "src/". &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you know if there is a specific path to be used in instances as this, perhaps the META-INF folder?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Please share such a declaration if you know.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Sep 2015 15:09:40 GMT</pubDate>
    <dc:creator>darkredd</dc:creator>
    <dc:date>2015-09-21T15:09:40Z</dc:date>
    <item>
      <title>Model constraints from a config file</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/model-constraints-from-a-config-file/m-p/303128#M256258</link>
      <description>Good day,I would like to know if possible, how I can read a config file to populate my model. I have a long list of values (not exhaustive); that need to be put as a constraint in my model. Placing the list directly would create havoc as the list can grow bigger, smaller or change of list display va</description>
      <pubDate>Fri, 18 Sep 2015 10:27:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/model-constraints-from-a-config-file/m-p/303128#M256258</guid>
      <dc:creator>darkredd</dc:creator>
      <dc:date>2015-09-18T10:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: Model constraints from a config file</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/model-constraints-from-a-config-file/m-p/303129#M256259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I guess what you are looking for is creating a custom constraint. You can create a custom constraint that extends ListOfValuesConstraint and fetches allowedValues from another file.And then you apply this constraint to property in your model file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can find an example here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://govindaroul.blogspot.in/2013/10/dynamic-list-constraints-in-alfresco.html" rel="nofollow noopener noreferrer"&gt;http://govindaroul.blogspot.in/2013/10/dynamic-list-constraints-in-alfresco.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here instead of DB, you can read from file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Sep 2015 12:00:34 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/model-constraints-from-a-config-file/m-p/303129#M256259</guid>
      <dc:creator>hardik1512</dc:creator>
      <dc:date>2015-09-18T12:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: Model constraints from a config file</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/model-constraints-from-a-config-file/m-p/303130#M256260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Hardik,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for the reply, it certainly helped. However I am unable to get the data out of the file, if I run the class as a standalone data is retrieved; which led me to suspecting that my path is not conforming to the Alfresco standard.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I place the jar file in the Alfresco/lib folder, and the text file is inside the jar under this structure "src/". &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you know if there is a specific path to be used in instances as this, perhaps the META-INF folder?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Please share such a declaration if you know.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Sep 2015 15:09:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/model-constraints-from-a-config-file/m-p/303130#M256260</guid>
      <dc:creator>darkredd</dc:creator>
      <dc:date>2015-09-21T15:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: Model constraints from a config file</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/model-constraints-from-a-config-file/m-p/303131#M256261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can try below approach.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Upload text file in some folder on alfresco server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Get file nodeRef by using searchservice and lucene query.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) Use contentservice and contentreader to read data. &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Sep 2015 07:07:49 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/model-constraints-from-a-config-file/m-p/303131#M256261</guid>
      <dc:creator>hardik1512</dc:creator>
      <dc:date>2015-09-22T07:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Model constraints from a config file</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/model-constraints-from-a-config-file/m-p/303132#M256262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hardik Thanks for all the replies,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That approach has weaknesses, where the file may be mistakenly deleted from the system or changed. What I have is a file that will be constant for the next 5 years.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Nonetheless, I have been told to use the DB approach for ease of maintenance. I have created the class to fetch data from the DB and the class work as a stand-alone, placed it in the alfresco/WEB-INF/lib folder together with the DB connection driver. Alfresco still cannot register the model with the custom constraint in place. I get the "The list of allowed values is empty", which suggest that the class is not fetching data. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I then realized that it looks like Alfresco is deploying my extensions folder before the alfresco and share apps are deploy which is wrong since the extension should be loaded last. I even implemented the "depends-on" attribute in the bean registration xml. Perhaps I am missing something small.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Below are my declarations:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Constraint class:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;lt;?xml version='1.0' encoding='UTF-8'?&amp;gt;&lt;BR /&gt;&amp;lt;!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' '&lt;A href="http://www.springframework.org/dtd/spring-beans.dtd" rel="nofollow noopener noreferrer"&gt;http://www.springframework.org/dtd/spring-beans.dtd&lt;/A&gt;'&amp;gt;&lt;BR /&gt;&amp;lt;beans&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;bean id="custom-constraints" class="za.co.dev.constraints.CustomContraints" /&amp;gt;&lt;BR /&gt;&amp;lt;/beans&amp;gt;&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Model registration:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;lt;bean id="research.wf.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="custom-constraints"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property name="models"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;list&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;value&amp;gt;alfresco/extension/ResearchUnitWorkflowModel.xml&amp;lt;/value&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/list&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/property&amp;gt;&lt;BR /&gt;&amp;lt;/bean&amp;gt;&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Model contraint definition&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;lt;constraint name="ru:committees" type="za.co.dev.constraints.CustomContraints"&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;parameter name="allowedValues"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;list&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/list&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;/parameter&amp;gt;&lt;BR /&gt;&amp;lt;/constraint&amp;gt;&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope these code snippets will shared some light into a mistake I am perhaps making.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Sep 2015 10:12:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/model-constraints-from-a-config-file/m-p/303132#M256262</guid>
      <dc:creator>darkredd</dc:creator>
      <dc:date>2015-09-22T10:12:00Z</dc:date>
    </item>
  </channel>
</rss>

