Creates a new collection

@throws SearchException
@throws PageException
501523
private void doCreate() throws SearchException, PageException {
	required("collection", action, "collection", collection);
	required("collection", action, "path", path);
	getSearchEngine().createCollection(collection, path, language, SearchEngine.DENY_OVERWRITE);
    }
282405
public I addPages(Collection<WebPage> webPages) {
        for (WebPage webPage : webPages) {
            addPage(webPage);
        }
        return getThis();
    }
408382
function (pageIndex, options, callback) {

            if (pageIndex < 0) {
                throw "pageIndex must be >= 0";
            }

            var page = this.$pageCache[pageIndex];
            if (!page) {
                page = this.$pageCache[pageIndex] = new Page(null, this, pageIndex);
            }

            var self = this;
            options = _.extend(this.$, options);
            page.fetch(options, function (err, page) {
                // insert data into items if not already inserted
                if (!err && !page.itemsInsertedIntoCollection) {
                    page.itemsInsertedIntoCollection = true;

                    // add items to collection
                    self.add(page.$items, {
                        index: (pageIndex || 0) * self.$.pageSize
                    });
                }

                if (callback) {
                    callback(err, page, options);
                }
            });
        }
121794
public void createMongoDBCollection(String colectionName, DataTable options) {
        BasicDBObject aux = new BasicDBObject();
        // Recorremos las options para castearlas y añadirlas a la collection
        List<List<String>> rowsOp = options.raw();
        for (int i = 0; i < rowsOp.size(); i++) {
            List<String> rowOp = rowsOp.get(i);
            if (rowOp.get(0).equals("size") || rowOp.get(0).equals("max")) {
                int intproperty = Integer.parseInt(rowOp.get(1));
                aux.append(rowOp.get(0), intproperty);
            } else {
                Boolean boolProperty = Boolean.parseBoolean(rowOp.get(1));
                aux.append(rowOp.get(0), boolProperty);
            }
        }
        dataBase.createCollection(colectionName, aux);
    }
920494
protected function addPageName()
    {
        if (! empty($this->getPageName()) && ! in_array($this->getPageName(), $this->collection)) {
            $this->add($this->getPageName());
        }
    }
326695
@Override
    public PagedSearchResult discoverSearch(UploadSearchParams uploadSearchParams) {
        try {
            return postImageSearch(uploadSearchParams, ENDPOINT_DISCOVER_SEARCH);
        } catch (InternalViSearchException e) {
            return new PagedSearchResult(e.getMessage(), e.getCause(), e.getServerRawResponse());
        }
    }
1101503
function() {
    var collection = [];
    var scope = this;
    this.each(function() {
      var p = scope.parent(this[0]);
      if(p && p[0]) collection.push(p[0]);
    });
    return new SpahQL(collection);
  }
