Package fr.becpg.repo.olap
Class OlapUtils
java.lang.Object
fr.becpg.repo.olap.OlapUtils
OlapUtils class.
- Version:
- $Id: $Id
- Author:
- matthieu
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringGrouping separators Mondrian may emit, depending on the locale.private static final org.apache.commons.logging.LogConstantloggerprivate static final PatternAnything that can plausibly be a formatted number.private static final PatternA number with no separator at all: `-1148`, `19`. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectConverts one Saiku display value — the fallback ofconvertCell(String, String), for the cells carrying no raw one.static ObjectconvertCell(String rawValue, String formattedValue) Converts one Saiku cell, preferring its raw value:valueis formatted for the connection locale,properties.rawis the measure itself.private static CharacterdecimalSeparatorOf(String value) Which character carries the decimal point, ornullwhen the value is a grouped integer.static StringreadJsonFromUrl(String url, OlapContext olapContext) readJsonFromUrl.static voidsendCreateQueryPostRequest(OlapContext olapContext, String postUrl, String xml) sendCreateQueryPostRequest.private static StringstripGrouping(String value, char decimal) Removes the grouping separators and normalises the decimal one to a dot, so the result can be handed toDouble.valueOf(String).
-
Field Details
-
logger
private static final org.apache.commons.logging.Log loggerConstantlogger -
GROUPING_SPACES
Grouping separators Mondrian may emit, depending on the locale.- See Also:
-
PLAIN
A number with no separator at all: `-1148`, `19`. -
NUMERIC
Anything that can plausibly be a formatted number.
-
-
Constructor Details
-
OlapUtils
private OlapUtils()Constructor for OlapUtils.
-
-
Method Details
-
readJsonFromUrl
readJsonFromUrl.
- Parameters:
url- aStringobject.olapContext- aOlapContextobject.- Returns:
- a
Stringobject. - Throws:
IOException- if any.
-
sendCreateQueryPostRequest
public static void sendCreateQueryPostRequest(OlapContext olapContext, String postUrl, String xml) throws IOException sendCreateQueryPostRequest.
- Parameters:
olapContext- aOlapContextobject.postUrl- aStringobject.xml- aStringobject.- Throws:
IOException- if any.
-
convertCell
Converts one Saiku cell, preferring its raw value:valueis formatted for the connection locale,properties.rawis the measure itself. Headers carry no raw value and fall back onconvert(String). A whole raw value is returned as aLongso that a count keeps being published as a count byretrieveDataType. -
convert
Converts one Saiku display value — the fallback ofconvertCell(String, String), for the cells carrying no raw one. The value is formatted by Mondrian for the connection locale, so it is read rather than parsed: both separators present means the last one is the decimal one, the same separator twice means grouping, spaces always mean grouping. A single separator followed by exactly three digits stays undecidable — one and the same cellset carries"1.148"for a count and"19.468"for an average — and is read as a decimal, the historical behaviour. -
decimalSeparatorOf
Which character carries the decimal point, ornullwhen the value is a grouped integer. Seeconvert(String)for the rules.- Parameters:
value- already stripped of spaces and known to be numeric- Returns:
- the decimal separator, or
null
-
stripGrouping
Removes the grouping separators and normalises the decimal one to a dot, so the result can be handed toDouble.valueOf(String).- Parameters:
value- already stripped of spacesdecimal- the decimal separator- Returns:
- a canonical numeric string
-