-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from diging/develop
CITE-138
- Loading branch information
Showing
8 changed files
with
112 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,6 @@ public interface Indexer { | |
|
||
void indexCitation(ICitation citation); | ||
|
||
void deleteCitation(ICitation citation); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
citesphere/src/main/java/edu/asu/diging/citesphere/core/service/ICitationStore.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package edu.asu.diging.citesphere.core.service; | ||
|
||
import java.util.Optional; | ||
|
||
import edu.asu.diging.citesphere.model.bib.ICitation; | ||
|
||
public interface ICitationStore { | ||
|
||
/** | ||
* Method to save citations. This method will also index | ||
* the citation before saving. | ||
* | ||
* @param citation Citation to be saved. | ||
* @return the saved Citation | ||
*/ | ||
ICitation save(ICitation citation); | ||
|
||
Optional<ICitation> findById(String id); | ||
|
||
void delete(ICitation citation); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
citesphere/src/main/java/edu/asu/diging/citesphere/core/service/impl/CitationStore.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package edu.asu.diging.citesphere.core.service.impl; | ||
|
||
import java.util.Optional; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import edu.asu.diging.citesphere.core.search.service.Indexer; | ||
import edu.asu.diging.citesphere.core.service.ICitationStore; | ||
import edu.asu.diging.citesphere.data.bib.CitationRepository; | ||
import edu.asu.diging.citesphere.model.bib.ICitation; | ||
import edu.asu.diging.citesphere.model.bib.impl.Citation; | ||
|
||
/** | ||
* Service class to store and retrieve {@link ICitation}s. | ||
* | ||
* @author Julia Damerow | ||
* | ||
*/ | ||
@Service | ||
public class CitationStore implements ICitationStore { | ||
|
||
@Autowired | ||
private CitationRepository citationRepository; | ||
|
||
@Autowired | ||
private Indexer indexer; | ||
|
||
/* (non-Javadoc) | ||
* @see edu.asu.diging.citesphere.core.service.impl.ICitationStore#save(edu.asu.diging.citesphere.model.bib.ICitation) | ||
*/ | ||
@Override | ||
public ICitation save(ICitation citation) { | ||
indexer.indexCitation(citation); | ||
return citationRepository.save((Citation) citation); | ||
} | ||
|
||
/* (non-Javadoc) | ||
* @see edu.asu.diging.citesphere.core.service.impl.ICitationStore#findById(java.lang.String) | ||
*/ | ||
@Override | ||
public Optional<ICitation> findById(String id) { | ||
return citationRepository.findByKey(id); | ||
} | ||
|
||
@Override | ||
public void delete(ICitation citation) { | ||
indexer.deleteCitation(citation); | ||
citationRepository.delete((Citation) citation); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters