openlsd.appli.autoimport.commonimport.LSDCommonFunctions Class Reference

Inheritance diagram for openlsd.appli.autoimport.commonimport.LSDCommonFunctions:

Inheritance graph
[legend]
Collaboration diagram for openlsd.appli.autoimport.commonimport.LSDCommonFunctions:

Collaboration graph
[legend]

List of all members.


Detailed Description

Class for common functions in Import methods

Author:
Frederic Bregier LGPL

Public Member Functions

 LSDCommonFunctions (ConcurrentLinkedQueue< LSDExtQueueMember > queue, ConcurrentLinkedQueue< LSDExtQueueMember > result, File file, boolean isBatch)
void setQueueb (ConcurrentLinkedQueue< LSDExtQueueMember > queue)
int tryImportOneFile (LSDDbAdmin admin, boolean isLocal, LSDExtQueueMember member, LSDDbLegacy legacy, FileChannel filechannelIn, LSDExtDbDocument document) throws LSDNoConnexionException, LSDImportNoActionException, LSDImportDbFileDelException, LSDImportDbDelException
LSDExtDbDocument tryImportOneNewFile (LSDDbAdmin admin, boolean isLocal, LSDExtQueueMember member, LSDDbLegacy legacy, FileChannel filechannelIn, long filesize)

Static Public Member Functions

static LSDExtDbDocument getDocument (LSDDbAdmin admin, long lid, LSDBusiness lsdb)
static boolean delDocument (LSDDbAdmin admin, LSDDbLegacy legacy, LSDExtDbDocument document)
static LSDExtDbDocument getNewStorageDocumentProcedureCommit (LSDDbAdmin admin, LSDDbLegacy legacy, long filesize, LSDBusiness lsdb, boolean sameLegacy, boolean isMove)
static LSDExtDbDocument[] getNewStorageDocumentsProcedureCommit (LSDDbAdmin admin, LSDDbLegacy legacy, LSDExtQueueMembers members, boolean sameLegacy, boolean isMove)
static boolean setNewStorageDocument (LSDDbAdmin admin, LSDDbLegacy legacy, LSDExtDbDocument document, LSDExtDbDocument documentnew, boolean inserted)
static boolean testPreviousFile (LSDDbAdmin admin, LSDExtQueueMember member, LSDDbLegacy legacy, LSDExtDbDocument document)

Static Public Attributes

static int nbblock = 20

Protected Member Functions

void setOutput (LSDDbAdmin admin, LSDDbLegacy legacy, LSDExtDbDocument document, LSDExtQueueMember member, String message, boolean status)

Static Protected Member Functions

static void closefile (FileChannel filechannelIn)

Protected Attributes

File file = null
boolean isBatch = true

Private Member Functions

void reopenfile (FileChannel filechannelIn)
void finishfile (LSDExtQueueMember member, String message)

Private Attributes

ConcurrentLinkedQueue
< LSDExtQueueMember
queue = null
ConcurrentLinkedQueue
< LSDExtQueueMember
result = null

Constructor & Destructor Documentation

openlsd.appli.autoimport.commonimport.LSDCommonFunctions.LSDCommonFunctions ( ConcurrentLinkedQueue< LSDExtQueueMember queue,
ConcurrentLinkedQueue< LSDExtQueueMember result,
File  file,
boolean  isBatch 
)

Constructor from args

Parameters:
queue 
result 
file 
isBatch 


Member Function Documentation

void openlsd.appli.autoimport.commonimport.LSDCommonFunctions.setQueueb ( ConcurrentLinkedQueue< LSDExtQueueMember queue  ) 

Constructor from args

Parameters:
queue 

static LSDExtDbDocument openlsd.appli.autoimport.commonimport.LSDCommonFunctions.getDocument ( LSDDbAdmin  admin,
long  lid,
LSDBusiness  lsdb 
) [static]

Get Document from args. lsdb object must contains unique index information.

Parameters:
admin 
lid 
lsdb 
Returns:
The Document if found, else null

static boolean openlsd.appli.autoimport.commonimport.LSDCommonFunctions.delDocument ( LSDDbAdmin  admin,
LSDDbLegacy  legacy,
LSDExtDbDocument  document 
) [static]

Del the document deleted when OK. It updates also the associated Storage

Parameters:
admin 
legacy 
document 
Returns:
True if deleted, else False

static LSDExtDbDocument openlsd.appli.autoimport.commonimport.LSDCommonFunctions.getNewStorageDocumentProcedureCommit ( LSDDbAdmin  admin,
LSDDbLegacy  legacy,
long  filesize,
LSDBusiness  lsdb,
boolean  sameLegacy,
boolean  isMove 
) [static]

Get New Storage for New Document. If it already exist, return false. This version uses a stored procedure: insertdoccommit. Commit is done once the storage is updated and document is inserted (must be updated manually after).

Parameters:
admin 
legacy 
filesize 
lsdb 
sameLegacy 
isMove 
Returns:
True if found, else False

