// iterate through migration paths of found service
for( MigrationPath path : sd.getPaths() ) {
Format inputFormat = fr.getFormatForUri(path.getInputFormat());
// check if this is the input format we are looking for
if (false == inputFormat.getExtensions().contains(sourceFormat.getDefaultExtension())) {
continue;
}
// get the output format the service is able to migrate to
Format outputFormat = fr.getFormatForUri(path.getOutputFormat());
PreservationActionDefinition pad = new PreservationActionDefinition();
pad.setActionIdentifier("Planets-local");
pad.setTargetFormat(outputFormat.getUri().toString());
pad.setShortname(sd.getName() + " @ " + sd.getEndpoint().getHost());
pad.setUrl(sd.getEndpoint().toString());
String input;
// if an extension is defined we take the first one from the list
if (inputFormat.getExtensions().size() > 0) {
input = inputFormat.getExtensions().iterator().next();
} else {
input = inputFormat.getUri().toString();
}
String output;
// if an extension is defined we take the first one from the list
if (outputFormat.getExtensions().size() > 0) {
output = outputFormat.getExtensions().iterator().next();
} else {
output = outputFormat.getUri().toString();
}
pad.setInfo(input+" > "+output);