public static String oneFromRepository ( FedoraAPIAMTOM sourceRepoAPIA , FedoraAPIMMTOM sourceRepoAPIM , String sourceExportFormat , String pid , FedoraAPIAMTOM targetRepoAPIA , FedoraAPIMMTOM targetRepoAPIM , String logMessage ) throws Exception { // EXPORT from source repository // The export context is set to "migrate" since the intent // of ingest from repository is to migrate an object from // one repository to another. The "migrate" option will // ensure that URLs that were relative to the "exporting" // repository are made relative to the "importing" repository. ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; AutoExporter . export ( sourceRepoAPIA , sourceRepoAPIM , pid , sourceExportFormat , "migrate" , out ) ; // Convert old format values to URIs for ingest String ingestFormat = sourceExportFormat ; if ( sourceExportFormat . equals ( METS_EXT1_0_LEGACY ) ) { ingestFormat = METS_EXT1_0 . uri ; } else if ( sourceExportFormat . equals ( FOXML1_0_LEGACY ) ) { ingestFormat = FOXML1_0 . uri ; } // INGEST into target repository String realLogMessage = logMessage ; if ( realLogMessage == null ) { realLogMessage = "Ingested from source repository with pid " + pid ; } return AutoIngestor . ingestAndCommit ( targetRepoAPIA , targetRepoAPIM , new ByteArrayInputStream ( out . toByteArray ( ) ) , ingestFormat , realLogMessage ) ; }
if logMessage is null will make informative one up