|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dlese.dpc.schemedit.SchemEditUtils
public class SchemEditUtils
Utility methods for SchemEdit
Field Summary | |
---|---|
static SimpleDateFormat |
fullDateFormat
* Formats and parses dates according to fullDateFormatString . |
static String |
fullDateFormatString
same as utcDateFormatString |
static SimpleDateFormat |
simpleDateFormat
Formats and parses dates according to simpleDateFormatString . |
static String |
simpleDateFormatString
"yyyy-MM-dd" |
static SimpleDateFormat |
utcDateFormat
Formats and parses dates according to utcDateFormatString. |
static String |
utcDateFormatString
"yyyy-MM-dd'T'HH:mm:ss'Z'" |
Constructor Summary | |
---|---|
SchemEditUtils()
|
Method Summary | |
---|---|
static void |
box(String s)
Description of the Method |
static String |
contractAmpersands(String in)
Contract expanded ampersands (&) that are part of entity references. |
static String |
escapeUriSpaces(String uriStr)
Escape spaces in the given uriStr so that it may be accepted by URI constructor. |
static String |
expandAmpersands(String in)
Expand expanded ampersands that are part of entities. |
static String |
formatQuery(String q)
Encodes query strings beginning with "id:" or "url:" using SimpleLuceneIndex.encodeToTerm(java.lang.String) . |
static org.apache.struts.action.ActionForward |
forwardToCaller(HttpServletRequest request,
String editedRecId,
SessionBean sessionBean)
General method to forward control to the appropriate page (Collections, Search or View) after completing an operation. |
static String |
fullDateString(Date date)
Converts a Date object into a string formatted with fullDateFormat |
static Object |
getAttr(Object obj,
String attr)
Based on attribute name, attempts to get the value of that attribute using a bean-style "gettter". |
static String |
getCollectionFromIndex(String id,
SimpleLuceneIndex index)
DEPRECIATED - use getCollectionOfIndexedRecord Returns the collection associated with an indexed record. |
static String |
getCollectionOfIndexedRecord(String id,
RepositoryManager rm)
Returns the collection associated with an indexed record. |
static DcsSetInfo |
getDcsSetInfo(String collection,
List dcsSetInfos)
pick a given DcsSetInfo from a list |
static DcsSetInfo |
getDcsSetInfo(String collection,
RepositoryManager rm)
Gets the dcsSetInfo attribute of the SchemEditUtils class |
static Document |
getEditableDocument(String docUri,
MetaDataFramework framework)
Returns the localized dom4j.Document from the given uri after checking that the schemaLocation declared by the document at uri corresponds with the schemaLocation known to the MetaDataFramework parameter. |
static String |
getEditableXml(File file)
Gets the editableXml attribute of the SchemEditUtils class |
static String |
getElapsedTimeSimple(long clicks)
Return a string representation of the elapsed time since an event date (which is represented as "clicks" since "the epoch"). |
static File |
getFileFromIndex(String id,
RepositoryManager rm)
Returns the file associated with an id in an index. |
static Document |
getLocalizedXmlDocument(URI uri)
Returns a localized xmlDocument for the given uri. |
static List |
getMirrorUrls(String recordXml)
Extracts mirrorUrl values from an adn record |
static SetInfo |
getSetInfo(String collection,
RepositoryManager rm)
Gets the setInfo attribute of the SchemEditUtils class |
static String |
getUniqueId()
Gets the uniqueId attribute of the SchemEditUtils class |
static Object |
getUriRef(String uriStr)
Gets the uriRef attribute of the SchemEditUtils class |
static Object |
getUriRef(String uriStr,
String docRoot)
Gets the uriRef attribute of the SchemEditUtils class |
static Object |
getUriRef(URI uri)
Gets the uriRef attribute of the SchemEditUtils class |
static Object |
getUriRef(URI uri,
String docRoot)
Given a string representation of a uri, returns either a File or URL instance. |
static Date |
getUtcTime()
Gets the utcTime attribute of the SchemEditUtils class |
static Date |
getUtcTime(Date date)
Gets the utcTime attribute of the SchemEditUtils class |
static boolean |
hasBadChar(String s)
Checks given string for characters outside the range of ASCII values |
static void |
main(String[] args)
The main program for the SchemEditUtils class |
static void |
prtln(String s)
Print a line to standard out. |
static void |
prtln(String s,
String prefix)
Description of the Method |
static String |
quoteWrap(String s)
Return the given string wrapped in quotation marks |
static void |
showReferer(HttpServletRequest request)
Displays request params for debugging. |
static void |
showRequestHeaders(HttpServletRequest request)
Display request headers for debugging. |
static void |
showRequestParameters(HttpServletRequest request)
Displays request params for debugging. |
static void |
showRequestParameters(HttpServletRequest request,
String[] paramFilter)
Description of the Method |
static void |
showRoleInfo(User sessionUser,
org.apache.struts.action.ActionMapping mapping)
Description of the Method |
static String |
simpleDateString(Date date)
Converts a Date object into a string formatted with simpleDateFormat |
static String |
stuffId(String recordXml,
String id,
MetaDataFramework framework)
Insert a new id into an existing metadata record |
static String |
toWinPath(String path)
Replace forward slashes in provided path with backward slashes |
static String |
utcDateString(Date date)
formats the given date in the form "yyyy-MM-dd'T'HH:mm:ss'Z'". |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static String utcDateFormatString
public static SimpleDateFormat utcDateFormat
public static String fullDateFormatString
public static SimpleDateFormat fullDateFormat
fullDateFormatString
.
public static String simpleDateFormatString
public static SimpleDateFormat simpleDateFormat
simpleDateFormatString
.
Constructor Detail |
---|
public SchemEditUtils()
Method Detail |
---|
public static org.apache.struts.action.ActionForward forwardToCaller(HttpServletRequest request, String editedRecId, SessionBean sessionBean)
request
- the request objecteditedRecId
- id of record edited in metadata editor (if any)sessionBean
- a sessionBean instance
public static String contractAmpersands(String in)
in
- String to be processed
public static String escapeUriSpaces(String uriStr)
uriStr
- Description of the Parameter
public static String expandAmpersands(String in)
in
- Description of the Parameter
public static Document getLocalizedXmlDocument(URI uri) throws Exception
NOTEs:
uri
- uri pointing to a file containing xml
Exception
- If scheme is not recognized or if a Document could
not be createdpublic static Object getUriRef(String uriStr) throws Exception, URISyntaxException
uriStr
- Description of the Parameter
Exception
- Description of the Exception
URISyntaxException
- Description of the Exceptionpublic static Object getUriRef(URI uri) throws Exception
uri
- Description of the Parameter
Exception
- Description of the Exceptionpublic static Object getUriRef(String uriStr, String docRoot) throws Exception, URISyntaxException
uriStr
- Description of the ParameterdocRoot
- Description of the Parameter
Exception
- Description of the Exception
URISyntaxException
- Description of the Exceptionpublic static Object getUriRef(URI uri, String docRoot) throws Exception
Relative paths are assumed to be file paths relative to "docRoot" and expanded accordingly into absolute files.
docRoot
- Path to docRoot for this application to aid in
resolving relative paths.uri
- Description of the Parameter
Exception
- NOT YET DOCUMENTEDpublic static String getEditableXml(File file) throws Exception
file
- NOT YET DOCUMENTED
Exception
- NOT YET DOCUMENTEDpublic static Document getEditableDocument(String docUri, MetaDataFramework framework) throws DocumentException
called from MetaDataFramework.getEditableDocument.
docUri
- uri of xml documentframework
- MetaDataFramework instance for consistency
checking.
DocumentException
- Description of the Exceptionpublic static void showReferer(HttpServletRequest request)
request
- Description of the Parameterpublic static void showRequestParameters(HttpServletRequest request)
Filtering out kinds of parameters. Construct an array containing strings which, if found in a parameter name, will filter that param from the display. E.g.,
request
- Description of the Parameterpublic static void showRequestParameters(HttpServletRequest request, String[] paramFilter)
request
- Description of the ParameterparamFilter
- Description of the Parameterpublic static String getCollectionFromIndex(String id, SimpleLuceneIndex index)
id
- record idindex
- a SimpleLuceneIndex instance
public static String getCollectionOfIndexedRecord(String id, RepositoryManager rm)
id
- record idrm
- Description of the Parameter
public static SetInfo getSetInfo(String collection, RepositoryManager rm)
collection
- Description of the Parameterrm
- Description of the Parameter
public static DcsSetInfo getDcsSetInfo(String collection, RepositoryManager rm)
collection
- Description of the Parameterrm
- Description of the Parameter
public static DcsSetInfo getDcsSetInfo(String collection, List dcsSetInfos)
collection
- Description of the ParameterdcsSetInfos
- Description of the Parameter
public static File getFileFromIndex(String id, RepositoryManager rm)
id
- record idrm
- Description of the Parameter
public static void showRoleInfo(User sessionUser, org.apache.struts.action.ActionMapping mapping)
sessionUser
- Description of the Parametermapping
- Description of the Parameterpublic static boolean hasBadChar(String s)
s
- String to be checked
public static String getUniqueId()
public static void showRequestHeaders(HttpServletRequest request)
request
- Description of the Parameterpublic static String formatQuery(String q)
SimpleLuceneIndex.encodeToTerm(java.lang.String)
.
q
- the query string
public static String quoteWrap(String s)
s
- the string to quote wrap
public static String fullDateString(Date date)
fullDateFormat
date
- date to be formatted
public static String simpleDateString(Date date)
simpleDateFormat
date
- date to be formatted
public static String utcDateString(Date date)
date
- a date object to be formatted
public static Date getUtcTime()
public static Date getUtcTime(Date date)
date
- the date object
public static String getElapsedTimeSimple(long clicks)
NOTE: this method does not consider elapsed times greater than 24 hours (the elapsed days are simply not shown).
clicks
- Description of the Parameter
public static void main(String[] args) throws Exception
args
- The command line arguments
Exception
- Description of the Exceptionpublic static String toWinPath(String path)
path
- the path to convert
public static List getMirrorUrls(String recordXml)
recordXml
- xml string to search for mirrorUrls
public static String stuffId(String recordXml, String id, MetaDataFramework framework) throws Exception
recordXml
- metadata record as xml stringid
- id to insert into the metadata recordframework
- MetaDataFramework object for the format of the record
Exception
- Description of the Exceptionpublic static Object getAttr(Object obj, String attr)
obj
- object for which to get attrattr
- attribute to get
public static void prtln(String s, String prefix)
s
- Description of the Parameterprefix
- Description of the Parameterpublic static void prtln(String s)
s
- The String to print.public static void box(String s)
s
- Description of the Parameter
|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |