/** * {@inheritDoc} * * @see org.opencastproject.mediapackage.MediaPackage#addDerived(org.opencastproject.mediapackage.MediaPackageElement, * org.opencastproject.mediapackage.MediaPackageElement, java.util.Map) */ @Override public void addDerived(MediaPackageElement derivedElement, MediaPackageElement sourceElement, Map<String, String> properties) { if (derivedElement == null) throw new IllegalArgumentException("The derived element is null"); if (sourceElement == null) throw new IllegalArgumentException("The source element is null"); if (!contains(sourceElement)) throw new IllegalStateException("The sourceElement needs to be part of the media package"); derivedElement.referTo(sourceElement); addInternal(derivedElement); if (properties != null) { MediaPackageReference ref = derivedElement.getReference(); for (Map.Entry<String, String> entry : properties.entrySet()) { ref.setProperty(entry.getKey(), entry.getValue()); } } }
/** * Integrates the attachment into the media package. This mainly involves moving the attachment into the media package * file structure. * * @param attachment * the attachment to integrate */ private void integrateAttachment(Attachment attachment) { // Check (uniqueness of) attachment identifier String id = attachment.getIdentifier(); if (id == null || contains(id)) { attachment.setIdentifier(createElementIdentifier()); } integrate(attachment); }
/** * Integrates the catalog into the media package. This mainly involves moving the catalog into the media package file * structure. * * @param catalog * the catalog to integrate */ private void integrateCatalog(Catalog catalog) { // Check (uniqueness of) catalog identifier String id = catalog.getIdentifier(); if (id == null || contains(id)) { catalog.setIdentifier(createElementIdentifier()); } integrate(catalog); }
/** * Integrates the track into the media package. This mainly involves moving the track into the media package file * structure. * * @param track * the track to integrate */ private void integrateTrack(Track track) { // Check (uniqueness of) track identifier String id = track.getIdentifier(); if (id == null || contains(id)) { track.setIdentifier(createElementIdentifier()); } duration = null; integrate(track); }