|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.softslate.commerce.daos.core.DAOUtilsImpl
public class DAOUtilsImpl
Holds various utility methods for use by DAOs.
| Field Summary | |
|---|---|
(package private) static org.apache.commons.logging.Log |
log
|
java.lang.String[] |
stopWords
|
| Constructor Summary | |
|---|---|
DAOUtilsImpl()
|
|
| Method Summary | |
|---|---|
java.lang.String |
generateKeyPair(java.lang.String publicFile,
java.lang.String privateFile,
boolean savePrivate)
|
void |
generateTwoWayKey(java.lang.String keyFile)
|
java.util.Collection |
getCollectionFromBeans(java.util.Collection collection,
java.lang.String field)
Given a Collection of beans representing a ResultSet, and a field name for a field, returns a Collection of Integers representing each field's value in the incoming Collection. |
java.util.Collection |
getCollectionFromCollection(java.util.Collection collection,
java.lang.String field)
Given a Collection of Maps representing a ResultSet, and a field name for a field, returns a Collection of Strings representing each field's value in the incoming Collection. |
java.util.Collection |
getCollectionFromResultSet(java.sql.ResultSet resultSet,
java.lang.String field)
Given a ResultSet and a field name for a field, returns a Collection of Strings representing each field value in the ResultSet. |
java.lang.String |
getDebugMessage(java.sql.ResultSet resultSet)
Retrieves a string indicating the number of rows and columns returned from a ResultSet. |
java.lang.String |
getDecrypted(java.lang.String stringToDecrypt,
java.lang.String encryptionType,
java.lang.String privateKeyFile)
Decrypts a string using the given encryption type. |
java.lang.String |
getEncrypted(java.lang.String stringToEncrypt,
java.lang.String encryptionType,
java.lang.String publicKeyFile)
Encrypts a string using the given encryption type. |
java.util.Collection |
getIntegersFromStrings(java.util.Collection collection)
Given a Collection of Strings, returns a collection of Integers corresponding to the strings. |
java.lang.String |
getList(java.lang.String[] stringArray)
Given an array of strings, returns a single string that can be used as a list in an SQL expression. |
java.lang.String |
getListFromCollection(java.util.Collection collection,
java.lang.String field)
Given a Collection of Maps representing a ResultSet, and a field name for a field, returns a String list representing each field's value in the incoming Collection. |
java.lang.String |
getListFromResultSet(java.sql.ResultSet resultSet,
java.lang.String field)
Given a ResultSet and a field name, returns a single string that can be used as a list in an SQL expression. |
java.lang.String |
getListFromStringCollection(java.util.Collection collection)
Given a Collection of Strings, returns a String list representing each element's value in the incoming Collection. |
java.lang.String |
getQuotedList(java.util.Map map)
Given a Map of string keys, returns a single string that
can be used as a list in an SQL expression. |
java.lang.String |
getQuotedList(java.lang.String[] stringArray)
Given an array of strings, returns a single string that can be used as a list in an SQL expression. |
java.lang.String[] |
getStopWords()
An array of strings to eliminate from database search queries. |
private java.security.Key |
loadKey(java.lang.String filename,
boolean isPublic)
|
void |
outputCsv(java.util.Collection data,
java.io.Writer out)
Outputs a matrix of strings as comma-separated values. |
java.lang.String |
prepareSearchString(java.lang.String searchString)
Prepares a string for insertion into an SQL search expression. |
private void |
saveKey(java.lang.String filename,
byte[] contents)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static org.apache.commons.logging.Log log
public java.lang.String[] stopWords
| Constructor Detail |
|---|
public DAOUtilsImpl()
| Method Detail |
|---|
public java.lang.String[] getStopWords()
DAOUtils
getStopWords in interface DAOUtilspublic java.lang.String getList(java.lang.String[] stringArray)
DAOUtils
getList in interface DAOUtilsstringArray - The array of strings to convert into a comma-separated list.
public java.lang.String getQuotedList(java.lang.String[] stringArray)
DAOUtils
getQuotedList in interface DAOUtilsstringArray - The array of strings to convert into a quoted string.
public java.lang.String getListFromResultSet(java.sql.ResultSet resultSet,
java.lang.String field)
throws java.sql.SQLException
DAOUtils
getListFromResultSet in interface DAOUtilsresultSet - The ResultSet holding the values.field - The name of the field whose values are to be returned in a
list.
java.sql.SQLException
public java.lang.String getListFromCollection(java.util.Collection collection,
java.lang.String field)
DAOUtils
getListFromCollection in interface DAOUtilscollection - The Collection holding the values.
public java.lang.String getListFromStringCollection(java.util.Collection collection)
DAOUtils
getListFromStringCollection in interface DAOUtilscollection - The Collection holding the values.
public java.util.Collection getCollectionFromResultSet(java.sql.ResultSet resultSet,
java.lang.String field)
throws java.sql.SQLException
DAOUtils
getCollectionFromResultSet in interface DAOUtilsresultSet - The ResultSet holding the values.field - The name of the field whose values are to be returned in a
Colleciton.
java.sql.SQLException
public java.util.Collection getCollectionFromCollection(java.util.Collection collection,
java.lang.String field)
DAOUtils
getCollectionFromCollection in interface DAOUtilscollection - The Collection holding the values.field - The name of the field whose values are to be returned in a
Collection.
public java.util.Collection getIntegersFromStrings(java.util.Collection collection)
DAOUtils
getIntegersFromStrings in interface DAOUtilscollection - A collection of Strings
public java.util.Collection getCollectionFromBeans(java.util.Collection collection,
java.lang.String field)
throws java.lang.Exception
DAOUtils
getCollectionFromBeans in interface DAOUtilscollection - The Collection holding the values.field - The name of the field whose values are to be returned in a
Collection.
java.lang.Exception
public java.lang.String getDebugMessage(java.sql.ResultSet resultSet)
throws java.sql.SQLException
DAOUtilsResultSet.
getDebugMessage in interface DAOUtilsresultSet - The ResultSet to produce a debugging message
for.
ResultSet.
java.sql.SQLExceptionpublic java.lang.String getQuotedList(java.util.Map map)
DAOUtilsMap of string keys, returns a single string that
can be used as a list in an SQL expression. Each of the elements of the
incoming Map are quoted and separated by commas.
getQuotedList in interface DAOUtilsmap - The Map to convert into a quoted string.
public void outputCsv(java.util.Collection data,
java.io.Writer out)
throws java.io.IOException
DAOUtils
outputCsv in interface DAOUtilsdata - List of String arrays or Object arrays.out - The stream to write to.
java.io.IOExceptionpublic java.lang.String prepareSearchString(java.lang.String searchString)
DAOUtils
prepareSearchString in interface DAOUtils
public java.lang.String getEncrypted(java.lang.String stringToEncrypt,
java.lang.String encryptionType,
java.lang.String publicKeyFile)
DAOUtils
getEncrypted in interface DAOUtilsstringToEncrypt - The String to encrypt.encryptionType - "noEncryption", "keyPairStore", "keyPairNoStore", or "oneWay".
public java.lang.String getDecrypted(java.lang.String stringToDecrypt,
java.lang.String encryptionType,
java.lang.String privateKeyFile)
DAOUtils
getDecrypted in interface DAOUtilsstringToDecrypt - The String to decrypt.encryptionType - "noEncryption", "keyPairStore", "keyPairNoStore", or "oneWay".
public void generateTwoWayKey(java.lang.String keyFile)
throws java.lang.Exception
generateTwoWayKey in interface DAOUtilsjava.lang.Exception
public java.lang.String generateKeyPair(java.lang.String publicFile,
java.lang.String privateFile,
boolean savePrivate)
throws java.lang.Exception
generateKeyPair in interface DAOUtilsjava.lang.Exception
private void saveKey(java.lang.String filename,
byte[] contents)
throws java.lang.Exception
java.lang.Exception
private java.security.Key loadKey(java.lang.String filename,
boolean isPublic)
throws java.lang.Exception
java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||