infopark_fiona_connector 7.0.1 → 7.0.1.5.2.3.rc4

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,6 +5,8 @@ module RailsConnector
5
5
  # @api public
6
6
  class NamedLink
7
7
 
8
+ LINKLIST_NAME = 'related_links'
9
+
8
10
  # @api public
9
11
  class NotFound < StandardError
10
12
  end
@@ -18,6 +20,19 @@ module RailsConnector
18
20
  def self.generate_named_links_cache
19
21
  return if @@named_links_cache
20
22
 
23
+ # add method for get related_links attiribute for simply Obj-instance
24
+ attributes = RailsConnector::Attribute.where(attribute_name: LINKLIST_NAME)
25
+ if attributes.length != 0
26
+ Obj.send(:define_attribute, LINKLIST_NAME, ActiveRecord::Type::String.new)
27
+ Obj.send(:delegate, LINKLIST_NAME.to_sym, to: :attr_dict)
28
+ else
29
+ Rails.logger.warn "Check if you NamedLink class is defined properly. Attibute related_links does not exist."
30
+ # there is not attribute named 'related_links' defined
31
+ @@named_links_cache = []
32
+ @@updated_at = Time.now
33
+ return nil
34
+ end
35
+
21
36
  found_objects = BasicObj.where(obj_class: 'NamedLink')
22
37
  Rails.logger.warn "Couldn't find NamedLink CMS Object!" if found_objects.empty?
23
38
  Rails.logger.warn "More than one NamedLink CMS Object found!" if found_objects.size > 1
@@ -1,16 +1,20 @@
1
1
  module RailsConnector
2
-
3
2
  # The CMS news object
4
3
  #
5
4
  # This class models the join table between channels and objects.
6
5
  # Instances of this class also hold information about validity range.
7
6
  # @api public
8
7
  class News < CmsBaseModel
9
-
10
8
  self.primary_key = "news_id"
11
9
 
12
10
  belongs_to :object, :class_name => 'Obj', :foreign_key => 'object_id'
13
11
 
14
- end
12
+ def self.table_name
13
+ "#{table_name_prefix}" "news"
14
+ end
15
15
 
16
+ scope :active, -> { where('? BETWEEN valid_from AND valid_until', Time.now.to_s(:number))}
17
+
18
+ scope :for_channel, ->(channel_name) {where(channel_name: channel_name)}
19
+ end
16
20
  end
