Package com.saperion.util
Class HdocUtil
java.lang.Object
com.saperion.util.HdocUtil
This 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 ClassesModifier and TypeClassDescriptionstatic classThis class represents a DocId.static classThis class represents a SAP DocId.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intThe Constant APOSTROPHE.static final intThe Constant CLOSE_BRACKET.static final char[]The Constant DIGITS.static final intThe Constant EXCLAMATION_MARK.static final intThe Constant NINE.static final intThe Constant OPEN_BRACKET.static final intThe Constant QOUTE.static final intThe Constant STAR.static final intThe Constant ZERO.
- 
Method SummaryModifier and TypeMethodDescriptionprotected static 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 Stringdecode(HdocUtil.DocId docId) This method tries to decode an encoded Document ID, which is used by the HTML-Gateway.static Stringdecode(HdocUtil.SAPDocId sapDocId) This methode decodes a SAPDocId and returns the decoded XHDOC (Version-specific Document ID).static HdocUtil.DocIdThis 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(String hex) Converts the given Hex String to a byte array.static voidTest driver.protected static StringreplaceAfterEncode(String encodedUID) Replaces after encoding the given string.protected static StringreplaceBeforeDecode(String encodedUID) Replaces before encoding the given string.static voidtest()Test method.
- 
Field Details- 
DIGITSpublic static final char[] DIGITSThe Constant DIGITS.
- 
EXCLAMATION_MARKpublic static final int EXCLAMATION_MARKThe Constant EXCLAMATION_MARK.- See Also:
 
- 
STARpublic static final int STARThe Constant STAR.- See Also:
 
- 
ZEROpublic static final int ZEROThe Constant ZERO.- See Also:
 
- 
NINEpublic static final int NINEThe Constant NINE.- See Also:
 
- 
OPEN_BRACKETpublic static final int OPEN_BRACKETThe Constant OPEN_BRACKET.- See Also:
 
- 
CLOSE_BRACKETpublic static final int CLOSE_BRACKETThe Constant CLOSE_BRACKET.- See Also:
 
- 
QOUTEpublic static final int QOUTEThe Constant QOUTE.- See Also:
 
- 
APOSTROPHEpublic static final int APOSTROPHEThe Constant APOSTROPHE.- See Also:
 
 
- 
- 
Method Details- 
encodeThis 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:
 
- 
convertThis 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
 
- 
decodeThis 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:
- Exception- If the sapDocId is not conform
 
- 
replaceAfterEncodeReplaces after encoding the given string.- Parameters:
- encodedUID- The String to be encoded.
- Returns:
- The encoded and replaced string.
 
- 
replaceBeforeDecodeReplaces before encoding the given string.- Parameters:
- encodedUID- The String to be encoded.
- Returns:
- The encoded and replaced string.
 
- 
decodeThis 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:
- IOException- If an error occurs, while decoding (Base64)
 
- 
bytesToHexConverts the given byte[] to a Hex String.- Parameters:
- raw- The byte array to be converted to a Hex String.
- Returns:
- The converted Hex String.
 
- 
hexToBytesConverts the given Hex String to a byte array.- Parameters:
- hex- The Hex String to be converted.
- Returns:
- the converted byte[].
 
- 
testTest method.- Throws:
- Exception- if an error occurs.
 
- 
mainTest driver.- Parameters:
- args- Console arguments.
- Throws:
- Exception- if an error occurs.
 
 
-