예제 #1
0
 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;
 }
예제 #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;
  }