@Test public void testEditorOperationSkip() throws WorkflowOperationException { WorkflowInstanceImpl workflowInstance = getWorkflowInstance(mp, getDefaultConfiguration(true)); WorkflowOperationResult result = videoEditorWorkflowOperationHandler.skip(workflowInstance, null); Assert.assertNotNull( "VideoEditor workflow operation returns null but should be an instantiated WorkflowOperationResult", result); WorkflowOperationInstance worflowOperationInstance = workflowInstance.getCurrentOperation(); String targetFlavorSubtypeProperty = worflowOperationInstance.getConfiguration("target-flavor-subtype"); String skippedFlavorsProperty = worflowOperationInstance.getConfiguration("skipped-flavors"); TrackSelector trackSelector = new TrackSelector(); trackSelector.addFlavor(skippedFlavorsProperty); Collection<Track> skippedTracks = trackSelector.select(result.getMediaPackage(), false); Assert.assertTrue("Mediapackage does not contain any tracks matching flavor " + skippedFlavorsProperty, skippedTracks != null && !skippedTracks.isEmpty()); for (Track skippedTrack : skippedTracks) { MediaPackageElementFlavor derivedTrackFlavor = MediaPackageElementFlavor.flavor(skippedTrack.getFlavor() .getType(), targetFlavorSubtypeProperty); MediaPackageElement[] derivedElements = result.getMediaPackage().getDerived(skippedTrack, derivedTrackFlavor); Assert.assertTrue("Media package should contain track with flavor " + derivedTrackFlavor.toString(), derivedElements != null && derivedElements.length > 0); } }
@Override public WorkflowOperationResult skip(WorkflowInstance workflowInstance, JobContext context) throws WorkflowOperationException { MediaPackage mp = workflowInstance.getMediaPackage(); logger.info("Skip video editor operation for mediapackage {}", mp.getIdentifier().toString()); WorkflowOperationInstance worflowOperationInstance = workflowInstance.getCurrentOperation(); String sourceTrackFlavorsProperty = StringUtils .trimToNull(worflowOperationInstance.getConfiguration(SKIPPED_FLAVORS_PROPERTY)); if (sourceTrackFlavorsProperty == null || sourceTrackFlavorsProperty.isEmpty()) { logger.info("\"{}\" option not set, use value of \"{}\"", SKIPPED_FLAVORS_PROPERTY, SOURCE_FLAVORS_PROPERTY); sourceTrackFlavorsProperty = StringUtils .trimToNull(worflowOperationInstance.getConfiguration(SOURCE_FLAVORS_PROPERTY)); if (sourceTrackFlavorsProperty == null) { throw new WorkflowOperationException( format("Required configuration property %s not set.", SOURCE_FLAVORS_PROPERTY)); } } final boolean skipProcessing = BooleanUtils .toBoolean(worflowOperationInstance.getConfiguration(SKIP_PROCESSING_PROPERTY)); if (skipProcessing) return createResult(mp, Action.SKIP); String targetFlavorSubTypeProperty = StringUtils .trimToNull(worflowOperationInstance.getConfiguration(TARGET_FLAVOR_SUBTYPE_PROPERTY)); if (targetFlavorSubTypeProperty == null) { throw new WorkflowOperationException( format("Required configuration property %s not set.", TARGET_FLAVOR_SUBTYPE_PROPERTY)); } TrackSelector trackSelector = new TrackSelector(); for (String flavor : asList(sourceTrackFlavorsProperty)) { trackSelector.addFlavor(flavor); } Collection<Track> sourceTracks = trackSelector.select(mp, false); for (Track sourceTrack : sourceTracks) { Track clonedTrack = (Track) sourceTrack.clone(); clonedTrack.setIdentifier(null); clonedTrack.setURI(sourceTrack.getURI()); clonedTrack .setFlavor(new MediaPackageElementFlavor(sourceTrack.getFlavor().getType(), targetFlavorSubTypeProperty)); mp.addDerived(clonedTrack, sourceTrack); } return createResult(mp, Action.SKIP); }
VideoEditorWorkflowOperationHandler extends ResumableWorkflowOperationHandlerBase { @Override public WorkflowOperationResult skip(WorkflowInstance workflowInstance, JobContext context) throws WorkflowOperationException { MediaPackage mp = workflowInstance.getMediaPackage(); logger.info("Skip video editor operation for mediapackage {}", mp.getIdentifier().toString()); WorkflowOperationInstance worflowOperationInstance = workflowInstance.getCurrentOperation(); String sourceTrackFlavorsProperty = StringUtils .trimToNull(worflowOperationInstance.getConfiguration(SKIPPED_FLAVORS_PROPERTY)); if (sourceTrackFlavorsProperty == null || sourceTrackFlavorsProperty.isEmpty()) { logger.info("\"{}\" option not set, use value of \"{}\"", SKIPPED_FLAVORS_PROPERTY, SOURCE_FLAVORS_PROPERTY); sourceTrackFlavorsProperty = StringUtils .trimToNull(worflowOperationInstance.getConfiguration(SOURCE_FLAVORS_PROPERTY)); if (sourceTrackFlavorsProperty == null) { throw new WorkflowOperationException( format("Required configuration property %s not set.", SOURCE_FLAVORS_PROPERTY)); } } final boolean skipProcessing = BooleanUtils .toBoolean(worflowOperationInstance.getConfiguration(SKIP_PROCESSING_PROPERTY)); if (skipProcessing) return createResult(mp, Action.SKIP); String targetFlavorSubTypeProperty = StringUtils .trimToNull(worflowOperationInstance.getConfiguration(TARGET_FLAVOR_SUBTYPE_PROPERTY)); if (targetFlavorSubTypeProperty == null) { throw new WorkflowOperationException( format("Required configuration property %s not set.", TARGET_FLAVOR_SUBTYPE_PROPERTY)); } TrackSelector trackSelector = new TrackSelector(); for (String flavor : asList(sourceTrackFlavorsProperty)) { trackSelector.addFlavor(flavor); } Collection<Track> sourceTracks = trackSelector.select(mp, false); for (Track sourceTrack : sourceTracks) { Track clonedTrack = (Track) sourceTrack.clone(); clonedTrack.setIdentifier(null); clonedTrack.setURI(sourceTrack.getURI()); clonedTrack .setFlavor(new MediaPackageElementFlavor(sourceTrack.getFlavor().getType(), targetFlavorSubTypeProperty)); mp.addDerived(clonedTrack, sourceTrack); } return createResult(mp, Action.SKIP); } }
VideoEditorWorkflowOperationHandler extends ResumableWorkflowOperationHandlerBase { @Override public WorkflowOperationResult skip(WorkflowInstance workflowInstance, JobContext context) throws WorkflowOperationException { MediaPackage mp = workflowInstance.getMediaPackage(); logger.info("Skip video editor operation for mediapackage {}", mp.getIdentifier().toString()); WorkflowOperationInstance worflowOperationInstance = workflowInstance.getCurrentOperation(); String sourceTrackFlavorsProperty = StringUtils .trimToNull(worflowOperationInstance.getConfiguration(SKIPPED_FLAVORS_PROPERTY)); if (sourceTrackFlavorsProperty == null || sourceTrackFlavorsProperty.isEmpty()) { logger.info("\"{}\" option not set, use value of \"{}\"", SKIPPED_FLAVORS_PROPERTY, SOURCE_FLAVORS_PROPERTY); sourceTrackFlavorsProperty = StringUtils .trimToNull(worflowOperationInstance.getConfiguration(SOURCE_FLAVORS_PROPERTY)); if (sourceTrackFlavorsProperty == null) { throw new WorkflowOperationException( format("Required configuration property %s not set.", SOURCE_FLAVORS_PROPERTY)); } } final boolean skipProcessing = BooleanUtils .toBoolean(worflowOperationInstance.getConfiguration(SKIP_PROCESSING_PROPERTY)); if (skipProcessing) return createResult(mp, Action.SKIP); String targetFlavorSubTypeProperty = StringUtils .trimToNull(worflowOperationInstance.getConfiguration(TARGET_FLAVOR_SUBTYPE_PROPERTY)); if (targetFlavorSubTypeProperty == null) { throw new WorkflowOperationException( format("Required configuration property %s not set.", TARGET_FLAVOR_SUBTYPE_PROPERTY)); } TrackSelector trackSelector = new TrackSelector(); for (String flavor : asList(sourceTrackFlavorsProperty)) { trackSelector.addFlavor(flavor); } Collection<Track> sourceTracks = trackSelector.select(mp, false); for (Track sourceTrack : sourceTracks) { Track clonedTrack = (Track) sourceTrack.clone(); clonedTrack.setIdentifier(null); clonedTrack.setURI(sourceTrack.getURI()); clonedTrack .setFlavor(new MediaPackageElementFlavor(sourceTrack.getFlavor().getType(), targetFlavorSubTypeProperty)); mp.addDerived(clonedTrack, sourceTrack); } return createResult(mp, Action.SKIP); }  }
VideoEditorWorkflowOperationHandler extends ResumableWorkflowOperationHandlerBase { @Override public WorkflowOperationResult skip(WorkflowInstance workflowInstance, JobContext context) throws WorkflowOperationException { MediaPackage mp = workflowInstance.getMediaPackage(); logger.info("Skip video editor operation for mediapackage {}", mp.getIdentifier().toString()); WorkflowOperationInstance worflowOperationInstance = workflowInstance.getCurrentOperation(); String sourceTrackFlavorsProperty = StringUtils .trimToNull(worflowOperationInstance.getConfiguration(SKIPPED_FLAVORS_PROPERTY)); if (sourceTrackFlavorsProperty == null || sourceTrackFlavorsProperty.isEmpty()) { logger.info("\"{}\" option not set, use value of \"{}\"", SKIPPED_FLAVORS_PROPERTY, SOURCE_FLAVORS_PROPERTY); sourceTrackFlavorsProperty = StringUtils .trimToNull(worflowOperationInstance.getConfiguration(SOURCE_FLAVORS_PROPERTY)); if (sourceTrackFlavorsProperty == null) { throw new WorkflowOperationException( format("Required configuration property %s not set.", SOURCE_FLAVORS_PROPERTY)); } } final boolean skipProcessing = BooleanUtils .toBoolean(worflowOperationInstance.getConfiguration(SKIP_PROCESSING_PROPERTY)); if (skipProcessing) return createResult(mp, Action.SKIP); String targetFlavorSubTypeProperty = StringUtils .trimToNull(worflowOperationInstance.getConfiguration(TARGET_FLAVOR_SUBTYPE_PROPERTY)); if (targetFlavorSubTypeProperty == null) { throw new WorkflowOperationException( format("Required configuration property %s not set.", TARGET_FLAVOR_SUBTYPE_PROPERTY)); } TrackSelector trackSelector = new TrackSelector(); for (String flavor : asList(sourceTrackFlavorsProperty)) { trackSelector.addFlavor(flavor); } Collection<Track> sourceTracks = trackSelector.select(mp, false); for (Track sourceTrack : sourceTracks) { Track clonedTrack = (Track) sourceTrack.clone(); clonedTrack.setIdentifier(null); clonedTrack.setURI(sourceTrack.getURI()); clonedTrack .setFlavor(new MediaPackageElementFlavor(sourceTrack.getFlavor().getType(), targetFlavorSubTypeProperty)); mp.addDerived(clonedTrack, sourceTrack); } return createResult(mp, Action.SKIP); }  @Override void activate(ComponentContext cc); @Override WorkflowOperationResult start(WorkflowInstance workflowInstance, JobContext context); @Override WorkflowOperationResult skip(WorkflowInstance workflowInstance, JobContext context); @Override WorkflowOperationResult resume(WorkflowInstance workflowInstance, JobContext context,
          Map<String, String> properties); void setSmilService(SmilService smilService); void setVideoEditorService(VideoEditorService editor); void setWorkspace(Workspace workspace); }
