Uderc programming article aggregator sites

Remote Key Manupulation in Java MDM APIs

Tags:
Answers: Have 5 answers
Advertisement
Hi ,
I need to do create/Modify/retrieve remote key using MDM Java APIs. I have found out two APIs for retrieve and modify of remote key (RetrieveRecordsKeyMappingsCommand and ModifyRecordsKeyMappingsCommand using RecordKeyMapping).
I am not getting any API to create remote key using Java APIs. Can anyone help me in this regard.If anyone has sample code also that would a great help.
Thanks and Regards,
Subhasis
Advertisement
The best answer: Hi,
Please have a look on below code ...
          /TableID/
          TableId tableId = schema.getTable("table Code").getId();
RecordId recordId = new RecordId("R1"); // record id of record to which you are going to add key mapping
          /Remote System Properties/
          RemoteSystemProperties remoteSystem = schema.getRemoteSystem("RemoteSystemCode");
          /*Creating new instance of RecordKeyMapping */
          RecordKeyMapping recordKeyMapp = KeyMappingFactory.createRecordKeyMapping(tableId,recordId);
          /*Creating new instance of KeyMapping */
          KeyMapping keyMapping = KeyMappingFactory.createKeyMapping(remoteSystem.getId());
          /*Setting value to Key value */
          keyMapping.addKey("1234");
          /storing keymapping instance in RecordKeyMapping instance/
          recordKeyMapp.addKeyMapping(keyMapping);
          RecordKeyMapping [] recordKey = ;
          ModifyRecordsKeyMappingsCommand rkm = null;
          try {
           rkm = new ModifyRecordsKeyMappingsCommand(context);
          } catch (SessionException e) {
          } catch (ConnectionException e) {
          rkm.setKeyMappings(keyMappings);
          try {
               rkm.execute();
          } catch (CommandException e) {
Hope this helps you.
Cheers,
Veeru.