org.orange.kicsa.integration.skill
Class SkillJDBCDAO

org.orange.util.integration.JDBCDAO
  |
  +--org.orange.kicsa.integration.skill.SkillJDBCDAO

public class SkillJDBCDAO
extends JDBCDAO
implements SkillDAO

Skill Data Access Object (DAO)

Author:
Jérôme Beau pour Orange (c) 2002
Version: $Revision: 1.1.1.1 $
Stereotype singleton
testcase test.org.orange.kicsa.integration.skill.TestSkillJDBCDAO

Field Summary
 final static StringALL_FIELDS
           
 (package private) SkillMemoryDAOcache
          Cache
 final static StringCOMMENTS
           
 final static StringINSERT
          Insère une nouvelle compétence
 final static StringKEY
           
 final static StringLEVEL_DESCRIPTIONS
           
 final static StringLEVELS_SEPARATOR
           
 final static StringLONG_NAME
           
 final static StringRELATIONSHIP_ID_FROM
           
 final static StringRELATIONSHIP_ID_TO
           
 final static StringRELATIONSHIP_INSERT
          Création d'une nouvelle relation
 final static StringRELATIONSHIP_REMOVE
           
 final static StringRELATIONSHIP_REMOVE_FOR_SKILL
           
 final static StringRELATIONSHIP_TABLE
           
 final static StringRELATIONSHIP_TYPE
           
 final static StringRELATIONSHIP_UPDATE
           
 final static StringREMOVE
           
 final static StringSELECT_ALL
           
 final static StringSELECT_ALL_DESTINATIONS
          Récupère les clés, noms courts et longs des compétences parentes
 final static StringSELECT_BY_PRIMARY_KEY
           
 final static StringSELECT_DESTINATIONS
          Récupère les clés, noms courts et longs des compétences parentes
 final static StringSELECT_LEVELS_BY_SKILL
           
 final static StringSELECT_NEW_KEY
          Recherche la plus grande clé.

 final static StringSELECT_SOURCES
          Récupère toutes les clés de compétences destinations pour une compétence donnée

public final static String SELECT_ALL_DESTINATIONS = SELECT + ID_TO + FROM + TABLE
+ WHERE + ID_FROM + "=?"
 final static StringSHORT_NAME
           
 final static StringSKILL_UPDATE
          Modification d'un enregistrement de compétence
 final static StringSTATUS
           
 final static charSTATUS_APPROVED
           
 final static charSTATUS_PROPOSED
           
 final static StringTABLE
           

Fields inherited from class org.orange.util.integration.JDBCDAO
AND, CONNECTION_FACTORY_CLASS_NAME, CONNECTION_FACTORY_CLASS_NAME_DEFAULT, DELETE_FROM, DISTINCT, EQUAL_PARAMETER, FROM, IN, INSERT_INTO, LIKE, NOT, OR, ORDER_BY, SELECT, SET, UPDATE, VALUES, WHERE

Method Summary
 voidclearCache()
           
 Skillcreate(Skill someSkill)
          Enregistre une nouvelle compétence
 MapgetAll()
           
 SkillgetByPrimaryKey(SkillKey someKey)
           
 CollectiongetChilds(Skill someParentSkill)
           
 CollectiongetDestinations(Skill someSourceSkill)
          Return all relationship destinations from a given skill.
 CollectiongetDestinations(Skill someSourceSkill, String someRelationshipType)
           
 static SkillDAOgetInstance()
          Recherche les compétences racines (sans relations parent)

public final static String SELECT_ROOTS = SELECT + " distinct " + ALL_FIELDS + FROM + TABLE + " LEFT JOIN "
+ TABLE + " ON " + TABLE + "."
 SortedMapgetLevels(SkillKey someSkillKey)
           
 CollectiongetParents(Skill someChildSkill)
           
 CollectiongetSources(Skill someDestinationSkill, String someRelationshipType)
          Get skills linking to some skill with some relationship type

This method lookup in cache first, and then read if not found in cache; return them.
 booleanisCacheEnabled()
           
 voidlink(Skill someFromSkill, String someType, SkillKey someToSkillKey)
          Crée une nouvelle relation entre deux compétences
 MapreadAll()
           
 SkillreadByPrimaryKey(SkillKey someKey)
          Get a skill by its name
 SortedMapreadLevels(SkillKey someSkillKey)
           
 intremove(SkillKey someSkillKey)
          Supprime un enregistrement de compétence
 voidremoveRelationship(SkillKey someSource, String someRelationshipType, SkillKey someDestination)
           
 intremoveRelationships(SkillKey someSkillKey)
          Remove relationships to or from a skill
 voidsetCacheEnabled(boolean someEnabledState)
           
 Skillupdate(Skill someSkill)
          Met à jour une nouvelle compétence