@@ -0,0 +1,140 @@
1
+ module RailsConnector
2
+
3
+ # This class is used to read out the custom attributes,
4
+ # mandatory attributes and titles of an Obj.
5
+ # Warning: Dependent on the setup of your DB replication, most tables
6
+ # with meta information will not be available on your live system!
7
+ class ObjClass < CmsBaseModel
8
+
9
+ self.primary_key = :obj_class_id
10
+
11
+ has_many :custom_attributes_jt, :class_name => '::RailsConnector::ObjClassAttr', :foreign_key => 'obj_class_id', :primary_key => 'obj_class_id'
12
+ has_many :custom_attributes_raw, :through => :custom_attributes_jt, :source => :custom_attributes_raw
13
+
14
+ alias_attribute :name, :obj_class_name
15
+ alias_attribute :type, :obj_type
16
+
17
+ attribute :is_enabled, :boolean
18
+ alias_attribute :enabled, :is_enabled
19
+
20
+ %w(attributeGroupNames attributeGroups canCreateNewsItems completionCheck
21
+ contentTypes createPermission workflowModification validSubObjClasses
22
+ validSubObjClassCheck
23
+ validContentTypes titles recordSetCallback presetFromParentAttributes
24
+ presetAttributes).each do |key|
25
+ define_method(key.underscore) do
26
+ load_blob_data
27
+ @blob_data[key]
28
+ end
29
+ end
30
+
31
+ # Returns the title of the file format or nil, if it was not set.
32
+ def title(language)
33
+ titles[language.to_s].presence
34
+ end
35
+
36
+ # returns channel feature is_activate?
37
+ def can_create_news_items?
38
+ can_create_news_items.to_i != 0
39
+ end
40
+
41
+ def ruby_class
42
+ @r_klass ||= RailsConnector::BasicObj.compute_type(name)
43
+ end
44
+
45
+ # Returns true, if a custom Ruby class exists.
46
+ def has_custom_ruby_class?
47
+ ruby_class != Obj
48
+ end
49
+
50
+ # Returns the custom attributes in the form of a Hash.
51
+ def custom_attributes
52
+ # create a Hash (with indifferent access) out of an Array of ActiveRecord objects
53
+ @custom_attributes ||= self.custom_attributes_raw.map do |attr|
54
+ {attr.attribute_name => attr}
55
+ end.reduce(HashWithIndifferentAccess.new, &:merge)
56
+ end
57
+
58
+ # Returns true, if the Obj Class has an attribute of the given name.
59
+ def custom_attribute?(attr)
60
+ self.custom_attributes.key?(attr.to_s)
61
+ end
62
+
63
+ # Returns an Array of String of all mandatory attributes found for this ObjClass,
64
+ # no matter if it is a custom or built-in attribute. Built-in attributes
65
+ # are underscored (valid_from, not validFrom).
66
+ # Possible +options+ are:
67
+ # <tt>:only_custom_attributes</tt>:: Return only custom attributes, omit
68
+ # built-in attributes like content_type or valid_from.
69
+ def mandatory_attribute_names(options = {})
70
+ only_custom_attributes ||= options[:only_custom_attributes] || false
71
+ build_mandatory_attribute_arrays
72
+ return @mandatory_custom_attributes if only_custom_attributes
73
+ @mandatory_attributes
74
+ end
75
+
76
+ # Returns true, if the file format has an mandatory attribute of the given name.
77
+ def mandatory_attribute?(attr)
78
+ self.mandatory_attribute_names.include?(attr.to_s)
79
+ end
80
+
81
+ # Convenience method for find_by_obj_class_name
82
+ def self.find_by_name(*args)
83
+ self.find_by_obj_class_name(*args)
84
+ end
85
+
86
+ # Reads a whole bunch of data, where only some of it is useful
87
+ # in a Rails application:
88
+ # attributeGroups, availableBlobEditors, bodyTemplateName,
89
+ # canCreateNewsItems, completionCheck, mandatoryAttributes,
90
+ # presetAttributes, recordSetCallback, titles, validSubObjClassCheck,
91
+ # workflowModification
92
+ def self.read_blob_data(name) #:nodoc:
93
+ blob = RailsConnector::Meta.hello_im_rails_and_im_retarted_so_please_be_patient do # these queries really pollute our logs!
94
+ blob_name = if RailsConnector::BlobMapping.exists?
95
+ RailsConnector::BlobMapping.get_fingerprint("#{name}.jsonObjClassDict")
96
+ else
97
+ "#{name}.jsonObjClassDict"
98
+ end
99
+
100
+ RailsConnector::Blob.find_without_excluded_blob_data(blob_name)
101
+ end
102
+
103
+ return {} unless blob && blob.blob_data?
104
+
105
+ JSON.parse(blob.blob_data)
106
+ end
107
+
108
+ private
109
+
110
+ def load_blob_data #:nodoc:
111
+ return if @blob_data
112
+
113
+ @blob_data = self.class.read_blob_data(self.name)
114
+
115
+ # reset depending instance variables
116
+ @mandatory_custom_attributes = @mandatory_attributes = nil
117
+ end
118
+
119
+ def build_mandatory_attribute_arrays #:nodoc:
120
+ return if @mandatory_attributes
121
+
122
+ load_blob_data
123
+
124
+ @mandatory_custom_attributes = []
125
+ @mandatory_attributes = []
126
+ (@blob_data['mandatoryAttributes'] || []).each do |attr|
127
+ attr_name = attr.to_s
128
+ if self.custom_attribute?(attr_name)
129
+ @mandatory_custom_attributes << attr_name
130
+ else
131
+ # only modify built-in attributes; i.e. `validFrom` will become `valid_from`
132
+ attr_name = attr_name.underscore
133
+ end
134
+ @mandatory_attributes << attr_name
135
+ end
136
+ end
137
+
138
+ end
139
+
140
+ end
@@ -0,0 +1,5 @@
1
+ module RailsConnector
2
+ class ObjClassAttr < CmsBaseModel
3
+ has_many :custom_attributes_raw, :class_name => '::RailsConnector::Attribute', :foreign_key => 'attribute_id', :primary_key => 'attribute_id'
4
+ end
5
+ end
@@ -0,0 +1,18 @@
1
+ # -*- encoding : utf-8 -*-
2
+ module RailsConnector
3
+
4
+ # This class allows us to read out the version and
5
+ # the reminder information of an Obj
6
+ class ObjectWithMetaData < CmsBaseModel #:nodoc:
7
+
8
+ # If we name the class Object, conflicts with the plain Ruby
9
+ # objects inside the RailsConnector will occur.
10
+ def self.table_name
11
+ "#{table_name_prefix}" "objects"
12
+ end
13
+
14
+ self.primary_key = :object_id
15
+
16
+ end
17
+
18
+ end
@@ -1,6 +1,5 @@
1
1
  module RailsConnector
2
2
  def self.rack_middlewares
