|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.repo.domain.CrcHelper
public class CrcHelper
Helper class to calculate CRC values for string persistence.
Field Summary | |
---|---|
static java.lang.String |
EMPTY_STRING
|
Constructor Summary | |
---|---|
CrcHelper()
|
Method Summary | |
---|---|
static org.alfresco.util.Pair |
getStringCrcPair(java.lang.String value,
int dataLength,
boolean useCharsFromStart,
boolean caseSensitive)
Calculate a persistable, unique pair of values that can be persisted in a database unique key and guarantee correct case-sensitivity. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String EMPTY_STRING
Constructor Detail |
---|
public CrcHelper()
Method Detail |
---|
public static org.alfresco.util.Pair getStringCrcPair(java.lang.String value, int dataLength, boolean useCharsFromStart, boolean caseSensitive)
While the short-string version of the value is always lowercase, the CRC is calculated from the virgin string if case-sensitivity is enforced; in the case-insensitive case, the CRC is calculated from a lowercase version of the string.
If the value is an empty string, then CrcHelper.EMPTY_STRING
is used instead. This ensures
that persisted values don't fall foul of the Oracle empty string comparison "behaviour" i.e
you should never persist an empty string in Oracle as it equates to a SQL NULL.
value
- the raw value that will be persisteddataLength
- the maximum number of characters that can be persisteduseCharsFromStart
- true if the shortened string value must be made from
the first characters of the string or false to use
characters from the end of the string.caseSensitive
- true if the resulting pair must be case-sensitive or
false if the pair must be case-insensitive.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |