org.nuiton.wikitty.jdbc
Class WikittyStorageJDBC

java.lang.Object
  extended by org.nuiton.wikitty.jdbc.WikittyStorageJDBC
All Implemented Interfaces:
WikittyStorage

public class WikittyStorageJDBC
extends Object
implements WikittyStorage

Version:
$Revision: 867 $ Last update: $Date: 2011-05-06 18:37:24 +0200 (ven., 06 mai 2011) $ by : $Author: sletellier $
Author:
morin

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.nuiton.wikitty.storage.WikittyStorage
WikittyStorage.DataStatistic, WikittyStorage.Scanner
 
Field Summary
protected  org.nuiton.util.ApplicationConfig config
           
protected  WikittyExtensionStorage extensionStorage
           
protected  Properties jdbcQuery
          Properties file
protected static org.apache.commons.logging.Log log
          to use log facility, just put in your code: log.info(\"...\");
 
Constructor Summary
WikittyStorageJDBC(org.nuiton.util.ApplicationConfig config, WikittyExtensionStorage extensionStorage)
           
 
Method Summary
protected  void checkTableOrCreation(WikittyTransaction tx)
          test table existance or create them if necessary
 WikittyEvent clear(WikittyTransaction tx)
           
protected  Wikitty constructWikitty(WikittyTransaction tx, String id, String version, String extensionList, ResultSet resultSet, String... fqFieldName)
          Create Wikitty from jdbc tables.
 WikittyEvent delete(WikittyTransaction tx, Collection<String> ids)
           
 boolean exists(WikittyTransaction tx, String id)
           
protected  String getColName(FieldType.TYPE type)
           
 WikittyStorage.DataStatistic getDataStatistic(WikittyTransaction tx)
           
protected  boolean isAcceptedField(Set<String> acceptedField, String fqfieldName)
          Test if fqfieldName is in acceptedField
 boolean isDeleted(WikittyTransaction tx, String id)
           
 Wikitty restore(WikittyTransaction tx, String id, String... fqFieldName)
           
 void scanWikitties(WikittyTransaction tx, WikittyStorage.Scanner scanner)
           
 WikittyEvent store(WikittyTransaction tx, Collection<Wikitty> wikitties, boolean force)
           
 
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.commons.logging.Log log
to use log facility, just put in your code: log.info(\"...\");


jdbcQuery

protected final Properties jdbcQuery
Properties file


config

protected org.nuiton.util.ApplicationConfig config

extensionStorage

protected WikittyExtensionStorage extensionStorage
Constructor Detail

WikittyStorageJDBC

public WikittyStorageJDBC(org.nuiton.util.ApplicationConfig config,
                          WikittyExtensionStorage extensionStorage)
Method Detail

checkTableOrCreation

protected void checkTableOrCreation(WikittyTransaction tx)
test table existance or create them if necessary


getColName

protected String getColName(FieldType.TYPE type)

store

public WikittyEvent store(WikittyTransaction tx,
                          Collection<Wikitty> wikitties,
                          boolean force)
                   throws WikittyException
Specified by:
store in interface WikittyStorage
Throws:
WikittyException

exists

public boolean exists(WikittyTransaction tx,
                      String id)
Specified by:
exists in interface WikittyStorage

isDeleted

public boolean isDeleted(WikittyTransaction tx,
                         String id)
Specified by:
isDeleted in interface WikittyStorage

restore

public Wikitty restore(WikittyTransaction tx,
                       String id,
                       String... fqFieldName)
                throws WikittyException
Specified by:
restore in interface WikittyStorage
Throws:
WikittyException

delete

public WikittyEvent delete(WikittyTransaction tx,
                           Collection<String> ids)
                    throws WikittyException
Specified by:
delete in interface WikittyStorage
Throws:
WikittyException

scanWikitties

public void scanWikitties(WikittyTransaction tx,
                          WikittyStorage.Scanner scanner)
Specified by:
scanWikitties in interface WikittyStorage

constructWikitty

protected Wikitty constructWikitty(WikittyTransaction tx,
                                   String id,
                                   String version,
                                   String extensionList,
                                   ResultSet resultSet,
                                   String... fqFieldName)
                            throws SQLException
Create Wikitty from jdbc tables.

Parameters:
id - the id of the wikitty to restore
version - the version of the wikitty to restore
extensionList - the list of the extensions of the wikitty to restore
resulSet - the ResultSet as the result of the selection of the in the data table
fqFieldName - minimum field to restore
Returns:
Throws:
SQLException

isAcceptedField

protected boolean isAcceptedField(Set<String> acceptedField,
                                  String fqfieldName)
Test if fqfieldName is in acceptedField

Parameters:
acceptedField - list of all accepted field
fqfieldName - fully qualified field name with potential [n/m] at end
Returns:
if fqfieldName without potential [n/m] is in acceptedField or if acceptedField is empty

clear

public WikittyEvent clear(WikittyTransaction tx)
Specified by:
clear in interface WikittyStorage

getDataStatistic

public WikittyStorage.DataStatistic getDataStatistic(WikittyTransaction tx)
Specified by:
getDataStatistic in interface WikittyStorage


Copyright © 2009-2011 CodeLutin. All Rights Reserved.