Package com.saperion.util
Class HdocUtil
- java.lang.Object
- 
- com.saperion.util.HdocUtil
 
- 
 public final class HdocUtil extends java.lang.ObjectThis Util should help, while working with SAPERION Document IDs. It can decode and encode the SAPERION IDs, so that it can interchange them with SAP and HTML-Gateway.- Author:
- Daniel Manzke
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classHdocUtil.DocIdThis class represents a DocId.static classHdocUtil.SAPDocIdThis class represents a SAP DocId.
 - 
Field SummaryFields Modifier and Type Field Description static intAPOSTROPHEThe Constant APOSTROPHE.static intCLOSE_BRACKETThe Constant CLOSE_BRACKET.static char[]DIGITSThe Constant DIGITS.static intEXCLAMATION_MARKThe Constant EXCLAMATION_MARK.static intNINEThe Constant NINE.static intOPEN_BRACKETThe Constant OPEN_BRACKET.static intQOUTEThe Constant QOUTE.static intSTARThe Constant STAR.static intZEROThe Constant ZERO.
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description protected static java.lang.StringbytesToHex(byte[] raw)Converts the given byte[] to a Hex String.static HdocUtil.SAPDocIdconvert(HdocUtil.DocId docId)This method converts an encoded XHDOC, so it can be used with SAP.static java.lang.Stringdecode(HdocUtil.DocId docId)This method tries to decode an encoded Document ID, which is used by the HTML-Gateway.static java.lang.Stringdecode(HdocUtil.SAPDocId sapDocId)This methode decodes a SAPDocId and returns the decoded XHDOC (Version-specific Document ID).static HdocUtil.DocIdencode(java.lang.String decoded)This method tooks a XHDOC (Version-specific Document ID) and encodes it, so this one can be used by the HTML-Gateway.protected static byte[]hexToBytes(java.lang.String hex)Converts the given Hex String to a byte array.static voidmain(java.lang.String[] args)Test driver.protected static java.lang.StringreplaceAfterEncode(java.lang.String encodedUID)Replaces after encoding the given string.protected static java.lang.StringreplaceBeforeDecode(java.lang.String encodedUID)Replaces before encoding the given string.static voidtest()Test method.
 
- 
- 
- 
Field Detail- 
DIGITSpublic static final char[] DIGITS The Constant DIGITS.
 - 
EXCLAMATION_MARKpublic static final int EXCLAMATION_MARK The Constant EXCLAMATION_MARK.- See Also:
- Constant Field Values
 
 - 
STARpublic static final int STAR The Constant STAR.- See Also:
- Constant Field Values
 
 - 
ZEROpublic static final int ZERO The Constant ZERO.- See Also:
- Constant Field Values
 
 - 
NINEpublic static final int NINE The Constant NINE.- See Also:
- Constant Field Values
 
 - 
OPEN_BRACKETpublic static final int OPEN_BRACKET The Constant OPEN_BRACKET.- See Also:
- Constant Field Values
 
 - 
CLOSE_BRACKETpublic static final int CLOSE_BRACKET The Constant CLOSE_BRACKET.- See Also:
- Constant Field Values
 
 - 
QOUTEpublic static final int QOUTE The Constant QOUTE.- See Also:
- Constant Field Values
 
 - 
APOSTROPHEpublic static final int APOSTROPHE The Constant APOSTROPHE.- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
encodepublic static HdocUtil.DocId encode(java.lang.String decoded) This method tooks a XHDOC (Version-specific Document ID) and encodes it, so this one can be used by the HTML-Gateway. If you want to use it with SAP, you have to convert it.- Parameters:
- decoded- XHDOC (Version-specific Document ID)
- Returns:
- the encoded XHDOC
- See Also:
- convert(DocId)
 
 - 
convertpublic static HdocUtil.SAPDocId convert(HdocUtil.DocId docId) This method converts an encoded XHDOC, so it can be used with SAP.- Parameters:
- docId- encoded XHDOC
- Returns:
- converted DocID Object, so it can be used by SAP
 
 - 
decodepublic static java.lang.String decode(HdocUtil.SAPDocId sapDocId) throws java.lang.Exception This methode decodes a SAPDocId and returns the decoded XHDOC (Version-specific Document ID). It also checks if the ID starts with SAPRRXX, due the fact that this String identicates, that it is a real SAPDocId.- Parameters:
- sapDocId- Encoded XHDOC (Version-specific Document ID)
- Returns:
- decoded XHDOC
- Throws:
- java.lang.Exception- If the sapDocId is not conform
 
 - 
replaceAfterEncodeprotected static java.lang.String replaceAfterEncode(java.lang.String encodedUID) Replaces after encoding the given string.- Parameters:
- encodedUID- The String to be encoded.
- Returns:
- The encoded and replaced string.
 
 - 
replaceBeforeDecodeprotected static java.lang.String replaceBeforeDecode(java.lang.String encodedUID) Replaces before encoding the given string.- Parameters:
- encodedUID- The String to be encoded.
- Returns:
- The encoded and replaced string.
 
 - 
decodepublic static java.lang.String decode(HdocUtil.DocId docId) throws java.io.IOException This method tries to decode an encoded Document ID, which is used by the HTML-Gateway.- Parameters:
- docId- Encoded XHDOC (Version-specific Document ID)
- Returns:
- decoded XHDOC
- Throws:
- java.io.IOException- If an error occurs, while decoding (Base64)
 
 - 
bytesToHexprotected static java.lang.String bytesToHex(byte[] raw) Converts the given byte[] to a Hex String.- Parameters:
- raw- The byte array to be converted to a Hex String.
- Returns:
- The converted Hex String.
 
 - 
hexToBytesprotected static byte[] hexToBytes(java.lang.String hex) Converts the given Hex String to a byte array.- Parameters:
- hex- The Hex String to be converted.
- Returns:
- the converted byte[].
 
 - 
testpublic static void test() throws java.lang.ExceptionTest method.- Throws:
- java.lang.Exception- if an error occurs.
 
 - 
mainpublic static void main(java.lang.String[] args) throws java.lang.ExceptionTest driver.- Parameters:
- args- Console arguments.
- Throws:
- java.lang.Exception- if an error occurs.
 
 
- 
 
-