class: CommonUtils

public class: CommonUtils
Author: : Thomas Diebäcker, created 25.04.2007
Project: Phase: 1.0; Status: Proposed; Version: : $Revision: 2719 $ $LastChangedDate: 2009-06-03 1; Complexity: 1
Dates: Created: 16.07.2009 15:33:38; Modified: 16.07.2009 15:33:38;
Flags: Active: false; IsRoot: false; IsLeaf: false;
Extension Points:
UUID: {F3A47F5F-EA72-4af7-8015-9B194E34947D}
Provides different utilities for all kinds of stuff.
 

Goto: Custom Properties, Fields, Methods

Extends: InternationalizedImpl

See also: InternationalizedImpl

Appears in: util

Connections
 
Custom Properties
 
CommonUtils Attributes
Attribute Details
private static const String
  DATE_FORMAT
Initial: "yyyy-MM-dd"
private static const String
  ESCAPED_CHARACTERS
Initial: { "&", ">", "<", """, "'", "
", "
", "
" , "  " }
private static String
  localLang
Initial: ""
private static Logger
  logger
Initial: Logger.getLogger(CommonUtils.class)
private static const String
  NO_ITEM_SET
Initial: "-"
private static const String
  PROBLEMATIC_CHARACTERS
Initial: { "&", ">", "<", "\"", "\'", "\r\n", "\n", "\r", "\t" }
Notes: HTML escaped characters mapping
private static const String
  TIMESTAMP_FORMAT
Initial: "yyyy-MM-dd HH:mm"
 
CommonUtils Methods
Operation Details
private static
change(
   String in,
   String oldPat,
   String newPat):String
Sequential
Tags: annotations=@Deprecated
Notes: Changes all occurrences of oldPat to newPat.
@return The escaped string.
@deprecated I do not see any advantage over String.replace
public static
convertToAffiliationVOPresentationList(
   List list):List
Sequential
Notes: Converts a list of AffiliationVOs to a list of AffiliationVOPresentations.
@return the list of AffiliationVOPresentations
public static
convertToContextVOList(
   List list):ArrayList
Sequential
Notes: Converts a list of PubCollectionVOPresentations to a list of PubCollections.
@return the list of ContextVOs
public static
convertToEnumString(
   String value):String
Sequential
public static
convertToOptions(
   Set set):SelectItem
Sequential
Notes: Converts a Set to an Array of SelectItems (an empty SelectItem is included at the beginning). This method is used to convert Enums into SelectItems for dropDownLists.
@return an Array of SelectItems
public static
convertToOptions(
   Set set,
   boolean includeEmptyOption):SelectItem
Sequential
Notes: Converts a Set to an Array of SelectItems. This method is used to convert Enums into SelectItems for dropDownLists.
@return an Array of SelectItems
public static
convertToOptions(
   Object[] objects):SelectItem
Sequential
Notes: Converts an Array of Objects to an Array of SelectItems (an empty SelectItem is included at the beginning). This method is used to convert Objects into SelectItems for dropDownLists.
@return an Array of SelectItems
public static
convertToOptions(
   Object[] objects,
   boolean includeEmptyOption):SelectItem
Sequential
Notes: Converts an Array of Objects to an Array of SelectItems. This method is used to convert Objects into SelectItems for dropDownLists.
@return an Array of SelectItems
public static
convertToPubCollectionVOPresentationList(
   List list):List
Sequential
Notes: Converts a list of PubCollections to a list of PubCollectionVOPresentations.
@return the list of PubCollectionVOPresentations
public static
convertToPubCollectionVOWrapperList(
   List valueObjectList):List
Sequential
Notes: Converts a list of valueObjects to a list of ValueObjectWrappers.
@return the list of ValueObjectWrappers
public static
convertToPubFileVOPresentationList(
   List list):List
Sequential
Notes: Converts a list of PubItems to a list of PubItemVOPresentations.
@return the list of PubItemVOPresentations
public static
convertToPubItemList(
   List wrapperList):List
Sequential
Notes: Converts a list of PubItemVOWrappers to a list of PubItemVOs.
@return the list of PubItemVOs
public static
convertToPubItemVOList(
   List list):ArrayList
Sequential
Notes: Converts a list of PubItemVOPresentations to a list of PubItems.
@return the list of PubItemVOs
public static
convertToPubItemVOPresentationList(
   List list):List
Sequential
Notes: Converts a list of PubItems to a list of PubItemVOPresentations.
@return the list of PubItemVOPresentations
public static
convertToRelationVOList(
   List list):ArrayList
Sequential
Notes: Converts a list of RelationVOPresentation to a list of Relations.
@return the list of RelationVO
public static
convertToRelationVOPresentationList(
   List list):List
Sequential
Notes: Converts a list of Relations to a list of RelationVOPresentation.
@return the list of RelationVOPresentation
public static
convertToSelectItemsUI(
   SelectItem[] selectItems):List
Sequential
Notes: Converts an array of SelectItems to a SelectItemUI. This is used for items for comboboxes.
@return a UISelectItems which can be added to a HtmlSelectOneMenu with HtmlSelectOneMenu.getChildren.add()
public static
convertToWrapperList(
   List valueObjectList):List
Sequential
Notes: Converts a list of valueObjects to a list of ValueObjectWrappers.
@return the list of ValueObjectWrappers
public static
createUniqueId(
   UIComponent uiComponent):String
Sequential
Notes: Creates a unique id for GUI components.
@return a unique id
public static
currentDate():String
Sequential
public static
format(
   Date date):String
Sequential
Notes: Formats a date with the default format.
@return a formated String
public static
formatTimestamp(
   Date date):String
Sequential
Notes: Formats a date with the default format.
@return a formated String
private static
getConeLanguages():Object
Sequential
Tags: throws=RuntimeException
Notes: Retrievs an array of all languages from the cone service in format abbr - language name.
@return Object array of languages
public static
getDecodedUrlParameterMap(
   String query):Map
Sequential
Tags: throws=UnsupportedEncodingException
public static
getisUriValidUrl(
   IdentifierVO id):boolean
Sequential
public static
getItemByID(
   List itemList,
   String itemID):PubItemVOPresentation
Sequential
Notes: Searches the given list for the item with the given ID.
@return the pubItem with the given ID or null if the item cannot be found in the given list
public static
getLanguageOptions():SelectItem
Sequential
Notes: Returns all Languages from Cone Service, with "de","en" and "ja" at the first positions.
@return all Languages from Cone Service, with "de","en" and "ja" at the first positions
public static
getTextElementConsideringEmpty(
   String elementText):HtmlOutputText
Sequential
Notes: generates an HTML OutputText element. The method also tests if the string that should be placed into the element is empty. If it is, a " " string is placed into.
@author Tobias Schraut
@return HtmlOutputText the generated and prepared html text element
public static
getUIValue(
   HtmlSelectOneMenu comboBox):String
Sequential
Notes: Returns the current value of a comboBox. Used in UIs.
@return the current value of the comboBox
public static
getUIValue(
   HtmlSelectOneRadio radioButton):String
Sequential
Notes: Returns the current value of a comboBox. Used in UIs.
@param comboBox the comboBox for which the value should be returned
@return the current value of the comboBox
public static
getUIValue(
   HtmlInputText textField):String
Sequential
Notes: Returns the current value of a textfield. Used in UIs.
@return the current value of the textfield
public static
getUIValue(
   HtmlInputTextarea textArea):String
Sequential
Notes: Returns the current value of a textArea. Used in UIs.
@return the current value of the textArea
public static
htmlEscape(
   String cdata):String
Sequential
Notes: Escapes problematic HTML characters ("less than", "greater than", ampersand, apostrophe and quotation mark).
@return The escaped string.
public static
javascriptEscape(
   String cdata):String
Sequential
Notes: Escapes problematic Javascript characters ("'", "\n").
@return The escaped string.
public static
limitString(
   String string,
   int length):String
Sequential
Notes: Limits a string to the given length (on word basis).
@return the limited String