@Test public void testExtractMetadata() throws Exception { MediaPackage mp = newMediaPackage("/manifest-simple.xml"); StaticMetadataServiceDublinCoreImpl ms = newStaticMetadataService(); StaticMetadata md = ms.getMetadata(mp); assertEquals("Land and Vegetation: Key players on the Climate Scene", md.getTitles().stream().filter(v -> v.getLanguage().equals(MetadataValues.LANGUAGE_UNDEFINED)) .findFirst().map(MetadataValue::getValue).orElse("")); assertEquals(createDate(2007, 12, 5, 0, 0, 0), md.getCreated().get()); }
@Override public StaticMetadata getMetadata(final MediaPackage mp) { return mlist(list(mp.getCatalogs(DublinCoreCatalog.ANY_DUBLINCORE))) .find(flavorPredicate(MediaPackageElements.EPISODE)) .flatMap(loader) .map(new Function<DublinCoreCatalog, StaticMetadata>() { @Override public StaticMetadata apply(DublinCoreCatalog episode) { return newStaticMetadataFromEpisode(episode); } }) .getOrElse((StaticMetadata) null); }
StaticMetadataServiceDublinCoreImpl implements StaticMetadataService { @Override public StaticMetadata getMetadata(final MediaPackage mp) { return mlist(list(mp.getCatalogs(DublinCoreCatalog.ANY_DUBLINCORE))) .find(flavorPredicate(MediaPackageElements.EPISODE)) .flatMap(loader) .map(new Function<DublinCoreCatalog, StaticMetadata>() { @Override public StaticMetadata apply(DublinCoreCatalog episode) { return newStaticMetadataFromEpisode(episode); } }) .getOrElse((StaticMetadata) null); } }
StaticMetadataServiceDublinCoreImpl implements StaticMetadataService { @Override public StaticMetadata getMetadata(final MediaPackage mp) { return mlist(list(mp.getCatalogs(DublinCoreCatalog.ANY_DUBLINCORE))) .find(flavorPredicate(MediaPackageElements.EPISODE)) .flatMap(loader) .map(new Function<DublinCoreCatalog, StaticMetadata>() { @Override public StaticMetadata apply(DublinCoreCatalog episode) { return newStaticMetadataFromEpisode(episode); } }) .getOrElse((StaticMetadata) null); }  }
StaticMetadataServiceDublinCoreImpl implements StaticMetadataService { @Override public StaticMetadata getMetadata(final MediaPackage mp) { return mlist(list(mp.getCatalogs(DublinCoreCatalog.ANY_DUBLINCORE))) .find(flavorPredicate(MediaPackageElements.EPISODE)) .flatMap(loader) .map(new Function<DublinCoreCatalog, StaticMetadata>() { @Override public StaticMetadata apply(DublinCoreCatalog episode) { return newStaticMetadataFromEpisode(episode); } }) .getOrElse((StaticMetadata) null); }  void setWorkspace(Workspace workspace); void activate(@SuppressWarnings("rawtypes") Map properties); @Override StaticMetadata getMetadata(final MediaPackage mp); @Override int getPriority(); }
StaticMetadataServiceDublinCoreImpl implements StaticMetadataService { @Override public StaticMetadata getMetadata(final MediaPackage mp) { return mlist(list(mp.getCatalogs(DublinCoreCatalog.ANY_DUBLINCORE))) .find(flavorPredicate(MediaPackageElements.EPISODE)) .flatMap(loader) .map(new Function<DublinCoreCatalog, StaticMetadata>() { @Override public StaticMetadata apply(DublinCoreCatalog episode) { return newStaticMetadataFromEpisode(episode); } }) .getOrElse((StaticMetadata) null); }  void setWorkspace(Workspace workspace); void activate(@SuppressWarnings("rawtypes") Map properties); @Override StaticMetadata getMetadata(final MediaPackage mp); @Override int getPriority();  }