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 RestEntity
buildRestEntityFrom(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.Object
convertAndEnrich(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.boolean
isEnrichableEntity(Class entityType)
Get whether an object type can be enriched using a RestEntity.boolean
isEnrichableList(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:ApiRestEntityFactory
Build a REST API entity from a ContentEntityObject.- Specified by:
buildRestEntityFrom
in 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:ApiRestEntityFactory
Build a REST API entity from a hibernate Space object.- Specified by:
buildRestEntityFrom
in interfaceApiRestEntityFactory
expansions
- 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:ApiRestEntityFactory
Build a list of REST API entity objects from ContentEntityObject objects.- Specified by:
buildRestEntityFromContent
in interfaceApiRestEntityFactory
expansions
- 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:ApiRestEntityFactory
Build a list of REST API entity objects from hibernate Space objects.- Specified by:
buildRestEntityFromSpaces
in interfaceApiRestEntityFactory
expansions
- The expansions to apply to the returned data- Returns:
- The REST API entity list
-
isEnrichableList
public boolean isEnrichableList(Class listType)
Description copied from interface:ApiRestEntityFactory
Get whether an object type can be enriched using a RestList.- Specified by:
isEnrichableList
in interfaceApiRestEntityFactory
-
isEnrichableEntity
public boolean isEnrichableEntity(Class entityType)
Description copied from interface:ApiRestEntityFactory
Get whether an object type can be enriched using a RestEntity.- Specified by:
isEnrichableEntity
in interfaceApiRestEntityFactory
-
getEnrichedPropertyTypes
public @NonNull Map<String,Type> getEnrichedPropertyTypes(Type type, boolean root)
Description copied from interface:ApiRestEntityFactory
Get the types of the properties that may possibly be provided by the enrichers. This is used to populate the graph-ql schema.- Specified by:
getEnrichedPropertyTypes
in 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:ApiRestEntityFactory
Converts the given entity into a RestEntity if the entity has the RestEnrichable annotation or is a PageResponse that contains RestEnrichable entities.- Specified by:
convertAndEnrich
in interfaceApiRestEntityFactory
- Parameters:
entity
- the entity to enrichschemaType
- rest or graphql- Returns:
- a converted rest entity or the entity that was given
-
-