public class SolrBrowseCreateDAO extends Object implements BrowseCreateDAO, SolrServiceIndexPlugin
| Constructor and Description |
|---|
SolrBrowseCreateDAO() |
SolrBrowseCreateDAO(Context context) |
| Modifier and Type | Method and Description |
|---|---|
void |
additionalIndex(Context context,
DSpaceObject dso,
org.apache.solr.common.SolrInputDocument doc) |
String |
createCollectionView(String table,
String view,
boolean execute)
Create the View of the full item index as seen from a collection.
|
String |
createCommunityView(String table,
String view,
boolean execute)
Create the View of the full item index as seen from a community
If the boolean execute is true this operation should be carried out, and if it is false
it should not.
|
String[] |
createDatabaseIndices(String table,
List<Integer> sortCols,
boolean value,
boolean execute)
Create any indices that the implementing DAO sees fit to maximise performance.
|
String |
createDistinctMap(String table,
String map,
boolean execute)
Create a table to hold a mapping between an item and a distinct metadata value that can appear
across multiple items (for example, author names).
|
String |
createDistinctTable(String table,
boolean execute)
Create the table which will hold the distinct metadata values that appear in multiple
items.
|
String[] |
createMapIndices(String disTable,
String mapTable,
boolean execute)
Create any indices that the implementing DAO sees fit to maximise performance.
|
String |
createPrimaryTable(String table,
List sortCols,
boolean execute)
Create the main index table.
|
String |
createSequence(String sequence,
boolean execute)
Create the sequence with the given name.
|
void |
deleteByItemID(String table,
int itemID)
Delete the record for the given item id from the specified table.
|
void |
deleteCommunityMappings(int itemID) |
List<Integer> |
deleteMappingsByItemID(String mapTable,
int itemID) |
String |
dropIndexAndRelated(String table,
boolean execute)
Drop the given table name, and all other resources that are attached to it.
|
String |
dropSequence(String sequence,
boolean execute)
Drop the given sequence name.
|
String |
dropView(String view,
boolean execute)
Drop the given view name.
|
int |
getDistinctID(String table,
String value,
String authority,
String sortValue)
Get the browse index's internal id for the location of the given string
and sort value in the given table.
|
int |
insertDistinctRecord(String table,
String value,
String authority,
String sortValue)
Insert the given value and sort value into the distinct index table.
|
void |
insertIndex(String table,
int itemID,
Map sortCols)
Insert an index record into the given table for the given item id.
|
void |
pruneDistinct(String table,
String map,
List<Integer> distinctIds)
So that there are no distinct values indexed which are no longer referenced from the
map table, this method checks for values which are not referenced from the map,
and removes them.
|
void |
pruneExcess(String table,
boolean withdrawn)
So that any left over indices for items which have been deleted can be assured to have
been removed, this method checks for indices for items which are not in the item table.
|
void |
pruneMapExcess(String map,
boolean withdrawn,
List<Integer> distinctIds)
So that any left over indices for items which have been deleted can be assured to have
been removed, this method checks for indices for items which are not in the item table.
|
boolean |
testTableExistence(String table)
Find out of a given table exists.
|
void |
updateCommunityMappings(int itemID) |
org.dspace.browse.MappingResults |
updateDistinctMappings(String table,
int itemID,
Set<Integer> distinctIDs)
Update a mapping between an item id and a distinct metadata field such as an author,
who can appear in multiple items.
|
boolean |
updateIndex(String table,
int itemID,
Map sortCols)
Updates an index record into the given table for the given item id.
|
public SolrBrowseCreateDAO()
public SolrBrowseCreateDAO(Context context) throws BrowseException
BrowseExceptionpublic void additionalIndex(Context context, DSpaceObject dso, org.apache.solr.common.SolrInputDocument doc)
additionalIndex in interface SolrServiceIndexPluginpublic void deleteByItemID(String table, int itemID) throws BrowseException
BrowseCreateDAOdeleteByItemID in interface BrowseCreateDAOtable - the browse table to remove the index fromitemID - the database id of the item to remove the index forBrowseExceptionpublic void deleteCommunityMappings(int itemID)
throws BrowseException
deleteCommunityMappings in interface BrowseCreateDAOBrowseExceptionpublic void updateCommunityMappings(int itemID)
throws BrowseException
updateCommunityMappings in interface BrowseCreateDAOBrowseExceptionpublic void insertIndex(String table, int itemID, Map sortCols) throws BrowseException
BrowseCreateDAO
Map map = new HashMap();
map.put(new Integer(1), "the title");
map.put(new Integer(2), "the subject");
BrowseCreateDAO dao = BrowseDAOFactory.getCreateInstance();
dao.insertIndex("index_1", 21, map);
insertIndex in interface BrowseCreateDAOtable - the browse table to insert the index initemID - the database id of the item being indexedsortCols - an Integer-String map of sort column numbers and valuesBrowseExceptionpublic boolean updateIndex(String table, int itemID, Map sortCols) throws BrowseException
BrowseCreateDAO
Map map = new HashMap();
map.put(new Integer(1), "the title");
map.put(new Integer(2), "the subject");
BrowseCreateDAO dao = BrowseDAOFactory.getCreateInstance();
dao.updateIndex("index_1", 21, map);
updateIndex in interface BrowseCreateDAOtable - the browse table to insert the index initemID - the database id of the item being indexedsortCols - an Integer-String map of sort column numbers and valuesBrowseExceptionpublic int getDistinctID(String table, String value, String authority, String sortValue) throws BrowseException
BrowseCreateDAO
BrowseCreateDAO dao = BrowseDAOFactory.getCreateInstance();
dao.createDistinctMapping("index_1_distinct_map", 21,
dao.getDistinctID("index_1_distinct", "Human Readable", "human readable"));
When it creates a distinct record, it would usually do so through insertDistinctRecord
defined below.getDistinctID in interface BrowseCreateDAOtable - the table in which to look for/create the idvalue - the value on which to searchsortValue - the sort value to use in case of the need to createBrowseExceptionpublic int insertDistinctRecord(String table, String value, String authority, String sortValue) throws BrowseException
BrowseCreateDAO
BrowseCreateDAO dao = BrowseDAOFactory.getCreateInstance();
dao.createDistinctMapping("index_1_distinct_map", 21,
dao.insertDistinctRecord("index_1_distinct", "Human Readable", "human readable"));
This is less good than using getDistinctID defined above, as if there is
already a distinct value in the table it may throw an exceptioninsertDistinctRecord in interface BrowseCreateDAOtable - the table into which to insert the recordvalue - the value to insertsortValue - the sort value to insertBrowseExceptionpublic String dropIndexAndRelated(String table, boolean execute) throws BrowseException
BrowseCreateDAOdropIndexAndRelated in interface BrowseCreateDAOtable - The table to dropexecute - Whether to action the removal or notBrowseExceptionpublic String dropSequence(String sequence, boolean execute) throws BrowseException
BrowseCreateDAOdropSequence in interface BrowseCreateDAOsequence - the sequence to dropexecute - whether to action the removal or notBrowseExceptionpublic String dropView(String view, boolean execute) throws BrowseException
BrowseCreateDAOdropView in interface BrowseCreateDAOview - the view to dropexecute - whether to action the removal or notBrowseExceptionpublic String createSequence(String sequence, boolean execute) throws BrowseException
BrowseCreateDAOcreateSequence in interface BrowseCreateDAOsequence - the sequence to createexecute - whether to action the create or notBrowseExceptionpublic String createPrimaryTable(String table, List sortCols, boolean execute) throws BrowseException
BrowseCreateDAO
List list = new ArrayList();
list.add(new Integer(1));
list.add(new Integer(2));
BrowseCreateDAO dao = BrowseDAOFactory.getCreateInstance();
dao.createPrimaryTable("index_1", list, true);
createPrimaryTable in interface BrowseCreateDAOtable - the raw table to createsortCols - a List of Integers numbering the sort columns requiredexecute - whether to action the create or notBrowseExceptionpublic String[] createDatabaseIndices(String table, List<Integer> sortCols, boolean value, boolean execute) throws BrowseException
BrowseCreateDAOcreateDatabaseIndices in interface BrowseCreateDAOtable - the table upon which to create indicessortCols - TODOexecute - whether to action the create or notBrowseExceptionpublic String[] createMapIndices(String disTable, String mapTable, boolean execute) throws BrowseException
BrowseCreateDAOcreateMapIndices in interface BrowseCreateDAOdisTable - the distinct table upon which to create indicesmapTable - the mapping table upon which to create indicesexecute - whether to action the create or notBrowseExceptionpublic String createCollectionView(String table, String view, boolean execute) throws BrowseException
BrowseCreateDAOcreateCollectionView in interface BrowseCreateDAOtable - the table to create the view onview - the name of the view to createexecute - whether to action the create or notBrowseExceptionpublic String createCommunityView(String table, String view, boolean execute) throws BrowseException
BrowseCreateDAOcreateCommunityView in interface BrowseCreateDAOtable - the table to create the view onview - the name of the view to createexecute - whether to action the create or notBrowseExceptionpublic String createDistinctTable(String table, boolean execute) throws BrowseException
BrowseCreateDAOcreateDistinctTable in interface BrowseCreateDAOtable - the table to createexecute - whether to action the create or notBrowseExceptionpublic String createDistinctMap(String table, String map, boolean execute) throws BrowseException
BrowseCreateDAOcreateDistinctMap in interface BrowseCreateDAOtable - the name of the distinct table which holds the target of the mappingmap - the name of the mapping table itselfexecute - whether to execute the query or notBrowseExceptionpublic org.dspace.browse.MappingResults updateDistinctMappings(String table, int itemID, Set<Integer> distinctIDs) throws BrowseException
BrowseCreateDAOupdateDistinctMappings in interface BrowseCreateDAOtable - the mapping tableitemID - the item iddistinctIDs - the id of the distinct recordBrowseExceptionpublic boolean testTableExistence(String table) throws BrowseException
BrowseCreateDAOtestTableExistence in interface BrowseCreateDAOtable - the table to testBrowseExceptionpublic List<Integer> deleteMappingsByItemID(String mapTable, int itemID) throws BrowseException
deleteMappingsByItemID in interface BrowseCreateDAOBrowseExceptionpublic void pruneExcess(String table, boolean withdrawn) throws BrowseException
BrowseCreateDAOpruneExcess in interface BrowseCreateDAOtable - the index table to checkwithdrawn - TODOBrowseExceptionpublic void pruneMapExcess(String map, boolean withdrawn, List<Integer> distinctIds) throws BrowseException
BrowseCreateDAOpruneMapExcess in interface BrowseCreateDAOmap - the name of the associated distinct mapping tablewithdrawn - TODOBrowseExceptionpublic void pruneDistinct(String table, String map, List<Integer> distinctIds) throws BrowseException
BrowseCreateDAOpruneDistinct in interface BrowseCreateDAOtable - the name of the distinct index tablemap - the name of the associated distinct mapping table.BrowseExceptionCopyright © 2014 DuraSpace. All Rights Reserved.