Class Workflow
In: app/models/workflow.rb
Parent: ActiveRecord::Base

Workflow

Original by:Sysphonic
Authors:MORITA Shintaro
Copyright:Copyright (c) 2007 MORITA Shintaro, Sysphonic. All rights reserved.
License:New BSD License (See LICENSE file)
URL:http://sysphonic.com/

Workflow is related to Item whose xtype attribute is XTYPE_WORKFLOW, and has information of its status and users to require confirmation.

Note:

*

Methods

Constants

STATUS_NOT_APPLIED = 'N/A'
STATUS_NOT_ISSUED = 'not_issued'
STATUS_ACTIVE = 'active'
STATUS_ACCEPTED = 'accepted'
STATUS_DENIED = 'denied'
STATUS_NAMES = { STATUS_NOT_APPLIED => _('N/A'), STATUS_NOT_ISSUED => _('Not Issued'), STATUS_ACTIVE => _('Active'), STATUS_ACCEPTED => _('Accepted'), STATUS_DENIED => _('Denied'), }

Public Class methods

expected_list_for

s Gets list of received Workflows expected to handle currently.

user_id:Target User-ID.
return:List of Workflows.

self.get_comments_for

Gets comments for specified User in the specified order.

orders:Array of orders returned from get_orders().
comments:Array of Comments for a Workflow.
user_id:Target User.
order:Order index to which the specified User belongs.
return:Comments for specified User.

get_received_list

Gets list of received Workflows of specified User.

user_id:Target User-ID.
order_by:Order. ex. ‘id ASC‘
return:List of received Workflows.

self.get_rss

Gets RSS feed of specified User.

maker:The RSS maker.
user:The target User.
root_url:Root URL.

self.get_toys

Gets Toys (desktop items) of specified User.

user:The target User.
return:Toys (desktop items) of specified User.

Public Instance methods

get_current_expected

Gets current response-expected Users.

return:Array of current response-expected User-IDs. If denied or not issued, returns nil. If accepted returns empty array.

get_last_nak

Gets last NAK Comment.

return:Last NAK Comment, or nil if not found.

get_order_idx

Gets order index to which specified User belongs.

user_id:Target User-ID.
return:Order index to which specified User belongs. If not found, returns -1.

get_orders

Gets Workflow orders.

return:Order array of hash which has User-ID as key and User name as value.

ex.

0
(Order-1) = {‘1’ => ‘Team Leader A’, ‘2’ => ‘Team Leader B’}
1
(Order-2) = {‘3’ => ‘Group Leader’}
2
(Order-3) = {‘4’ => ‘Manager’}

get_status_name

Gets String which represents status of the Workflow.

return:String which represents status of the Workflow.

get_target_users

Gets all target Users of this Workflow.

return:Array of User-ID of the target Users.

update_status

Updates status of this Workflow.

[Validate]