public class LibIndex extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ATT_CLASSNAME |
static java.lang.String |
ATT_FOLDER |
static java.lang.String |
ATT_KARENTRYPATH |
static java.lang.String |
ATT_KARFILE |
static java.lang.String |
ATT_REPOPATH
Attribute names that are used to keep information about Library nodes.
|
static java.lang.String |
ATT_XMLFILE |
static java.lang.String |
LIBRARY_ATTRIBUTES_TABLE_NAME
the name of the table in the database used to store attributes
|
static java.lang.String |
LIBRARY_INDEX_TABLE_NAME
the name of the table in the database
|
static java.lang.String |
LIBRARY_LSIDS_TABLE_NAME
the name of the table in the database used to store attributes
|
static int |
TYPE_COMPONENT
Map of integers for the different types of objects that are stored in the
LIBRARY_INDEX table.
|
static int |
TYPE_CONCEPT |
static int |
TYPE_FOLDER |
static int |
TYPE_KAR |
static int |
TYPE_KAR_ERROR |
static int |
TYPE_KARFOLDER |
static int |
TYPE_LOCALREPO |
static int |
TYPE_NAMED_OBJ |
static int |
TYPE_OBJECT |
static int |
TYPE_ONTOLOGY |
Constructor and Description |
---|
LibIndex(java.sql.Connection conn)
A constructor that is given a connection to the database.
|
Modifier and Type | Method and Description |
---|---|
void |
addToSearchIndex(LibItem li)
Add the given LibItem to the search index.
|
LibItem |
assureKarEntry(KARCacheContent content)
Assures that the LibIndex row under the folder hierarchy exists for the
given KARCacheContent.
|
java.util.Vector<LibItem> |
assureOntologyComponent(KARCacheContent content)
Assures that the LibIndex rows for the KARCacheContent object exist under
the Ontology tree.
|
LibItem |
assureXML(java.io.File file) |
int |
checkIfDuplicate(LibItem li)
Take a LibItem and check to see if there is already an entry
in the sql table for it depending on the type,name,and parent.
|
int |
childExists(java.lang.Integer parentLiid,
java.lang.String childName)
Return true if there is a child of the parent in the index with the given
name.
|
void |
clear()
Delete all rows in the LIBRARY_INDEX table.
|
int |
countItems()
Count how many rows there are in the LIBRARY_INDEX table.
|
int |
determineLibIndexType(KARCacheContent content)
Determine the appropriate LibIndex type of the given KARCacheContent
|
LibItem |
findKar(java.io.File karFile) |
LibItem |
findXML(java.io.File file) |
java.util.Vector<LibItem> |
getItems()
Get all of the items.
|
java.util.Vector<LibItem> |
getItemsOfType(int type)
Get all items of the given type.
|
java.util.Vector<LibItem> |
getItemsOfType(int type,
int root)
Return items of the given type that are somewhere under the given root.
|
java.util.Vector<LibItem> |
getPath(LibItem li)
Returns a Vector of LibItems that are the parents of the given LibItem.
|
LibSearch |
getSearcher() |
boolean |
isOrderedInsert()
Return the current value of orderedInsert.
|
void |
rebuild()
Completely delete the library index and recreate it from the contents of
cached KARs.
|
boolean |
removeItem(int liid)
Remove all data from the index database that is associated with the given
Library Index ID and all of the data of it's children.
|
boolean |
removeItem(LibItem li)
Remove all data from the index database that is associated with the given
Library Item (using the Library Index ID) and all of the data of it's
children.
|
java.util.Vector<java.lang.Integer> |
removeItemsByLsid(KeplerLSID lsidToRemove)
This method will remove the given LSID from being associated with any of
the Library Items.
|
void |
setOrderedInsert(boolean orderedInsert)
In general orderedInsert should always be true.
|
void |
updateDefaultLsid(int liid,
KeplerLSID lsid)
Update the default LSID for the given LIID to the given LSID.
|
boolean |
verifyPreorderValues()
Sum the LFT and RGT columns and verify they are continuous integers from
1 to (countItems()*2).
|
public static final java.lang.String LIBRARY_INDEX_TABLE_NAME
public static final java.lang.String LIBRARY_LSIDS_TABLE_NAME
public static final java.lang.String LIBRARY_ATTRIBUTES_TABLE_NAME
public static final int TYPE_COMPONENT
public static final int TYPE_NAMED_OBJ
public static final int TYPE_ONTOLOGY
public static final int TYPE_CONCEPT
public static final int TYPE_FOLDER
public static final int TYPE_LOCALREPO
public static final int TYPE_KAR
public static final int TYPE_KAR_ERROR
public static final int TYPE_KARFOLDER
public static final int TYPE_OBJECT
public static final java.lang.String ATT_REPOPATH
public static final java.lang.String ATT_FOLDER
public static final java.lang.String ATT_KARENTRYPATH
public static final java.lang.String ATT_KARFILE
public static final java.lang.String ATT_XMLFILE
public static final java.lang.String ATT_CLASSNAME
public LibIndex(java.sql.Connection conn)
conn
- public boolean isOrderedInsert()
public void setOrderedInsert(boolean orderedInsert)
orderedInsert
- public void clear()
public void rebuild()
public void updateDefaultLsid(int liid, KeplerLSID lsid) throws java.sql.SQLException
liid
- lsid
- java.sql.SQLException
public boolean removeItem(int liid)
liid
- public boolean removeItem(LibItem li)
li
- public java.util.Vector<java.lang.Integer> removeItemsByLsid(KeplerLSID lsidToRemove) throws java.sql.SQLException
lsid
- java.sql.SQLException
public LibItem assureKarEntry(KARCacheContent content) throws java.sql.SQLException
content
- java.sql.SQLException
public int determineLibIndexType(KARCacheContent content)
kcc
- public java.util.Vector<LibItem> assureOntologyComponent(KARCacheContent content)
content
- public int countItems()
public java.util.Vector<LibItem> getPath(LibItem li) throws java.sql.SQLException
li
- java.sql.SQLException
public java.util.Vector<LibItem> getItemsOfType(int type)
type
- public java.util.Vector<LibItem> getItemsOfType(int type, int root)
type
- root
- public int checkIfDuplicate(LibItem li) throws java.sql.SQLException
li
- java.sql.SQLException
public void addToSearchIndex(LibItem li) throws java.sql.SQLException
li
- java.sql.SQLException
public LibSearch getSearcher()
public boolean verifyPreorderValues() throws java.sql.SQLException
java.sql.SQLException
public LibItem findKar(java.io.File karFile) throws java.sql.SQLException
karFile
- java.sql.SQLException
public LibItem findXML(java.io.File file) throws java.sql.SQLException
file
- java.sql.SQLException
public int childExists(java.lang.Integer parentLiid, java.lang.String childName)
parentLiid
- childName
-