All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.liferay.apio.architect.routes.NestedCollectionRoutes Maven / Gradle / Ivy

There is a newer version: 7.4.3.112-ga112
Show newest version
/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.liferay.apio.architect.routes;

import aQute.bnd.annotation.ProviderType;

import com.liferay.apio.architect.alias.form.FormBuilderFunction;
import com.liferay.apio.architect.alias.routes.NestedBatchCreateItemFunction;
import com.liferay.apio.architect.alias.routes.NestedCreateItemFunction;
import com.liferay.apio.architect.alias.routes.NestedGetPageFunction;
import com.liferay.apio.architect.alias.routes.permission.HasNestedAddingPermissionFunction;
import com.liferay.apio.architect.form.Form;
import com.liferay.apio.architect.function.throwable.ThrowableBiFunction;
import com.liferay.apio.architect.function.throwable.ThrowableHexaFunction;
import com.liferay.apio.architect.function.throwable.ThrowablePentaFunction;
import com.liferay.apio.architect.function.throwable.ThrowableTetraFunction;
import com.liferay.apio.architect.function.throwable.ThrowableTriFunction;
import com.liferay.apio.architect.pagination.PageItems;
import com.liferay.apio.architect.pagination.Pagination;

import java.util.List;
import java.util.Optional;

/**
 * Holds information about the routes supported for a {@link
 * com.liferay.apio.architect.router.NestedCollectionRouter}.
 *
 * 

* This interface's methods return functions to get the collection resource's * different endpoints. You should always use a {@link Builder} to create * instances of this interface. *

* * @author Alejandro Hernández * @param the model's type * @param the type of the model's identifier (e.g., {@code Long}, * {@code String}, etc.) * @param the type of the parent model's identifier (e.g., {@code * Long}, {@code String}, etc.) * @see Builder * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions} annotations * instead * @review */ @Deprecated @ProviderType @SuppressWarnings("DeprecatedIsStillUsed") public interface NestedCollectionRoutes { /** * Returns the form that is used to create a collection item, if it was * added through the {@link NestedCollectionRoutes.Builder}. Returns {@code * Optional#empty()} otherwise. * * @return the form used to create a collection item; {@code * Optional#empty()} otherwise * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions} annotations * instead * @review */ @Deprecated public Optional
getFormOptional(); /** * Returns the function that's used to create multiple collection items, if * the endpoint was added through the builder and the function therefore * exists; returns {@code Optional#empty()} otherwise. * * @return the function, if it exists; {@code Optional#empty()} * otherwise * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions} annotations * instead * @review */ @Deprecated public Optional> getNestedBatchCreateItemFunctionOptional(); /** * Returns the function that is used to create a collection item, if the * endpoint was added through the {@link NestedCollectionRoutes.Builder} and * the function therefore exists. Returns {@code Optional#empty()} * otherwise. * * @return the function used to create a collection item, if the * function exists; {@code Optional#empty()} otherwise * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions} annotations * instead * @review */ @Deprecated public Optional> getNestedCreateItemFunctionOptional(); /** * Returns the function used to obtain the page, if the endpoint was added * through the {@link NestedCollectionRoutes.Builder} and the function * therefore exists. Returns {@code Optional#empty()} otherwise. * * @return the function used to obtain the page, if the function exists; * {@code Optional#empty()} otherwise * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions} annotations * instead * @review */ @Deprecated public Optional> getNestedGetPageFunctionOptional(); /** * Creates the {@link NestedCollectionRoutes} of a {@link * com.liferay.apio.architect.router.NestedCollectionRouter}. * * @param the model's type * @param the type of the model's identifier (e.g., {@code Long}, * {@code String}, etc.) * @param the type of the parent model's identifier (e.g., {@code * Long}, {@code String}, etc.) * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions} annotations * instead * @review */ @Deprecated @ProviderType public interface Builder { /** * Adds a route to a creator function that has no extra parameters. * * @param creatorThrowableBiFunction the creator function that adds * the collection item * @param hasNestedAddingPermissionFunction the permission function * for this route * @param formBuilderFunction the function that creates the form * for this operation * @return the updated builder * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions.Create} * annotation instead * @review */ @Deprecated public default Builder addCreator( ThrowableBiFunction creatorThrowableBiFunction, HasNestedAddingPermissionFunction hasNestedAddingPermissionFunction, FormBuilderFunction formBuilderFunction) { return addCreator( (u, r, ignored) -> creatorThrowableBiFunction.apply(u, r), Void.class, hasNestedAddingPermissionFunction, formBuilderFunction); } /** * Adds a route to a creator function that has no extra parameters. * * @param creatorThrowableBiFunction the creator function that adds * the collection item * @param batchCreatorThrowableBiFunction the batch creator * function * @param hasNestedAddingPermissionFunction the permission function * for this route * @param formBuilderFunction the function that creates the form * for this operation * @return the updated builder * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions.Create} * annotation instead * @review */ @Deprecated public default Builder addCreator( ThrowableBiFunction creatorThrowableBiFunction, ThrowableBiFunction, List> batchCreatorThrowableBiFunction, HasNestedAddingPermissionFunction hasNestedAddingPermissionFunction, FormBuilderFunction formBuilderFunction) { return addCreator( (u, r, ignored) -> creatorThrowableBiFunction.apply(u, r), (u, l, ignored) -> batchCreatorThrowableBiFunction.apply(u, l), Void.class, hasNestedAddingPermissionFunction, formBuilderFunction); } /** * Adds a route to a creator function that has four extra parameters. * * @param creatorThrowableHexaFunction the creator function that * adds the collection item * @param aClass the class of the creator function's third * parameter * @param bClass the class of the creator function's fourth * parameter * @param cClass the class of the creator function's fifth * parameter * @param dClass the class of the creator function's sixth * parameter * @param hasNestedAddingPermissionFunction the permission function * for this route * @param formBuilderFunction the function that creates the form * for this operation * @return the updated builder * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions.Create} * annotation instead * @review */ @Deprecated public Builder addCreator( ThrowableHexaFunction creatorThrowableHexaFunction, Class aClass, Class bClass, Class cClass, Class dClass, HasNestedAddingPermissionFunction hasNestedAddingPermissionFunction, FormBuilderFunction formBuilderFunction); /** * Adds a route to a creator function that has four extra parameters. * * @param creatorThrowableHexaFunction the creator function that * adds the collection item * @param batchCreatorThrowableHexaFunction the batch creator * function * @param aClass the class of the creator function's third * parameter * @param bClass the class of the creator function's fourth * parameter * @param cClass the class of the creator function's fifth * parameter * @param dClass the class of the creator function's sixth * parameter * @param hasNestedAddingPermissionFunction the permission function * for this route * @param formBuilderFunction the function that creates the form * for this operation * @return the updated builder * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions.Create} * annotation instead * @review */ @Deprecated public Builder addCreator( ThrowableHexaFunction creatorThrowableHexaFunction, ThrowableHexaFunction, A, B, C, D, List> batchCreatorThrowableHexaFunction, Class aClass, Class bClass, Class cClass, Class dClass, HasNestedAddingPermissionFunction hasNestedAddingPermissionFunction, FormBuilderFunction formBuilderFunction); /** * Adds a route to a creator function that has three extra parameters. * * @param creatorThrowablePentaFunction the creator function that * adds the collection item * @param aClass the class of the creator function's third * parameter * @param bClass the class of the creator function's fourth * parameter * @param cClass the class of the creator function's fifth * parameter * @param hasNestedAddingPermissionFunction the permission function * for this route * @param formBuilderFunction the function that creates the form * for this operation * @return the updated builder * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions.Create} * annotation instead * @review */ @Deprecated public default Builder addCreator( ThrowablePentaFunction creatorThrowablePentaFunction, Class aClass, Class bClass, Class cClass, HasNestedAddingPermissionFunction hasNestedAddingPermissionFunction, FormBuilderFunction formBuilderFunction) { return addCreator( (u, r, a, b, c, ignored) -> creatorThrowablePentaFunction.apply( u, r, a, b, c), aClass, bClass, cClass, Void.class, hasNestedAddingPermissionFunction, formBuilderFunction); } /** * Adds a route to a creator function that has three extra parameters. * * @param creatorThrowablePentaFunction the creator function that * adds the collection item * @param batchCreatorThrowablePentaFunction the batch creator * function * @param aClass the class of the creator function's third * parameter * @param bClass the class of the creator function's fourth * parameter * @param cClass the class of the creator function's fifth * parameter * @param hasNestedAddingPermissionFunction the permission function * for this route * @param formBuilderFunction the function that creates the form * for this operation * @return the updated builder * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions.Create} * annotation instead * @review */ @Deprecated public default Builder addCreator( ThrowablePentaFunction creatorThrowablePentaFunction, ThrowablePentaFunction, A, B, C, List> batchCreatorThrowablePentaFunction, Class aClass, Class bClass, Class cClass, HasNestedAddingPermissionFunction hasNestedAddingPermissionFunction, FormBuilderFunction formBuilderFunction) { return addCreator( (u, r, a, b, c, ignored) -> creatorThrowablePentaFunction.apply( u, r, a, b, c), (u, l, a, b, c, ignored) -> batchCreatorThrowablePentaFunction.apply(u, l, a, b, c), aClass, bClass, cClass, Void.class, hasNestedAddingPermissionFunction, formBuilderFunction); } /** * Adds a route to a creator function that has two extra parameters. * * @param creatorThrowableTetraFunction the creator function that * adds the collection item * @param aClass the class of the creator function's third * parameter * @param bClass the class of the creator function's fourth * parameter * @param hasNestedAddingPermissionFunction the permission function * for this route * @param formBuilderFunction the function that creates the form * for this operation * @return the updated builder * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions.Create} * annotation instead * @review */ @Deprecated public default Builder addCreator( ThrowableTetraFunction creatorThrowableTetraFunction, Class aClass, Class bClass, HasNestedAddingPermissionFunction hasNestedAddingPermissionFunction, FormBuilderFunction formBuilderFunction) { return addCreator( (u, r, a, b, ignored) -> creatorThrowableTetraFunction.apply( u, r, a, b), aClass, bClass, Void.class, hasNestedAddingPermissionFunction, formBuilderFunction); } /** * Adds a route to a creator function that has two extra parameters. * * @param creatorThrowableTetraFunction the creator function that * adds the collection item * @param batchCreatorThrowableTetraFunction the batch creator * function * @param aClass the class of the creator function's third * parameter * @param bClass the class of the creator function's fourth * parameter * @param hasNestedAddingPermissionFunction the permission function * for this route * @param formBuilderFunction the function that creates the form * for this operation * @return the updated builder * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions.Create} * annotation instead * @review */ @Deprecated public default Builder addCreator( ThrowableTetraFunction creatorThrowableTetraFunction, ThrowableTetraFunction, A, B, List> batchCreatorThrowableTetraFunction, Class aClass, Class bClass, HasNestedAddingPermissionFunction hasNestedAddingPermissionFunction, FormBuilderFunction formBuilderFunction) { return addCreator( (u, r, a, b, ignored) -> creatorThrowableTetraFunction.apply( u, r, a, b), (u, l, a, b, ignored) -> batchCreatorThrowableTetraFunction.apply(u, l, a, b), aClass, bClass, Void.class, hasNestedAddingPermissionFunction, formBuilderFunction); } /** * Adds a route to a creator function that has one extra parameter. * * @param creatorThrowableTriFunction the creator function that * adds the collection item * @param aClass the class of the creator function's third * parameter * @param hasNestedAddingPermissionFunction the permission function * for this route * @param formBuilderFunction the function that creates the form * for this operation * @return the updated builder * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions.Create} * annotation instead * @review */ @Deprecated public default Builder addCreator( ThrowableTriFunction creatorThrowableTriFunction, Class aClass, HasNestedAddingPermissionFunction hasNestedAddingPermissionFunction, FormBuilderFunction formBuilderFunction) { return addCreator( (u, r, a, ignored) -> creatorThrowableTriFunction.apply( u, r, a), aClass, Void.class, hasNestedAddingPermissionFunction, formBuilderFunction); } /** * Adds a route to a creator function that has one extra parameter. * * @param creatorThrowableTriFunction the creator function that * adds the collection item * @param batchCreatorThrowableTriFunction the batch creator * function * @param aClass the class of the creator function's third * parameter * @param hasNestedAddingPermissionFunction the permission function * for this route * @param formBuilderFunction the function that creates the form * for this operation * @return the updated builder * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions.Create} * annotation instead * @review */ @Deprecated public default Builder addCreator( ThrowableTriFunction creatorThrowableTriFunction, ThrowableTriFunction, A, List> batchCreatorThrowableTriFunction, Class aClass, HasNestedAddingPermissionFunction hasNestedAddingPermissionFunction, FormBuilderFunction formBuilderFunction) { return addCreator( (u, r, a, ignored) -> creatorThrowableTriFunction.apply( u, r, a), (u, l, a, ignored) -> batchCreatorThrowableTriFunction.apply( u, l, a), aClass, Void.class, hasNestedAddingPermissionFunction, formBuilderFunction); } /** * Adds a route to a collection page function with none extra * parameters. * * @param getterThrowableBiFunction the function that calculates * the page * @return the updated builder * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions.Retrieve} * annotation instead * @review */ @Deprecated public default Builder addGetter( ThrowableBiFunction> getterThrowableBiFunction) { return addGetter( (p, u, ignored) -> getterThrowableBiFunction.apply(p, u), Void.class); } /** * Adds a route to a collection page function with four extra * parameters. * * @param getterThrowableHexaFunction the function that calculates * the page * @param aClass the class of the page function's second parameter * @param bClass the class of the page function's third parameter * @param cClass the class of the page function's fourth parameter * @param dClass the class of the page function's fifth parameter * @return the updated builder * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions.Retrieve} * annotation instead * @review */ @Deprecated public Builder addGetter( ThrowableHexaFunction> getterThrowableHexaFunction, Class aClass, Class bClass, Class cClass, Class dClass); /** * Adds a route to a collection page function with three extra * parameters. * * @param getterThrowablePentaFunction the function that calculates * the page * @param aClass the class of the page function's second parameter * @param bClass the class of the page function's third parameter * @param cClass the class of the page function's fourth parameter * @return the updated builder * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions.Retrieve} * annotation instead * @review */ @Deprecated public default Builder addGetter( ThrowablePentaFunction> getterThrowablePentaFunction, Class aClass, Class bClass, Class cClass) { return addGetter( (p, u, a, b, c, ignored) -> getterThrowablePentaFunction.apply( p, u, a, b, c), aClass, bClass, cClass, Void.class); } /** * Adds a route to a collection page function with two extra parameters. * * @param getterThrowableTetraFunction the function that calculates * the page * @param aClass the class of the page function's second parameter * @param bClass the class of the page function's third parameter * @return the updated builder * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions.Retrieve} * annotation instead * @review */ @Deprecated public default Builder addGetter( ThrowableTetraFunction> getterThrowableTetraFunction, Class aClass, Class bClass) { return addGetter( (p, u, a, b, ignored) -> getterThrowableTetraFunction.apply( p, u, a, b), aClass, bClass, Void.class); } /** * Adds a route to a collection page function with one extra parameter. * * @param getterThrowableTriFunction the function that calculates * the page * @param aClass the class of the page function's second parameter * @return the updated builder * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions.Retrieve} * annotation instead * @review */ @Deprecated public default Builder addGetter( ThrowableTriFunction> getterThrowableTriFunction, Class aClass) { return addGetter( (p, u, a, ignored) -> getterThrowableTriFunction.apply(p, u, a), aClass, Void.class); } /** * Constructs the {@link NestedCollectionRoutes} instance with the * information provided to the builder. * * @return the {@code Routes} instance * @deprecated As of 1.9.0, use {@link * com.liferay.apio.architect.annotation.Actions} * annotations instead * @review */ @Deprecated public NestedCollectionRoutes build(); } }