class Dgrid::API::Workspace::Backup_0_2

Public Class Methods

backed_up_classes() click to toggle source
# File lib/dgrid/api/workspace.rb, line 464
def self.backed_up_classes
  self.entity_classes
end
entity_classes() click to toggle source
# File lib/dgrid/api/workspace.rb, line 458
def self.entity_classes 
  # This is the only real difference between versions 0_1 and 0_2
  # Incident promoted to base-level entity and Keywords added.
  @@entity_classes ||= predecessor.entity_classes + [Incident, Keyword]
end

Protected Class Methods

predecessor() click to toggle source
# File lib/dgrid/api/workspace.rb, line 484
def self.predecessor
  Backup_0_1
end

Public Instance Methods

migrate_from_predecessor(predecessor) click to toggle source
# File lib/dgrid/api/workspace.rb, line 468
def migrate_from_predecessor(predecessor)
  pred_entity_classes = Set.new(predecessor.class.entity_classes)
  self.class.entity_classes.each do |entity_class|
    if pred_entity_classes.include?(entity_class)
      pred_entities = predecessor.get_entities_hash(entity_class)
      set_entities_hash(my_entity_class,pred_entities.clone)
    end
  end
  if self.incidents_are_entities? && !pred_entity_classes.include?(Incident)
    migrate_item_subord_incidents_to_entity_incidents(predecessor)
  end
end

Private Instance Methods

migrate_item_subord_incidents_to_entity_incidents(predecessor) click to toggle source
# File lib/dgrid/api/workspace.rb, line 493
def migrate_item_subord_incidents_to_entity_incidents(predecessor)
  pred_item_ids = predecessor.get_entities_hash(Item).keys
  incidents_hash = {}
  links_hash = get_entities_hash(Link)
  pred_item_ids.each do |item_id|
    item_incidents = incidents(item_id)
    item_incidents.each_pair do |incident_id,incident_params|
      incidents_hash[incident_id] = incident_params
      ensure_links_include_item_incident(links_hash, item_id,incident_id)
    end
  end
end
restore_weird_special_cases_into(workspace) click to toggle source
# File lib/dgrid/api/workspace.rb, line 489
def restore_weird_special_cases_into(workspace)
  # nothing to do, just overriding predecessor's implementation
end