Package fr.becpg.repo.olap.impl
Class OlapServiceImpl
java.lang.Object
fr.becpg.repo.olap.impl.OlapServiceImpl
- All Implemented Interfaces:
OlapService
OlapServiceImpl class.
- Version:
- $Id: $Id
- Author:
- matthieu
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BeCPGTicketServiceprivate org.alfresco.service.cmr.repository.ContentServiceprivate Booleanprivate org.alfresco.service.cmr.model.FileFolderServiceprivate static final StringSeparates the levels of a multi-level row axis inside the single label published.private static final org.apache.commons.logging.LogConstantloggerprivate org.alfresco.service.cmr.repository.NodeServiceprivate Stringprivate Stringprivate org.alfresco.service.cmr.security.PersonServiceprivate RepoServiceprivate static final StringConstantROW_HEADER="ROW_HEADER_HEADER" -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate StringbuildCreateQueryUrl(String olapQueryId, OlapContext context) buildCreateQueryUrl.private StringbuildDataUrl(String olapQueryId, OlapContext context) buildDataUrl.private StringbuildQueryUrl(String queryName, OlapContext context) buildQueryUrl.private StringbuildRepositoryUrl(OlapContext context) buildRepositoryUrl.private ObjectcellValue(org.json.JSONObject cell) The value of one cellset cell.private voidcollectCharts(org.alfresco.service.cmr.repository.NodeRef folder, List<OlapChart> olapCharts) Adds every.saikudocument of a folder to the chart list.private static intcountRowHeaders(org.json.JSONArray headerRow) Counts the leading row-header columns of a cell set, which is how many levels the query put on rows.private OlapChartgetOlapChart(String olapQueryId) getOlapChart.org.alfresco.service.cmr.repository.NodeRefgetOlapQueriesFolder.private org.alfresco.service.cmr.repository.NodeRefResolves the current user's personal OLAP query folder.getSSOUrl.private static StringjoinHeaderLabels(org.json.JSONArray headerRow, int rowHeaders) Joins the captions of the row levels into the single column name the consumers expect.private StringjoinRowLabels(org.json.JSONArray row, int rowHeaders) Joins the row-header values of one data row into a single label.Names the personal query folder can carry: this repository's locale first, then every other translation ofpath.olapqueries.retrieveChartData(String olapQueryId) retrieveChartData.private StringretrieveDataType(org.json.JSONObject cell) The class a column's values will be published as, taken from the first data cell of that column.retrieveOlapCharts.retrieveOlapChartsFromSaiku.runMdxQuery(String cube, String mdxQuery) runMdxQuery.private String
-
Field Details
-
ROW_HEADER
ConstantROW_HEADER="ROW_HEADER_HEADER"- See Also:
-
LEVEL_SEPARATOR
Separates the levels of a multi-level row axis inside the single label published.- See Also:
-
logger
private static final org.apache.commons.logging.Log loggerConstantlogger -
olapPublicUrl
-
olapServerUrl
-
enabled
-
fileFolderService
@Autowired private org.alfresco.service.cmr.model.FileFolderService fileFolderService -
personService
@Autowired private org.alfresco.service.cmr.security.PersonService personService -
nodeService
@Autowired private org.alfresco.service.cmr.repository.NodeService nodeService -
contentService
@Autowired private org.alfresco.service.cmr.repository.ContentService contentService -
repoService
-
beCPGTicketService
-
-
Constructor Details
-
OlapServiceImpl
public OlapServiceImpl()
-
-
Method Details
-
retrieveOlapCharts
retrieveOlapCharts.
- Specified by:
retrieveOlapChartsin interfaceOlapService- Returns:
- a
Listobject.
-
collectCharts
private void collectCharts(org.alfresco.service.cmr.repository.NodeRef folder, List<OlapChart> olapCharts) Adds every.saikudocument of a folder to the chart list.- Parameters:
folder- the folder to read, ignored when nullolapCharts- the list to fill
-
getPersonalOlapQueriesFolder
private org.alfresco.service.cmr.repository.NodeRef getPersonalOlapQueriesFolder()Resolves the current user's personal OLAP query folder.beCPG OLAP saves a user's own queries under their home folder rather than in the shared system space, so the dashlet has to read both. The folder carries the localised name of
path.olapqueries; every translation is accepted, because the folder may have been created by an OLAP session running in another language than this repository's default.- Returns:
- the folder, or null when the user has none
-
personalFolderNames
Names the personal query folder can carry: this repository's locale first, then every other translation ofpath.olapqueries.- Returns:
- the candidate folder names, never null
-
getOlapQueriesFolder
public org.alfresco.service.cmr.repository.NodeRef getOlapQueriesFolder()getOlapQueriesFolder.
- Specified by:
getOlapQueriesFolderin interfaceOlapService- Returns:
- a
NodeRefobject.
-
retrieveOlapChartsFromSaiku
retrieveOlapChartsFromSaiku.
- Specified by:
retrieveOlapChartsFromSaikuin interfaceOlapService- Returns:
- a
Listobject. - Throws:
IOException- if any.org.json.JSONException- if any.
-
retrieveChartData
retrieveChartData.
Parse [ [{"value":"null","properties":{},"type":"COLUMN_HEADER"},{"value": "Oct","properties":{},"type":"COLUMN_HEADER"}] ,[{"value":"Type","properties":{"levelindex":"0"} ,"type":"ROW_HEADER_HEADER"} ,{"value":"Week41/2011","properties":{"levelindex" :"1","dimension":"Date de modification" },"type":"COLUMN_HEADER"}],[{"value" :"finishedProduct","properties":{"levelindex" :"0","dimension":"Type de produit" },"type":"ROW_HEADER"},{"value":"10","properties" :null,"type":"DATA_CELL"} ],[{"value":"rawMaterial","properties":{"levelindex" :"0","dimension":"Type de produit" },"type":"ROW_HEADER"},{"value":"14","properties" :null,"type":"DATA_CELL"}]]- Specified by:
retrieveChartDatain interfaceOlapService- Parameters:
olapQueryId- aStringobject.- Returns:
- a
OlapChartDataobject. - Throws:
IOException- if any.
-
countRowHeaders
private static int countRowHeaders(org.json.JSONArray headerRow) throws org.json.JSONException Counts the leading row-header columns of a cell set, which is how many levels the query put on rows.- Parameters:
headerRow- the first row of the cell set- Returns:
- the number of row-header columns, at least one
- Throws:
org.json.JSONException
-
joinHeaderLabels
private static String joinHeaderLabels(org.json.JSONArray headerRow, int rowHeaders) throws org.json.JSONException Joins the captions of the row levels into the single column name the consumers expect.- Parameters:
headerRow- the first row of the cell setrowHeaders- how many of its columns are row headers- Returns:
- the joined caption
- Throws:
org.json.JSONException
-
joinRowLabels
Joins the row-header values of one data row into a single label.- Parameters:
row- a data row of the cell setrowHeaders- how many of its columns are row headers- Returns:
- the joined label
- Throws:
org.json.JSONException
-
xmlEscape
-
runMdxQuery
public OlapChartData runMdxQuery(String cube, String mdxQuery) throws IOException, org.json.JSONException runMdxQuery.
- Specified by:
runMdxQueryin interfaceOlapService- Parameters:
cube- the cube name.mdxQuery- the MDX query.- Returns:
- a
OlapChartDataobject. - Throws:
IOException- if any.org.json.JSONException- if any.
-
getSSOUrl
getSSOUrl.
- Specified by:
getSSOUrlin interfaceOlapService- Returns:
- a
Stringobject.
-
getOlapChart
getOlapChart.
-
retrieveDataType
The class a column's values will be published as, taken from the first data cell of that column.- Parameters:
cell- the first data cell under the header being described- Returns:
- the simple class name of the converted value
-
cellValue
The value of one cellset cell. A Saiku data cell carries the measure twice:value, formatted for the connection locale, andproperties.raw, the number itself. Only the second one can be parsed without guessing — the displayed"1,148"is 1 148, and the same shape elsewhere in the payload is a genuine fraction. SeeOlapUtils.convertCell(String, String).- Parameters:
cell- a cellset cell- Returns:
- the converted value
-
buildDataUrl
private String buildDataUrl(String olapQueryId, OlapContext context) throws org.apache.commons.httpclient.URIException buildDataUrl.
- Parameters:
olapQueryId- aStringobjectcontext- aOlapContextobject- Returns:
- a
Stringobject - Throws:
org.apache.commons.httpclient.URIException- if any.
-
buildCreateQueryUrl
private String buildCreateQueryUrl(String olapQueryId, OlapContext context) throws org.apache.commons.httpclient.URIException buildCreateQueryUrl.
- Parameters:
olapQueryId- aStringobjectcontext- aOlapContextobject- Returns:
- a
Stringobject - Throws:
org.apache.commons.httpclient.URIException- if any.
-
buildRepositoryUrl
private String buildRepositoryUrl(OlapContext context) throws org.apache.commons.httpclient.URIException buildRepositoryUrl.
- Parameters:
context- aOlapContextobject- Returns:
- a
Stringobject - Throws:
org.apache.commons.httpclient.URIException- if any.
-
buildQueryUrl
private String buildQueryUrl(String queryName, OlapContext context) throws org.apache.commons.httpclient.URIException buildQueryUrl.
- Parameters:
queryName- aStringobjectcontext- aOlapContextobject- Returns:
- a
Stringobject - Throws:
org.apache.commons.httpclient.URIException- if any.
-