Really my tabs still are there?
I have switched my kdevelop setting....
Here if the diff
recapitulation:
- the new ActiveParticipant may read both style of stored workitems
-> Yes
- it can query only the old "with field table" workitems, queries on
new workitems will return [] (empty array)
-> Yes, it makes the queries also on the compact ones but the search stops
at the participant_names
- the integrator/admin/developer decides which version he wants to use
when instantiating the participant
-> Yes
- the default is the current behaviour
-> Yes
Ok?
Tom
On Jan 11, 2008 9:43 AM, John Mettraux <[EMAIL PROTECTED]> wrote:
>
> On Jan 11, 2008 5:41 PM, Tomaso Tosolini <[EMAIL PROTECTED]>
> wrote:
> >
> > Ok for me, i'll start writing soon.
>
> Great, have a nice week-end too.
>
> I'll be after you for the tabs vs spaces and the docs :)
>
>
> Thanks a lot,
>
> --
> John Mettraux -///- http://jmettraux.openwfe.org
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"OpenWFEru dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/openwferu-dev?hl=en
-~----------~----~----~----~------~----~------~--~---
Index: activeparticipants.rb
===================================================================
--- activeparticipants.rb (revision 1434)
+++ activeparticipants.rb (working copy)
@@ -81,6 +85,10 @@
t.column :store_name, :string
t.column :dispatch_time, :timestamp
t.column :last_modified, :timestamp
+
+ t.column :yattributes, :text
+ # when using compact_workitems, attributes are store here
+
end
add_index :workitems, :wfid
add_index :workitems, :wf_name
@@ -146,6 +154,9 @@
has_many :fields, :dependent => :destroy
+ serialize :yattribues
+
+
#
# Returns the flow expression id of this work (its unique OpenWFEru
# identifier) as a FlowExpressionId instance.
@@ -182,10 +193,27 @@
i.store_name = store_name
- wi.attributes.each do |k, v|
- i.fields << Field.new_field(k, v)
+
+ # This is a field set by the active participant immediately before calling this method.
+ # the default behavior is "use field method"
+
+ if wi.attributes["compact_workitems"]
+
+ wi.attributes.delete("compact_workitems")
+ i.yattributes= wi.attributes
+
+ else
+
+ i.yattributes= nil
+
+ wi.attributes.each do |k, v|
+ i.fields << Field.new_field(k, v)
+ end
+
+
end
+
i.save!
# making sure to throw an exception in case of trouble
end
@@ -217,6 +245,8 @@
#
def fields_hash
+ return self.yattributes if self.yattributes
+
h = {}
fields.each do |f|
h[f.fkey] = f.value
@@ -231,6 +261,11 @@
#
def replace_fields (fhash)
+ if self.yattributes
+ self.yattributes = fhash
+ return
+ end
+
fields.delete_all
fhash.each do |k, v|
@@ -253,6 +288,10 @@
# wi.field :customer_name
#
def field (key)
+
+ if self.yattributes
+ return self.yattributes[key.to_s]
+ end
fields.find_by_fkey(key.to_s)
end
@@ -328,6 +367,10 @@
#
# A kind of 'google search' among workitems
#
+ # WARNING: when this is used on compact_workitmes, it will not be able to search info
+ # within the fields, because they aren't used by this kind of workitems. In
+ # this case the search will be limited to paritipant_name
+ #
def self.search (search_string, storename_list=nil)
storename_list = Array(storename_list) if storename_list
@@ -494,15 +537,36 @@
# # ...
# end
#
+ # -----------------------
+ #
+ # COMPACT WORKITEMS:
+ # It is possible to save all the workitem data into a single table, the workitems table, without
+ # splitting info between workitems and fields.
+ #
+ # You can configure the "compact_workitems" behavior by setting the field compact_workitems to true:
+ # Add to the previous lines:
+ # >
+ # > new_active_participant = engine.register_participant(
+ # > :active_participant_name, OpenWFE::Extras::ActiveParticipant)
+ # >
+ # > new_active_participant.compact_workitems = true # <-- enables compact_workitems operating way
+ # >
+ #
class ActiveParticipant
include OpenWFE::LocalParticipant
+ :compact_workitems
+
#
# This is the method called by the OpenWFEru engine to hand a
# workitem to this participant.
#
def consume (workitem)
+ if compact_workitems
+ workitem.attributes["compact_workitems"] = true
+ end
+
Workitem.from_owfe_workitem(workitem)
end
@@ -558,6 +622,10 @@
#
def consume (workitem)
+ if compact_workitems
+ workitem.attributes["compact_workitems"] = true
+ end
+
Workitem.from_owfe_workitem(workitem, @store_name)
end