Page History
...
Code Representation of a DSpace Object
DSpace API Object (hibernate): org.dspace.content.DSpaceObject
Rest Object: org.dspace.app.rest.model.DSpaceObject
This is a plain old java object (pojo) representation of a DSpace object.
- Add private properties
- https://github.com/DSpace/DSpace/blob/rest7/dspace-spring-rest/src/main/java/org/dspace/app/rest/model/DSpaceObjectRest.java#L24-L30
- Add a get/set bean methods
- To exclude a property from JSON representation, add @JsonIgnore to the get method or to the property
...
The base class in this package uses reflection to identify embedded and linked properties.attributes that are actual links to other REST resources. On a such attribute is discovered the code
- wrap the linked REST resource inside a DSpaceResource (so to have the identifier, self link, and links to other resources)
- put the wrapper in the embedde
- https://github.com/DSpace/DSpace/blob/rest7/dspace-spring-rest/src/main/java/org/dspace/app/rest/model/hateoas/DSpaceResource.java#L45-L74
- TODO: summarize in plain language the decisions that this code is making
Converter Object: org.dspace.app.rest.converter.DSpaceObjectConverter
Convert between the REST representation of an object and the hibernate representation of an object
Coding a converter object
- In the fromModel() function, map all object attributes from the persistence/hibernate model to the rest model
Overview
Content Tools