public XView importView(String sessionId, XView view) throws DbOperationFailedException,
SessionExpiredException {
WPaloCubeViewConverter converter = new WPaloCubeViewConverter(
getLoggedInUser(sessionId));
XView importedXView = importViewWith(sessionId, converter, view);
View realView = getView(sessionId, importedXView);
try {
assignViewerAndEditorRole(sessionId, null, realView, true, true);
} catch (SQLException e) {
e.printStackTrace();
}
List <String> roleIds = new ArrayList<String>();
List <String> roleNames = new ArrayList<String>();
IRoleManagement rm = MapperRegistry.getInstance().getRoleManagement();
try {
Role r = (Role) rm.findByName("VIEWER");
roleIds.add(r.getId());
roleNames.add(r.getName());
} catch (Throwable t) {
}
try {
Role r = (Role) rm.findByName("EDITOR");
roleIds.add(r.getId());
roleNames.add(r.getName());
} catch (Throwable t) {
}
importedXView.setRoleIds(roleIds);
importedXView.setRoleNames(roleNames);
//saves xml definition in spagobi
CubeView cubeView = realView.getCubeView();
String xml = CubeViewIO.toXML(cubeView);
return importedXView;
}