VideoEditorWorkflowOperationHandler extends ResumableWorkflowOperationHandlerBase { @Override public WorkflowOperationResult skip(WorkflowInstance workflowInstance, JobContext context) throws WorkflowOperationException { MediaPackage mp = workflowInstance.getMediaPackage(); logger.info("Skip video editor operation for mediapackage {}", mp.getIdentifier().toString()); WorkflowOperationInstance worflowOperationInstance = workflowInstance.getCurrentOperation(); String sourceTrackFlavorsProperty = StringUtils .trimToNull(worflowOperationInstance.getConfiguration(SKIPPED_FLAVORS_PROPERTY)); if (sourceTrackFlavorsProperty == null || sourceTrackFlavorsProperty.isEmpty()) { logger.info("\"{}\" option not set, use value of \"{}\"", SKIPPED_FLAVORS_PROPERTY, SOURCE_FLAVORS_PROPERTY); sourceTrackFlavorsProperty = StringUtils .trimToNull(worflowOperationInstance.getConfiguration(SOURCE_FLAVORS_PROPERTY)); if (sourceTrackFlavorsProperty == null) { throw new WorkflowOperationException( format("Required configuration property %s not set.", SOURCE_FLAVORS_PROPERTY)); } } final boolean skipProcessing = BooleanUtils .toBoolean(worflowOperationInstance.getConfiguration(SKIP_PROCESSING_PROPERTY)); if (skipProcessing) return createResult(mp, Action.SKIP); String targetFlavorSubTypeProperty = StringUtils .trimToNull(worflowOperationInstance.getConfiguration(TARGET_FLAVOR_SUBTYPE_PROPERTY)); if (targetFlavorSubTypeProperty == null) { throw new WorkflowOperationException( format("Required configuration property %s not set.", TARGET_FLAVOR_SUBTYPE_PROPERTY)); } TrackSelector trackSelector = new TrackSelector(); for (String flavor : asList(sourceTrackFlavorsProperty)) { trackSelector.addFlavor(flavor); } Collection<Track> sourceTracks = trackSelector.select(mp, false); for (Track sourceTrack : sourceTracks) { Track clonedTrack = (Track) sourceTrack.clone(); clonedTrack.setIdentifier(null); clonedTrack.setURI(sourceTrack.getURI()); clonedTrack .setFlavor(new MediaPackageElementFlavor(sourceTrack.getFlavor().getType(), targetFlavorSubTypeProperty)); mp.addDerived(clonedTrack, sourceTrack); } return createResult(mp, Action.SKIP); }  @Override void activate(ComponentContext cc); @Override WorkflowOperationResult start(WorkflowInstance workflowInstance, JobContext context); @Override WorkflowOperationResult skip(WorkflowInstance workflowInstance, JobContext context); @Override WorkflowOperationResult resume(WorkflowInstance workflowInstance, JobContext context,
          Map<String, String> properties); void setSmilService(SmilService smilService); void setVideoEditorService(VideoEditorService editor); void setWorkspace(Workspace workspace);  }