158187
public function createAction()
	{
		$this->isPostRequest();

		$type = $this->getRequestParameter('type');

		$page = null;

		switch ($type) {
			case Entity::APPLICATION_DISCR:
				$page = new ApplicationPage(
						$this->getRequestParameter('application_id')
				);
				break;
			case Entity::PAGE_DISCR:
				$page = new Page();
				break;
			default:
				throw new \InvalidArgumentException(sprintf('Unknown page type [%s]', $type));
		}

		$localeId = $this->getCurrentLocale()->getId();

		$localization = Localization::factory($page, $localeId);
		/* @var $localization PageLocalization */

		if (! $localization instanceof PageLocalization) {
			throw new \UnexpectedValueException(sprintf(
					'Expecting created localization to be instance of PageLocalization, [%s] received.',
					get_class($localization)
			));
		}

		$templateId = $this->getRequestParameter('template');
		
		$template = $this->getEntityManager()
				->find(Template::CN(), $templateId);
		/* @var $template Template */

		if ($template === null) {
			throw new CmsException(null, 'Template not specified or found.');
		}

		$templateLocalization = $template->getLocalization($localeId);

		if ($templateLocalization === null) {
			throw new \InvalidArgumentException(
					"Specified template has no localization for [{$localeId}] locale."
			);
		}

		$localization->setTemplate($template);

		// copy values from template
		$localization->setIncludedInSearch($templateLocalization->isIncludedInSearch());
		$localization->setVisibleInMenu($templateLocalization->isVisibleInMenu());
		$localization->setVisibleInSitemap($templateLocalization->isVisibleInSitemap());

		$title = trim($this->getRequestParameter('title', ''));

		if (empty($title)) {
			throw new CmsException(null, 'Page title cannot be empty.');
		}
		
		$localization->setTitle($title);

		$parentLocalization = $pathPart
				= null;

		$parentLocalizationId = $this->getRequestParameter('parent_id');
		
		if (! empty($parentLocalizationId)) {

			$parentLocalization = $this->getEntityManager()
					->find(Localization::CN(), $parentLocalizationId);

			if ($parentLocalization === null) {
				throw new CmsException(null, sprintf(
						'Specified parent page [%s] not found.',
						$parentLocalizationId
				));
			}

			$pathPart = trim($this->getRequestParameter('path'));

			// path part cannot be empty for non-root pages.
			if (empty($pathPart)) {
				throw new CmsException(null, 'Page path can not be empty.');
			}
		}

		if ($parentLocalization && $pathPart) {
			$localization->setPathPart($pathPart);
		} else {
			$rootPath = $localization->getPathEntity();
			$rootPath->setPath('');
			$localization->setPathPart('');
		}

		$entityManager = $this->getEntityManager();

		$entityManager->transactional(function (EntityManager $entityManager) use ($page, $localization, $parentLocalization) {

			$this->lockNestedSet($page);

			$entityManager->persist($page);
			$entityManager->persist($localization);

			if ($parentLocalization) {
				$page->moveAsLastChildOf($parentLocalization->getMaster());
			}

			$this->unlockNestedSet($page);
		});

		return new SupraJsonResponse($this->loadNodeMainData($localization));
	}
720352
def configure_createcollection(self, ns, definition):
        
        paginated_list_schema = self.page_cls.make_paginated_list_schema_class(
            ns,
            definition.response_schema,
        )()

        @self.add_route(ns.collection_path, Operation.CreateCollection, ns)
        @request(definition.request_schema)
        @response(paginated_list_schema)
        @wraps(definition.func)
        def create_collection(**path_data):
            request_data = load_request_data(definition.request_schema)
            # NB: if we don't filter the request body through an explicit page schema,
            # we will leak other request arguments into the pagination query strings
            page = self.page_cls.from_query_string(self.page_schema(), request_data)

            result = definition.func(**merge_data(
                path_data,
                merge_data(
                    request_data,
                    page.to_dict(func=identity),
                ),
            ))

            response_data, headers = page.to_paginated_list(result, ns, Operation.CreateCollection)
            definition.header_func(headers, response_data)
            response_format = self.negotiate_response_content(definition.response_formats)
            return dump_response_data(
                paginated_list_schema,
                response_data,
                headers=headers,
                response_format=response_format,
            )

        create_collection.__doc__ = "Create the collection of {}".format(pluralize(ns.subject_name))
70701
@SuppressWarnings(
	{ "unchecked", "rawtypes" })
	public static <T> List<Collection<T>> toPages(Collection<T> collection, int pageSize)
	{
		if (collection == null || collection.isEmpty())
			return null;

		int collectionSize = collection.size();

		if (pageSize <= 0 || collectionSize <= pageSize)
			return (List<Collection<T>>) Collections.singletonList(collection);

		int initialSize = collectionSize / pageSize;

		ArrayList<Collection<T>> list = new ArrayList(initialSize);

		ArrayList<Object> current = new ArrayList<Object>();
		for (Object object : collection)
		{
			current.add(object);

			if (current.size() >= pageSize)
			{
				current.trimToSize();

				list.add((Collection<T>) current);
				current = new ArrayList<Object>();
			}
		}

		if (!current.isEmpty())
			list.add((Collection<T>) current);

		return (List<Collection<T>>) list;

	}
