@Override public void addAttachment(Attachment attachment) { // Check (uniqueness of) attachment identifier String id = attachment.getIdentifier(); if (id == null) { attachment.setIdentifier(createElementIdentifier()); } attachments.add(attachment); }
/** * @see org.opencastproject.mediapackage.MediaPackageElementBuilder#newElement(org.opencastproject.mediapackage.MediaPackageElement.Type * , org.opencastproject.mediapackage.MediaPackageElementFlavor) */ @Override public MediaPackageElement newElement(MediaPackageElement.Type type, MediaPackageElementFlavor flavor) { Attachment attachment = new AttachmentImpl(); attachment.setFlavor(flavor); return attachment; }
/** * {@inheritDoc} * * @see org.opencastproject.mediapackage.MediaPackage#getAttachments(org.opencastproject.mediapackage.MediaPackageElementFlavor) */ @Override public Attachment[] getAttachments(MediaPackageElementFlavor flavor) { if (flavor == null) throw new IllegalArgumentException("Unable to filter by null criterion"); // Go through attachments and remove those that don't match Collection<Attachment> attachments = loadAttachments(); List<Attachment> candidates = new ArrayList<Attachment>(attachments); for (Attachment a : attachments) { if (a.getFlavor() == null || !a.getFlavor().matches(flavor)) { candidates.remove(a); } } return candidates.toArray(new Attachment[candidates.size()]); }
timelinepreviewsMpe.referTo(track); timelinepreviewsMpe.getProperties().put("imageSizeX", String.valueOf(tileX)); timelinepreviewsMpe.getProperties().put("imageSizeY", String.valueOf(tileY)); timelinepreviewsMpe.getProperties().put("resolutionX", String.valueOf(resolutionX)); timelinepreviewsMpe.getProperties().put("resolutionY", String.valueOf(resolutionY)); timelinepreviewsMpe.setFlavor(track.getFlavor()); timelinepreviewsMpe.setIdentifier(IdBuilderFactory.newInstance().newIdBuilder().createNew().compact());
composedImage.setMimeType(MimeTypes.parseMimeType(mimetype)); } catch (IllegalArgumentException e) { logger.warn("Invalid mimetype provided for timeline previews image"); try { composedImage.setMimeType(MimeTypes.fromURI(composedImage.getURI())); } catch (UnknownFileTypeException ex) { logger.warn("No valid mimetype could be found for timeline previews image"); composedImage.getProperties().put("imageCount", String.valueOf(imageCount));
waveformMpe.setIdentifier(IdBuilderFactory.newInstance().newIdBuilder().createNew().compact()); return waveformMpe;
/** * {@inheritDoc} * * @see org.opencastproject.mediapackage.MediaPackage#getAttachments(org.opencastproject.mediapackage.MediaPackageElementFlavor, * org.opencastproject.mediapackage.MediaPackageReference) */ @Override public Attachment[] getAttachments(MediaPackageElementFlavor flavor, MediaPackageReference reference) { if (flavor == null) throw new IllegalArgumentException("Unable to filter by null criterion"); if (reference == null) throw new IllegalArgumentException("Unable to filter by null reference"); // Go through attachments and remove those that don't match Collection<Attachment> attachments = loadAttachments(); List<Attachment> candidates = new ArrayList<Attachment>(attachments); for (Attachment a : attachments) { if (!flavor.equals(a.getFlavor()) || !reference.matches(a.getReference())) { candidates.remove(a); } } return candidates.toArray(new Attachment[candidates.size()]); }
@Override public void removeAttachmentById(String attachmentId) { attachments.removeIf(a -> a.getIdentifier().equals(attachmentId)); }
List<Attachment> candidates = new ArrayList<Attachment>(attachments); for (Attachment a : attachments) { MediaPackageReference r = a.getReference(); if (!reference.matches(r)) { boolean indirectHit = false;
/** * 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); }