mondrian-rest 0.7.8-java → 0.7.9-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6023f46286466d2773e0bf1ac6cb52fe205bf2bbe584aea26170b4359e87385c
4
- data.tar.gz: 384f5eaf3e30be55fa31c909e30880845499dba09f058361876d4bb62dc627a4
3
+ metadata.gz: fbd9d6692bb827f1b325d682e9df7872a83be6a5085b0af4ceb41cc4194b59d7
4
+ data.tar.gz: 8e1d250c08c9c88adec227560d816ee79afe1f6c236f0ab31fa5574e981d3d81
5
5
  SHA512:
6
- metadata.gz: 4bcf966cbbad1d698004c825954bcc86b3b65b98234ae88d92bf9576e39dc9fe8dff89e973102e3ed14dead99894fae88a31bca0b59127edd19f33ec53bb79c5
7
- data.tar.gz: e605341fc73f78a852b12f77e733ff919fa938f200201be2f810a5b4ba2f39c578f909766ba4845980df117365783566adf256ad6e5be903331b97faf2d646ba
6
+ metadata.gz: cc64f9b2911c3e3e7b4142ec91a2796a83190e4abb00a0cb340b0a841d0f706ff43aade8dad0c833e54273b9a4672cf7f2a53223281e4febf9e92fd15bbdaadb
7
+ data.tar.gz: 55e965893aec267dd80d1acac550d0b9b85443e36485357468c1c27dcc3e7851205dfef6bc0afcc2b0025786b3a2f07f1448da254cb2c3c826f763724e5c32bb
@@ -21,13 +21,18 @@ module Mondrian::REST
21
21
  begin
22
22
  return cube.member(member_exp)
23
23
  rescue Java::JavaLang::IllegalArgumentException
24
- error!("Illegal member expression: #{member_exp}", 400)
24
+ error!("Illegal expression: #{member_exp}", 400)
25
25
  end
26
26
  end
27
27
 
28
+ def get_named_set(cube, named_set_exp)
29
+ nss = cube.named_sets
30
+ nss.find { |ns| ns.name == named_set_exp }
31
+ end
32
+
28
33
  ##
29
34
  # Parses a string containing a 'cut' expression
30
- # It can be a set (`{Dim.Mem, Dim2.Mem2}`), a range (`([Time].[Year].[1997]:[Time].[Year].[1998])`) or a member identifier (`[Time].[Year].[1998]`).
35
+ # It can be a set (`{Dim.Mem, Dim2.Mem2}`), a range (`([Time].[Year].[1997]:[Time].[Year].[1998])`), a member identifier (`[Time].[Year].[1998]`) or a NamedSet.
31
36
  def parse_cut(cube, cut_expr)
32
37
  p = mdx_parser.parseExpression(cut_expr)
33
38
 
@@ -70,6 +75,13 @@ module Mondrian::REST
70
75
  error!("Illegal cut: " + cut_expr, 400)
71
76
  end
72
77
  when org.olap4j.mdx.IdentifierNode
78
+
79
+ # does cut_expr look like a NamedSet?
80
+ s = get_named_set(cube, cut_expr)
81
+ if !s.nil?
82
+ return { level: nil, cut: cut_expr, type: :named_set }
83
+ end
84
+
73
85
  # if `cut_expr` looks like a member, check that it's level is
74
86
  # equal to `level`
75
87
  m = get_member(cube, cut_expr)
@@ -177,6 +189,7 @@ module Mondrian::REST
177
189
  cut[:cut]
178
190
  end
179
191
  elsif cut = slicer_axis.find { |lvl, cut|
192
+ next if cut[:type] == :named_set
180
193
  qa.raw_level.hierarchy == lvl.hierarchy && lvl.depth < qa.depth
181
194
  }
182
195
  slicer_axis.delete(cut[0])
@@ -217,7 +230,14 @@ module Mondrian::REST
217
230
 
218
231
  # slicer axes (cut)
219
232
  if slicer_axis.size >= 1
220
- query = query.where(slicer_axis.values.map { |v| v[:cut] }.join(' * '))
233
+ puts slicer_axis.inspect
234
+ query = query.where(slicer_axis.values.map { |v|
235
+ if v[:type] == :named_set
236
+ "[#{v[:cut]}]"
237
+ else
238
+ v[:cut]
239
+ end
240
+ }.join(' * '))
221
241
  end
222
242
  query
223
243
  end
@@ -1,5 +1,5 @@
1
1
  module Mondrian
2
2
  module REST
3
- VERSION = "0.7.8"
3
+ VERSION = "0.7.9"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mondrian-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.8
4
+ version: 0.7.9
5
5
  platform: java
6
6
  authors:
7
7
  - Manuel Aristarán
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-23 00:00:00.000000000 Z
11
+ date: 2017-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement