infopark_cloud_connector 6.8.0.beta.200.650.7c93155 → 6.8.0.beta.200.663.ceecdee

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,9 +4,14 @@ module RailsConnector
4
4
  class ContentCache < CmsBaseModel
5
5
  self.key_prefix = "cc"
6
6
 
7
- property :workspace_id
7
+ property :revision_id
8
8
  property :transferring_to
9
9
 
10
+ # TODO remove when renaming workspace to revision in code
11
+ def workspace_id
12
+ revision_id
13
+ end
14
+
10
15
  # returns the workspace that is represented by this content cache.
11
16
  # returns nil if the workspace cannot be found.
12
17
  def workspace
@@ -26,14 +26,14 @@ module RailsConnector
26
26
  # instantiate an Obj instance from obj_data.
27
27
  # May result in an instance of a subclass of Obj according to STI rules.
28
28
  def self.instantiate(obj_data) # :nodoc:
29
- obj_class = obj_data["values"]["obj_class"]
29
+ obj_class = obj_data["values"]["_obj_class"]
30
30
  Obj.compute_type(obj_class).new(
31
31
  obj_data["values"], obj_data
32
32
  )
33
33
  end
34
34
 
35
35
  def id
36
- @values["id"]
36
+ @values["_id"]
37
37
  end
38
38
 
39
39
  ### FINDERS ####################
@@ -163,7 +163,7 @@ module RailsConnector
163
163
  end
164
164
 
165
165
  def path_list # :nodoc:
166
- read_attribute(:path) || []
166
+ read_attribute(:_path) || []
167
167
  end
168
168
 
169
169
  # returns the Obj's name, i.e. the last component of the path.
@@ -211,7 +211,7 @@ module RailsConnector
211
211
 
212
212
  # returns the obj's permalink.
213
213
  def permalink
214
- read_attribute(:permalink)
214
+ read_attribute(:_permalink)
215
215
  end
216
216
 
217
217
  # This method determines the controller that should be invoked when the Obj is requested.
@@ -245,7 +245,7 @@ module RailsConnector
245
245
 
246
246
  # Returns the type of the object: :document, :publication, :image or :generic
247
247
  def object_type
248
- read_attribute(:obj_type).to_sym
248
+ read_attribute(:_obj_type).to_sym
249
249
  end
250
250
 
251
251
  # Returns true if image? or generic?
@@ -290,7 +290,7 @@ module RailsConnector
290
290
  # (for example a teaser) and will not be delivered by the rails application
291
291
  # as a standalone web page.
292
292
  def suppressed?
293
- @values["suppress_export"] ? true : false
293
+ @values["_suppress_export"] ? true : false
294
294
  end
295
295
 
296
296
  # Returns true if the export of the object is not suppressed and the content is active?
@@ -364,31 +364,31 @@ module RailsConnector
364
364
  end
365
365
 
366
366
  def sort_order # :nodoc:
367
- read_attribute(:sort_order) == 1 ? "descending" : "ascending"
367
+ read_attribute(:_sort_order) == 1 ? "descending" : "ascending"
368
368
  end
369
369
 
370
370
  def sort_type1 # :nodoc:
371
- converted_sort_type(:sort_type1)
371
+ converted_sort_type(:_sort_type1)
372
372
  end
373
373
 
374
374
  def sort_type2 # :nodoc:
375
- converted_sort_type(:sort_type2)
375
+ converted_sort_type(:_sort_type2)
376
376
  end
377
377
 
378
378
  def sort_type3 # :nodoc:
379
- converted_sort_type(:sort_type3)
379
+ converted_sort_type(:_sort_type3)
380
380
  end
381
381
 
382
382
  def sort_key1 # :nodoc:
383
- converted_sort_key(:sort_key1)
383
+ converted_sort_key(:_sort_key1)
384
384
  end
385
385
 
386
386
  def sort_key2 # :nodoc:
387
- converted_sort_key(:sort_key2)
387
+ converted_sort_key(:_sort_key2)
388
388
  end
389
389
 
390
390
  def sort_key3 # :nodoc:
391
- converted_sort_key(:sort_key3)
391
+ converted_sort_key(:_sort_key3)
392
392
  end
393
393
 
394
394
  # Returns the Object with the given name next in the hierarchy
@@ -399,18 +399,38 @@ module RailsConnector
399
399
  parent.find_nearest(name) unless self.root?
