class NicInfo::ResponseObjSet

for keeping track of objects to display

Public Class Methods

new(config) click to toggle source
# File lib/nicinfo/common_json.rb, line 235
def initialize config
  @config = config
  @arr = Array.new #for keeping track of insertion order
  @set = Hash.new
  @self_links = Hash.new
end

Public Instance Methods

add(respObj) click to toggle source
# File lib/nicinfo/common_json.rb, line 242
def add respObj
  if respObj.instance_of? Array
    respObj.each do |obj|
      add obj
    end
  else
    if !@set[ respObj.get_cn ]
      @set[ respObj.get_cn ] = respObj
      @arr << respObj
      self_link = NicInfo.get_self_link( NicInfo.get_links( respObj.objectclass, @config ) )
      @self_links[ self_link ] = respObj if self_link
    end
  end
end
associateEntities(entities) click to toggle source
# File lib/nicinfo/common_json.rb, line 271
def associateEntities entities
  entities.each do |entity|
    associateEntities entity.entities if !entity.entities.empty?
    entity.asEvents.each do |asEvent|
      asEvent.entity_cn = entity.get_cn
      associateEventActor asEvent
    end
  end if entities
end
associateEventActor(eventActor) click to toggle source
# File lib/nicinfo/common_json.rb, line 263
def associateEventActor eventActor
  return if !eventActor or !eventActor.related
  associate = @self_links[ eventActor.related ]
  if associate
    associate.asEventActors << eventActor
  end
end
display() click to toggle source
# File lib/nicinfo/common_json.rb, line 257
def display
  @arr.each do |object|
    object.display
  end
end