<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,55 +1,34 @@
-#
-#--
-# Copyright (c) 2007, John Mettraux OpenWFE.org
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# . Redistributions of source code must retain the above copyright notice, this
-#   list of conditions and the following disclaimer.
-#
-# . Redistributions in binary form must reproduce the above copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-#
-# . Neither the name of the &quot;OpenWFE&quot; nor the names of its contributors may be
-#   used to endorse or promote products derived from this software without
-#   specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot;
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#++
-#
-# $Id: definitions.rb 2725 2006-06-02 13:26:32Z jmettraux $
-#
 
+# Copyright (c) 2001-2009, John Mettraux, jmettraux@gmail.com
 #
-# &quot;made in Japan&quot;
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the &quot;Software&quot;), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
 #
-# John Mettraux at openwfe.org
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
 #
+# THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
 
-#
 # see
 # http://groups.google.com/group/openwferu-users/browse_frm/thread/81294030fc52cd04
 # for the context of this example
-#
 
 require 'rubygems'
 
+require 'openwfe/workitem'
 #require 'openwfe/engine/engine'
-require 'openwfe/engine/file_persisted_engine'
-require 'openwfe/expressions/raw_prog'
+require 'openwfe/engine/fs_engine'
 require 'openwfe/worklist/storeparticipant'
 
 
@@ -57,42 +36,39 @@ require 'openwfe/worklist/storeparticipant'
 # The process definition
 # (using a programmatic process definition instead of an XML process definition)
 
-class TrackerDefinition &lt; OpenWFE::ProcessDefinition
-  def make
+TRACKER_DEF = OpenWFE.process_definition :name =&gt; 'mano_tracker' do
 
-    _loop do
-      participant &quot;${f:creative}&quot;
-      participant &quot;${f:analyst}&quot;
+  _loop do
+    participant '${f:creative}'
+    participant '${f:analyst}'
 
-      _break :if =&gt; &quot;${f:done}&quot;
-        #
-        # loops until the analyst sets the value of the field
-        # 'done' to true.
-    end
+    _break :if =&gt; '${f:done}'
       #
-      # 'loop' and 'break' are ruby keywords, they have to be
-      # preceded by an underscore '_' to be used in their
-      # OpenWFEru sense.
+      # loops until the analyst sets the value of the field
+      # 'done' to true.
   end
+    #
+    # 'loop' and 'break' are ruby keywords, they have to be
+    # preceded by an underscore '_' to be used in their ruote sense.
 end
 
 #
 # prepare the engine and the participants
 
-ANALYSTS = [ &quot;Mano&quot;, &quot;Matt&quot;, &quot;Moe&quot; ]
-CREATIVES = [ &quot;Jamie&quot;, &quot;Jeff&quot;, &quot;John&quot;, &quot;Jeremy&quot; ]
+ANALYSTS = %w[ Mano Matt Moe ]
+CREATIVES = %w[ Jami Jeff John Jeremy ]
 
 #
 # instantiate the engine (a transient one is sufficient for the example)
 
-#$engine = OpenWFE::Engine.new
-  # no persistence
+ac = {}
+ac[:definition_in_launchitem_allowed] = true
 
-#$engine = OpenWFE::FilePersistedEngine.new
-  # persistence, but no caching (worst performance)
+#$engine = OpenWFE::Engine.new(ac)
+  # no persistence
 
-$engine = OpenWFE::CachedFilePersistedEngine.new
-  # persistence and performance
+$engine = OpenWFE::FsPersistedEngine.new(ac)
+  # persisted to work/
 
 $analyst_stores = {}
 $creative_stores = {}
@@ -116,7 +92,7 @@ add_stores(CREATIVES, $creative_stores)
 #
 def launch_tracker (analyst_name, creative_name, title, item_url)
 
-  li = LaunchItem.new(TrackerDefinition)
+  li = OpenWFE::LaunchItem.new(TRACKER_DEF)
     #
     # preparing a lunchitem ;) around our TrackerDefinition
 
@@ -139,26 +115,26 @@ end
 # Later it can be used as follow
 
 fei = launch_tracker(
-  &quot;Mano&quot;,
-  &quot;Jamie&quot;,
-  &quot;new logo for company&quot;,
-  &quot;http://openwferu.rubyforge.org/images/openwfe-logo.png&quot;)
+  'Mano',
+  'Jami',
+  'new logo for company',
+  'http://openwferu.rubyforge.org/images/openwfe-logo.png')
 
 puts &quot;launched tracker process #{fei.workflow_instance_id}&quot;
 
 #
-# the creative Jamie can browse the items he has to treat with :
+# the creative Jami can browse the items he has to treat with :
 
-jamie_store = $analyst_stores[&quot;Jamie&quot;]
+jami_store = $creative_stores['Jami']
 
 first_fei = nil
 
-jamie_store.each do |fei, workitem|
-  first_fei = fei unless fei
+jami_store.each do |fei, workitem|
+  first_fei ||= fei
   puts &quot; - #{fei.workflow_instance_id} -- #{workitem.title}&quot;
 end
 
-workitem = jamie_store[first_fei]
+workitem = jami_store[first_fei]
 
 # play with the workitem and then send it back to the engine
 
@@ -166,7 +142,7 @@ workitem.item_url = &quot;some other url&quot;
   #
   # actually just changing the item_url
 
-jamie_store.forward(workitem)
+jami_store.forward(workitem)
 
 # ...
 </diff>
      <filename>examples/mano_tracker.rb</filename>
    </modified>
    <modified>
      <diff>@@ -216,7 +216,6 @@ module OpenWFE
     #
     #   {:fullpath}/
     #
-    #
     def initialize (options={})
 
       self.application_context = options[:application_context]
@@ -230,6 +229,11 @@ module OpenWFE
       FileUtils.mkdir_p(@fullpath)
     end
 
+    def [] (fei)
+
+      load_workitem(filename_for(fei))
+    end
+
     def []= (fei, workitem)
 
       File.open(filename_for(fei), 'w') do |f|</diff>
      <filename>lib/openwfe/participants/store_participants.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1a722a57cc244459f17bfa09b3dbc1b6c24d281a</id>
    </parent>
  </parents>
  <author>
    <name>John Mettraux</name>
    <email>jmettraux@gmail.com</email>
  </author>
  <url>http://github.com/jmettraux/ruote/commit/0a8bd18251de1392cc897f2cd5b27598f540b1a0</url>
  <id>0a8bd18251de1392cc897f2cd5b27598f540b1a0</id>
  <committed-date>2009-05-31T22:53:46-07:00</committed-date>
  <authored-date>2009-05-31T22:53:46-07:00</authored-date>
  <message>bug #26085 : mano_tracker.rb seriously outdated. Fixed.</message>
  <tree>50450b6ec0267f4271f262949dd6e2e7a3750bd6</tree>
  <committer>
    <name>John Mettraux</name>
    <email>jmettraux@gmail.com</email>
  </committer>
</commit>
