com.astroshare.astroonline.database
Class Sql

java.lang.Object
  extended by com.astroshare.astroonline.database.Database
      extended by com.astroshare.astroonline.database.Sql

public class Sql
extends Database

Implementation of the Astro-Online database access layer.

All database access is defined in this class.


Field Summary
protected static org.apache.log4j.Logger log
           
 
Fields inherited from class com.astroshare.astroonline.database.Database
conn
 
Constructor Summary
Sql()
           Constructor.
 
Method Summary
 boolean checkEntry(Visitor visitor)
           Check whether the atlas data found in object visitor is valid.
 int deleteHoroscope(java.lang.String horoscopeId, java.lang.String horoscopeLanguage)
           Remove horoscope from database.
 java.lang.String getAspect(java.lang.String language, java.lang.String id, int planetfrom, int planetto, int aspect, java.lang.String aspectsAll, boolean param_switch)
           Get text from table aspects.
 java.sql.ResultSet getConfiguration()
           Select configuration from database.
 java.lang.String getConfigurationValue(java.lang.String param)
           Get configuration value for a specific parameter.
 java.lang.String getGeneralText(java.lang.String language, java.lang.String id, int textnr)
           Get text from table generaltext.
 java.lang.String[] getHoroscopeInfo(java.lang.String horoscopeId, java.lang.String horoscopeLanguage)
           Gets horoscope information from the database.
 java.sql.ResultSet getInstalledHoroscopes()
           Select installed horoscopes from database.
 java.lang.String[][] getLOVCity(java.lang.String country, java.lang.String city)
           Builds a List of Values of cities for a specific country in HTML form.
 boolean getPartner(java.lang.String language, java.lang.String id, int sun1, int sun2, java.lang.String[] text)
           Select text from table partner.
 java.util.ArrayList<java.lang.Object> getPartnerToList(java.lang.String language, java.lang.String id, int sun1, int sun2)
           Return partner text in an aaraylist.
 java.lang.String getPlanetInHouse(java.lang.String language, java.lang.String id, int planet, int house)
           Get text form table planetinhouse.
 java.lang.String getPlanetInSign(java.lang.String language, java.lang.String id, int planet, int sign)
           Get text from table planetinsign.
 java.lang.String getPlanetText(java.lang.String language, java.lang.String id, int planet)
           Get text from table planets.
 java.lang.String getSignText(java.lang.String language, java.lang.String id, int sign)
           Get text from table signs.
 int insertHoroscope(java.lang.String horoscopeId, java.lang.String horoscopeLanguage, java.lang.String horoscopeType, java.lang.String horoscopeDbid, java.lang.String horoscopeTitle, java.lang.String horoscopeInput, java.lang.String horoscopeOutput, java.lang.String horoscopeIntro)
           Add a new horoscope to the database.
 int setConfigurationValue(java.lang.String param, java.lang.String value)
           Update the value for a specific parameter.
 int updateHoroscopeInfo(java.lang.String horoscopeId, java.lang.String horoscopeLanguage, java.lang.String horoscopeType, java.lang.String horoscopeDbid, java.lang.String horoscopeTitle, java.lang.String horoscopeInput, java.lang.String horoscopeOutput, java.lang.String horoscopeIntro)
           Update horoscope information.
 
Methods inherited from class com.astroshare.astroonline.database.Database
close, execute, executeQuery
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.log4j.Logger log
Constructor Detail

Sql

public Sql()
    throws javax.naming.NamingException,
           java.sql.SQLException

Constructor.

Throws:
javax.naming.NamingException - Exception is thrown when JNDI datasource is not found
java.sql.SQLException - Exception is thrown when a connection cannot be established
Method Detail

getLOVCity

public java.lang.String[][] getLOVCity(java.lang.String country,
                                       java.lang.String city)

Builds a List of Values of cities for a specific country in HTML form.

Parameters:
country - Country to search for
city - Part of the city to search for
Returns:
List of Values of cities in HTML form

checkEntry

public boolean checkEntry(Visitor visitor)

Check whether the atlas data found in object visitor is valid.

Parameters:
visitor - Object holding the data of a visitor
Returns:
TRUE=Data is correct; FALSE=Data not found

getGeneralText

public java.lang.String getGeneralText(java.lang.String language,
                                       java.lang.String id,
                                       int textnr)

Get text from table generaltext.

Parameters:
language - Language
id - Horoscope ID
textnr - Text number
Returns:
Text

getSignText

public java.lang.String getSignText(java.lang.String language,
                                    java.lang.String id,
                                    int sign)

Get text from table signs.

Parameters:
language - Language
id - Horoscope ID
sign - Sign number
Returns:
Text

getPlanetText

public java.lang.String getPlanetText(java.lang.String language,
                                      java.lang.String id,
                                      int planet)

Get text from table planets.

Parameters:
language - Language
id - Horoscope ID
planet - Planet number
Returns:
Text

getPlanetInSign

