com.zphinx.spine
Class Resources

java.lang.Object
  extended by com.zphinx.spine.Resources

public class Resources
extends Object

Resources allows access to a collection of language/locale,country,state,account and message information.

This object serves as a means of creating lists and maps of norminal language,country and state information with this information been obtained from com.zphinx.spine.resources.ResourceProperties

Version:
1.0

Copyright © Zphinx Software Solutions

Author:
David Ladapo

Method Summary
 LabelIntBean getAccount(int accountId)
          Gets a LabelIntBean containing the Account Type and it's account code.
 ArrayList getAccountsList()
          Gets the ArrayList of LabelIntBeans which contains references to the account types available in the application
 StringAttributeBean getCountry(String countryId)
          Gets the StringAttributeBean of the country to use, this represented as CountryName|countryCode
 ArrayList<StringAttributeBean> getCountryList()
          Gets the list of StringAttributeBeans containing the country names with the associated ids.The id is usually represented in the properties file as country.countryId=countryName.
static Resources getInstance()
          Gets the static instance of this object
 LabelIntBean getIntBean(int intValue, ArrayList aList)
          Gets a LabelIntBean whose intValue is equal to the given intValue
 StringAttributeBean getLocale(String localeId)
          Gets a StringAttributeBean containing the Locale and it's locale code.
 ArrayList getLocaleList()
          Gets the list of locales which are defined in the resource properties file
 LabelIntBean getMessage(int messageId)
          Gets a LabelIntBean containing the Message Type and it's message code.
 ArrayList getMessagesList()
          Gets the ArrayList of LabelIntBean which hold references to message types
static PropertyResourceBundle getResourceBundle()
          Gets the resource bundle
 StringAttributeBean getState(String stateId)
          Gets a StringAttributeBean containing the state amd it's state code.
 ArrayList<StringAttributeBean> getStateList()
          Gets the list of StringAttributeBean containing the state names with the associated ids.The id is usually represented in the properties file as state.stateId=State Name.
static String getString(String key)
          Gets the locale sensitive string defined by this key
 ArrayList getSubjectsList()
          Gets the ArrayList of LabelIntBean which hold references to subject titles
protected  ArrayList<StringAttributeBean> sortList(ArrayList aList)
          Alphabetically sort the contents of this list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getString

public static String getString(String key)
Gets the locale sensitive string defined by this key

Parameters:
key - The key to the object been fetched
Returns:
The locale sensitive string

getResourceBundle

public static PropertyResourceBundle getResourceBundle()
Gets the resource bundle

Returns:
Returns the RESOURCE_BUNDLE.

getCountry

public StringAttributeBean getCountry(String countryId)
Gets the StringAttributeBean of the country to use, this represented as CountryName|countryCode

Parameters:
countryId - The id by which the country is known in the properties file
Returns:
The StringAttributeBean of countries in use

getState

public StringAttributeBean getState(String stateId)
Gets a StringAttributeBean containing the state amd it's state code.

Parameters:
stateId - The key by which the state is known in the properties file
Returns:
The state in whose id is represented by stateId

getCountryList

public ArrayList<StringAttributeBean> getCountryList()
Gets the list of StringAttributeBeans containing the country names with the associated ids.The id is usually represented in the properties file as country.countryId=countryName.

The returned StringAttributeBean is of the format countryName|countryId

Returns:
Returns the countryList.

getInstance

public static Resources getInstance()
Gets the static instance of this object

Returns:
A static instance of this object

getStateList

public ArrayList<StringAttributeBean> getStateList()
Gets the list of StringAttributeBean containing the state names with the associated ids.The id is usually represented in the properties file as state.stateId=State Name.

The returned StringAttributeBean is of the format stateName|stateId

Returns:
Returns the stateList.

sortList

protected ArrayList<StringAttributeBean> sortList(ArrayList aList)
Alphabetically sort the contents of this list

Parameters:
aList - The ArrayList of StringAttributeBeans to be sorted alphabetically according to name variable of the bean
Returns:
A sorted list

getLocaleList

public ArrayList getLocaleList()
Gets the list of locales which are defined in the resource properties file

Returns:
Returns the localeList.

getLocale

public StringAttributeBean getLocale(String localeId)
Gets a StringAttributeBean containing the Locale and it's locale code.

Parameters:
localeId - The id or language code of this locale
Returns:
A StringAttributeBean representing the Locale in question

getAccountsList

public ArrayList getAccountsList()
Gets the ArrayList of LabelIntBeans which contains references to the account types available in the application

Returns:
An ArrayList of account types of configured

getSubjectsList

public ArrayList getSubjectsList()
Gets the ArrayList of LabelIntBean which hold references to subject titles

Returns:
An ArrayList of subject titles

getMessagesList

public ArrayList getMessagesList()
Gets the ArrayList of LabelIntBean which hold references to message types

Returns:
An ArrayList of message types

getAccount

public LabelIntBean getAccount(int accountId)
Gets a LabelIntBean containing the Account Type and it's account code.

Parameters:
accountId - The id or code of this AccountType
Returns:
A LabelIntBean representing the AccountType in question

getMessage

public LabelIntBean getMessage(int messageId)
Gets a LabelIntBean containing the Message Type and it's message code.

Parameters:
messageId - The id or code of this MessageType
Returns:
A LabelIntBean representing the MessageType in question

getIntBean

public LabelIntBean getIntBean(int intValue,
                               ArrayList aList)
Gets a LabelIntBean whose intValue is equal to the given intValue

Parameters:
intValue - The intValue used for tthe Search search
aList - The ArrayList to search
Returns:
An instance of the LabelIntBean whose intValue is equal to the given intValue