private Brand extractSummaryBrand(ProgData progData, String originalURI, Timestamp updatedAt) {
   Brand summaryBrand = new Brand();
   summaryBrand.setCanonicalUri(
       originalURI.replace(Publisher.PA.key(), Publisher.PA_SERIES_SUMMARIES.key()));
   summaryBrand.setPublisher(Publisher.PA_SERIES_SUMMARIES);
   summaryBrand.setLongDescription(progData.getSeriesSummary());
   summaryBrand.setLastUpdated(updatedAt.toDateTimeUTC());
   return summaryBrand;
 }
Beispiel #2
0
  private Brand getBrandSummary(ProgData progData, Brand brand, Timestamp updatedAt) {
    String uri =
        brand.getCanonicalUri().replace(Publisher.PA.key(), Publisher.PA_SERIES_SUMMARIES.key());
    Maybe<Identified> maybeBrandSummary =
        contentResolver.findByCanonicalUris(ImmutableList.of(uri)).getFirstValue();
    Brand brandSummary;

    if (maybeBrandSummary.isNothing()) {
      brandSummary = new Brand();
      brandSummary.setCanonicalUri(uri);
      brandSummary.setPublisher(Publisher.PA_SERIES_SUMMARIES);
      brandSummary.setEquivalentTo(ImmutableSet.of(LookupRef.from(brand)));
    } else {
      brandSummary = (Brand) maybeBrandSummary.requireValue();
    }

    brandSummary.setLongDescription(progData.getSeriesSummary());
    brandSummary.setLastUpdated(updatedAt.toDateTimeUTC());

    return brandSummary;
  }