Пример #1
0
 private DBObject updateForItem(Container container, SeriesRef seriesRef) {
   MongoUpdateBuilder childUpdate =
       MongoBuilders.update().setField(ItemTranslator.CONTAINER_ID, container.getId());
   if (seriesRef != null) {
     childUpdate.setField(ItemTranslator.SERIES_ID, seriesRef.getId());
   }
   DBObject update = childUpdate.build();
   return update;
 }
Пример #2
0
 private void updateContainersRefs(
     Container container,
     Map<String, SeriesRef> seriesRefs,
     Multimap<String, ChildRef> childRefs) {
   MongoUpdateBuilder brandUpdate =
       update().setField(ContainerTranslator.CHILDREN_KEY, dbosFromChildRefs(childRefs.values()));
   if (!seriesRefs.isEmpty()) {
     brandUpdate.setField(
         ContainerTranslator.FULL_SERIES_KEY, dbosFromSeriesRefs(seriesRefs.values()));
   }
   containers.update(where().idEquals(container.getCanonicalUri()).build(), brandUpdate.build());
 }
Пример #3
0
 private void updateSeriesRefs(
     Container container,
     Map<String, SeriesRef> seriesRefs,
     Multimap<String, ChildRef> seriesChildRefs) {
   if (seriesRefs.size() == 1 && seriesRefs.containsKey(container.getCanonicalUri())) {
     return; // container is a top level series.
   }
   for (String seriesUri : Iterables.transform(seriesRefs.values(), SeriesRef.TO_URI)) {
     MongoUpdateBuilder seriesUpdate =
         update().setField(ContainerTranslator.CONTAINER_ID, container.getId());
     Collection<ChildRef> seriesChildren = seriesChildRefs.get(seriesUri);
     if (!seriesChildren.isEmpty()) {
       seriesUpdate.setField(ContainerTranslator.CHILDREN_KEY, dbosFromChildRefs(seriesChildren));
     }
     programmeGroups.update(where().idEquals(seriesUri).build(), seriesUpdate.build());
   }
 }