public java.lang.String getPlanetInSign(java.lang.String language,
                                        java.lang.String id,
                                        int planet,
                                        int sign)

Get text from table planetinsign.

Parameters:
language - Language
id - Horoscope ID
planet - Planet number
sign - Sign number
Returns:
Planet in sign text

getPlanetInHouse

public java.lang.String getPlanetInHouse(java.lang.String language,
                                         java.lang.String id,
                                         int planet,
                                         int house)

Get text form table planetinhouse.

Parameters:
language - Language
id - Horoscope ID
planet - Planet number
house - House number
Returns:
Planet in house text

getAspect

public java.lang.String getAspect(java.lang.String language,
                                  java.lang.String id,
                                  int planetfrom,
                                  int planetto,
                                  int aspect,
                                  java.lang.String aspectsAll,
                                  boolean param_switch)

Get text from table aspects.

Parameters:
language - Language
id - Horoscope ID
planetfrom - Planet number planet from
planetto - Planet number planet to
aspect - Aspect
aspectsAll - Show all aspects?
param_switch - TRUE=Switch parameters planetfrom and planetto if applicable;FALSE=Never switch parameter planetfrom and planetto
Returns:
Text

getPartner

public boolean getPartner(java.lang.String language,
                          java.lang.String id,
                          int sun1,
                          int sun2,
                          java.lang.String[] text)

Select text from table partner.

Parameters:
language - Language
id - Horoscope ID
sun1 - Sun person 1
sun2 - Sub person 2
text - Text array
Returns:
TRUE=Data found;FALSE=No data found

getPartnerToList

public java.util.ArrayList<java.lang.Object> getPartnerToList(java.lang.String language,
                                                              java.lang.String id,
                                                              int sun1,
                                                              int sun2)

Return partner text in an aaraylist.

Parameters:
language - Language
id - Horoscope ID
sun1 - Sun person 1
sun2 - Sun person 2
Returns:
Arraylist including partner text

getConfiguration

public java.sql.ResultSet getConfiguration()

Select configuration from database.

Returns:
Configuration

getConfigurationValue

public java.lang.String getConfigurationValue(java.lang.String param)

Get configuration value for a specific parameter.

Parameters:
param - Configuration parameter
Returns:
Configuration value

setConfigurationValue

public int setConfigurationValue(java.lang.String param,
                                 java.lang.String value)

Update the value for a specific parameter.

Parameters:
param - Parameter to be updated
value - New value for parameter to be updated
Returns:
Number of records affected

getInstalledHoroscopes

public java.sql.ResultSet getInstalledHoroscopes()

Select installed horoscopes from database.

Returns:
List of installed horoscopes

getHoroscopeInfo

public java.lang.String[] getHoroscopeInfo(java.lang.String horoscopeId,
                                           java.lang.String horoscopeLanguage)

Gets horoscope information from the database.

Parameters:
horoscopeId - Horoscope id
horoscopeLanguage - Horoscope language
Returns:
Horoscope info

updateHoroscopeInfo

public int updateHoroscopeInfo(java.lang.String horoscopeId,
                               java.lang.String horoscopeLanguage,
                               java.lang.String horoscopeType,
                               java.lang.String horoscopeDbid,
                               java.lang.String horoscopeTitle,
                               java.lang.String horoscopeInput,
                               java.lang.String horoscopeOutput,
                               java.lang.String horoscopeIntro)

Update horoscope information.

Parameters:
horoscopeId - Horoscope id
horoscopeLanguage - Horoscope language
horoscopeType - Horoscope type
horoscopeDbid - Horoscope database id
horoscopeTitle - Horoscope title
horoscopeInput - Horoscope input template
horoscopeOutput - Horoscope output template
horoscopeIntro - Horoscope intro text
Returns:
Number of records affected

deleteHoroscope

public int deleteHoroscope(java.lang.String horoscopeId,
                           java.lang.String horoscopeLanguage)

Remove horoscope from database.

Parameters:
horoscopeId - Horoscope id
horoscopeLanguage - Horoscope language
Returns:
Number of records affected

insertHoroscope

public int insertHoroscope(java.lang.String horoscopeId,
                           java.lang.String horoscopeLanguage,
                           java.lang.String horoscopeType,
                           java.lang.String horoscopeDbid,
                           java.lang.String horoscopeTitle,
                           java.lang.String horoscopeInput,
                           java.lang.String horoscopeOutput,
                           java.lang.String horoscopeIntro)

Add a new horoscope to the database.

Parameters:
horoscopeId - Horoscope id
horoscopeLanguage - Horoscope language
horoscopeType - Horoscope type
horoscopeDbid - Horoscope database id
horoscopeTitle - Horoscope title
horoscopeInput - Horoscope input template
horoscopeOutput - Horoscope output template
horoscopeIntro - Horoscope intro text
Returns:
Number of records affected


Astro-Online © 2001 − 2008 Astro Share
Documentation generated on: Thursday August 12th 2008 (PS)