Creates the feed mapping for the DSA page feeds.
436741
private static function createFeedMapping(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        DSAFeedDetails $feedDetails
    ) {
        $feedMappingService = $adWordsServices->get($session, FeedMappingService::class);

        // Map the feed attribute IDs to the field ID constants.
        $urlFieldMapping = new AttributeFieldMapping();
        $urlFieldMapping->setFeedAttributeId(
            $feedDetails->urlAttributeId
        );
        $urlFieldMapping->setFieldId(self::DSA_PAGE_URLS_FIELD_ID);
        $labelFieldMapping = new AttributeFieldMapping();
        $labelFieldMapping->setFeedAttributeId(
            $feedDetails->labelAttributeId
        );
        $labelFieldMapping->setFieldId(self::DSA_LABEL_FIELD_ID);

        // Create the feed mapping and feed mapping operation.
        $feedMapping = new FeedMapping();
        $feedMapping->setCriterionType(self::DSA_PAGE_FEED_CRITERION_TYPE);
        $feedMapping->setFeedId($feedDetails->feedId);
        $feedMapping->setAttributeFieldMappings(
            [$urlFieldMapping, $labelFieldMapping]
        );

        $operation = new FeedMappingOperation();
        $operation->setOperand($feedMapping);
        $operation->setOperator(Operator::ADD);

        // Create the feed mapping operation on the server and print out some
        // information.
        $result = $feedMappingService->mutate([$operation]);
        $feedMapping = $result->getValue()[0];
        printf(
            "Feed mapping with ID %d and criterion type %d was saved for feed with ID %d.\n",
            $feedMapping->getFeedMappingId(),
            $feedMapping->getCriterionType(),
            $feedMapping->getFeedId()
        );
    }
739122
function setupPage( pageName ) {
         assert( pageName ).hasType( String ).isNotNull();

         publishDebugInfo( 'willLoad.page', { page: pageName } );

         return pageLoader.load( pageName )
            .then( page => {
               areaHelper = createAreaHelper( page, log );
               visibilityManager.setAreaHelper( areaHelper );

               const layoutPromise = layoutLoader.load( page.layout )
                  .then( layoutInfo => {
                     cleanUpLayout = renderLayout( pageElement, areaHelper, layoutInfo );
                  } );

               localeManager.subscribe();
               const layoutWidget = widget => layoutWidgetAdapterFor( areaHelper, widget );

               // instantiate controllers wrapped by widget adapters
               const widgetPromises = widgetsForPage( page )
                  .map( widget => 'layout' in widget ?
                     layoutWidget( widget ) :
                     widgetLoader.load( widget, {}, instanceContext ) );

               return Promise.all( [ ...widgetPromises, layoutPromise ] )
                  .then( results => results.slice( 0, -1 ) );
            } )
            .then( widgetAdapterWrappers => {
               publishDebugInfo( 'didLoad.page', { page: pageName } );

               activePage = pageName;
               activeWidgetAdapterWrappers = widgetAdapterWrappers;
            } )
            .then( localeManager.initialize )
            .then( () => {
               return eventBus.publishAndGatherReplies(
                  'beginLifecycleRequest.default', LIFECYCLE_EVENT, EVENT_OPTIONS
               );
            } )
            .then( visibilityManager.initialize )
            // Give the widgets (a little) time to settle on the event bus before $digesting and painting:
            .then( () => delay( WIDGET_ATTACH_DELAY_MS ) )
            .then( () => areaHelper.attachWidgets( activeWidgetAdapterWrappers ) );
      }
808091
public static Feed generateFeed(String request, String matcherDetails, Map<URI, MatchResult> matchingResults) {

        Feed feed = initialiseFeed(request, matcherDetails);

        // Return empty feed if null
        if (matchingResults == null) {
            return feed;
        }

        int numResults = matchingResults.size();
        log.debug(matchingResults.keySet().toString());

        Set<Map.Entry<URI, MatchResult>> entries = matchingResults.entrySet();
        for (Map.Entry<URI, MatchResult> entry : entries) {
            Entry rssEntry = createMatchResultEntry(entry.getKey(), entry.getValue());
            feed.addEntry(rssEntry);
        }

        return feed;
    }
