Package org.dspace.app.rest.projection
Class SpecificLevelProjection
java.lang.Object
org.dspace.app.rest.projection.AbstractProjection
org.dspace.app.rest.projection.SpecificLevelProjection
- All Implemented Interfaces:
Projection
This Projection will allow us to specify how many levels deep we're going to embed resources onto the requested
HalResource.
The projection is used by using the name combined with the embedLevelDepth parameter to specify how deep the embeds
have to go. There is an upper limit in place for this, which is specified on the bean through the maxEmbed property.
-
Field Summary
FieldsFields inherited from interface org.dspace.app.rest.projection.Projection
DEFAULT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanallowEmbedding(HALResource<? extends RestAddressableModel> halResource, LinkRest linkRest, org.springframework.hateoas.Link... oldLinks) Tells whether this projection permits the embedding of a particular embeddable subresource.booleanallowLinking(HALResource halResource, LinkRest linkRest) Tells whether this projection permits the linking of a particular linkable subresource.intgetName()Gets the projection name.voidsetMaxEmbed(int maxEmbed) Methods inherited from class org.dspace.app.rest.projection.AbstractProjection
getPagingOptions, transformModel, transformResource, transformRest
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
SpecificLevelProjection
public SpecificLevelProjection()
-
-
Method Details
-
getMaxEmbed
public int getMaxEmbed() -
setMaxEmbed
public void setMaxEmbed(int maxEmbed) -
getName
Description copied from interface:ProjectionGets the projection name.- Returns:
- the name, which is a unique alphanumeric string.
-
allowEmbedding
public boolean allowEmbedding(HALResource<? extends RestAddressableModel> halResource, LinkRest linkRest, org.springframework.hateoas.Link... oldLinks) Description copied from interface:ProjectionTells whether this projection permits the embedding of a particular embeddable subresource. This gives the projection an opportunity to opt in to to certain embeds, by returningtrue. Note: If this method returnstruefor a given subresource, it will be automatically linked regardless of whatProjection.allowLinking(HALResource, LinkRest)returns.- Specified by:
allowEmbeddingin interfaceProjection- Overrides:
allowEmbeddingin classAbstractProjection- Parameters:
halResource- the resource from which the embed may or may not be made.linkRest- the LinkRest annotation through which the related resource was discovered on the rest object.oldLinks- The previously traversed links- Returns:
- true if allowed, false otherwise.
-
allowLinking
Description copied from interface:ProjectionTells whether this projection permits the linking of a particular linkable subresource. This gives the projection an opportunity to opt in to to certain links, by returningtrue. Note: IfProjection.allowEmbedding(HALResource, LinkRest, Link...)returnstruefor a given subresource, it will be automatically linked regardless of what this method returns.- Specified by:
allowLinkingin interfaceProjection- Overrides:
allowLinkingin classAbstractProjection- Parameters:
halResource- the resource from which the link may or may not be made.linkRest- the LinkRest annotation through which the related resource was discovered on the rest object.- Returns:
- true if allowed, false otherwise.
-