Skip to content

Commit

Permalink
small cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lbownik committed Dec 3, 2024
1 parent be8c5c3 commit 4570092
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@
import javax.inject.Named;
import java.io.IOException;
import java.util.List;
import java.util.logging.Logger;

/**
* Responsible for displaying messages and banners across the dataverse.
*/
@SuppressWarnings("serial")
@ViewScoped
@Named("MessagesAndBannersFragment")
public class MessagesAndBannersFragment implements java.io.Serializable {

private static final Logger logger = Logger.getLogger(MessagesAndBannersFragment.class.getCanonicalName());

@EJB
private DataverseTextMessageServiceBean textMessageService;

Expand All @@ -34,17 +32,19 @@ public class MessagesAndBannersFragment implements java.io.Serializable {


public List<String> textMessages(Long dataverseId) {
return textMessageService.getTextMessagesForDataverse(dataverseId, dataverseSession.getLocaleCode());
return textMessageService.getTextMessagesForDataverse(dataverseId,
dataverseSession.getLocaleCode());
}

public List<ImageWithLinkDto> banners(Long dataverseId) {
return bannerDAO.getBannersForDataverse(dataverseId, dataverseSession.getLocaleCode());
return bannerDAO.getBannersForDataverse(dataverseId,
dataverseSession.getLocaleCode());
}

public void redirect(String link) throws IOException {

if (!link.startsWith("http")) {
link = "http://" + link;
link = "http://".concat(link);
}
FacesContext.getCurrentInstance().getExternalContext().redirect(link);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ public List<String> getTextMessagesForDataverse(Long dataverseId, String localeC
public List<DataverseTextMessage> fetchAllTextMessagesForDataverse(long dataverseId) {
return em.createQuery("select dtm FROM DataverseTextMessage as dtm " +
"join fetch DataverseLocalizedMessage " +
"where dtm.dataverse.id = :dataverseid")
"where dtm.dataverse.id = :dataverseid",
DataverseTextMessage.class)
.setParameter("dataverseid", dataverseId)
.getResultList();
}
Expand All @@ -136,7 +137,8 @@ public List<DataverseTextMessage> fetchAllTextMessagesForDataverse(long datavers
public List<DataverseTextMessage> fetchTextMessagesForDataverseWithPaging(long dataverseId, int firstResult, int maxResult) {
return em.createQuery("select dtm FROM DataverseTextMessage as dtm " +
"join fetch DataverseLocalizedMessage " +
"where dtm.dataverse.id = :dataverseid order by dtm.id DESC ")
"where dtm.dataverse.id = :dataverseid order by dtm.id DESC ",
DataverseTextMessage.class)
.setParameter("dataverseid", dataverseId)
.setFirstResult(firstResult)
.setMaxResults(maxResult)
Expand Down

0 comments on commit 4570092

Please sign in to comment.