106699
def create_ad_product_feed(name:, schedule:)
      query = { name: name, schedule: schedule }
      result = AdProductCatalog.post("/#{id}/product_feeds", query: query)
      AdProductFeed.find(result['id'])
    end
597582
private static void createFeedItems(
      AdWordsServicesInterface adWordsServices,
      AdWordsSession session,
      DSAFeedDetails feedDetails,
      String labelName)
      throws RemoteException {
    // Get the FeedItemService.
    FeedItemServiceInterface feedItemService =
        adWordsServices.get(session, FeedItemServiceInterface.class);

    // Create operations to add FeedItems.
    FeedItemOperation[] operations =
        new FeedItemOperation[] {
          createDsaUrlAddOperation(
              feedDetails, "http://www.example.com/discounts/rental-cars", labelName),
          createDsaUrlAddOperation(
              feedDetails, "http://www.example.com/discounts/hotel-deals", labelName),
          createDsaUrlAddOperation(
              feedDetails, "http://www.example.com/discounts/flight-deals", labelName),
        };

    FeedItemReturnValue result = feedItemService.mutate(operations);
    for (FeedItem item : result.getValue()) {
      System.out.printf("Feed item with feed item ID %d was added.%n", item.getFeedItemId());
    }
  }
49342
def new_mapping(self, lineup, station, channel, channelMinor,
                   validFrom, validTo, onAirFrom, onAirTo):
        """"""

        raise NotImplementedError()
