infopark_cloud_connector 6.8.0.beta.200.663.ceecdee → 6.8.0.beta.200.681.7c84f4a

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,35 +1,20 @@
1
1
  #:enddoc:
2
2
  module RailsConnector
3
+ class Attribute
4
+ attr_reader :name, :type
3
5
 
4
- class Attribute < CmsBaseModel
5
- def self.type_of(name)
6
- attribute = attribute_cache[name.to_s]
7
- attribute.type if attribute
8
- end
9
-
10
- def self.reset_cache
11
- @attribute_cache = nil
12
- end
13
-
14
- def name
15
- attribute_name
6
+ def initialize(data)
7
+ @name, @type = data['name'], data['type'].to_sym
16
8
  end
17
9
 
18
- def type
19
- attribute_type.to_sym
10
+ def self.by_name(name)
11
+ data = Workspace.current.attributes[name.to_s]
12
+ new(data) if data
20
13
  end
21
14
 
22
- module ClassMethods
23
- private
24
-
25
- def attribute_cache
26
- @attribute_cache ||= find(:all).each_with_object({}) do |attr, map|
27
- map[attr.name] = attr
28
- end
29
- end
15
+ def self.type_of(name)
16
+ attribute = by_name(name)
17
+ attribute.type if attribute
30
18
  end
31
-
32
- extend ClassMethods
33
19
  end
34
-
35
20
  end
@@ -33,7 +33,7 @@ module RailsConnector
33
33
  end
34
34
 
35
35
  def id
36
- @values["_id"]
36
+ read_raw_attribute_value('_id')
37
37
  end
38
38
 
39
39
  ### FINDERS ####################
@@ -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
+ read_raw_attribute_value('_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?
@@ -527,7 +527,7 @@ module RailsConnector
527
527
 
528
528
  def read_attribute(name)
529
529
  name = name.to_s
530
- raw = @values[name]
530
+ raw = read_raw_attribute_value(name)
531
531
  @attr_cache[name] ||= case type_of(name)
532
532
  when :markdown
533
533
  StringTagging.tag_as_markdown(raw, self)
@@ -606,17 +606,21 @@ module RailsConnector
606
606
  def converted_sort_key(attribute)
607
607
  key = read_attribute(attribute)
608
608
  case key
609
- when "_validUntil"
609
+ when "_valid_until"
610
610
  "_valid_until"
611
- when "_validFrom"
611
+ when "_valid_from"
612
612
  "_valid_from"
613
- when "_lastChanged"
613
+ when "_last_changed"
614
614
  "_last_changed"
615
615
  else
616
616
  key
617
617
  end
618
618
  end
619
619
 
620
+ def read_raw_attribute_value(attribute_name)
621
+ @values[attribute_name]
622
+ end
623
+
620
624
  class << self
621
625
  private
622
626
 
@@ -7,7 +7,7 @@ module ObjBody
7
7
  if binary?
8
8
  nil
9
9
  else
10
- StringTagging.tag_as_html(read_attribute(:blob), self)
10
+ StringTagging.tag_as_html(read_attribute(:body), self)
11
11
  end
12
12
  end
13
13
 
@@ -1,35 +1,19 @@
1
1
  #:enddoc:
2
2
  module RailsConnector
3
+ class ObjClass
4
+ attr_reader :name
3
5
 
4
- class ObjClass < CmsBaseModel
5
- def self.by_name(name)
6
- obj_class_cache[name]
7
- end
8
-
9
- def self.reset_cache
10
- @obj_class_cache = nil
11
- end
12
-
13
- def name
14
- obj_class_name
6
+ def initialize(data)
7
+ @name, @attributes = data['name'], data['attributes']
15
8
  end
16
9
 
17
- def has_attribute?(name)
18
- @custom_attribute_names ||= custom_attributes.map(&:name)
19
- @custom_attribute_names.include?(name.to_s)
10
+ def self.by_name(name)
11
+ data = Workspace.current.obj_classes[name.to_s]
12
+ new(data) if data
20
13
  end
21
14
 
22
- module ClassMethods
23
- private
24
-
25
- def obj_class_cache
26
- @obj_class_cache ||= find(:all).each_with_object({}) do |objclass, map|
27
- map[objclass.name] = objclass
28
- end
29
- end
15
+ def has_attribute?(attribute_name)
16
+ @attributes.include?(attribute_name.to_s)
30
17
  end
31
-
32
- extend ClassMethods
33
18
  end
34
-
35
19
  end
@@ -9,6 +9,8 @@ module RailsConnector
9
9
  property :base_revision_id
10
10
  property :title
11
11
  property :content_cache_id
12
+ property :attributes
13
+ property :obj_classes
12
14
 
13
15
  # TODO remove when renaming workspace to revision in code
14
16
  def base_workspace_id
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: -16163019875
4
+ hash: -177875434235
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 6
@@ -9,9 +9,14 @@ version: !ruby/object:Gem::Version
9
9
  - 0
10
10
  - beta
11
11
  - 200
12
- - 663
13
- - ceecdee
14
- version: 6.8.0.beta.200.663.ceecdee
12
+ - 681
13
+ - 7
14
+ - c
15
+ - 84
16
+ - f
17
+ - 4
18
+ - a
19
+ version: 6.8.0.beta.200.681.7c84f4a
15
20
  platform: ruby
16
21
  authors:
17
22
  - Infopark AG
@@ -19,7 +24,7 @@ autorequire:
19
24
  bindir: bin
20
25
  cert_chain: []
21
26
 
22
- date: 2012-06-06 00:00:00 +02:00
27
+ date: 2012-06-26 00:00:00 +02:00
23
28
  default_executable:
24
29
  dependencies:
25
30
  - !ruby/object:Gem::Dependency
@@ -60,16 +65,21 @@ dependencies:
60
65
  requirements:
61
66
  - - "="
62
67
  - !ruby/object:Gem::Version
63
- hash: -16163019875
68
+ hash: -177875434235
64
69
  segments:
65
70
  - 6
66
71
  - 8
67
72
  - 0
68
73
  - beta
69
74
  - 200
70
- - 663
71
- - ceecdee
72
- version: 6.8.0.beta.200.663.ceecdee
75
+ - 681
76
+ - 7
77
+ - c
78
+ - 84
79
+ - f
80
+ - 4
81
+ - a
82
+ version: 6.8.0.beta.200.681.7c84f4a
73
83
  version_requirements: *id003
74
84
  name: kvom
75
85
  prerelease: false