|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface BrowseCreateDAO
Interface for any class wishing to provide a browse storage later. This particular Data Access Object deals with building and destroying the database, and inserting and removing content from it. There is an alternative class BrowseDAO which deals with Read-Only operations. If you implement this class, and you wish it to be loaded via the BrowseDAOFactory you must supply a constructor of the form: public BrowseCreateDAOImpl(Context context) {} Where Context is the DSpace Context object Where tables are referred to in this class, they can be obtained from the BrowseIndex class, which will answer queries given the context of the request on which table is the relevant target.
| Method Summary | |
|---|---|
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<Integer> 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<Integer,String> 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<Integer,String> sortCols)
Updates an index record into the given table for the given item id. |
| Method Detail |
|---|
void deleteByItemID(String table,
int itemID)
throws BrowseException
table - the browse table to remove the index fromitemID - the database id of the item to remove the index for
BrowseException
void deleteCommunityMappings(int itemID)
throws BrowseException
BrowseException
void updateCommunityMappings(int itemID)
throws BrowseException
BrowseException
void insertIndex(String table,
int itemID,
Map<Integer,String> sortCols)
throws BrowseException
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);
table - 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 values
BrowseException
boolean updateIndex(String table,
int itemID,
Map<Integer,String> sortCols)
throws BrowseException
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);
table - 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 values
BrowseException
int getDistinctID(String table,
String value,
String authority,
String sortValue)
throws BrowseException
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.
table - 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 create
BrowseException
int insertDistinctRecord(String table,
String value,
String authority,
String sortValue)
throws BrowseException
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 exception
table - the table into which to insert the recordvalue - the value to insertsortValue - the sort value to insert
BrowseException
org.dspace.browse.MappingResults updateDistinctMappings(String table,
int itemID,
Set<Integer> distinctIDs)
throws BrowseException
table - the mapping tableitemID - the item iddistinctIDs - the id of the distinct record
BrowseException
boolean testTableExistence(String table)
throws BrowseException
table - the table to test
BrowseException
String dropIndexAndRelated(String table,
boolean execute)
throws BrowseException
table - The table to dropexecute - Whether to action the removal or not
BrowseException
String dropSequence(String sequence,
boolean execute)
throws BrowseException
sequence - the sequence to dropexecute - whether to action the removal or not
BrowseException
String dropView(String view,
boolean execute)
throws BrowseException
view - the view to dropexecute - whether to action the removal or not
BrowseException
String createSequence(String sequence,
boolean execute)
throws BrowseException
sequence - the sequence to createexecute - whether to action the create or not
BrowseException
String createPrimaryTable(String table,
List<Integer> sortCols,
boolean execute)
throws BrowseException
List list = new ArrayList();
list.add(new Integer(1));
list.add(new Integer(2));
BrowseCreateDAO dao = BrowseDAOFactory.getCreateInstance();
dao.createPrimaryTable("index_1", list, true);
table - the raw table to createsortCols - a List of Integers numbering the sort columns requiredexecute - whether to action the create or not
BrowseException
String[] createDatabaseIndices(String table,
List<Integer> sortCols,
boolean value,
boolean execute)
throws BrowseException
table - the table upon which to create indicessortCols - TODOexecute - whether to action the create or not
BrowseException
String[] createMapIndices(String disTable,
String mapTable,
boolean execute)
throws BrowseException
disTable - the distinct table upon which to create indicesmapTable - the mapping table upon which to create indicesexecute - whether to action the create or not
BrowseException
String createCollectionView(String table,
String view,
boolean execute)
throws BrowseException
table - the table to create the view onview - the name of the view to createexecute - whether to action the create or not
BrowseException
String createCommunityView(String table,
String view,
boolean execute)
throws BrowseException
table - the table to create the view onview - the name of the view to createexecute - whether to action the create or not
BrowseException
List<Integer> deleteMappingsByItemID(String mapTable,
int itemID)
throws BrowseException
BrowseException
String createDistinctTable(String table,
boolean execute)
throws BrowseException
table - the table to createexecute - whether to action the create or not
BrowseException
String createDistinctMap(String table,
String map,
boolean execute)
throws BrowseException
table - 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 not
BrowseException
void pruneExcess(String table,
boolean withdrawn)
throws BrowseException
table - the index table to checkwithdrawn - TODO
BrowseException
void pruneMapExcess(String map,
boolean withdrawn,
List<Integer> distinctIds)
throws BrowseException
map - the name of the associated distinct mapping tablewithdrawn - TODO
BrowseException
void pruneDistinct(String table,
String map,
List<Integer> distinctIds)
throws BrowseException
table - the name of the distinct index tablemap - the name of the associated distinct mapping table.
BrowseException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||