400
400
  end
401
401
 
402
+ OLD_INTERNAL_KEYS = Set.new(%w(
403
+ body
404
+ id
405
+ last_changed
406
+ name
407
+ obj_class
408
+ obj_type
409
+ path
410
+ permalink
411
+ sort_key1
412
+ sort_key2
413
+ sort_key3
414
+ sort_order
415
+ sort_type1
416
+ sort_type2
417
+ sort_type3
418
+ suppress_export
419
+ text_links
420
+ valid_from
421
+ valid_until
422
+ ))
402
423
  # Returns the value of the attribute specified by its name.
403
424
  #
404
425
  # Passing an invalid key will not raise an error, but return nil.
405
426
  def [](raw_key)
406
427
  key = raw_key.to_s
407
- case key
408
- when "name"
409
- name
410
- when "body"
411
- body
412
- else
413
- read_attribute(key)
428
+ if OLD_INTERNAL_KEYS.include?(key)
429
+ send(key)
430
+ elsif key.start_with?('_')
431
+ send(key.slice(1..-1))
432
+ else
433
+ read_attribute(key)
414
434
  end
415
435
  end
416
436
 
@@ -422,16 +442,24 @@ module RailsConnector
422
442
  update_data(obj_data["values"], obj_data)
423
443
  end
424
444
 
445
+ def text_links
446
+ read_attribute(:_text_links)
447
+ end
448
+
449
+ def obj_class
450
+ read_attribute(:_obj_class)
451
+ end
452
+
425
453
  def last_changed
426
- self[:last_changed]
454
+ read_attribute(:_last_changed)
427
455
  end
428
456
 
429
457
  def valid_from
430
- self[:valid_from]
458
+ read_attribute(:_valid_from)
431
459
  end
432
460
 
433
461
  def valid_until
434
- self[:valid_until]
462
+ read_attribute(:_valid_until)
435
463
  end
436
464
 
437
465
  # For a binary Obj, the content_type is equal to the content_type of it's body (i.e. it's data).
@@ -499,41 +527,35 @@ module RailsConnector
499
527
 
500
528
  def read_attribute(name)
501
529
  name = name.to_s
502
- if name == "suppress_export"
503
- suppress_export
504
- else
505
- raw = @values[name]
506
- @attr_cache[name] ||= case type_of(name)
507
- when :markdown
508
- StringTagging.tag_as_markdown(raw, self)
509
- when :html
510
- StringTagging.tag_as_html(raw, self)
511
- when :date
512
- DateAttribute.parse raw if raw
513
- when :linklist
514
- if name == "text_links"
515
- LinkList.new(raw.values)
516
- else
517
- LinkList.new(raw)
518
- end
530
+ raw = @values[name]
531
+ @attr_cache[name] ||= case type_of(name)
532
+ when :markdown
533
+ StringTagging.tag_as_markdown(raw, self)
534
+ when :html
535
+ StringTagging.tag_as_html(raw, self)
536
+ when :date
537
+ DateAttribute.parse raw if raw
538
+ when :linklist
539
+ if name == "_text_links"
540
+ LinkList.new(raw.values)
519
541
  else
520
- raw
521
- end
542
+ LinkList.new(raw)
543
+ end
544
+ else
545
+ raw
522
546
  end
523
547
  end
524
548
 
525
549
  def type_of(key)
526
550
  key = key.to_s
527
551
  case key
528
- when "permission_live_server_read"
529
- nil
530
- when "text_links"
552
+ when "_text_links"
531
553
  :linklist
532
- when "valid_from"
554
+ when "_valid_from"
533
555
  :date
534
- when "valid_until"
556
+ when "_valid_until"
535
557
  :date
536
- when "last_changed"
558
+ when "_last_changed"
537
559
  :date
538
560
  when "title"
539
561
  :html
@@ -584,14 +606,12 @@ module RailsConnector
584
606
  def converted_sort_key(attribute)
585
607
  key = read_attribute(attribute)
586
608
  case key
587
- when "validUntil"
588
- "valid_until"
589
- when "validFrom"
590
- "valid_from"
591
- when "lastChanged"
592
- "last_changed"
593
- when "contentType"
594
- "content_type"
609
+ when "_validUntil"
610
+ "_valid_until"
611
+ when "_validFrom"
612
+ "_valid_from"
613
+ when "_lastChanged"
614
+ "_last_changed"
595
615
  else
