Class: Reactor::Cm::AttributeGroup
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from ObjectBase
#base_name, base_name, #delete, #delete!, delete!, get, inherited, #initialize, #reload, #save, #save!, serialize_attribute_to_xml, #serialize_attribute_to_xml, set_base_name
Class Method Details
.create(obj_class, name, index = nil) ⇒ Object
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/reactor/cm/attribute_group.rb', line 39
def self.create(obj_class, name, index = nil)
pk = [obj_class, name].join(".")
attributes = {
objClass: obj_class,
name: name
}
attributes[:index] = index if index
super(pk, attributes)
end
|
.exists?(pk_val) ⇒ Boolean
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/reactor/cm/attribute_group.rb', line 26
def self.exists?(pk_val)
request = XmlRequest.prepare do |xml|
xml.where_key_tag!(base_name, primary_key, pk_val)
xml.get_key_tag!(base_name, :name)
end
response = request.execute!
response.ok?
rescue XmlRequestError
false
end
|
Instance Method Details
#add_attributes(attributes) ⇒ Object
50
51
52
|
# File 'lib/reactor/cm/attribute_group.rb', line 50
def add_attributes(attributes)
add_or_remove_attributes(attributes, "add")
end
|
#identifier ⇒ Object
18
19
20
|
# File 'lib/reactor/cm/attribute_group.rb', line 18
def identifier
primary_key_value
end
|
#identifier=(val) ⇒ Object
22
23
24
|
# File 'lib/reactor/cm/attribute_group.rb', line 22
def identifier=(val)
primary_key_value_set(val)
end
|
#move_attribute(attribute, index) ⇒ Object
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/reactor/cm/attribute_group.rb', line 58
def move_attribute(attribute, index)
request = XmlRequest.prepare do |xml|
xml.where_key_tag!(base_name, primary_key, primary_key_value)
xml.tag!("#{base_name}-moveAttribute") do
xml.tag!("attribute") do
xml.text!(attribute.to_s)
end
xml.tag!("index") do
xml.text!(index.to_s)
end
end
end
response = request.execute!
response.ok? && reload
end
|
#remove_attributes(attributes) ⇒ Object
54
55
56
|
# File 'lib/reactor/cm/attribute_group.rb', line 54
def remove_attributes(attributes)
add_or_remove_attributes(attributes, "remove")
end
|
#set(attr, value) ⇒ Object
76
77
78
|
# File 'lib/reactor/cm/attribute_group.rb', line 76
def set(attr, value)
send(:"#{attr}=", value)
end
|