788192
def new_collection(query, resources = nil, &block)
      if loaded?
        resources ||= filter(query)
      end

      # TOOD: figure out a way to pass not-yet-saved Resources to this newly
      # created Collection.  If the new resource matches the conditions, then
      # it should be added to the collection (keep in mind limit/offset too)

      self.class.new(query, resources, &block)
    end
796056
public ResultList<Collection> searchCollection(String query, Integer page, String language) throws MovieDbException {
        return tmdbSearch.searchCollection(query, page, language);
    }
225852
public function build(): SearchInResponseBodyRequest
	{
		$instance = new SearchInResponseBodyRequest();
		if ($this->requestId === null) {
			throw new BuilderException('Property [requestId] is required.');
		}
		$instance->requestId = $this->requestId;
		if ($this->query === null) {
			throw new BuilderException('Property [query] is required.');
		}
		$instance->query = $this->query;
		$instance->caseSensitive = $this->caseSensitive;
		$instance->isRegex = $this->isRegex;
		return $instance;
	}
931349
final public function findAll()
    {
        $this->query->setStartSelect();

        $this->query->prepare()->bindWhere()->bindLimit()->execute();

        $this->setRowCount();

        $collection = new Collection($this, $this->query->getSqlQuery());

        $this->query->close();

        return $collection();
    }
225447
public function createRouteCollection()
    {
        $routeCollection  = $this->createNew(RouteCollection::class);

        $routeCollection->addRoute('GET', '/{resourceNamePlural}', [$this, 'callGetResources']);
        $routeCollection->addRoute('POST', '/{resourceNamePlural}', [$this, 'callCreateNewResource']);
        $routeCollection->addRoute('PUT', '/{resourceNamePlural}', [$this, 'callCreateNewResource']);
        $routeCollection->addRoute('HEAD', '/{resourceNamePlural}', [$this, 'callMethodNotAllowed']);
        $routeCollection->addRoute('DEL', '/{resourceNamePlural}', [$this, 'callMethodNotAllowed']);

        $routeCollection->addRoute('GET', '/{resourceNamePlural}/{id}', [$this, 'callGetResource']);
        $routeCollection->addRoute('POST', '/{resourceNamePlural}/{id}', [$this, 'callEditResource']);
        $routeCollection->addRoute('PUT', '/{resourceNamePlural}/{id}', [$this, 'callEditResource']);
        $routeCollection->addRoute('HEAD', '/{resourceNamePlural}/{id}', [$this, 'callResourceExists']);
        $routeCollection->addRoute('DEL', '/{resourceNamePlural}/{id}', [$this, 'calldDeleteResource']);

        $routeCollection->addRoute('GET', '/{resourceNamePlural}/{id}/{childNamePlural}', [$this, 'callGetChildResources']);
        $routeCollection->addRoute('POST', '/{resourceNamePlural}/{id}/{childNamePlural}', [$this, 'callCreateNewChildResource']);
        $routeCollection->addRoute('PUT', '/{resourceNamePlural}/{id}/{childNamePlural}', [$this, 'callCreateNewChildResource']);
        $routeCollection->addRoute('HEAD', '/{resourceNamePlural}/{id}/{childNamePlural}', [$this, 'callMethodNotAllowed']);
        $routeCollection->addRoute('DEL', '/{resourceNamePlural}/{id}/{childNamePlural}', [$this, 'callMethodNotAllowed']);

        return $routeCollection;
    }
250711
private void doGetDatasourceSetting() throws PageException {
	Struct sct = new StructImpl();
	pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
	sct.set("psq", Caster.toBoolean(config.getPSQL()));
    }
1071337
function createPage() {
        var page = new View(view.clone(), lazy.extend({}, view.options, opts));
        page.data.pagination = new Parent(lazy.extend({}, self.options, {Item: Item}));
        return page;
      }