254521
function processFeed(feed) {

	var feedName = ('nitro-'+feed.name).toCamelCase();
	var s = '/**\n';
	s += '* '+feed.title+'\n';
	s += '*/\n';
	fs.appendFileSync(apijs, s+'const '+feedName+" = '"+feed.href+"';\n", 'utf8');
	cache.push(feedName+' : '+feedName+',\n');

	var pathname = feed.href.replace('/nitro/api','');
	var path = openapi.paths[pathname] = {};
	path.get = {};
	path.get.description = feed.title;
	path.get.tags = ['feeds'];
	path.get.summary = feed.title;

	// a long time ago, in a galaxy far, far away, the API had longer descriptions. Some taken from https://developer.bbc.co.uk/content/
	if (feed.name == 'Programmes') {
		path.get.description = 'Fetch metadata about Programmes (brands, series, episodes, clips). By applying different filter restrictions this feed can be used in many ways, for example to retrieve all series belonging to a brand, all the episodes and/or clips for a specific series, or any TLEO objects for a masterbrand. Other filters permit restricting to specific formats and/or genres, and you can request specific versions (for example Signed or Audio-Described). Parameters may be combined in any way suitable for your application.';
	}
	else if (feed.name == 'Broadcasts') {
		path.get.description = 'Fetch metadata about linear Broadcasts and Services, allowing the generation of Television and Radio schedules and other datasets for broadcast items. Use /schedules instead of this feed as it is more efficient. Broadcasts will be deprecated in the future.';
	}
	else if (feed.name == 'Schedules') {
		path.get.description = 'Dates, Times, Schedules: when and where are programmes being shown?';
	}
	else if (feed.name == 'Versions') {
		path.get.description = 'The versions feed exposes editorial "Versions" of programmes. These are concepts used to capture different presentations of an overall programme: for example, versions of a programme may include one with sign language, one with audio description, one edited for content and more. Versions are also important to understand for broadcasts: a linear broadcast or an ondemand is always of a specific version, not merely of a programme.';
	}
	else if (feed.name == 'Services') {
		path.get.description = 'The services feed exposes the linear broadcast "services" from PIPs. These are the actual services which broadcast programmes (eg bbc_one_oxford is the service for BBC One in Oxford).';
	}
	else if (feed.name == 'People') {
		path.get.description = 'The People feed allows you to search for the people and groups that contribute to programmes. This is the starting point for cast and crew credits, as well as finding contributors using external IDs (such as Wikipedia URLs)';
	}
	else if (feed.name == 'Availabilities') {
		path.get.description = 'For advanced users only: Use the availabilities feed to discover details of on-demand availability for programmes and their versions.';
	}
	else if (feed.name == 'Images') {
		path.get.description = 'Find metadata for images, particularly those in galleries';
	}
	else if (feed.name == 'Promotions') {
		path.get.description = 'Details of short-term editorially curated "promotions", for instance those programmes featured on iPlayer today';
	}
	else if (feed.name == 'Groups') {
		path.get.description = 'Long-lived curated collections of programmes and more, including Collections, Seasons, Franchises and Galleries';
	}

	path.get.operationId = 'list'+feed.name;
	params = path.get.parameters = [];

	path.get.responses = {};
	path.get.responses['200'] = {};
	path.get.responses['200'].description = 'Nitro response';
	path.get.responses['200'].content = {};
	path.get.responses['200'].content['application/json'] = {};
	path.get.responses['200'].content['application/json'].schema = {};
	path.get.responses['200'].content['application/json'].schema.$ref = '#/components/schemas/nitro';
	path.get.responses['200'].content['application/xml'] = clone(path.get.responses['200'].content['application/json']);

	path.get.responses.default = {};
	path.get.responses.default.description = 'Unexpected error';
	path.get.responses.default.content = {};
	path.get.responses.default.content['application/json'] = {};
	path.get.responses.default.content['application/json'].schema = {};
	path.get.responses.default.content['application/json'].schema.$ref = '#/components/schemas/ErrorModel';
	path.get.responses.default.content['application/xml'] = clone(path.get.responses.default.content['application/json']);

	if (feed.release_status == 'deprecated') {
		path.get.deprecated = true;
		console.log('! Warning, feed '+feed.name+' is '+feed.release_status+deprecationInfo(feed,feed.name,'feed',feed.deprecated_since))
	}

	if (feed.sorts) {
		feed.sorts.sort = toArray(feed.sorts.sort);
		if (feed.sorts.sort instanceof Array) {
			for (var i in feed.sorts.sort) {
				var sort = feed.sorts.sort[i];
				var sortName = ('s-'+feed.name+'-'+sort.name).toCamelCase();
				processSort(feed,sort,sortName);
			}
		}
	}

	if (feed.mixins) {
		feed.mixins.mixin = toArray(feed.mixins.mixin);
		for (var i in feed.mixins.mixin) {
			var mixin = feed.mixins.mixin[i];
			var mixinName = ('m-'+feed.name+'-'+mixin.name).toCamelCase();
			processMixin(feed,mixin,mixinName,true);
		}
		if (feed.mixins.unstable_mixins) {
			feed.mixins.unstable_mixins.mixin = toArray(feed.mixins.unstable_mixins.mixin);
			for (var i in feed.mixins.unstable_mixins.mixin) {
				var mixin = feed.mixins.unstable_mixins.mixin[i];
				var mixinName = ('m-'+feed.name+'-'+mixin.name).toCamelCase();
				processMixin(feed,mixin,mixinName,false);
			}
		}
	}

	if (feed.filters) {
		feed.filters.filter = toArray(feed.filters.filter);
		for (var i in feed.filters.filter) {
			var filter = feed.filters.filter[i];
			var filterName = ('f-'+feed.name+'-'+filter.name).toCamelCase();
			processFilter(feed,filter,filterName);
		}
	}

	additionalParameters(feed.name);

}
24639
function createPages() {
        var i,
            pages = [],
            page,
            start = config.pageStart - 1,
            end = config.pageEnd,
            links = sortPageLinks();

        //initialize pages
        for (i = start; i < end; i++) {
            page = scope.createComponent('page');
            page.init(config.$pages.eq(i - start), {
                index: i,
                status: getInitialPageStatus(i),
                enableLinks: config.enableLinks,
                links: links[i],
                pageScale: config.pageScale,
                useSVG: config.useSVG
            });
            pages.push(page);
        }
        config.pages = pages;
    }
276138
public static function buildTableMap()
    {
      $dbMap = Propel::getServiceContainer()->getDatabaseMap(DealerContentVersionTableMap::DATABASE_NAME);
      if (!$dbMap->hasTable(DealerContentVersionTableMap::TABLE_NAME)) {
        $dbMap->addTableObject(new DealerContentVersionTableMap());
      }
    }
