Package com.saperion.rs
Class AbstractWeblinkService
java.lang.Object
com.saperion.rs.RestService
com.saperion.rs.AbstractWeblinkService
- Direct Known Subclasses:
WeblinkService,WeblinkZipService
The Class AbstractWeblinkService. Extends the
RestService basis class with helper methods
for the weblink services.-
Field Summary
Fields inherited from class com.saperion.rs.RestService
LOGGER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringappendToFilename(String filename, String appendix) Appends the given appendix to the given filename.protected static InputStreamgetContent(com.saperion.connector.SaClassicConnector connector, String xhdoc, String field, String id, int element) Gets the content stream of a document from the backend.protected StringgetFilenameFromDocElement(String xhdoc, com.saperion.connector.SaClassicConnector connector, boolean currentRevision, int element, String field, String id) Gets the filename from doc element.protected static StringgetHDoc(com.saperion.connector.SaClassicConnector connector, String archive, String field, String id, int element, boolean released, boolean currentRevision) Gets the hdoc.protected static ObjectgetTypedId(com.saperion.connector.SaClassicConnector connector, String archive, String field, String id) Gets the typed id.protected static voidlogAndThrowWebException(String field, int element, String id, Exception e, jakarta.ws.rs.core.Response.Status status) Logs a error message (generated by the given values) and throws a.protected static voidMethods inherited from class com.saperion.rs.RestService
checkConnection, getConnection
-
Constructor Details
-
AbstractWeblinkService
public AbstractWeblinkService()
-
-
Method Details
-
getHDoc
protected static String getHDoc(com.saperion.connector.SaClassicConnector connector, String archive, String field, String id, int element, boolean released, boolean currentRevision) Gets the hdoc.- Parameters:
connector- the classic connectorarchive- the archive/DDC to queryfield- the fieldid- the idelement- the elementreleased- the releasedcurrentRevision- the current revision- Returns:
- the hdoc
-
logAndThrowWebException
protected static void logAndThrowWebException(String field, int element, String id, Exception e, jakarta.ws.rs.core.Response.Status status) Logs a error message (generated by the given values) and throws a.- Parameters:
field- the fieldelement- the elementid- the ide- the estatus- the status- Throws:
jakarta.ws.rs.WebApplicationException- the web application exceptionWebApplicationExceptionwith the error message and given status.
-
sendBadRequestMessage
protected static void sendBadRequestMessage() -
getTypedId
protected static Object getTypedId(com.saperion.connector.SaClassicConnector connector, String archive, String field, String id) Gets the typed id. Finds out the type of the archive field and converts the id to this type.- Parameters:
connector- the connector to get DB Definitions of the archivearchive- the archive / DDC to find out type of given fieldfield- the field to convert idid- the id to convert- Returns:
- the typed id
-
getFilenameFromDocElement
protected String getFilenameFromDocElement(String xhdoc, com.saperion.connector.SaClassicConnector connector, boolean currentRevision, int element, String field, String id) Gets the filename from doc element.- Parameters:
xhdoc- the xhdoc of documentconnector- the classic connectorcurrentRevision- true, of current revision of document is neededelement- the element number of documentfield- the fieldid- the id- Returns:
- the filename from the document element
-
appendToFilename
Appends the given appendix to the given filename. The result will look like: - <filename w/o ending>_. if an ending is existing in the given filename, or - _ if no ending was detected. - Parameters:
filename- The filename to be appended.appendix- The appendix to append the given filename with.- Returns:
- the appended filename.
-
getContent
protected static InputStream getContent(com.saperion.connector.SaClassicConnector connector, String xhdoc, String field, String id, int element) Gets the content stream of a document from the backend.- Parameters:
connector- the classic connectorxhdoc- the xhdoc of document to get contentfield- the field to identify documentid- the id to identify value of document fieldelement- the element number of document- Returns:
- the content stream
-