Skip to content

Commit

Permalink
Merge pull request #9970 from IQSS/9507-show-linked-collections
Browse files Browse the repository at this point in the history
9507 show linked collections
  • Loading branch information
kcondon authored Oct 16, 2023
2 parents 3665752 + 15ac60e commit 2aa71fb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -3391,7 +3391,7 @@ public void saveLinkingDataverses(ActionEvent evt) {
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, BundleUtil.getStringFromBundle("dataset.notlinked"), linkingDataverseErrorMessage);
FacesContext.getCurrentInstance().addMessage(null, message);
}

alreadyLinkedDataverses = null; //force update to list of linked dataverses
}

private String linkingDataverseErrorMessage = "";
Expand Down Expand Up @@ -3427,7 +3427,23 @@ private Boolean saveLink(Dataverse dataverse){
}
return retVal;
}


private String alreadyLinkedDataverses = null;

public String getAlreadyLinkedDataverses(){
if (alreadyLinkedDataverses != null) {
return alreadyLinkedDataverses;
}
List<Dataverse> dataverseList = dataverseService.findDataversesThatLinkToThisDatasetId(dataset.getId());
for (Dataverse dv: dataverseList){
if (alreadyLinkedDataverses == null){
alreadyLinkedDataverses = dv.getCurrentName();
} else {
alreadyLinkedDataverses = alreadyLinkedDataverses + ", " + dv.getCurrentName();
}
}
return alreadyLinkedDataverses;
}

public List<Dataverse> completeLinkingDataverse(String query) {
dataset = datasetService.find(dataset.getId());
Expand Down
1 change: 1 addition & 0 deletions src/main/java/propertyFiles/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2498,6 +2498,7 @@ dataset.registered=DatasetRegistered
dataset.registered.msg=Your dataset is now registered.
dataset.notlinked=DatasetNotLinked
dataset.notlinked.msg=There was a problem linking this dataset to yours:
dataset.linking.popop.already.linked.note=Note: This dataset is already linked to the following dataverse(s):
datasetversion.archive.success=Archival copy of Version successfully submitted
datasetversion.archive.failure=Error in submitting an archival copy
datasetversion.update.failure=Dataset Version Update failed. Changes are still in the DRAFT version.
Expand Down
6 changes: 6 additions & 0 deletions src/main/webapp/dataset.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -1622,6 +1622,12 @@
</div>
</div>
</div>
<div>
<p:fragment rendered="#{!empty DatasetPage.alreadyLinkedDataverses}">
<h:outputLabel value="#{bundle['dataset.linking.popop.already.linked.note']}"/>&#160;
<h:outputText rendered="#{!empty DatasetPage.alreadyLinkedDataverses }" value="#{DatasetPage.alreadyLinkedDataverses}"/>
</p:fragment>
</div>
<div class="button-block">
<p:commandButton id="saveLinkButton" styleClass="btn btn-default"
update="linkNameContent @([id$=Messages])"
Expand Down

0 comments on commit 2aa71fb

Please sign in to comment.