895111
private static function getAttributeFieldMappings(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        $feedId,
        $placeholderTypeId
    ) {
        $feedMappingService = $adWordsServices->get($session, FeedMappingService::class);
        $page = $feedMappingService->query(
            sprintf(
                'SELECT FeedMappingId, AttributeFieldMappings WHERE FeedId="%d" '
                . 'AND PlaceholderType="%d" AND Status="ENABLED"',
                $feedId,
                $placeholderTypeId
            )
        );

        $attributeMappings = [];
        if ($page->getEntries() !== null) {
            // Normally, a feed attribute is mapped only to one field. However,
            // you may map it to more than one field if needed.
            foreach ($page->getEntries() as $feedMapping) {
                foreach ($feedMapping->getAttributeFieldMappings() as $attributeMapping) {
                    if (array_key_exists(
                        $attributeMapping->getFeedAttributeId(),
                        $attributeMappings
                    ) === false) {
                        $attributeMappings[$attributeMapping->getFeedAttributeId()] = [];
                    }
                    $attributeMappings[$attributeMapping->getFeedAttributeId()][] = $attributeMapping->getFieldId();
                }
            }
        }

        return $attributeMappings;
    }
991816
function createPagesMetadata(src, dest) {
  return new Promise((resolve, reject) => {
    const thisTaskName = swlog.logSubStart('create metadata file');
    const outputStr = sketchtoolExec(`metadata ${src}`)
    const ignoredPages = ['Symbols', 'Icon Sheet', '------------']

    let customObj = { categories: [] };
    const dataObj = JSON.parse(outputStr);

    // Loop through pages, then arboards, to create a
    // simple mapping of names (ignoring certain pages)
    // and naming pages "categories" and artboards "icons"
    for (const pageId in dataObj.pagesAndArtboards) {
      if (dataObj.pagesAndArtboards.hasOwnProperty(pageId)
        && ! ignoredPages.includes(dataObj.pagesAndArtboards[pageId].name)) {

        const tempObj = {
          name: dataObj.pagesAndArtboards[pageId].name,
          icons: []
        };

        for (const ab in dataObj.pagesAndArtboards[pageId].artboards) {
          if (dataObj.pagesAndArtboards[pageId].artboards.hasOwnProperty(ab)) {
            tempObj.icons.push(dataObj.pagesAndArtboards[pageId].artboards[ab].name);
          }
        }
        tempObj.icons.sort();
        customObj.categories.push(tempObj);
      }
    }
    fs.writeFileSync(`${dest}/metadata.json`, JSON.stringify(customObj, null, 4), 'utf-8');
    swlog.logSubEnd(thisTaskName);
    resolve();
  });
}
235025
private static Map<String, ModelDescription> assigneModelsToViews(Map<ModelDescription, 
            XLinkConnectorView[]> modelsToViews) {
        HashMap<String, ModelDescription> viewsToModels = new HashMap<String, ModelDescription>();
        for (ModelDescription modelInfo : modelsToViews.keySet()) {
            List<XLinkConnectorView> currentViewList = Arrays.asList(modelsToViews.get(modelInfo));
            for (XLinkConnectorView view : currentViewList) {
                if (!viewsToModels.containsKey(view.getViewId())) {
                    viewsToModels.put(view.getViewId(), modelInfo);
                }
            }
        }
        return viewsToModels;
    }
205935
private static FeedItemOperation createDsaUrlAddOperation(
      DSAFeedDetails feedDetails, String url, String labelName) {
    // Create the FeedItemAttributeValues for the URL and label.
    FeedItemAttributeValue urlAttributeValue = new FeedItemAttributeValue();
    urlAttributeValue.setFeedAttributeId(feedDetails.urlAttributeId);
    // See https://support.google.com/adwords/answer/7166527 for page feed URL recommendations and
    // rules.
    urlAttributeValue.setStringValues(new String[] {url});

    FeedItemAttributeValue labelAttributeValue = new FeedItemAttributeValue();
    labelAttributeValue.setFeedAttributeId(feedDetails.labelAttributeId);
    labelAttributeValue.setStringValues(new String[] {labelName});

    // Create the feed item and operation.
    FeedItem feedItem = new FeedItem();
    feedItem.setFeedId(feedDetails.feedId);

    feedItem.setAttributeValues(
        new FeedItemAttributeValue[] {urlAttributeValue, labelAttributeValue});

    FeedItemOperation operation = new FeedItemOperation();
    operation.setOperand(feedItem);
    operation.setOperator(Operator.ADD);

    return operation;
  }
