<?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 How To Implement Sequence ID In the Alfresco in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/how-to-implement-sequence-id-in-the-alfresco/m-p/258307#M211437</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear Gurus,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm working on the alfresco and i need to implement a sequence of ids, so can you please give me a way to implement a sequence.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Exactly, let we have a type and that type has id and may be exist in the repository multiple instance of that type and all of every instance must has id as a unique identifier and that id must be recognized as this equation:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;sequence no + date as example.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can i implement something like this&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mohammed Amr&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Senior System Developer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Digital Series Co.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Jul 2011 13:17:47 GMT</pubDate>
    <dc:creator>mohammed_amr</dc:creator>
    <dc:date>2011-07-20T13:17:47Z</dc:date>
    <item>
      <title>How To Implement Sequence ID In the Alfresco</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/how-to-implement-sequence-id-in-the-alfresco/m-p/258307#M211437</link>
      <description>Dear Gurus,I'm working on the alfresco and i need to implement a sequence of ids, so can you please give me a way to implement a sequence.Exactly, let we have a type and that type has id and may be exist in the repository multiple instance of that type and all of every instance must has id as a uniq</description>
      <pubDate>Wed, 20 Jul 2011 13:17:47 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/how-to-implement-sequence-id-in-the-alfresco/m-p/258307#M211437</guid>
      <dc:creator>mohammed_amr</dc:creator>
      <dc:date>2011-07-20T13:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: How To Implement Sequence ID In the Alfresco</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/how-to-implement-sequence-id-in-the-alfresco/m-p/258308#M211438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sequences are surprisingly tricky. :roll:&amp;nbsp;&amp;nbsp; And can you allow gaps within your sequence?&amp;nbsp;&amp;nbsp; No gaps makes things far harder :!: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Each node already has a DBID and a NodeRef.&amp;nbsp; Those are the "unique keys" that are already available.&amp;nbsp;&amp;nbsp; I suggest you use these first.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you really do want a sequence then you will need to write some sort of sequence generator.&amp;nbsp;&amp;nbsp; It could be as simple as a five line class with a synchronized counter, although that would need initialising and would not work clustered.&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another approach sometimes used is to put attributes or properties onto a node that gets incremented with each new addition.&amp;nbsp; Or you could use a sequence if you have a database that supports sequences.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Either way you call your sequence generator in an on create policy handler for the specified type.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2011 13:38:29 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/how-to-implement-sequence-id-in-the-alfresco/m-p/258308#M211438</guid>
      <dc:creator>mrogers</dc:creator>
      <dc:date>2011-07-20T13:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: How To Implement Sequence ID In the Alfresco</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/how-to-implement-sequence-id-in-the-alfresco/m-p/258309#M211439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Another approach sometimes used is to put attributes or properties onto a node that gets incremented with each new addition. Or you could use a sequence if you have a database that supports sequences.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;let i used the above scenario, is this scenario support clustered ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;FYI, i use the already built-in alfresco database and it is MYSQL, and i think it is capable to handle the sequences.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2011 14:03:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/how-to-implement-sequence-id-in-the-alfresco/m-p/258309#M211439</guid>
      <dc:creator>mohammed_amr</dc:creator>
      <dc:date>2011-07-20T14:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: How To Implement Sequence ID In the Alfresco</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/how-to-implement-sequence-id-in-the-alfresco/m-p/258310#M211440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes both those approaches would work clustered.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2011 14:15:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/how-to-implement-sequence-id-in-the-alfresco/m-p/258310#M211440</guid>
      <dc:creator>mrogers</dc:creator>
      <dc:date>2011-07-20T14:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: How To Implement Sequence ID In the Alfresco</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/how-to-implement-sequence-id-in-the-alfresco/m-p/258311#M211441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;let i will go through this scenario&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i have a node A with property a, once i create the node B the property a within node A will be incremented by one.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;pseudopod for this&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Assumption:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;getIncrement() {return a + 1}; // where a is the sequence&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Begin:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Node B = new Node(); // new node&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Node A = getNodeA(); // sequence node&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;lock(A); // lock the sequence node by LockService &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;int incremenntByOne = A.getIncrement();&amp;nbsp; // increment the sequence within A by one and return it back to variable incrementByOne&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;B.setId(incrementByOne); // set the new sequence into the new node.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;unlock(A); // unlock sequence node to allow another to gain it&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;end;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- Is this scenario supported by clustered environment ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- should i use the lockService&amp;nbsp; ? or there is another service will be used ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks In Advance&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mohammed Amr.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Senior System Developer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Digital Series Co.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2011 07:02:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/how-to-implement-sequence-id-in-the-alfresco/m-p/258311#M211441</guid>
      <dc:creator>mohammed_amr</dc:creator>
      <dc:date>2011-07-21T07:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: How To Implement Sequence ID In the Alfresco</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/how-to-implement-sequence-id-in-the-alfresco/m-p/258312#M211442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes that should work in a clustered enviornment.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; You probably want to use the JobLockService rather than the LockService.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another approach is just to run the update in a read/write transaction.&amp;nbsp;&amp;nbsp; Should more than one tran attempt to update the same property at the same time then the database will conflict so the looser will rollback.&amp;nbsp;&amp;nbsp; If you use the RetryingTransactionHelper then it will retry for you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2011 09:17:32 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/how-to-implement-sequence-id-in-the-alfresco/m-p/258312#M211442</guid>
      <dc:creator>mrogers</dc:creator>
      <dc:date>2011-07-21T09:17:32Z</dc:date>
    </item>
  </channel>
</rss>

