Developer

Data Component

The data component of MAF Extensibility Framework communicates with the data source via the MAFDataSourceAdapter interface.

This communication includes create, read, update, delete, and MAFGenericBO related operations.

The data component handles and forwards metadata-driven requests to the data source adapter as MAFBusinessRequest objects. Use the MAFGenericBOManager interface to communicate directly with the data component. Reference the MAFGenericBOManager instance via the MAFCore.

If you create your own controller for each metadata-driven tile, you can ignore the data component of the framework and implement yours, or you can communicate directly with the data provider. However, to override or modify the behavior of the data component, SAP recommends that you instead register an MAFApplicationBOListener. This listener is notified each time the MAFGenericBOManager object is about to execute an operation that is related to the MAF Generic Business Object, and you can override it, decorate it, or let the framework execute its default logic.

// MAFCore is the main object to deal with MAF Extensibility
	// MAFCore should be built before MAF Extensibility feature can be used
        MAFCoreBuilder mafCoreBuilder = new MAFCoreBuilder(this, false);

        //Registering application Generic BO Listener
        mafCoreBuilder.setApplicationGenericBOListener(new MyGBOListener());

…

	private class MyGBOListener implements MAFApplicationGenericBOListener {

		@Override
		public void afterGetGenericBOList(MAFBusinessQuery query,
				MAFGenericBOResultListener listener, MAFBOResult result) {
			MAFGenericBOList resultList = result.getResultData();
			for (MAFGenericBO resultBO : resultList) {
				String calculatedValue = resultBO.getValue("originalAttr1") + resultBO.getValue("originalAttr2");  
				resultBO.setValue("MyAttribute", calculatedValue);
			}
		}

		…

	}