cancel
Showing results for 
Search instead for 
Did you mean: 

Java api and Remote Key

Former Member
0 Kudos

Hi,

Do you know how do I retrieve the remote keys? I've already the record I want and find out how do i get the remote keys for each system. Can anyone help me?

e.g.

In a Country table i've already get the record id(mdm internal code), code (e.g. US), description (e.g. United States), what I need now is the remote keys associated to this record like:

AS400 - 1A

ECC - US

Oher legacy - 23

Thanks and Regards,

Eduardo

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

you can get all the remote systems using the following code


///Get List of all the Remote system.					
				GetRemoteSystemListCommand  getre = new GetRemoteSystemListCommand(pool);
				getre.setSession(UsersessionId);
				try {
					getre.execute();
				} catch (CommandException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				RemoteSystemProperties[] remSysId  = getre.getRemoteSystems();
				RemoteSystemId remoteSystem = null;	
				for(int i=0;i<remSysId.length;i++)
				{
					//compare the system with the passed system. and get the id of the passed system
					if (remSysId<i>.getCode().equalsIgnoreCase("Remote system"))
					{ 
					remoteSystem = new RemoteSystemId(remSysId<i>.getId()); 
					break;
					} 
	 
				}		
/////*****************Conevert record id string inot recordid Object.	*****************////
				RecordId l_delRecId = new RecordId("R41");
				RecordId[] l_re = new RecordId[1];
				l_re[0]= l_delRecId;
				
	///*****************Retriving the keymapping for selectd Record ids......***************//////////////
				RetrieveRecordsKeyMappingsCommand rrkey = new RetrieveRecordsKeyMappingsCommand(pool);
				rrkey.setSession(UsersessionId);
				rrkey.setTableId(tbl);
				rrkey.setRecordIds(l_re);
				try {
					rrkey.execute();
				} catch (CommandException e2) {
					// TODO Auto-generated catch block
					e2.printStackTrace();
				}catch (RuntimeException e2) {
				// TODO Auto-generated catch block
				e2.printStackTrace();
			}
				
				RecordKeyMapping[] l_keyMaapings = rrkey.getKeyMappings();
				KeyMapping l_keys = l_keyMaapings[0].getKeyMapping(remoteSystem);
				String[] keys = l_keys.getKeys();

Regards,

Shruti

Former Member
0 Kudos

Shruti,

Thank you very much, this is exactly what I was looking for.

Best regards,

Eduardo

Answers (0)