Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Syndicate via MDM JAVA API

Hi All,

I am trying to syndicate record via MDM JAVA API, i used the below code to syndicate and my code runs without any exception

but i am not finding any PortDataFiles

String portCode = "_A";
		String filePrefix = "Data_";
		ConnectionPool connections = ConnectionPoolFactory.getInstance(serverName);;
		String session;
		PortProperties[] portList;
		RecordId[] recordIds = new RecordId[1];
		RecordId recordId = new RecordId("R"+recordID);
		recordIds[0] = recordId;
 
		GetPortListCommand getPortsCmd = new GetPortListCommand(connections);
		getPortsCmd.setSession(session);
		getPortsCmd.execute();		
		portList = getPortsCmd.getPorts();
 
//			 Search a specific portCode
		PortProperties port = null;
		for (int i=0; i < portList.length; i++) {
			if (portCode.equals(portList<i>.getCode())) {
				port = portList<i>;
				break;
			}
		}
		if (port == null) {
			wdComponentAPI.getMessageManager().reportException("Can't syndicate, port doesn't exist",false);
			throw new RuntimeException("Can't syndicate, port doesn't exist" );			
		}
 
//			 Call sindication
		AddSyndicationRecordIdsCommand addSyndRecordCmd = new AddSyndicationRecordIdsCommand(connections);
		addSyndRecordCmd.setSession(session);
		addSyndRecordCmd.setFilePrefix(filePrefix);
		addSyndRecordCmd.setPortId(port.getId());
		addSyndRecordCmd.setRemoteSystemId(port.getRemoteSystemId());
		addSyndRecordCmd.setRecordIds(recordIds);
		addSyndRecordCmd.execute();
		
				
		GetPortDataFilesCommand getPortDataFilesCommand = new GetPortDataFilesCommand(connections);
		getPortDataFilesCommand.setSession(session);
		getPortDataFilesCommand.setRemoteSystemId(port.getRemoteSystemId());
		getPortDataFilesCommand.setPortId(port.getId());
		getPortDataFilesCommand.setFilePrefix(filePrefix);
		getPortDataFilesCommand.execute();
		PortDataFile[] portDataFiles = getPortDataFilesCommand.getFiles();
		
		for (int i = 0; i < portDataFiles.length; i++) {
			wdComponentAPI.getMessageManager().reportSuccess("File Name: "+portDataFiles<i>.getFilename());
		}

Can anyone tell where i am wrong or anyone has a example on syndication of record?

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question