225322
private function makeChannels()
    {
        $out = '';

        //Start channel tag
        switch ($this->version) {
            case Feed::RSS2:
                $out .= '<channel>' . PHP_EOL;
                break;
            case Feed::RSS1:
                $out .= (isset($this->data['ChannelAbout']))? "<channel rdf:about=\"{$this->data['ChannelAbout']}\">" : "<channel rdf:about=\"{$this->channels['link']['content']}\">";
                break;
        }

        //Print Items of channel
        foreach ($this->channels as $key => $value) {
            // In ATOM feeds, strip all ATOM namespace prefixes from the tag name. They are not needed here,
            // because the ATOM namespace name is set as default namespace.
            if ($this->version == Feed::ATOM && strncmp($key, 'atom', 4) == 0) {
                $key = substr($key, 5);
            }

            // The channel element can occur multiple times, when the key 'content' is not in the array.
            if (!array_key_exists('content', $value)) {
                // If this is the case, iterate through the array with the multiple elements.
                foreach ($value as $singleElement) {
                    $out .= $this->makeNode($key, $singleElement['content'], $singleElement['attributes']);
                }
            } else {
                $out .= $this->makeNode($key, $value['content'], $value['attributes']);
            }
        }

        if ($this->version == Feed::RSS1) {
            //RSS 1.0 have special tag <rdf:Seq> with channel
            $out .= "<items>" . PHP_EOL . "<rdf:Seq>" . PHP_EOL;
            foreach ($this->items as $item) {
                $thisItems = $item->getElements();
                $out .= "<rdf:li resource=\"{$thisItems['link']['content']}\"/>" . PHP_EOL;
            }
            $out .= "</rdf:Seq>" . PHP_EOL . "</items>" . PHP_EOL . "</channel>" . PHP_EOL;

            // An image has its own element after the channel elements.
            if (array_key_exists('image', $this->data))
                $out .= $this->makeNode('image', $this->data['Image'], array('rdf:about' => $this->data['Image']['url']));
        } else if ($this->version == Feed::ATOM) {
            // ATOM feeds have a unique feed ID. Use the title channel element as key.
            $out .= $this->makeNode('id', Feed::uuid($this->channels['title']['content'], 'urn:uuid:'));
        }

        return $out;
    }
261276
def _create_mappings(self):
        ''
        created1 = self._create_tag_mapping()
        created2 = self._create_assoc_mapping()
        return created1 or created2
650682
public function feed()
    {
        $page = TypiCMS::getPageLinkedToModule('news');
        if (!$page) {
            return;
        }
        $feed = app('feed');
        if (config('typicms.cache')) {
            $feed->setCache(60, 'typicmsNewsFeed');
        }
        if (!$feed->isCached()) {
            $models = $this->repository->latest(10);

            $feed->title = $page->title.' – '.TypiCMS::title();
            $feed->description = $page->body;
            if (config('typicms.image')) {
                $feed->logo = url('storage/settings/'.config('typicms.image'));
            }
            $feed->link = url()->route(config('app.locale').'::news-feed');
            $feed->setDateFormat('datetime'); // 'datetime', 'timestamp' or 'carbon'
            if (isset($models[0]) && $models[0]->date) {
                $feed->pubdate = $models[0]->date;
            }
            $feed->lang = config('app.locale');
            $feed->setShortening(true); // true or false
            $feed->setTextLimit(100); // maximum length of description text

            foreach ($models as $model) {
                $feed->add($model->title, null, url($model->uri()), $model->date, $model->summary, $model->present()->body);
            }
        }

        return $feed->render('atom');
    }
624375
def new_mapping(self, lineup, station, channel, channelMinor,
                   validFrom, validTo, onAirFrom, onAirTo):
        """"""

        if self.__v_mapping:
            # [Mapping: FL09567:X, 11097, 45, None, 2010-06-29 00:00:00.00, None, None, None]
            print("[Mapping: %s, %s, %s, %s, %s, %s, %s, %s]" % 
                  (lineup, station, channel, channelMinor, validFrom, validTo, 
                   onAirFrom, onAirTo))