Cette méthode ne prend pas en compte la mise à jour des relations de la compétence.
 voidupdateRelationship(SkillKey someSource, String someRelationshipType, SkillKey someDestination)
          Update a relationship between two skills

Methods inherited from class org.orange.util.integration.JDBCDAO
getConnection

Field Detail

ALL_FIELDS

public final static String ALL_FIELDS

cache

SkillMemoryDAO cache
Cache
supplierQualifier cache

COMMENTS

public final static String COMMENTS

INSERT

public final static String INSERT
Insère une nouvelle compétence

KEY

public final static String KEY

LEVEL_DESCRIPTIONS

public final static String LEVEL_DESCRIPTIONS

LEVELS_SEPARATOR

public final static String LEVELS_SEPARATOR

LONG_NAME

public final static String LONG_NAME

RELATIONSHIP_ID_FROM

public final static String RELATIONSHIP_ID_FROM

RELATIONSHIP_ID_TO

public final static String RELATIONSHIP_ID_TO

RELATIONSHIP_INSERT

public final static String RELATIONSHIP_INSERT
Création d'une nouvelle relation

RELATIONSHIP_REMOVE

public final static String RELATIONSHIP_REMOVE

RELATIONSHIP_REMOVE_FOR_SKILL

public final static String RELATIONSHIP_REMOVE_FOR_SKILL

RELATIONSHIP_TABLE

public final static String RELATIONSHIP_TABLE

RELATIONSHIP_TYPE

public final static String RELATIONSHIP_TYPE

RELATIONSHIP_UPDATE

public final static String RELATIONSHIP_UPDATE

REMOVE

public final static String REMOVE

SELECT_ALL

public final static String SELECT_ALL

SELECT_ALL_DESTINATIONS

public final static String SELECT_ALL_DESTINATIONS
Récupère les clés, noms courts et longs des compétences parentes

SELECT_BY_PRIMARY_KEY

public final static String SELECT_BY_PRIMARY_KEY

SELECT_DESTINATIONS

public final static String SELECT_DESTINATIONS
Récupère les clés, noms courts et longs des compétences parentes

SELECT_LEVELS_BY_SKILL

public final static String SELECT_LEVELS_BY_SKILL

SELECT_NEW_KEY

public final static String SELECT_NEW_KEY
Recherche la plus grande clé.

Utilisé pour déterminer la clé d'un nouvel enregistrement : max + 1

SELECT_SOURCES

public final static String SELECT_SOURCES
Récupère toutes les clés de compétences destinations pour une compétence donnée

public final static String SELECT_ALL_DESTINATIONS = SELECT + ID_TO + FROM + TABLE
+ WHERE + ID_FROM + "=?";

