Package no.unit.nva
Class PublicationMapper
- java.lang.Object
-
- no.unit.nva.PublicationMapper
-
public final class PublicationMapper extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <R extends WithContext>
RconvertValue(Publication publication, com.fasterxml.jackson.databind.JsonNode context, java.lang.Class<R> responseType)Maps a publication and context to specified type.static <R extends WithContext>
RconvertValue(Publication publication, java.lang.Class<R> responseType)Maps a publication to specified type with default context.static <REQUEST extends PublicationBase>
PublicationtoExistingPublication(REQUEST request, WithInternal existing)Maps a publication request to a publication and copies internal properties from existing publication.static <REQUEST extends PublicationBase>
PublicationtoNewPublication(REQUEST request, java.lang.String owner, java.net.URI handle, java.net.URI link, Organization publisher)Maps a publication request to a new publication and sets internal properties for the first time.
-
-
-
Method Detail
-
toExistingPublication
public static <REQUEST extends PublicationBase> Publication toExistingPublication(REQUEST request, WithInternal existing)
Maps a publication request to a publication and copies internal properties from existing publication.- Type Parameters:
REQUEST- request type- Parameters:
request- publication requestexisting- existing publication to copy internal properties from- Returns:
- complete updated publication
-
toNewPublication
public static <REQUEST extends PublicationBase> Publication toNewPublication(REQUEST request, java.lang.String owner, java.net.URI handle, java.net.URI link, Organization publisher)
Maps a publication request to a new publication and sets internal properties for the first time.- Type Parameters:
REQUEST- request type- Parameters:
request- publication requestowner- ownerhandle- handlelink- linkpublisher- publisher- Returns:
- complete new publication
-
convertValue
public static <R extends WithContext> R convertValue(Publication publication, com.fasterxml.jackson.databind.JsonNode context, java.lang.Class<R> responseType)
Maps a publication and context to specified type.- Type Parameters:
R- Type to be converted to.- Parameters:
publication- publication.context- jsonld context.responseType- Class to be converted to.- Returns:
- publication response
-
convertValue
public static <R extends WithContext> R convertValue(Publication publication, java.lang.Class<R> responseType)
Maps a publication to specified type with default context.- Type Parameters:
R- Type to be converted to.- Parameters:
publication- publication.responseType- Class to be converted to.- Returns:
- publication response
-
-