class: Utils

public class: Utils
Author: vmakarenko (initial creation)
Project: Phase: 1.0; Status: Proposed; Version: $Revision: 2055 $ $LastChangedDate: 2009-06-03 18:; Complexity: 1
Dates: Created: 16.07.2009 15:20:32; Modified: 16.07.2009 15:20:32;
Flags: Active: false; IsRoot: false; IsLeaf: false;
Extension Points:
UUID: {6D663268-9058-4b79-A7AA-FF98A755FE7D}
Utilities class for eSciDoc syndication manager
 

Goto: Custom Properties, Fields, Methods

Appears in: syndication

Custom Properties
 
Utils Attributes
Attribute Details
private static Logger
  logger
Initial: Logger.getLogger(Utils.class)
private static TreeMap
  outm
Initial: null
private static XPath
  xpath
Initial: XPathFactory.newInstance().newXPath()
 
Utils Methods
Operation Details
public static
checkAndCutString(
   boolean cond,
   String str,
   int maxLen,
   String postfx):String
Sequential
Notes: Cut <code>string</code> and appends it with postfix id <code>cond</code> is <code>true</code>
@return
public static
checkCondition(
   boolean cond,
   String message):void
Sequential
Tags: throws=SyndicationException
Notes: Throws ExportManagerException true if cond is true
public static
checkLen(
   String val):boolean
Sequential
Notes: Returns true if val is not null && Length >0
@return first not null && Length >0
public static
checkList(
   List l):boolean
Sequential
Tags: generic=
Notes: Returns <code>true</code> if list is not empty
@return
public static
checkName(
   String name):void
Sequential
Tags: throws=SyndicationException
public static
checkName(
   String name,
   String message):void
Sequential
Tags: throws=SyndicationException
public static
checkVal(
   String val):boolean
Sequential
Notes: Returns true if val is not null && not empty String
@return first not null && not empty String
public static
createDocument(
   String xml):Document
Sequential
Tags: throws=Exception
public static
createDocument(
   Node sourceNode):Document
Sequential
Tags: throws=Exception
public static
createDocumentBuilder():DocumentBuilder
Sequential
Tags: throws=Exception
public static
cutString(
   String str,
   int maxLen,
   String postfx):String
Sequential
Notes: Cut <code>string</code> and appends it with postfix
@return
public static
findInList(
   String[] a,
   String name):boolean
Sequential
Notes: Find <code>name</code> in <code>a</code> String[]
@return <code>true</code> if <code>name</code> has been found
public static
getInputStreamAsString(
   InputStream is):String
Sequential
Tags: throws=IOException
Notes: Get an InputStream as String.
@param fileName The path and name of the file relative from the working directory.
@return The resource as String.
public static
getOrganizationUnitTree():TreeMap
Sequential
Tags: throws=SyndicationException
Notes: Get sorted Organizational Unit Tree. Please call {@link #recalcOrganizationUnitTree() recalcOrganizationUnitTree} to refresh <code>OrganizationUnitTree</code>
@return <code>TreeMap<String, String></code>:
<code>keys</code> are unit names, <code>values</code> are objids
public static
getResourceAsStream(
   String fileName):InputStream
Sequential
Tags: throws=FileNotFoundException
Notes: Get a resource as InputStream.
@return The resource as InputStream.
public static
getResourceAsString(
   String fileName):String
Sequential
Tags: throws=IOException
Notes: Get a resource as String.
@return The resource as String.
public static
join(
   Collection objs,
   String delimiter):String
Sequential
Tags: generic=
Notes: Join elements of any collection with delimiter
@param <T>
@return a joined string
public static
loginUser(
   String userid,
   String password):String
Sequential
Tags: throws=HttpException,IOException,ServiceException,URISyntaxException
public static
quoteReplacement(
   String str):String
Sequential
Notes: Quote <code>{}</code>
@return quoted <code>str</code>
public static
recalcOrganizationUnitTree():TreeMap
Sequential
Tags: throws=SyndicationException
Notes: Recalculate sorted Organizational Unit Tree.
@return <code>TreeMap<String, String></code>:
<code>keys</code> are unit names, <code>values</code> are objids
public static
replaceAllTotal(
   String what,
   String expr,
   String replacement):String
Sequential
Notes: Version of the <code>String.replaceAll(what, expr, replacement)</code> which ignores new line breaks and case sensitivity
@return replaced <code>what</code>
public static
writeToFile(
   String fileName,
   String content):void
Sequential
Tags: throws=IOException
Notes: Writes <code>content</code> to the file
public static
xpathNodeList(
   String expr,
   String xml):NodeList
Sequential
Tags: throws=Exception
public static
xpathNodeList(
   String expr,
   Document doc):NodeList
Sequential
Tags: throws=Exception
public static
xpathString(
   String expr,
   Document doc):String
Sequential
Tags: throws=Exception