-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add enums for alt text datastreams, permissions. Add test coverage for datastream classes * Add minimal service for updating alt text. Add minimal controller for performing service. Add relation * Add alt text field to solr and add filter for indexing it. Add facet values to track when it is present. Add tests, plus some for cases that weren't previously covered * Add serialization of alt text field. Some cleanup of serialization, and added some additional test coverage * Add admin ui form for setting alt text * Fix how alt text is retrieved. Add missing annotation so that alt text indexes. Add alt text to search result field lists * Only submit text as body param, otherwise text gets duplicated * Use custom alt text for thumbnails if available * Start adding method for getting thumbnail record, so we can get the alt text at the same time * Add alt text during deposit. Make sending a message configurable, and allow for shared transfer session * Populate alt text for works from thumbnail object. Change accessCopiesService methods to work with object records and set alt text * Codeclimate and add missing property injection * Address comments and make input larger * Use different verb for link text versus image text, but use custom alt text for both
- Loading branch information
Showing
51 changed files
with
1,505 additions
and
115 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
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
50 changes: 50 additions & 0 deletions
50
indexing-solr/src/main/java/edu/unc/lib/boxc/indexing/solr/filter/SetAltTextFilter.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,50 @@ | ||
package edu.unc.lib.boxc.indexing.solr.filter; | ||
|
||
import edu.unc.lib.boxc.indexing.solr.exception.IndexingException; | ||
import edu.unc.lib.boxc.indexing.solr.indexing.DocumentIndexingPackage; | ||
import edu.unc.lib.boxc.model.api.exceptions.NotFoundException; | ||
import edu.unc.lib.boxc.model.api.objects.ContentObject; | ||
import edu.unc.lib.boxc.model.api.objects.FileObject; | ||
import edu.unc.lib.boxc.model.api.objects.RepositoryObjectLoader; | ||
import edu.unc.lib.boxc.model.fcrepo.ids.DatastreamPids; | ||
import org.apache.commons.io.IOUtils; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.io.IOException; | ||
|
||
import static java.nio.charset.StandardCharsets.UTF_8; | ||
|
||
/** | ||
* Filter which populates alt text for the object being indexed | ||
* | ||
* @author bbpennel | ||
*/ | ||
public class SetAltTextFilter implements IndexDocumentFilter { | ||
private static final Logger log = LoggerFactory.getLogger(SetAltTextFilter.class); | ||
private RepositoryObjectLoader repositoryObjectLoader; | ||
|
||
@Override | ||
public void filter(DocumentIndexingPackage dip) throws IndexingException { | ||
ContentObject contentObj = dip.getContentObject(); | ||
// object being indexed must be a file object | ||
if (!(contentObj instanceof FileObject)) { | ||
return; | ||
} | ||
|
||
try { | ||
var altTextPid = DatastreamPids.getAltTextPid(contentObj.getPid()); | ||
var altTextBinary = repositoryObjectLoader.getBinaryObject(altTextPid); | ||
var altText = IOUtils.toString(altTextBinary.getBinaryStream(), UTF_8); | ||
dip.getDocument().setAltText(altText); | ||
} catch (NotFoundException e) { | ||
log.debug("No alt text datastream found for {}", dip.getPid()); | ||
} catch (IOException e) { | ||
throw new IndexingException("Failed to retrieve alt text datastream for {}" + dip.getPid(), e); | ||
} | ||
} | ||
|
||
public void setRepositoryObjectLoader(RepositoryObjectLoader repositoryObjectLoader) { | ||
this.repositoryObjectLoader = repositoryObjectLoader; | ||
} | ||
} |
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
Oops, something went wrong.