Intellicus Native Library (INL) allows developers to provide access and analysis of Intellicus servers’ entities, data objects (Query and Cube objects) as well as formatted reports (Standard/ Ad hoc/ High Speed) and dashboards in mobile application. By utilizing rich and user-friendly visualizations provided by INL in applications, developers can help users make better decisions on the go.
Follow the below mentioned steps to add “Intellicus framework” to your application:
- Copy “IntellicusLib.aar” to your local directory
- Include IntellicusLib.aar into Android Studio Project
- Open Android Studio and go to menu, File > New > New Module
- In New Module wizard select “Import .JAR/.AAR Package” and click Next
- In File Name Field click on the button with folder icon.
- Browse to the IntellicusLib.aar
- Click Finish
- Project Settings
- Right click your project
- Select “Open Module Settings”
- Go to Dependencies tab
- Click on “+” Button
- Select Module Dependency
- Select IntellicusLib
- Press OK
How to integrate “Intellicus Library” into your application
- Initialize library. Preferably initialize library in “android.app.Application.onCreate()”.
- Create a subclass of android.app.Application
- Open Application Manifest File and specify the path of your application class inside application tag
- Example: android:name=”.MyApplication”
- Override onCreate method.
- You can add a Private method “initializeIntellicusLibrary” to your Application class and call “initializeIntellicusLibrary” method from “onCreate()” method.
Please refer to the following piece of code.
- Set up Intellicus library to set the subscribed report maximum snapshot property.
Please refer to the following piece of code. - If the application is using single sign-on, then application needs to set the server URL and user information to the Intellicus Library. This should be done after the Intellicus framework is setup successfully.
Please refer to the following piece of code. - Call Intellicus servers’ synchronization that includes two tasks:
- Check server’s connectivity with user authentication, and update security policy
- Apply server’s security policy on the entities imported from that server
Please refer to the following piece of code.
- Load Intellicus Entities List
You need to load a list of entities for Ad hoc analysis, multidimensional analysis, viewing reports and dashboards etc. Following piece of code loads the list of entities. - Download specific Intellicus’s Entity (Entities) and view it
If you do not want to use Intellicus mobile application’s entity list screen instead if you want to create your own listing screen to show Intellicus entities, then you will need the logic to download specific Intellicus Entities and view it.
private void initializeIntellicusLibrary(android.app.Application app) { // Create default library configuration information object IALLibInitializeInfo initInfo = new IALLibInitializeInfo(); initInfo.setApp(app); //Initialize library IntellicusAndroidApp instance = IntellicusAndroidApp.getInstance(); instance.initializeLibrary(initInfo); //Read Persistent Information instance.readPersistentInfo(); }
// This method sets the subscribed report’s maximum snapshot property // This property is required if the application wants to use // subscribed reports functionality of IntellicusLib Module. private void setSubscribedReportMaximumScreenshots(int maxReportCount){ //set this information in library IALConfigurationInfo configurationInfo = IntellicusAndroidApp.getInstance().getConfigurationInfo(); configurationInfo.setMaxReportSnapShotCount(maxReportCount); }
public void addServerInformation() { //Get the IntellicusiAndroidApp object IntellicusAndroidApp intellicusAndroidApp = IntellicusAndroidApp.getInstance(); //Get server information collection from the app object ArrayList<ServerInfo> serverList = intellicusAndroidApp.getConfigurationInfo().getServerList(); //If server is not already added then only add it if (serverList.size() == 0) { //Preparing Server Information Object ServerInfo serverInfo = new ServerInfo(); //Set User ID serverInfo.setUsername("Admin"); //Set User ID serverInfo.setAppId("Admin"); //Set User Password serverInfo.setPassword("Admin"); //Set Organization ID serverInfo.setOrgId("Intellica"); //Set Server URL serverInfo.setUrl("http://127.0.0.1:8080/intellicus"); serverInfo.setLastConnectedTime(System.currentTimeMillis()); serverInfo.setConnectionStatus(ServerInfo.ConnectionStatus.CONNECTED); //Add Server information into Collection intellicusAndroidApp.getConfigurationInfo().addServer(serverInfo); //Set as default server intellicusAndroidApp.getConfigurationInfo().setDefaultServer(serverInfo); } }
private void fatchAndApplySecurityPolicy() { //Create Callback Object for checking Server connection IntellicusServerConnectionHandler connectionHandler = new IntIntellicusServerConnectionHandler (( // This method will get called when connection with server is established //and task has been completed successfully @Override public void onSucces(String message) { } // This method will get called when there is some Error in connection with // server with an IntellicusLibError object, which contains details of error @Override public void onError(IntellicusLibError error) { } }; // Pass the Context and connectionHandler Object along with forced flag true // sending Forced Flag true to forcefully Update Security Policy IALUtils.updateandApplySecurityPolicyForServers(context,connectionHandler,true); } If your application at any point of time (let’s say while starting) wants Intellicus mobile library to synchronize entities downloaded on device with Intellicus server, this can be achieved using following piece of code. //This method will fetch the list of all connected servers and // Sync All the Subscribed Reports on device from corresponding server private void synchronizeAllReports(){ //This will return list of all connected servers. ArrayList<ServerInfo> serverList = IntellicusAndroidApp.getInstance().getConfigurationInfo().getServerList(); for (ServerInfo serverInfo : serverList) { synchronizeServersEntities(EntityType.REPORT,serverInfo); } } Create a task handler to handle Synchronization task TaskHandler taskHandler = new TaskHandler(){ /**This method will notify if synchronization task is completed successfully */ @Override public void onTaskFinished(ResponseFetcher responseFetcher){} /**This method will notify if synchronization task fails due to some error */ @Override public void onTaskFailure(IntellicusLibError intellicusLibError) {} /**This method will notify if synchronization task got cancelled by user */ @Override public void onTaskCancelled(ResponseFetcher responseFetcher){} }; private void synchronizeServersEntities(EntityType entityType,ServerInfo serverInfo){ Bundle data = new Bundle(); //Putting the Server Info for which you need to sync Entity data.putParcelable(Constants.KEY_SERVER_INFO, serverInfo); //Putting the Entity Type which you need to sync data.putString(Constants.KEY_ENTITY_TYPE, entityType.name()); //Creating the Sync Task Object AccessRightSyncTask accessRightSyncTask = new AccessRightSyncTask (data, this, taskHandler); //This will start sync task, and notify using taskHandler callback accessRightSyncTask.execute(); }
public void showIntellicusEntitiesList (EntityType lEntityType) { //Create the Intent for Entities list screen Intent intent = new Intent(context, EntityListActivity.class); //Set the appropriate entity type //As of now possible entity types which can be set are EntityType.DATASET, //EntityType.REPORT, EntityType.ANALYTICAL, EntityType.DASHBOARD intent.putExtra(Constants.KEY_ENTITY_TYPE,lEntityType.name()); //Show the Intellicus entities list screen startActivity(intent); }
//This method will help load and save parameter values for dashboard private void loadParameterFormForDashboard(DashboardBean dashboardEntity) { //initiating dashboard object initDashboardObject(); ServerInfo server = IntellicusAndroidApp.getInstance().getConfigurationInfo().getServerInfo(dashboardEntity.getServerKey()); Bundle bundle = new Bundle(); //Setting information to load Parameter Form //Entity Type is EntityType.DASHBOARD EntityType mEntityType = EntityType.DASHBOARD; //Setting server info to fetch Parameter Form bundle.putParcelable(Constants.KEY_SERVER_INFO,server); bundle.putString(Constants.KEY_ENTITY_TYPE, mEntityType.name()); // Setting Entity Information //Setting dashboard Id for which you need to fetch Parameter Form bundle.putString(EntityListActivity.REQUESTED_ENTITY_ID, dashboardEntity.getUniqueId()); bundle.putString(Constants.KEY_ENTITY_TYPE, mEntityType.name()); bundle.putParcelable(Constants.KEY_ENTITY, dashboardEntity); bundle.putBoolean(Constants.KEY_IS_IMPORT, false); //Starting Activity to load Parameter form Intent intent = new Intent(this, DashBoardParameterFormActivity.class); intent.putExtras(bundle); startActivityForResult(intent, EntityListActivity.REQUEST_CODE_INPUT_PARAMETER_FORM); } Following piece of code downloads and views a specific dashboard. private void downloadSpecificDashboard() { //Creating list of Dashboards to be downloaded, //here in case you are downloading single dashboard ArrayList<BaseEntity> dashboardListToDownload = new ArrayList<>() ; dashboardListToDownload.add(dashboardEntity); //Save the dashboard with us putListItemsIntoDB(dashboardListToDownload,EntityType.DASHBOARD); //Setting the context for download requests RequestXmlCreator.setDefaultContext(this); //Create dashboard tasks executer. Task executer is responsible // for downloading dashboard from Intellicus Server // you also need to pass a DownloadHandler object through which //it will notify about download status DashBoardDownloadManager dashBoardDownloadManager = new DashBoardDownloadManager( MainActivity.this,dashboardListToDownload, handler,false); //Start the task executer to start the download of dashboard dashBoardDownloadManager.execute(); //Show the loading alert till you download the dashboard completely showProgressDialog("Downloading","Downloading Dashboard"); } //This method will initialize the dashboard object private void initDashboardObject() { if(dashboardEntity == null) { //Get the default server ServerInfo defaultServer = IntellicusAndroidApp.getInstance(). getConfigurationInfo().getDefaultServer(); //Create a dashboard object, which you want to download dashboardEntity = new DashboardBean(); //dashboardID is the unique id of dashboard on Intellicus Report Server dashboardEntity.dashboardID = "C9020B95-7927-768E-1321-A22B6F449643"; //categoryID is the unique id of folder on Intellicus Report Server //in which dashboard is saved dashboardEntity.categoryID = "571937DE-9934-90CB-FFD0-371470A44B7E"; //categoryName is the name of folder on Intellicus Report Server //in which dashboard is saved dashboardEntity.categoryName = "Demo"; //dashboardName is the name of dashboard dashboardEntity.setDisplayText("Dashboard Name"); //Source Server Unique id the unique id of the Intellicus Server //from where you want to download the dashboard dashboardEntity.setServerKey(defaultServer.getuniqueKey()); } } /** This object will help DashBoardDownloadManager to notify about download status */ DownloadHandler handler = new DownloadHandler() { @Override public void onDownloadComplete() { showMsg("Download Completed"); closeProgressDialog(); } @Override public void publishProgress(Bundle bundle) { } @Override public void onDownloadFailure(IntellicusLibError intellicusLibError) { showMsg("Download Failed "); closeProgressDialog(); } @Override public void onDownloadCancelled() { showMsg("Download Cancelled "); closeProgressDialog(); } }; private void viewDownloadedDashboard() { if(dashboardEntity != null) { //View dashboard only when you have successfully downloaded dashboard on device long dashboardUniqueRowID = dashboardEntity.getUniqueRowId(); String entityName = dashboardEntity.getDisplayText(); String serverURL = dashboardEntity.getServerKey(); Intent intent = null; //if device is Tab than open Tab Competible Dashboard if (IntellicusUtils.isTabletUIModeAvailable(this)) { //Set dashboard info to Intent intent = new Intent(getApplicationContext(), SummarizedDashboardActivity.class); intent.putExtra(SummarizedDashboardActivity.COLOUMN_UNIQUE_ID, dashboardUniqueRowID); intent.putExtra(SummarizedDashboardActivity.COLOUMN_NAME, entityName); intent.putExtra(SummarizedDashboardActivity.SERVER_URL, serverURL); } else { intent = new Intent(getApplicationContext(), DashboardDetailActivity.class); //Set dashboard info to Intent intent.putExtra(DashboardDetailActivity.EXTRA_DASHBOARD_ID, dashboardUniqueRowID); intent.putExtra(DashboardDetailActivity.EXTRA_DASHBOARD_TITLE, entityName); intent.putExtra(DashboardDetailActivity.EXTRA_DASHBOARD_SERVER_URL, serverURL); } //Start Activity startActivity(intent); } else { //As you have not successfully downloaded dashboard on device, show the message to the user showMsg("Please download Dashboard to view it"); } } Following piece of code downloads and views a specific dataset private void downloadSpecificDataset() { //Get the default server ServerInfo defaultServer = IntellicusAndroidApp.getInstance(). getConfigurationInfo().getDefaultServer(); //Create a dataset object, which you want to download datasetEntity = new IROBean(); //id is the unique id of QueryObject/Dataset on Intellicus Report Server datasetEntity.id = "13418431845938127097093196244462"; //categoryID the unique id of folder on Intellicus Report Server in //which QueryObject/Dataset is saved datasetEntity.categoryID = "571937DE-9934-90CB-FFD0-371470A44B7E"; //Category name is the name of folder on Intellicus Report Server in // which QueryObject/Dataset is saved datasetEntity.categoryName = "Demo"; //name is the name of QueryObject/Dataset datasetEntity.name = "Dataset Name"; //Source Server Unique id the unique id of the Intellicus Server from //where you want to download the QueryObject/Dataset datasetEntity.setServerKey(defaultServer.getuniqueKey()); //Type is type of entity i.e. Dataset datasetEntity.type = EntityType.DATASET.getTagName(); //Creating list of QueryObject/Dataset to be downloaded, here in case // you are downloading single QueryObject/Dataset ArrayList<BaseEntity> datasetListToDownload = new ArrayList<>() ; datasetListToDownload.add(datasetEntity); //Save the Dataset with us putListItemsIntoDB(datasetListToDownload,EntityType.DATASET); //Setting the context for download requests RequestXmlCreator.setDefaultContext(this); //Create Dataset tasks executer. Task executer is responsible for //downloading dataset from Intellicus Server, you also need to pass // a DownloadHandler object through which it will notify about // download status DatasetDownloadManager datasetDownloadManager = new DatasetDownloadManager( MainActivity.this,datasetListToDownload, handler,false); //Start the task executer to start the download of dataset datasetDownloadManager.execute(); //Show the loading alert till you download the dataset completely showProgressDialog("Downloading","Downloading Dataset"); } private void browseDownloadedDataset() { //View Dataset only when you have successfully downloaded Dataset on device if(datasetEntity != null) { String entityName = datasetEntity.getDisplayText(); Intent intent = new Intent(getApplicationContext(), BrowseActivity.class); intent.putExtra(BrowseActivity.COLOUMN_UNIQUE_ID, String.valueOf(datasetEntity.getUniqueRowId())); intent.putExtra(Constants.KEY_IPF, ParamDBHelper.getDefaultIPF(false)); intent.putExtra(BrowseActivity.COLOUMN_NAME, entityName); startActivity(intent); }else { //As you have not successfully downloaded dashboard on device, // show the message to the user showMsg("Please download Dataset to view it"); } } private void analyseDownloadedDataset() { //View Dataset only when you have successfully downloaded Dataset on device if(datasetEntity != null) { String entityName = datasetEntity.getDisplayText(); Intent intent = new Intent(getApplicationContext(), DatasetAnalyzeActivity.class); intent.putExtra(BrowseActivity.COLOUMN_UNIQUE_ID, String.valueOf(datasetEntity.getUniqueRowId())); intent.putExtra(BrowseActivity.COLOUMN_NAME, entityName); startActivity(intent); }else { //As you have not successfully downloaded dashboard on device, show the message to the user showMsg("Please download Dataset to view it"); } } Following piece of code downloads and views a specific Report //This method will help load and save parameter values for Report private void showParameterForm() { //initiating Report object initReportObject(); ServerInfo server = IntellicusAndroidApp.getInstance(). getConfigurationInfo().getServerInfo(reportItem.getServerKey()); Bundle bundle = new Bundle(); //Setting information to load Parameter Form //Entity Type is EntityType.REPORT EntityType mEntityType = EntityType.REPORT; //Setting server info to fetch Parameter Form bundle.putParcelable(Constants.KEY_SERVER_INFO,server); bundle.putString(Constants.KEY_ENTITY_TYPE, mEntityType.name()); // Setting Entity Information //Setting dashboard Id for which you need to fetch Parameter Form bundle.putString(EntityListActivity.REQUESTED_ENTITY_ID, reportItem.getUniqueId()); bundle.putBoolean(Constants.KEY_SERVER_POLICY_FATCH_REQUIRED, true); bundle.putString(Constants.KEY_ENTITY_TYPE, mEntityType.name()); Intent intent = null; bundle.putParcelable(Constants.KEY_ENTITY, reportItem); bundle.putBoolean(Constants.KEY_IS_IMPORT, false); //Starting Activity to load Parameter Form intent = new Intent(this, ParameterFormActivity.class); intent.putExtras(bundle); startActivityForResult(intent, EntityListActivity.REQUEST_CODE_INPUT_PARAMETER_FORM); } private void downloadSpecificReport() { initReportObject() //Creating list of Report to be downloaded, here in case you //are downloading a single report ArrayList<BaseEntity> reportListToDownload = new ArrayList<>() ; reportListToDownload.add(reportItem); //Save the Report with us putListItemsIntoDB(reportListToDownload,EntityType.REPORT); //Setting the context for download requests RequestXmlCreator.setDefaultContext(this); //Create Report tasks executer. Task executer is responsible for //downloading Report from Intellicus Server, you also need to pass a //DownloadHandler object through which it will notify about download status ReportDownloadManager reportDownloadManager = new ReportDownloadManager( MainActivity.this,reportListToDownload, handler,false); //Start the task executer to start the download of Report reportDownloadManager.execute(); //Show the loading alert till you download the Report completely showProgressDialog("Downloading","Downloading Report"); } private void initReportObject() { if (reportItem == null){ //Get the default server ServerInfo defaultServer = IntellicusAndroidApp.getInstance(). getConfigurationInfo().getDefaultServer(); //Create a Report object, which you want to download reportItem = new ReportsBean(); //id is the unique id of QReport on Intellicus Report Server reportItem.id = "FE2F4FBB-6EFF-AB7B-1942-0C5C79A448A0"; //Category ID the unique id of folder on Intellicus Report Server in //which Report is saved reportItem.categoryID = "571937DE-9934-90CB-FFD0-371470A44B7E"; //Category name is the name of folder on Intellicus Report Server in //which Report is saved reportItem.categoryName = "Demo"; //name is the name of Report reportItem.name = "Report Name"; //Source Server Unique id the unique id of the Intellicus Server from //where you want to download the Report reportItem.setServerKey(defaultServer.getuniqueKey()); //USE STUDIO/ADHOC based on your report reportItem.dsgnMode = Constants.DESIGN_MODE_STUDIO; ; } } private void viewDownloadedReport() { if(reportItem != null) { //View Report only when you have successfully downloaded Report on device long reportItemUniqueRowId = reportItem.getUniqueRowId(); String entityName = reportItem.getDisplayText(); String serverURL = reportItem.getServerKey(); try { ArrayList<String> savedReportUinqueIds = ReportDBHelper .getSavedReportUinqueIds(reportItemUniqueRowId); Cursor savedViewCursor = null; savedViewCursor = DBHelper.getInstance().query( new SavedReportListSchema().getQueryForLatestSavedInstanceForReport( savedReportUinqueIds), false); if (null != savedViewCursor && savedViewCursor.getCount() > 0) { if (savedViewCursor.moveToFirst()) { String savedReportUniqueId = savedViewCursor.getString(savedViewCursor.getColumnIndex(SavedReportListSchema.KEY_ID)); String serverTime = savedViewCursor.getString(savedViewCursor.getColumnIndex(SavedReportListSchema.KEY_SERVER_TIME_STAMP)); Date serverDate = IntellicusUtils.getDateFromString(serverTime, "MM/dd/yyyy hh:mm:ss"); String reportTime = SimpleDateFormat.getDateTimeInstance() .format(serverDate); ReportInfo reportInfo = new ReportInfo(String.valueOf( reportItemUniqueRowId),savedReportUniqueId); reportInfo.setReportName(entityName); reportInfo.setReportpublishDate(reportTime); Intent intent = new Intent(getApplicationContext(), HTMLReportViewer.class); intent.putExtra(Constants.KEY_REPORT_INFO, reportInfo); startActivity(intent); } }else{ showMsg("ERROR_NO_REPORT_AVAILABLE"); } if (savedViewCursor != null) { savedViewCursor.close(); } } catch (SQLiteException e) { showMsg("ERROR_NO_REPORT_AVAILABLE"); } }else { //As you have not successfully downloaded dashboard on device, show the message to the user showMsg("Please download Report to view it"); } } Following piece of code downloads and views a specific Cube Object . private void downloadSpecificCube() { //Get the default server ServerInfo defaultServer = IntellicusAndroidApp.getInstance(). getConfigurationInfo().getDefaultServer(); //Create a Cube Object, which you want to download cubeEntity = new CubeObject(); //id is the unique id of Cube Object on Intellicus Report Server cubeEntity.cubeId = "CUBE_OBJECT_13418448596848127031012183580027"; //categoryId the unique id of folder on Intellicus Report Server in //which Cube Object is saved cubeEntity.categoryId = "571937DE-9934-90CB-FFD0-371470A44B7E"; //name is the name of Cube Object cubeEntity.setName("Cube Name"); //Source Server Unique id the unique id of the Intellicus Server from //where you want to download the Cube Object cubeEntity.setServerKey(defaultServer.getuniqueKey()); //creating list of Cube Object to be downloaded, here in case you //are downloading a single Cube Object ArrayList<BaseEntity> cubeListToDownload = new ArrayList<>() ; cubeListToDownload.add(cubeEntity); //Save the Cube Object with us putListItemsIntoDB(cubeListToDownload,EntityType.ANALYTICAL); //Setting the context for download requests RequestXmlCreator.setDefaultContext(this); //Create Dataset tasks executer. Task executer is responsible //for downloading Cube Object from Intellicus Server, you also need //to pass a DownloadHandler object through which it will notify //about download status CubeDownloadManager dashBoardDownloadManager = new CubeDownloadManager( MainActivity.this,cubeListToDownload, handler,false); //start the task executer to start the download of Cube Object dashBoardDownloadManager.execute(); //Show the loading alert till you download the dashboard completely showProgressDialog("Downloading","Downloading Cube Object"); } private void viewDownloadedCube() { if(cubeEntity != null) { //View dashboard only when you have successfully downloaded dashboard //on device long cubeId = cubeEntity.getUniqueRowId(); String entityName = cubeEntity.getDisplayText(); String serverURL = cubeEntity.getServerKey(); Intent intent = new Intent(getApplicationContext(), OlapObjectViewerActicity.class); intent.putExtra(BrowseActivity.COLOUMN_UNIQUE_ID, cubeEntity.getUniqueId()); intent.putExtra(BrowseActivity.COLOUMN_NAME, entityName); intent.putExtra(EntityListActivity.REQUESTED_ENTITY_ROW_ID, cubeId); TestableContextFactory.instance(MainActivity.this).startActivity(intent); } else { //As you have not successfully downloaded dashboard on device, //show the message to the user showMsg("Please download Cube to view it"); } }