Package com.saperion.rs
Class AbstractWeblinkService
- java.lang.Object
-
- com.saperion.rs.RestService
-
- com.saperion.rs.AbstractWeblinkService
-
- Direct Known Subclasses:
WeblinkService,WeblinkZipService
public abstract class AbstractWeblinkService extends RestService
The Class AbstractWeblinkService. Extends theRestServicebasis class with helper methods for the weblink services.
-
-
Field Summary
-
Fields inherited from class com.saperion.rs.RestService
LOGGER
-
-
Constructor Summary
Constructors Constructor Description AbstractWeblinkService()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.StringappendToFilename(java.lang.String filename, java.lang.String appendix)Appends the given appendix to the given filename.protected static java.io.InputStreamgetContent(com.saperion.connector.SaClassicConnector connector, java.lang.String xhdoc, java.lang.String field, java.lang.String id, int element)Gets the content stream of a document from the backend.protected java.lang.StringgetFilenameFromDocElement(java.lang.String xhdoc, com.saperion.connector.SaClassicConnector connector, boolean currentRevision, int element, java.lang.String field, java.lang.String id)Gets the filename from doc element.protected static java.lang.StringgetHDoc(com.saperion.connector.SaClassicConnector connector, java.lang.String archive, java.lang.String field, java.lang.String id, int element, boolean released, boolean currentRevision)Gets the hdoc.protected static java.lang.ObjectgetTypedId(com.saperion.connector.SaClassicConnector connector, java.lang.String archive, java.lang.String field, java.lang.String id)Gets the typed id.protected static voidlogAndThrowWebException(java.lang.String field, int element, java.lang.String id, java.lang.Exception e, javax.ws.rs.core.Response.Status status)Logs a error message (generated by the given values) and throws a.protected static voidsendBadRequestMessage()-
Methods inherited from class com.saperion.rs.RestService
checkConnection, getConnection
-
-
-
-
Method Detail
-
getHDoc
protected static java.lang.String getHDoc(com.saperion.connector.SaClassicConnector connector, java.lang.String archive, java.lang.String field, java.lang.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(java.lang.String field, int element, java.lang.String id, java.lang.Exception e, javax.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:
javax.ws.rs.WebApplicationException- the web application exceptionWebApplicationExceptionwith the error message and given status.
-
sendBadRequestMessage
protected static void sendBadRequestMessage()
-
getTypedId
protected static java.lang.Object getTypedId(com.saperion.connector.SaClassicConnector connector, java.lang.String archive, java.lang.String field, java.lang.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 java.lang.String getFilenameFromDocElement(java.lang.String xhdoc, com.saperion.connector.SaClassicConnector connector, boolean currentRevision, int element, java.lang.String field, java.lang.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
public static java.lang.String appendToFilename(java.lang.String filename, java.lang.String appendix)Appends the given appendix to the given filename. The result will look like: -_ . 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 java.io.InputStream getContent(com.saperion.connector.SaClassicConnector connector, java.lang.String xhdoc, java.lang.String field, java.lang.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
-
-