Class: ODDB::Migel::Group

Inherits:
Object show all
Includes:
SimpleLanguage
Defined in:
src/model/migel/group.rb

Constant Summary

ODBA_SERIALIZABLE =
['@descriptions']

Constants included from Persistence

ODBA_PREDEFINE_SERIALIZABLE

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods included from SimpleLanguage

#description, #descriptions, #has_description?, #match, #method_missing, #respond_to?, #search_text, #to_s, #update_values

Methods included from PersistenceMethods

#data_origin, #data_origins, #diff, #init, #nil_if_empty, #parent, #structural_ancestors, #undiffable?, #update_values

Constructor Details

- (Group) initialize(sgcd)

A new instance of Group



18
19
20
21
# File 'src/model/migel/group.rb', line 18

def initialize(sgcd)
  @code = sgcd
  @subgroups = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ODDB::SimpleLanguage

Instance Attribute Details

- (Object) code (readonly) Also known as: pointer_descr

Returns the value of attribute code



15
16
17
# File 'src/model/migel/group.rb', line 15

def code
  @code
end

- (Object) group

Returns the value of attribute group



16
17
18
# File 'src/model/migel/group.rb', line 16

def group
  @group
end

- (Object) limitation_text

Returns the value of attribute limitation_text



16
17
18
# File 'src/model/migel/group.rb', line 16

def limitation_text
  @limitation_text
end

- (Object) subgroups (readonly)

Returns the value of attribute subgroups



15
16
17
# File 'src/model/migel/group.rb', line 15

def subgroups
  @subgroups
end

Instance Method Details

- (Object) checkout



22
23
24
25
26
# File 'src/model/migel/group.rb', line 22

def checkout
  raise "cannot delete nonempty group" unless(@subgroups.empty?)
  @subgroups.odba_delete
  @limitation_text.odba_delete unless(@limitation_text.nil?)
end

- (Object) create_limitation_text



27
28
29
# File 'src/model/migel/group.rb', line 27

def create_limitation_text
  @limitation_text = LimitationText.new
end

- (Object) create_subgroup(sgcd)



30
31
32
33
34
# File 'src/model/migel/group.rb', line 30

def create_subgroup(sgcd)
  subgroup = Subgroup.new(sgcd)
  subgroup.group = self
  @subgroups.store(sgcd, subgroup)
end

- (Object) delete_limitation_text



35
36
37
38
39
40
41
# File 'src/model/migel/group.rb', line 35

def delete_limitation_text
  if(lt = @limitation_text)
    @limitation_text = nil
    lt.odba_delete
    lt
  end
end

- (Object) delete_subgroup(code)



42
43
44
45
46
47
# File 'src/model/migel/group.rb', line 42

def delete_subgroup(code)
  if sbg = @subgroups.delete(code)
    @subgroups.odba_isolated_store
    sbg
  end
end

- (Object) migel_code



48
49
50
# File 'src/model/migel/group.rb', line 48

def migel_code
  @code
end

- (Object) subgroup(code)



51
52
53
# File 'src/model/migel/group.rb', line 51

def subgroup(code)
  @subgroups[code]
end