Package org.dspace.app.rest.projection
Class EmbedRelsProjection
java.lang.Object
org.dspace.app.rest.projection.AbstractProjection
org.dspace.app.rest.projection.EmbedRelsProjection
- All Implemented Interfaces:
Projection
Projection that allows a given set of rels to be embedded.
A Rel refers to a Link Relation, this is an Embedded Object of the HalResource and the HalResource contains
a link to this
-
Field Summary
FieldsFields inherited from interface org.dspace.app.rest.projection.Projection
DEFAULT -
Constructor Summary
ConstructorsConstructorDescriptionEmbedRelsProjection(Set<String> embedRels, Set<String> embedSizes) The EmbedRelsProjection will take a set of embed relations and embed sizes as a parameter that will be added to the projection. -
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.getName()Gets the projection name.org.springframework.data.domain.PageRequestgetPagingOptions(String rel, HALResource<? extends RestAddressableModel> resource, org.springframework.hateoas.Link... oldLinks) This method will return thePageRequestobject for a specific given relvoidsetEmbedSizes(Map<String, Integer> embedSizes) Methods inherited from class org.dspace.app.rest.projection.AbstractProjection
allowLinking, transformModel, transformResource, transformRest
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
EmbedRelsProjection
The EmbedRelsProjection will take a set of embed relations and embed sizes as a parameter that will be added to the projection. The set of embedRels contains strings representing the embedded relation. The set of embedSizes contains a string containing the embedded relation followed by a "=" and the size of the embedded relation. Example: embed=collections&embed.size=collections=5 - These parameters will ensure that the embedded collections size will be limited to 5- Parameters:
embedRels- The embedded relationsembedSizes- The sizes of the embedded relations defined as {relation}={size}
-
-
Method Details
-
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.
-
getPagingOptions
public org.springframework.data.domain.PageRequest getPagingOptions(String rel, HALResource<? extends RestAddressableModel> resource, org.springframework.hateoas.Link... oldLinks) Description copied from interface:ProjectionThis method will return thePageRequestobject for a specific given rel- Specified by:
getPagingOptionsin interfaceProjection- Overrides:
getPagingOptionsin classAbstractProjection- Parameters:
rel- The rel for which thePageRequestobject will be maderesource- the resource from which the embed may or may not be made.oldLinks- The previously traversed links- Returns:
- The
PageRequestobject for the given rel
-
getEmbedSizes
-
setEmbedSizes
-