3
- ["RailsConnector::CacheMiddleware"]
3
+ [RailsConnector::CacheMiddleware]
4
4
  end
5
5
  end
6
-
@@ -1,7 +1,7 @@
1
1
  module RailsConnector
2
2
  module Version
3
3
  def self.get
4
- '7.0.1'
4
+ '7.0.1.5.2.3.rc4'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_fiona_connector
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.1
4
+ version: 7.0.1.5.2.3.rc4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Infopark AG
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-04 00:00:00.000000000 Z
11
+ date: 2020-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
19
+ version: '5.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '4.2'
26
+ version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '4.2'
33
+ version: '5.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '4.2'
40
+ version: '5.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.5'
47
+ version: '12.3'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.5'
54
+ version: '12.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: json
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.8'
61
+ version: '2.3'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.8'
68
+ version: '2.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: maruku
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -86,56 +86,56 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '4.1'
89
+ version: '4.3'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '4.1'
96
+ version: '4.3'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: mime-types
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '2.99'
103
+ version: '3.1'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '2.99'
110
+ version: '3.1'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: mysql_blob_streaming
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '2.2'
117
+ version: '2.3'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '2.2'
124
+ version: '2.3'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rsolr
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '1.0'
131
+ version: 2.1.0s
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '1.0'
138
+ version: 2.1.0s
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: helpful_configuration
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -199,38 +199,50 @@ files:
199
199
  - lib/generators/rails_connector/install/templates/initializers/rails_connector.rb
200
200
  - lib/generators/rails_connector/install/templates/local/configuration.rb
201
201
  - lib/infopark_fiona_connector.rb
202
+ - lib/meta_eager_loader.rb
202
203
  - lib/obj.rb
203
204
  - lib/rails_connector/attr_dict.rb
204
205
  - lib/rails_connector/attr_value_provider.bundle
205
206
  - lib/rails_connector/attr_value_provider.so
206
207
  - lib/rails_connector/attr_value_provider64.so
208
+ - lib/rails_connector/attribute.rb
207
209
  - lib/rails_connector/authenticable.rb
208
210
  - lib/rails_connector/basic_obj.rb
209
211
  - lib/rails_connector/blob.rb
212
+ - lib/rails_connector/blob_mapping.rb
210
213
  - lib/rails_connector/blob_mysql.rb
211
214
  - lib/rails_connector/blob_oracle.rb
212
215
  - lib/rails_connector/cache_middleware.rb
216
+ - lib/rails_connector/channel.rb
213
217
  - lib/rails_connector/cms_accessible.rb
214
218
  - lib/rails_connector/cms_base_model.rb
215
219
  - lib/rails_connector/cms_dispatch_controller.rb
216
220
  - lib/rails_connector/cms_env.rb
217
221
  - lib/rails_connector/cms_test_request.rb
218
222
  - lib/rails_connector/configuration.rb
223
+ - lib/rails_connector/content.rb
219
224
  - lib/rails_connector/core_extensions.rb
220
225
  - lib/rails_connector/core_extensions/time.rb
221
226
  - lib/rails_connector/date_attribute.rb
222
227
  - lib/rails_connector/default_search_request.rb
223
228
  - lib/rails_connector/engine.rb
224
229
  - lib/rails_connector/errors.rb
230
+ - lib/rails_connector/fiona_datetime.rb
225
231
  - lib/rails_connector/fiona_engine.rb
226
232
  - lib/rails_connector/html_string.rb
233
+ - lib/rails_connector/job.rb
227
234
  - lib/rails_connector/link.rb
228
235
  - lib/rails_connector/link_list.rb
229
236
  - lib/rails_connector/link_resolvable.rb
230
237
  - lib/rails_connector/lucene_search_request.rb
231
238
  - lib/rails_connector/markdown_string.rb
239
+ - lib/rails_connector/meta.rb
240
+ - lib/rails_connector/meta/eager_loader.rb
232
241
  - lib/rails_connector/named_link.rb
233
242
  - lib/rails_connector/news.rb
243
+ - lib/rails_connector/obj_class.rb
244
+ - lib/rails_connector/obj_class_attr.rb
245
+ - lib/rails_connector/object_with_meta_data.rb
234
246
  - lib/rails_connector/permission.rb
235
247
  - lib/rails_connector/rack_middlewares.rb
236
248
  - lib/rails_connector/ses.rb
@@ -258,8 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
258
270
  - !ruby/object:Gem::Version
259
271
  version: 1.3.5
260
272
  requirements: []
261
- rubyforge_project:
262
- rubygems_version: 2.5.1
273
+ rubygems_version: 3.0.3
263
274
  signing_key:
264
275
  specification_version: 4
265
276
  summary: Infopark Fiona Connector