# #-- # Copyright (c) 2005-2006, 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 "OpenWFE" 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 "AS IS" # 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: workitem.rb 3556 2006-11-13 04:15:52Z jmettraux $ # # # "hecho en Costa Rica" # # john.mettraux@openwfe.org # require 'base64' require 'definitions' require 'utils' module OpenWFE # # WORKITEMS # class WorkItem attr_accessor :lastModified, :attributes def initialize () @lastModified = nil @attributes = {} @attributes[MAP_TYPE] = E_SMAP end def copy () raise "not implemented" end end class InFlowItem < WorkItem attr_accessor :flowExpressionId, :participantName def lastExpressionId return @flowExpressionId end def lastExpressionId= (fei) @flowExpressionId = fei end alias last_expression_id lastExpressionId end class InFlowWorkItem < InFlowItem attr_accessor :dispatchTime, :filter, :history attr_accessor :store # # special : added by the ruby lib, not given by the worklist def dup return OpenWFE::dup(self) end end class CancelItem < InFlowItem end class LaunchItem < WorkItem attr_accessor :workflowDefinitionUrl #, :descriptionMap end # # HISTORY ITEM # class HistoryItem attr_accessor \ :date, \ :author, \ :host, \ :text, \ :wfdName, \ :wfdRevision, \ :wfInstanceId, \ :expressionId def dup return OpenWFE::dup(self) end end # # STORES # # # Models the information about a store as viewed by the current user # (upon calling the listStores or getStoreNames methods) # class Store attr_accessor :name, :workitemCount, :permissions def initialize () @name = nil @workitemCount = nil @permissions = nil end # # Returns true if the current user may read headers and workitems # from this store # def mayRead? () return @permissions.index('r') > -1 end # # Returns true if the current user may modify workitems (and at least # proceed/forward them) in this store # def mayWrite? () return @permissions.index('w') > -1 end # # Returns true if the current user may browse the headers of this # store # def mayBrowse? () return @permissions.index('b') > -1 end # # Returns true if the current user may delegate workitems to this store # def mayDelegate? () return @permissions.index('d') > -1 end end # # A header is a summary of a workitem, returned by the getHeader # worklist method # class Header attr_accessor :lastModified, :locked, :flowExpressionId, :attributes end # # MISC ATTRIBUTES # # in openwfe-ruby, OpenWFE attributes are immediately mapped to # Ruby instances, but some attributes still deserve their own class # # # a wrapper for some binary content # class Base64Attribute attr_accessor :content def initialize (base64content) @content = base64content end # # dewraps (decode) the current content and returns it # def dewrap () return Base64.decode64(@content) end # # wraps some binary content and stores it in this attribute # (class method) # def Base64Attribute.wrap (binaryData) return Base64Attribute.new(Base64.encode64(binaryData)) end end # # LAUNCHABLE # class Launchable attr_accessor :url, :engineId end # # EXPRESSION (for the control iface) # class Expression attr_accessor :id, :applyTime, :state, :stateSince end end