Class DataItem
In: vendor/plugins/services/lib/data_item.rb
Parent: ActiveRecord::Base

This is the the ActiveRecord model that represents data items. A bunch of convienence methods will be added here to help DataService do its job. Of course, this means that DataService will absolutely not be able to run outside of Rails. At least not without some hack.

Methods

Public Class methods

Finds a group of data based on the grouping UUID specified. Can limit to a certain data type if desired. The order the data is returned can be specified using :desc or :asc.

[Source]

    # File vendor/plugins/services/lib/data_item.rb, line 14
14:         def self.findDataByGrouping(groupID, dataType = nil, order = :desc)
15:                 if order == :desc
16:                         sql_order = "DESC"
17:                 elsif order == :asc
18:                         sql_order = "ASC"
19:                 else
20:                         sql_order = "DESC"
21:                 end
22:                 if dataType != nil
23:                         return self.find(:all, :conditions => ["grouping = ? AND datatype = ?", groupID, dataType], :order => "creation #{sql_order}")
24:                 else
25:                         return self.find(:all, :conditions => ["grouping = ?", groupID], :order => "creation #{sql_order}")
26:                 end
27:         end

Finds a specific data item based on its ID

[Source]

    # File vendor/plugins/services/lib/data_item.rb, line 30
30:         def self.findDataItem(dataID)
31:                 return self.find(:first, :conditions => ["dataid = ?", dataID])
32:         end

[Validate]