. . .

Using other modules

Like using libraries in programming, you can use other modules within an own module.

Each module has a field containing all used modules, based on the system; its name is usedModules. Under some circumstances, the map of used modules of a module is automatically updated; an example would be setting a field type to a class of another module in class editor (attribute X in class A of module P is of type B, which is a class of module Q) or setting a inheritance from a class A to a class B of another module. But you can also set one module to be used by another manually; the latter case would make sense if the used module contains some methods or REST interfaces which should be used in an other module.

The dashboard will show all used modules in the left menu.

Setting a used module relationship manually

Defining the used modules for an own module can be done via REST or in NativeModule code.

To declare used modules via REST, the using module must already exist and has to be updated for example as follows:

curl -X PUT BASE_URL/yambas/rest/modules/MODULENAME -d "{\"usedModules\":{\"LIVE\":["NAME_OF_USED_MODULE\"]}" -u AUTH -H "Content-Type:appliation/json"

This will add a module NAME_OF_USED_MODULE in live system to a module MODULENAME. The handling follows a usual REST update.

To set the map of used modules via NativeModule code, open the module class and update the @Module annotation:

@Module( usedModules = { "NAME_OF_USED_MODULE" } )

After uploading the module, the used module field will get updated on server and the downloaded NativeModule code will contain the used module in its lib directory as jar file.