Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only

Configuring multiple data sources for the Map Control 

Mon March 16, 2020 02:19 PM

Configuring multiple data sources for the Map Control

Author: Leandro Barollo Borges de Macedo, Staff Software Engineer, lebm@br.ibm.com

Author: Rafael Thomas Goz Coutinho, Advisor Software Engineer

Standard Maximo data sources can be configured to display objects on the Maximo Scheduler Map Control. A data source in Maximo is attached to a query on the Maximo objects and can return only one Maximo object type. Maximo Scheduler allows users to create the data source programmatically, expanding the power of the data source customization, and to have different kind of records displayed in the same data source input.

Creating the Bean Class to define the data source

All bean classes must be extended from DataBean.java and must implement the MapDataSourceSetup.java interface so that Maximo can load multiple sources for the map.
Let's create a MultiDataSourceExampleBean in the following location:

<MAXIMO_ROOT>\applications\maximo\maximouiweb\src\com\example\map

The default code for the bean class will be the following:

package com.example.map;

import java.rmi.RemoteException;
import java.util.List;

import psdi.mbo.MboSetRemote;
import psdi.util.MXException;
import psdi.webclient.system.beans.DataBean;

public class MultipleSourceBean extends DataBean implements MapDataSourceSetup {

	@Override
	public List<MboSetRemote> getRecordsToPlaceOnMap() throws MXException, RemoteException {
		return null;
	}

	@Override
	public void cleanupRecordsMboSet(List<MboSetRemote> recordsList)
	throws MXException, RemoteException {
	}
}

These methods must be implemented in order to load all data:

  • getRecordsToPlaceOnMap(): This method will return a list with all MboSets that will be shown on the map.
  • cleanupRecordsMboSet(): This method is used to clean up all data used in the map. Depending on how these data were acquired, Maximo may not clear them in cache, so we need to take care of that manually.
    IMPORTANT NOTE: If the main record data is included in the List, DO NOT PERFORM CLEANUP ON THEM!! If you perform that cleanup, changes made in the UI will not be saved. We will only clean the records that were retrieved exclusively for this bean.

Now we need to fill the List with some records for the map. Let's load some Work Orders recently created with the Service Address configured. If you want to load the default data for the map, include them in the list as well:

public List<MboSetRemote> getRecordsToPlaceOnMap() throws MXException, RemoteException {
		List<MboSetRemote> dataSourceList = new ArrayList<MboSetRemote>();
		// Default app data. Index is being specified for cleanup logic
		dataSourceList.add(0, app.getAppBean().getMboSet());
		MboSetRemote mboSet = MXServer.getMXServer().getMboSet("WORKORDER", getMXSession().getUserInfo());
		mboSet.setWhere("wonum like 'WO%'");
		mboSet.reset();
		dataSourceList.add(mboSet);
		return dataSourceList;
	}

For the cleanup logic, we need to make sure the main app data is not cleaned:

public void cleanupRecordsMboSet(List<MboSetRemote> recordsList)
	throws MXException, RemoteException {
		// Remove the index 0, which contains the app data that cannot be cleaned
		recordsList.remove(0);
		for (MboSetRemote mboSet : recordsList) {
			// For MboSets that came from MXServer, just use close()
			mboSet.close();
		}
		recordsList.clear();
	}

With the bean class properly set, we need to set it on the Map Controller in the desired app:


Save the application presentation and open the same application on the tab where your map is. All records included in the list will be displayed in the map. Just make sure they implement GISable (Making your Maximo objects available on the Map) or they won't be applied in the map.

NOTE: When using multiple data sources, all information in the map becomes read-only, including the data retrieved by the data source itself. It's recommended to have a separate map with multiple data sources that serves as a "View only" map and a default map where you can make changes related to the application record(s).









#AssetandFacilitiesManagement
#Maximo
#Scheduler
#MaximoScheduler

Statistics
0 Favorited
15 Views
0 Files
0 Shares
0 Downloads