/**
Récupère toutes les clés de compétences sources pour un type de relation donné

public final static String RELATIONSHIP_SELECT_SOURCES
= SELECT + RELATIONSHIP_ID_FROM + FROM + RELATIONSHIP_TABLE
+ WHERE + RELATIONSHIP_ID_TO + "=?"
+ AND + RELATIONSHIP_TYPE+ "=?";

/** Récupère les clés, noms courts et longs des compétences parentes

SHORT_NAME

public final static String SHORT_NAME

SKILL_UPDATE

public final static String SKILL_UPDATE
Modification d'un enregistrement de compétence

STATUS

public final static String STATUS

STATUS_APPROVED

public final static char STATUS_APPROVED

STATUS_PROPOSED

public final static char STATUS_PROPOSED

TABLE

public final static String TABLE
Method Detail

clearCache

public void clearCache()

create

public Skill create(Skill someSkill)
throws org.orange.util.integration.DAOException
Enregistre une nouvelle compétence
Parameters:
someSkill La compétence à enregistrer
Returns: La compétence enregistrée, avec sa clé générée (sauf si la clé est celle de la compétence racine)

getAll

public Map getAll()
throws org.orange.util.integration.DAOException
Returns: L'ensemble des noms courts de compétences, indexés par leur clé (Integer id)

getByPrimaryKey

public Skill getByPrimaryKey(SkillKey someKey)
throws org.orange.util.integration.DAOException,
org.orange.kicsa.SkillNotFoundException

getChilds

public Collection getChilds(Skill someParentSkill)
throws org.orange.util.integration.DAOException
Returns: The childs of the skill

getDestinations

public Collection getDestinations(Skill someSourceSkill)
throws org.orange.util.integration.DAOException
Return all relationship destinations from a given skill.
Parameters:
someSourceSkill The skill you want to find destinations from
Returns: The set of relationships' destinations from this skill

getDestinations

public Collection getDestinations(Skill someSourceSkill, String someRelationshipType)
throws org.orange.util.integration.DAOException
Parameters:
someSourceSkill Une compétence
someRelationshipType Un type de relation ("Parent", etc.)
Returns: L'ensemble des relations d'un certain type partant de la compétence

getInstance

public static SkillDAO getInstance()
throws org.orange.util.integration.DAOException
Recherche les compétences racines (sans relations parent)

public final static String SELECT_ROOTS = SELECT + " distinct " + ALL_FIELDS + FROM + TABLE + " LEFT JOIN "
+ TABLE + " ON " + TABLE + "." + KEY + "=" + ID_FROM
+ WHERE + ID_FROM + " IS NULL";

/** /
public Collection getRoots() throws DAOException
{
log.debug ("getRoots");

if (roots.size() == 0)
try
{
Connection connection = getConnection();
try
{
PreparedStatement selectAllStatement = connection.prepareStatement (SELECT_ROOTS);
ResultSet rootsResultSet = selectAllStatement.executeQuery();
while (rootsResultSet.next())
{
Skill skill = rowToObject (null, rootsResultSet);
roots.add (skill);
}
}
finally
{
connection.close();
}
}
catch (SQLException sqlProblem)
{
throw new DAOException("Impossible de récupérer les compétences racines", sqlProblem);
}
return roots;
}

/**
Returns: Le singleton

getLevels

public SortedMap getLevels(SkillKey someSkillKey)
throws org.orange.util.integration.DAOException,
org.orange.kicsa.SkillNotFoundException

getParents

public Collection getParents(Skill someChildSkill)
throws org.orange.util.integration.DAOException
Parameters:
someChildSkill The skill you want to find parents of
Returns: Skills that have a parent-typed relationship with some skill

getSources

public Collection getSources(Skill someDestinationSkill, String someRelationshipType)
throws org.orange.util.integration.DAOException
Get skills linking to some skill with some relationship type


This method lookup in cache first, and then read if not found in cache; return them.


isCacheEnabled

public boolean isCacheEnabled()

link

public void link(Skill someFromSkill, String someType, SkillKey someToSkillKey)
throws org.orange.util.integration.DAOException
Crée une nouvelle relation entre deux compétences

readAll

public Map readAll()
throws org.orange.util.integration.DAOException
Returns: L'ensemble des noms courts de compétences persistantes, indexés par leur clé (Integer id)

readByPrimaryKey

public Skill readByPrimaryKey(SkillKey someKey)
throws org.orange.util.integration.DAOException,
org.orange.kicsa.SkillNotFoundException
Get a skill by its name

readLevels

public SortedMap readLevels(SkillKey someSkillKey)
throws org.orange.kicsa.SkillNotFoundException,
org.orange.util.integration.DAOException
Parameters:
someSkillKey La clé d'une compétence
Returns: Les descriptions (String) des niveaux de la compétence, indexés par leur rang (Integer)
See Also:
#stringToLevels

remove

public int remove(SkillKey someSkillKey)
throws org.orange.util.integration.DAOException
Supprime un enregistrement de compétence
Parameters:
someSkillKey La clé de la compétence à supprimer

removeRelationship

public void removeRelationship(SkillKey someSource, String someRelationshipType, SkillKey someDestination)
throws org.orange.util.integration.DAOException

removeRelationships

public int removeRelationships(SkillKey someSkillKey)
throws org.orange.util.integration.DAOException
Remove relationships to or from a skill
Parameters:
someSkillKey The key of the skill
Returns: The count of removed relationships

setCacheEnabled

public void setCacheEnabled(boolean someEnabledState)
throws org.orange.util.integration.DAOException

update

public Skill update(Skill someSkill)
throws org.orange.util.integration.DAOException
Met à jour une nouvelle compétence


Cette méthode ne prend pas en compte la mise à jour des relations de la compétence.

Parameters:
someSkill La compétence à enregistrer
Returns: La compétence enregistrée, avec sa clé générée (sauf si la clé est celle de la compétence racine)

updateRelationship

public void updateRelationship(SkillKey someSource, String someRelationshipType, SkillKey someDestination)
throws org.orange.util.integration.DAOException
Update a relationship between two skills

Association Links

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class org.orange.kicsa.integration.skill.SkillMemoryDAO

Cache

Supplier Qualifier cache

to Class java.lang.String

Création d'une nouvelle relation

to Class java.lang.String

Insère une nouvelle compétence

to Class java.lang.String

to Class java.lang.String

Récupère toutes les clés de compétences destinations pour une compétence donnée

public final static String SELECT_ALL_DESTINATIONS = SELECT + ID_TO + FROM + TABLE
+ WHERE + ID_FROM + "=?";

/**
Récupère toutes les clés de compétences sources pour un type de relation donné

public final static String RELATIONSHIP_SELECT_SOURCES
= SELECT + RELATIONSHIP_ID_FROM + FROM + RELATIONSHIP_TABLE
+ WHERE + RELATIONSHIP_ID_TO + "=?"
+ AND + RELATIONSHIP_TYPE+ "=?";

/** Récupère les clés, noms courts et longs des compétences parentes

to Class java.lang.String

Récupère les clés, noms courts et longs des compétences parentes

to Class java.lang.String

to Class java.lang.String

Recherche la plus grande clé.

Utilisé pour déterminer la clé d'un nouvel enregistrement : max + 1

to Class java.lang.String

to Class org.orange.kicsa.integration.skill.SkillJDBCDAO

Supplier Role instance

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

Modification d'un enregistrement de compétence

to Class java.lang.String

to Class java.lang.String

to Class java.lang.String

Récupère les clés, noms courts et longs des compétences parentes

Dependency Links

to Class test.org.orange.kicsa.integration.skill.TestSkillJDBCDAO

to Class org.orange.util.integration.JDBCDAO

to Class org.orange.kicsa.integration.skill.SkillDAO

to Class java.lang.String

to Class org.orange.util.integration.DAOException

to Class org.orange.kicsa.integration.skill.SkillMemoryDAO

to Class org.orange.kicsa.business.skill.Skill

to Class org.orange.kicsa.business.skill.SkillKey

to Class org.orange.util.Assert

to Class java.sql.Connection

to Class java.sql.PreparedStatement

to Class java.sql.SQLException

to Class org.orange.kicsa.Application

to Class java.util.Collection

to Class org.orange.kicsa.integration.skill.RelationshipTypeJDBCDAO

to Class java.util.Iterator

to Class java.util.HashSet

to Class java.util.Set

to Class java.sql.ResultSet

to Class java.util.ArrayList

to Class org.orange.kicsa.business.skill.Relationship

to Class java.lang.Throwable

to Class org.orange.kicsa.SkillNotFoundException

to Class java.util.SortedMap

to Class org.orange.kicsa.business.skill.SkillImpl

to Class org.orange.kicsa.business.skill.RelationshipImpl

to Class java.util.StringTokenizer

to Class java.util.List

to Class java.util.Map

to Class java.util.HashMap

to Class java.lang.Integer

to Class java.lang.StringBuffer

to Class java.util.Date

to Class java.lang.Class

to Class org.orange.kicsa.business.skill.SkillLevel

to Class java.util.TreeMap

to Class java.lang.NumberFormatException

to Class org.orange.kicsa.business.skill.SkillLevelImpl

to Class Diagram test.org.orange.kicsa.integration.skill

to Class Diagram test.org.orange.kicsa.integration

to Class Diagram test.org.orange.kicsa

to Class Diagram test.org.orange

to Class Diagram test.org

to Class Diagram test

to Class Diagram <default>

to Class Diagram org.orange.util.integration

to Class Diagram org.orange.util

to Class Diagram org.orange

to Class Diagram org

to Class Diagram org.orange.kicsa.integration.skill

to Class Diagram org.orange.kicsa.integration

to Class Diagram org.orange.kicsa

to Class Diagram org.orange.kicsa.business.skill

to Class Diagram org.orange.kicsa.business