Class DefaultApiRestEntityFactory
- java.lang.Object
-
- com.atlassian.confluence.api.impl.DefaultApiRestEntityFactory
-
- All Implemented Interfaces:
ApiRestEntityFactory
public class DefaultApiRestEntityFactory extends Object implements ApiRestEntityFactory
- Since:
- 6.12.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.atlassian.confluence.core.ApiRestEntityFactory
ApiRestEntityFactory.SchemaType
-
-
Constructor Summary
Constructors Constructor Description DefaultApiRestEntityFactory(ContentFactory contentFactory, SpaceFactory spaceFactory, RestEntityEnrichmentManager restEntityEnrichmentManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RestEntitybuildRestEntityFrom(ContentEntityObject entity, Expansions expansions)Build a REST API entity from a ContentEntityObject.RestEntity<Space>buildRestEntityFrom(Space space, Expansions expansions)Build a REST API entity from a hibernate Space object.Iterable<RestEntity>buildRestEntityFromContent(Iterable<? extends ContentEntityObject> entities, Expansions expansions)Build a list of REST API entity objects from ContentEntityObject objects.Iterable<RestEntity>buildRestEntityFromSpaces(Iterable<Space> spaces, Expansions expansions)Build a list of REST API entity objects from hibernate Space objects.ObjectconvertAndEnrich(Object entity, ApiRestEntityFactory.SchemaType schemaType)Converts the given entity into a RestEntity if the entity has the RestEnrichable annotation or is a PageResponse that contains RestEnrichable entities.@NonNull Map<String,Type>getEnrichedPropertyTypes(Type type, boolean root)Get the types of the properties that may possibly be provided by the enrichers.booleanisEnrichableEntity(Class entityType)Get whether an object type can be enriched using a RestEntity.booleanisEnrichableList(Class listType)Get whether an object type can be enriched using a RestList.
-
-
-
Constructor Detail
-
DefaultApiRestEntityFactory
public DefaultApiRestEntityFactory(ContentFactory contentFactory, SpaceFactory spaceFactory, RestEntityEnrichmentManager restEntityEnrichmentManager)
-
-
Method Detail
-
buildRestEntityFrom
public RestEntity buildRestEntityFrom(ContentEntityObject entity, Expansions expansions)
Description copied from interface:ApiRestEntityFactoryBuild a REST API entity from a ContentEntityObject.- Specified by:
buildRestEntityFromin interfaceApiRestEntityFactory- Parameters:
entity- The entity objectexpansions- The expansions to apply to the returned data- Returns:
- The REST API entity
-
buildRestEntityFrom
public RestEntity<Space> buildRestEntityFrom(Space space, Expansions expansions)
Description copied from interface:ApiRestEntityFactoryBuild a REST API entity from a hibernate Space object.- Specified by:
buildRestEntityFromin interfaceApiRestEntityFactoryexpansions- The expansions to apply to the returned data- Returns:
- The REST API entity
-
buildRestEntityFromContent
public Iterable<RestEntity> buildRestEntityFromContent(Iterable<? extends ContentEntityObject> entities, Expansions expansions)
Description copied from interface:ApiRestEntityFactoryBuild a list of REST API entity objects from ContentEntityObject objects.- Specified by:
buildRestEntityFromContentin interfaceApiRestEntityFactoryexpansions- The expansions to apply to the returned data- Returns:
- The REST API entity list
-
buildRestEntityFromSpaces
public Iterable<RestEntity> buildRestEntityFromSpaces(Iterable<Space> spaces, Expansions expansions)
Description copied from interface:ApiRestEntityFactoryBuild a list of REST API entity objects from hibernate Space objects.- Specified by:
buildRestEntityFromSpacesin interfaceApiRestEntityFactoryexpansions- The expansions to apply to the returned data- Returns:
- The REST API entity list
-
isEnrichableList
public boolean isEnrichableList(Class listType)
Description copied from interface:ApiRestEntityFactoryGet whether an object type can be enriched using a RestList.- Specified by:
isEnrichableListin interfaceApiRestEntityFactory
-
isEnrichableEntity
public boolean isEnrichableEntity(Class entityType)
Description copied from interface:ApiRestEntityFactoryGet whether an object type can be enriched using a RestEntity.- Specified by:
isEnrichableEntityin interfaceApiRestEntityFactory
-
getEnrichedPropertyTypes
public @NonNull Map<String,Type> getEnrichedPropertyTypes(Type type, boolean root)
Description copied from interface:ApiRestEntityFactoryGet the types of the properties that may possibly be provided by the enrichers. This is used to populate the graph-ql schema.- Specified by:
getEnrichedPropertyTypesin interfaceApiRestEntityFactory- Parameters:
type- The type of the object being enriched- Returns:
- A map of property names to property types
-
convertAndEnrich
public Object convertAndEnrich(Object entity, ApiRestEntityFactory.SchemaType schemaType)
Description copied from interface:ApiRestEntityFactoryConverts the given entity into a RestEntity if the entity has the RestEnrichable annotation or is a PageResponse that contains RestEnrichable entities.- Specified by:
convertAndEnrichin interfaceApiRestEntityFactory- Parameters:
entity- the entity to enrichschemaType- rest or graphql- Returns:
- a converted rest entity or the entity that was given
-
-