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: 727 $ Last update: $Date: 2011-02-23 16:40:00 +0100 (mer. 23 févr. 2011) $ by : $Author: bpoussin $
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 checkColumnBinaryOrAlter()
          Add binary column if necessary If add can be done, wikitty work for all, except binary type
protected  void checkTableOrCreation()
          test table existance or create them if necessary
 WikittyEvent clear(WikittyTransaction transaction)
           
protected  Wikitty constructWikitty(WikittyTransaction transaction, String id, String version, String extensionList, ResultSet resultSet, String... fqFieldName)
          Create Wikitty from jdbc tables.
 WikittyEvent delete(WikittyTransaction transaction, Collection<String> ids)
           
 boolean exists(WikittyTransaction transaction, String id)
           
protected  String getColName(FieldType.TYPE type)
           
 WikittyStorage.DataStatistic getDataStatistic(WikittyTransaction transaction)
           
protected  boolean isAcceptedField(Set<String> acceptedField, String fqfieldName)
          Test if fqfieldName is in acceptedField
 boolean isDeleted(WikittyTransaction transaction, String id)
           
 Wikitty restore(WikittyTransaction transaction, String id, String... fqFieldName)
           
 void scanWikitties(WikittyTransaction transaction, WikittyStorage.Scanner scanner)
           
 WikittyEvent store(WikittyTransaction transaction, 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()
test table existance or create them if necessary


checkColumnBinaryOrAlter

protected void checkColumnBinaryOrAlter()
Add binary column if necessary If add can be done, wikitty work for all, except binary type


getColName

protected String getColName(FieldType.TYPE type)

store

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

exists

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

isDeleted

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

restore

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

delete

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

scanWikitties

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

constructWikitty

protected Wikitty constructWikitty(WikittyTransaction transaction,
                                   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 transaction)
Specified by:
clear in interface WikittyStorage

getDataStatistic

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


Copyright © 2009-2011 CodeLutin. All Rights Reserved.