class Libis::Workflow::Mongoid::WorkItem

Public Instance Methods

add_item(item) click to toggle source
Calls superclass method
# File lib/libis/workflow/mongoid/work_item.rb, line 29
def add_item(item)
  raise Libis::WorkflowError, 'Trying to add item already linked to another item' unless item.parent.nil?
  super(item)
end
copy_item(item) { |new_item, item| ... } click to toggle source
# File lib/libis/workflow/mongoid/work_item.rb, line 34
def copy_item(item)
  new_item = item.dup
  yield new_item, item if block_given?
  new_item.parent = nil
  item.get_items.each { |i| new_item.copy_item(i) }
  self.add_item(new_item)
  new_item
end
get_item_list() click to toggle source
# File lib/libis/workflow/mongoid/work_item.rb, line 59
def get_item_list
  self.items.to_a
end
get_items() click to toggle source
# File lib/libis/workflow/mongoid/work_item.rb, line 55
def get_items
  self.items.no_timeout
end
move_item(item) { |new_item, item| ... } click to toggle source
# File lib/libis/workflow/mongoid/work_item.rb, line 43
def move_item(item)
  new_item = item.dup
  yield new_item, item if block_given?
  new_item.parent = nil
  item.get_items.each { |i| new_item.move_item(i) }
  self.add_item(new_item)
  if item.parent
    item.parent.items.delete(item)
  end
  new_item
end

Protected Instance Methods

add_status_log(info) click to toggle source
# File lib/libis/workflow/mongoid/work_item.rb, line 69
def add_status_log(info)
  # noinspection RubyResolve
  self.status_log << info
  self.status_log.last
end
save_log_entry(_log_entry) click to toggle source
# File lib/libis/workflow/mongoid/work_item.rb, line 65
def save_log_entry(_log_entry)
  self.save!
end