static LSDExtDbDocument [] openlsd.appli.autoimport.commonimport.LSDCommonFunctions.getNewStorageDocumentsProcedureCommit ( LSDDbAdmin  admin,
LSDDbLegacy  legacy,
LSDExtQueueMembers  members,
boolean  sameLegacy,
boolean  isMove 
) [static]

Get New Storage for a set of New Documents. If they already exist, return null. This version uses a stored procedure: insertdocscommit. Commit is done once the storage is updated and all documents are inserted at all (must be updated manually after). (only LSDConstants.NBLINEOP members can be handle at a time due to a limitation of VARCHAR2 as out in PL/SQL procedures)

Parameters:
admin 
legacy 
members 
sameLegacy 
isMove 
Returns:
True if found, else False

Reimplemented in openlsd.multiple.autoimport.commonimport.LSDCommonFunctionsExtOp.

static boolean openlsd.appli.autoimport.commonimport.LSDCommonFunctions.setNewStorageDocument ( LSDDbAdmin  admin,
LSDDbLegacy  legacy,
LSDExtDbDocument  document,
LSDExtDbDocument  documentnew,
boolean  inserted 
) [static]

Set New Storage for New Document if it was inserted, or Set Storage as its previous state and not Set Document

Parameters:
admin 
legacy 
document only in move (previous document)
documentnew in import
inserted 
Returns:
True if the update is correctly done, else False

static boolean openlsd.appli.autoimport.commonimport.LSDCommonFunctions.testPreviousFile ( LSDDbAdmin  admin,
LSDExtQueueMember  member,
LSDDbLegacy  legacy,
LSDExtDbDocument  document 
) [static]

During import, Test if previous files are really differents or not and remove the DB ref if it is really the same. If so, it try to remove the LSD file (which is in bad status). It does not remove any LSD File that has a valid entry in DB.

Parameters:
admin 
member 
legacy 
document 
Returns:
True if clean is done, else (if not all clean) false

static void openlsd.appli.autoimport.commonimport.LSDCommonFunctions.closefile ( FileChannel  filechannelIn  )  [static, protected]

Close the filechannelIn

Parameters:
filechannelIn 

void openlsd.appli.autoimport.commonimport.LSDCommonFunctions.reopenfile ( FileChannel  filechannelIn  )  [private]

Reset the position from beginning

Parameters:
filechannelIn 

void openlsd.appli.autoimport.commonimport.LSDCommonFunctions.finishfile ( LSDExtQueueMember  member,
String  message 
) [private]

finish task for current file (delete or not, set or not the OK/KO file)

Parameters:
member 
message 

void openlsd.appli.autoimport.commonimport.LSDCommonFunctions.setOutput ( LSDDbAdmin  admin,
LSDDbLegacy  legacy,
LSDExtDbDocument  document,
LSDExtQueueMember  member,
String  message,
boolean  status 
) [protected]

Set output according to the status (True ok, False wrong)

Parameters:
admin 
legacy 
document 
member 
message 
status 

int openlsd.appli.autoimport.commonimport.LSDCommonFunctions.tryImportOneFile ( LSDDbAdmin  admin,
boolean  isLocal,
LSDExtQueueMember  member,
LSDDbLegacy  legacy,
FileChannel  filechannelIn,
LSDExtDbDocument  document 
) throws LSDNoConnexionException, LSDImportNoActionException, LSDImportDbFileDelException, LSDImportDbDelException

Real Import of one file where all necessary info are already OK (directly from Block mode or from tryImportOneNewFile)

Parameters:
admin 
isLocal 
member 
legacy 
filechannelIn 
document 
Returns:
KO : 0 = nothing to do,1=del file+db,2=db,3=MINA no connect or OK : -1
Exceptions:
LSDNoConnexionException KO Mina no connect
LSDImportNoActionException Ko but no Action to do
LSDImportDbFileDelException KO need to delete Db and File
LSDImportDbDelException KO need to delete Db

Reimplemented in openlsd.multiple.autoimport.commonimport.LSDCommonFunctionsExtOp.

LSDExtDbDocument openlsd.appli.autoimport.commonimport.LSDCommonFunctions.tryImportOneNewFile ( LSDDbAdmin  admin,
boolean  isLocal,
LSDExtQueueMember  member,
LSDDbLegacy  legacy,
FileChannel  filechannelIn,
long  filesize 
)

Import 1 file by the simple way (not a set of files) so requests necessary info for this new file.

Parameters:
admin 
isLocal 
member 
legacy 
filechannelIn 
filesize 
Returns:
The LSDExtDbDocument or Null if an error occurs

Reimplemented in openlsd.multiple.autoimport.commonimport.LSDCommonFunctionsExtOp.


Member Data Documentation

Queue of work

Queue of results

File to import

Is import in Batch mode

Number of documents by block to import (20 is apparently optimal by testing); must be between 1 and 100


The documentation for this class was generated from the following file: