Class: SoarSr::DomainPerspectives

Inherits:
Handler show all
Includes:
Jsender
Defined in:
lib/soar_sr/domain_perspectives.rb

Direct Known Subclasses

Teams

Instance Attribute Summary

Attributes inherited from Handler

#registry

Instance Method Summary collapse

Methods inherited from Handler

#authorize, #initialize

Methods inherited from Validator

#authorized?, #contact?, #credentials?, #identifier?, #key_provided?, #length_at_least?, #meta?, #one_of, #present?, #provided?, #type?, #uri?, #wadl?

Constructor Details

This class inherits a constructor from SoarSr::Handler

Instance Method Details

#configure_meta_for_domain_perspective(type, domain_perspective, meta) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/soar_sr/domain_perspectives.rb', line 55

def configure_meta_for_domain_perspective(type, domain_perspective, meta)_{
  domain_perspective = standardize(domain_perspective)            
  authorize
  provided?(domain_perspective, one_of(type)) and registered?(domain_perspective, type)
  provided?(type, 'element type') and type?(type)
  provided?(meta, 'meta') and meta?(meta)
  # byebug
  
  detail = extract_detail_for_domain_perspective(type, domain_perspective)
  descriptions = extract_non_meta_descriptions_for_domain_perspective(detail)
  # byebug
  detail['description'] = compile_meta_into_descriptions(descriptions, meta)

  result = @uddi.save_business(detail['id'], detail['name'], detail['description'], detail['contacts'])
  authorized?(result) and identifier?(result, type)
  success('meta updated', result['data'])
}end

#delete_all_domain_perspectivesObject



10
11
12
13
14
15
16
17
18
# File 'lib/soar_sr/domain_perspectives.rb', line 10

def delete_all_domain_perspectives()_{
  authorize
  result = list_domain_perspectives
  if has_data?(result, 'domain_perspectives') 
    result['data']['domain_perspectives'].each do |name, detail|
      @uddi.delete_business(detail['id'])
    end
  end
}end

#deregister_domain_perspective(domain_perspective) ⇒ Object



51
52
53
# File 'lib/soar_sr/domain_perspectives.rb', line 51

def deregister_domain_perspective(domain_perspective)_{
  deregister_domain('domains', domain_perspective)
}end

#domain_perspective_by_name(type, domain_perspective) ⇒ Object



20
21
22
23
24
# File 'lib/soar_sr/domain_perspectives.rb', line 20

def domain_perspective_by_name(type, domain_perspective)
  domain_perspective = standardize(domain_perspective)            
  provided?(domain_perspective, one_of(type))
  @uddi.get_business(compile_domain_id(type, domain_perspective))
end

#domain_perspective_registered?(domain_perspective) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/soar_sr/domain_perspectives.rb', line 43

def domain_perspective_registered?(domain_perspective)_{
  domain_registered?('domains', domain_perspective)
}end

#list_domain_perspectives(domain_types = SoarSr::DOMAIN_TYPES) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/soar_sr/domain_perspectives.rb', line 26

def list_domain_perspectives(domain_types = SoarSr::DOMAIN_TYPES)_{
  result = @uddi.find_businesses
  result['data']['domain_perspectives'] ||= {}

  if has_data?(result, 'businesses')
    result['data']['businesses'].each do |business, detail|
      hetz = false
      domain_types.each do |type|
        hetz = true if detail['id'].include?(type)
      end
      result['data']['domain_perspectives'][business] = detail if hetz
    end
  end
  result['data'].delete('businesses')
  result
}end

#meta_for_domain_perspective(type, domain_perspective) ⇒ Object



73
74
75
76
77
78
79
80
81
82
# File 'lib/soar_sr/domain_perspectives.rb', line 73

def meta_for_domain_perspective(type, domain_perspective)_{
  domain_perspective = standardize(domain_perspective)            
  provided?(domain_perspective, one_of(type)) and registered?(domain_perspective, type)
  provided?(type, 'element type') and type?(type)
  meta = extract_meta_for_domain_perspective(extract_detail_for_domain_perspective(type, domain_perspective))
  meta['associations'] ||= {}
  meta['associations']['service_components'] ||= {}
  meta['associations']['services'] ||= {}
  meta     
}end

#register_domain_perspective(domain_perspective) ⇒ Object



47
48
49
# File 'lib/soar_sr/domain_perspectives.rb', line 47

def register_domain_perspective(domain_perspective)_{
  register_domain('domains', domain_perspective)
}end