Skip to content

Commit

Permalink
Merge pull request #78 from mderuijter/filter-inactive-licenses-from-…
Browse files Browse the repository at this point in the history
…dropdown-list

DD-482 Filter inactive licenses from dropdown list
  • Loading branch information
janvanmansum authored Jun 1, 2021
2 parents 71f6be2 + 55bd5a1 commit 8f1969c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -2049,7 +2049,7 @@ private String init(boolean initFull) {
previewTools = externalToolService.findFileToolsByType(ExternalTool.Type.PREVIEW);
datasetExploreTools = externalToolService.findDatasetToolsByType(ExternalTool.Type.EXPLORE);
rowsPerPage = 10;
licenseSelectItems = licenseServiceBean.listAll().stream()
licenseSelectItems = licenseServiceBean.listAllActive().stream()
.map(license -> new SelectItem(license.getId().toString(), license.getName()))
.collect(Collectors.toList());

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/License.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
*/
@NamedQueries({
@NamedQuery( name="License.findAll",
query="SELECT l FROM License l"),
query="SELECT l FROM License l"),
@NamedQuery( name="License.findAllActive",
query="SELECT l FROM License l WHERE l.active='true'"),
@NamedQuery( name="License.findById",
query = "SELECT l FROM License l WHERE l.id=:id"),
@NamedQuery( name="License.findByName",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public List<License> listAll() {
return em.createNamedQuery("License.findAll", License.class).getResultList();
}

public List<License> listAllActive() {
return em.createNamedQuery("License.findAllActive", License.class).getResultList();
}

public License getById(Long id) throws FetchException {
List<License> licenses = em.createNamedQuery("License.findById", License.class)
.setParameter("id", id )
Expand Down

0 comments on commit 8f1969c

Please sign in to comment.