PropertiesUtils.ingestProperties(rd, properties, contentProperties);
// binaries ingestion - in Alfresco we could have more than one binary for each node (custom content models)
for (NamedValue contentProperty : contentProperties) {
//we are ingesting all the binaries defined as d:content property in the Alfresco content model
Content binary = ContentReader.read(endpoint, username, password, socketTimeout, session, predicate, contentProperty.getName());
fileLength = binary.getLength();
is = ContentReader.getBinary(endpoint, binary, username, password, socketTimeout, session);
rd.setBinary(is, fileLength);
//id is the node reference only if the node has an unique content stream
//For a node with a single d:content property: id = node reference
String id = PropertiesUtils.getNodeReference(properties);
//For a node with multiple d:content properties: id = node reference;QName
//The QName of a property of type d:content will be appended to the node reference
if(contentProperties.size()>1){
id = id + INGESTION_SEPARATOR_FOR_MULTI_BINARY + contentProperty.getName();
}
//version label
String version = PropertiesUtils.getVersionLabel(properties);
//the document uri is related to the specific d:content property available in the node
//we want to ingest each content stream that are nested in a single node
String documentURI = binary.getUrl();
activities.ingestDocumentWithException(id, version, documentURI, rd);
}
AuthenticationUtils.endSession();