Class: Persistence::Object::Complex::ComplexObject

Inherits:
String
  • Object
show all
Includes:
CascadingConfiguration::Setting
Defined in:
lib/persistence/object/complex/complex_object.rb

Overview

Class used for persisting references to other complex objects nested inside a complex object.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ ComplexObject

Returns a new instance of ComplexObject.

Parameters:

  • object

    Object for which ComplexObject instance is used.



17
18
19
20
21
22
23
24
# File 'lib/persistence/object/complex/complex_object.rb', line 17

def initialize( object )
  
  super( object.persistence_id.to_s )
  
  self.persistence_port = object.persistence_port
  self.persistence_bucket = object.persistence_bucket

end

Instance Attribute Details

#delete_cascades=(value) ⇒ Object (writeonly)

Sets the attribute delete_cascades

Parameters:

  • value

    the value to set the attribute delete_cascades to.



33
34
35
# File 'lib/persistence/object/complex/complex_object.rb', line 33

def delete_cascades=(value)
  @delete_cascades = value
end

#Whether this object should be deleted when its parent is deleted.(thisobjectshouldbedeleted) ⇒ Object



33
# File 'lib/persistence/object/complex/complex_object.rb', line 33

attr_writer :delete_cascades

Instance Method Details

#delete_cascades?true, false

Query whether object should be deleted when parent object is deleted.

Returns:

  • (true, false)

    Whether object delete should cascade.



104
105
106
107
108
# File 'lib/persistence/object/complex/complex_object.rb', line 104

def delete_cascades?

  return @delete_cascades

end

#persistObject

Store object to persistence bucket.



42
43
44
45
46
47
48
49
# File 'lib/persistence/object/complex/complex_object.rb', line 42

def persist
  
  global_id = persistence_id
  klass = persistence_port.get_class_for_object_id( global_id )
  
  return klass.persist( global_id )
  
end

#persistence_bucketObject

Get object’s persistence bucket.



84
85
86
87
88
89
90
91
92
93
# File 'lib/persistence/object/complex/complex_object.rb', line 84

def persistence_bucket
  
  unless return_bucket = super
    return_bucket = persistence_port.get_bucket_name_for_object_id( persistence_id )
    self.persistence_bucket = return_bucket
  end
  
  return return_bucket
  
end

#persistence_idObject

Get persistence ID.



58
59
60
61
62
# File 'lib/persistence/object/complex/complex_object.rb', line 58

def persistence_id

  return to_i

end

#persistence_portObject

Get object’s persistence port.



73
# File 'lib/persistence/object/complex/complex_object.rb', line 73

attr_instance_setting :persistence_port