596
616
  key
597
617
  end
@@ -11,7 +11,7 @@ class Version
11
11
  end
12
12
 
13
13
  def workspace_id
14
- @doc["workspace_id"]
14
+ @doc["revision_id"]
15
15
  end
16
16
 
17
17
  def diff
@@ -3,13 +3,18 @@ module RailsConnector
3
3
 
4
4
  class Workspace < CmsBaseModel
5
5
 
6
- self.key_prefix = "ws"
6
+ self.key_prefix = "rev"
7
7
 
8
8
  property :generation
9
- property :base_workspace_id
9
+ property :base_revision_id
10
10
  property :title
11
11
  property :content_cache_id
12
12
 
13
+ # TODO remove when renaming workspace to revision in code
14
+ def base_workspace_id
15
+ base_revision_id
16
+ end
17
+
13
18
  # Selects the workspace with the given id as current workspace
14
19
  def self.current=(workspace)
15
20
  @current = workspace
@@ -107,7 +112,7 @@ module RailsConnector
107
112
  obj_data_list.each do |obj_data|
108
113
  values = obj_data["values"]
109
114
  UNIQUE_INDICES.each do |unique_index|
110
- index_value = values[unique_index.to_s]
115
+ index_value = values["_#{unique_index}"]
111
116
  if (converter = OBJ_PROPERTY_VALUE_TO_RANGE_VALUE_CONVERSIONS[unique_index])
112
117
  index_value = converter.call(index_value)
113
118
  end
@@ -126,9 +131,9 @@ module RailsConnector
126
131
  def extract_obj_data(data)
127
132
  {
128
133
  "values" => data["values"].merge(
129
- "id" => data["obj_id"],
130
- "obj_type" => data["obj_type"],
131
- "obj_class" => data["obj_class"]["name"]
134
+ "_id" => data["obj_id"],
135
+ "_obj_type" => data["obj_type"],
136
+ "_obj_class" => data["obj_class"]["name"]
132
137
  ),
133
138
  "attributes" => data["attributes"]
134
139
  }
@@ -2,9 +2,14 @@
2
2
  module RailsConnector
3
3
 
4
4
  class WorkspaceLabel < CmsBaseModel
5
- self.key_prefix = "wsl"
5
+ self.key_prefix = "ws"
6
6
 
7
- property :workspace_id
7
+ property :revision_id
8
+
9
+ # TODO remove when renaming workspace to revision in code
10
+ def workspace_id
11
+ revision_id
12
+ end
8
13
  end
9
14
 
10
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_cloud_connector
3
3
  version: !ruby/object:Gem::Version
4
- hash: -30600717246
4
+ hash: -16163019875
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 6
@@ -9,11 +9,9 @@ version: !ruby/object:Gem::Version
9
9
  - 0
10
10
  - beta
11
11
  - 200
12
- - 650
13
- - 7
14
- - c
15
- - 93155
16
- version: 6.8.0.beta.200.650.7c93155
12
+ - 663
13
+ - ceecdee
14
+ version: 6.8.0.beta.200.663.ceecdee
17
15
  platform: ruby
18
16
  authors:
19
17
  - Infopark AG
@@ -21,7 +19,7 @@ autorequire:
21
19
  bindir: bin
22
20
  cert_chain: []
23
21
 
24
- date: 2012-06-01 00:00:00 +02:00
22
+ date: 2012-06-06 00:00:00 +02:00
25
23
  default_executable:
26
24
  dependencies:
27
25
  - !ruby/object:Gem::Dependency
@@ -62,18 +60,16 @@ dependencies:
62
60
  requirements:
63
61
  - - "="
64
62
  - !ruby/object:Gem::Version
65
- hash: -30600717246
63
+ hash: -16163019875
66
64
  segments:
67
65
  - 6
68
66
  - 8
69
67
  - 0
70
68
  - beta
71
69
  - 200
72
- - 650
73
- - 7
74
- - c
75
- - 93155
76
- version: 6.8.0.beta.200.650.7c93155
70
+ - 663
71
+ - ceecdee
72
+ version: 6.8.0.beta.200.663.ceecdee
77
73
  version_requirements: *id003
78
74
  name: kvom
79
75
  prerelease: false