Package org.dspace.discovery.indexobject
Class CommunityIndexFactoryImpl
- java.lang.Object
-
- org.dspace.discovery.indexobject.IndexFactoryImpl<T,S>
-
- org.dspace.discovery.indexobject.DSpaceObjectIndexFactoryImpl<IndexableCommunity,Community>
-
- org.dspace.discovery.indexobject.CommunityIndexFactoryImpl
-
- All Implemented Interfaces:
CommunityIndexFactory,DSpaceObjectIndexFactory<IndexableCommunity,Community>,IndexFactory<IndexableCommunity,Community>
public class CommunityIndexFactoryImpl extends DSpaceObjectIndexFactoryImpl<IndexableCommunity,Community> implements CommunityIndexFactory
Factory implementation for indexing/retrieving communities in the search core- Author:
- Kevin Van de Velde (kevin at atmire dot com)
-
-
Field Summary
Fields Modifier and Type Field Description protected CommunityServicecommunityService-
Fields inherited from class org.dspace.discovery.indexobject.IndexFactoryImpl
solrSearchCore, solrServiceIndexPlugins
-
-
Constructor Summary
Constructors Constructor Description CommunityIndexFactoryImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.solr.common.SolrInputDocumentbuildDocument(Context context, IndexableCommunity indexableObject)Create solr document with all the shared fields initialized.Iterator<IndexableCommunity>findAll(Context context)Retrieve all instances of a certain indexable object typeOptional<IndexableCommunity>findIndexableObject(Context context, String id)Retrieve a single indexable object using the provided identifierListgetIndexableObjects(Context context, Community object)Retrieve all the indexable objects for the provided objectList<String>getLocations(Context context, IndexableCommunity indexableDSpaceObject)Return a list of the identifiers from the parents for the provided IndexableObject, communities will be prepended by "m", collections b "c"StringgetType()Return the type of the indexable objectbooleansupports(Object object)Determine whether the class can handle the factory implementation-
Methods inherited from class org.dspace.discovery.indexobject.DSpaceObjectIndexFactoryImpl
addContainerMetadataField, storeCommunityCollectionLocations
-
Methods inherited from class org.dspace.discovery.indexobject.IndexFactoryImpl
addFacetIndex, addFacetIndex, addNamedResourceTypeIndex, delete, delete, deleteAll, writeDocument, writeDocument
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.dspace.discovery.indexobject.factory.DSpaceObjectIndexFactory
storeCommunityCollectionLocations
-
Methods inherited from interface org.dspace.discovery.indexobject.factory.IndexFactory
delete, delete, deleteAll, writeDocument
-
-
-
-
Field Detail
-
communityService
@Autowired(required=true) protected CommunityService communityService
-
-
Method Detail
-
findAll
public Iterator<IndexableCommunity> findAll(Context context) throws SQLException
Description copied from interface:IndexFactoryRetrieve all instances of a certain indexable object type- Specified by:
findAllin interfaceIndexFactory<IndexableCommunity,Community>- Parameters:
context- DSpace context object- Returns:
- An iterator containing all the objects to be indexed for the indexable object
- Throws:
SQLException- If database error
-
getType
public String getType()
Description copied from interface:IndexFactoryReturn the type of the indexable object- Specified by:
getTypein interfaceIndexFactory<IndexableCommunity,Community>- Returns:
- a string containing the type
-
buildDocument
public org.apache.solr.common.SolrInputDocument buildDocument(Context context, IndexableCommunity indexableObject) throws SQLException, IOException
Description copied from interface:IndexFactoryCreate solr document with all the shared fields initialized.- Specified by:
buildDocumentin interfaceIndexFactory<IndexableCommunity,Community>- Overrides:
buildDocumentin classDSpaceObjectIndexFactoryImpl<IndexableCommunity,Community>indexableObject- the indexableObject that we want to index- Returns:
- initialized solr document
- Throws:
SQLExceptionIOException
-
supports
public boolean supports(Object object)
Description copied from interface:IndexFactoryDetermine whether the class can handle the factory implementation- Specified by:
supportsin interfaceIndexFactory<IndexableCommunity,Community>- Parameters:
object- The object which we want to check- Returns:
- True if the factory implementation can handle the given object. False if it doesn't.
-
getIndexableObjects
public List getIndexableObjects(Context context, Community object)
Description copied from interface:IndexFactoryRetrieve all the indexable objects for the provided object- Specified by:
getIndexableObjectsin interfaceIndexFactory<IndexableCommunity,Community>- Parameters:
context- DSpace context objectobject- The object we want to retrieve our indexable objects for- Returns:
- A list of indexable objects
-
findIndexableObject
public Optional<IndexableCommunity> findIndexableObject(Context context, String id) throws SQLException
Description copied from interface:IndexFactoryRetrieve a single indexable object using the provided identifier- Specified by:
findIndexableObjectin interfaceIndexFactory<IndexableCommunity,Community>- Parameters:
context- DSpace context objectid- The identifier for which we want to retrieve our indexable object- Returns:
- An indexable object
- Throws:
SQLException- If database error
-
getLocations
public List<String> getLocations(Context context, IndexableCommunity indexableDSpaceObject) throws SQLException
Description copied from interface:DSpaceObjectIndexFactoryReturn a list of the identifiers from the parents for the provided IndexableObject, communities will be prepended by "m", collections b "c"- Specified by:
getLocationsin interfaceDSpaceObjectIndexFactory<IndexableCommunity,Community>- Parameters:
context- DSpace context object- Returns:
- A list of community identifiers with "m" prepended to every one
- Throws:
SQLException- If database error
-
-