CRecordApplication
The record
This record belongs to the application factory collector API.
The Application Collector Service is located in the plugin NY_ApplicationFactoryCollectorPlugIn.
{ "id": "5a8d5a3f-37c0-47f5-bb88-25f5f5e6a20c", "name": "APPLICATION ", "isService": "false", "namespaces": "", "description": "The application data.", "slots": [ { "key": "appId", "name": "ID ", "direction": "REQUEST", "mandatory": "false", "type": "UUID", "description": "The ID of an application." }, { "key": "appName", "name": "NAME ", "direction": "REQUEST", "mandatory": "false", "type": "STRING", "description": "The name of the application." }, { "key": "shortAppDesc", "name": "SHORT_DESCRIPTION ", "direction": "REQUEST", "mandatory": "false", "type": "STRING", "description": "A short description." }, { "key": "longAppDesc", "name": "LONG_DESCRIPTION ", "direction": "REQUEST", "mandatory": "false", "type": "STRING", "description": "A long description." }, { "key": "iconPath", "name": "ICON ", "direction": "REQUEST", "mandatory": "false", "type": "STRING", "description": "The relative path of the icon file in the file store." }, { "key": "properties", "name": "PROPERTIES ", "direction": "REQUEST", "mandatory": "false", "type": "STRING_PROPERTIES", "description": "Properties for running the application." }, { "key": "permissions", "name": "PERMISSIONS ", "direction": "REQUEST", "mandatory": "false", "type": "STRING_ARRAY", "description": "Permissions required to start the application." } ] }
Arguments
ID : The ID of the application.NAME : The name of the application.SHORT_DESCRIPTION : A short description of the application.LONG_DESCRIPTION : A long description of the application.ICON : The relative path of an icon. The binary icon can be retrieved from the FileStore.PROPERTIES : Predefined arguments for the application.PERMISSIONS :A list of rights that are required to start the application.
Usage
Sending the message
This record is used, for example, when registering application factories.
Example of use (after generating of the class
// create an application description @NotNull private CRecord createApplicationRecord() throws CException { final CRecord record =CRecordApplication .create();CRecordApplication .setId(record,UUID.fromString("186687b0-e99b-4479-be94-d69051c9542f") );CRecordApplication .setName(record,"Monitor" );CRecordApplication .setShortDescription(record,"A monitor to hold monitoring panels" );CRecordApplication .setLongDescription(record,"An application for monitoring states of the );nyssr .net "CRecordApplication .setIcon(record,"apps/Monitor/monitor.png" );CRecordApplication .setPermissions(record,new String[]{} ); return record; }// register your app private void registerApplicationFactory() throws CException { final IId microserviceId = CIdFactory.fromObject("NY_ApplicationFactoryCollector"); final CEnvelope env = CEnvelope.forMicroService(microserviceId); final CRecord record = CRecordAddAppFactory.create(); CRecordAddAppFactory.setApplication(record, createApplicationRecord()); CRecordAddAppFactory.setFactoryAddress(record, getAddress()); sendRequest(env, record); }
Dealing with the response
You can check the result of the registration in a separate message handler for the response:
// in the constructor of your target: addMessageHandler(CRecordAddAppFactory.ID, this::asyncAddAppFactory);
// handle the answer private boolean asyncAddAppFactory(@NotNull final CEnvelope aEnvelope, @NotNull final CRecord aRecord) { if (aEnvelope.isAnswer()) { if (aEnvelope.getResultCode() != CResultCode.SUCCESS) {// ... } return true; } else { return false; } }