Skip to content

Commit

Permalink
fix merge issues
Browse files Browse the repository at this point in the history
  • Loading branch information
qqmyers committed Aug 16, 2023
1 parent bc737b6 commit d876715
Show file tree
Hide file tree
Showing 10 changed files with 193 additions and 164 deletions.
3 changes: 0 additions & 3 deletions doc/release-notes/9558-async-indexing.md

This file was deleted.

3 changes: 2 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -1863,6 +1863,7 @@ private String init(boolean initFull) {
if (persistentId != null) {
setIdByPersistentId();
}

if (this.getId() != null) {
// Set Working Version and Dataset by Datasaet Id and Version

Expand All @@ -1877,7 +1878,7 @@ private String init(boolean initFull) {
// all we need, we are not using any of the entities produced
// below.

dataset = datasetService.findDeep(this.getId());
dataset = datasetService.find(this.getId());

if (dataset == null) {
logger.warning("No such dataset: "+dataset);
Expand Down
13 changes: 1 addition & 12 deletions src/main/java/edu/harvard/iq/dataverse/DvObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,6 @@ public String getDType() {
}
}

public enum DType {
Dataverse("Dataverse"), Dataset("Dataset"),DataFile("DataFile");

String dtype;
DType(String dt) {
dtype = dt;
}
public String getDType() {
return dtype;
}
}
public static final Visitor<String> NamePrinter = new Visitor<String>(){

@Override
Expand Down Expand Up @@ -196,7 +185,7 @@ public boolean isPreviewImageAvailable() {
public void setPreviewImageAvailable(boolean status) {
this.previewImageAvailable = status;
}

/**
* Indicates whether a previous attempt to generate a preview image has failed,
* regardless of size. This could be due to the file not being accessible, or a
Expand Down
73 changes: 0 additions & 73 deletions src/main/java/edu/harvard/iq/dataverse/DvObjectServiceBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,79 +179,6 @@ public DvObject findByGlobalId(GlobalId globalId) {
}
}

public boolean isGlobalIdLocallyUnique(GlobalId globalId) {
return em.createNamedQuery("DvObject.findByProtocolIdentifierAuthority")
.setParameter("identifier", globalId.getIdentifier())
.setParameter("authority", globalId.getAuthority())
.setParameter("protocol", globalId.getProtocol())
.getResultList().isEmpty();
}

public DvObject findByAltGlobalId(GlobalId globalId, DvObject.DType dtype) {
Query query = em.createNamedQuery("DvObject.findByAlternativeGlobalId");
return runFindByGlobalId(query, globalId, dtype);
}

public Long findIdByGlobalId(GlobalId globalId, DvObject.DType dtype) {
Query query = em.createNamedQuery("DvObject.findIdByGlobalId");
return runFindIdByGlobalId(query, globalId, dtype);
}

public Long findIdByAltGlobalId(GlobalId globalId, DvObject.DType dtype) {
Query query = em.createNamedQuery("DvObject.findIdByAlternativeGlobalId");
return runFindIdByGlobalId(query, globalId, dtype);
}

private DvObject runFindByGlobalId(Query query, GlobalId gid, DvObject.DType dtype) {
DvObject foundDvObject = null;
try {
query.setParameter("identifier", gid.getIdentifier());
query.setParameter("protocol", gid.getProtocol());
query.setParameter("authority", gid.getAuthority());
query.setParameter("dtype", dtype.getDType());
foundDvObject = (DvObject) query.getSingleResult();
} catch (javax.persistence.NoResultException e) {
// (set to .info, this can fill the log file with thousands of
// these messages during a large harvest run)
logger.fine("no dvObject found: " + gid.asString());
// DO nothing, just return null.
return null;
} catch (Exception ex) {
logger.info("Exception caught in findByGlobalId: " + ex.getLocalizedMessage());
return null;
}

return foundDvObject;
}

private Long runFindIdByGlobalId(Query query, GlobalId gid, DvObject.DType dtype) {
Long foundDvObject = null;
try {
query.setParameter("identifier", gid.getIdentifier());
query.setParameter("protocol", gid.getProtocol());
query.setParameter("authority", gid.getAuthority());
query.setParameter("dtype", dtype.getDType());
foundDvObject = (Long) query.getSingleResult();
} catch (javax.persistence.NoResultException e) {
// (set to .info, this can fill the log file with thousands of
// these messages during a large harvest run)
logger.fine("no dvObject found: " + gid.asString());
// DO nothing, just return null.
return null;
} catch (Exception ex) {
logger.info("Exception caught in findByGlobalId: " + ex.getLocalizedMessage());
return null;
}
return foundDvObject;
}

public DvObject findByGlobalId(GlobalId globalId) {
return (DvObject) em.createNamedQuery("DvObject.findByProtocolIdentifierAuthority")
.setParameter("identifier", globalId.getIdentifier())
.setParameter("authority", globalId.getAuthority())
.setParameter("protocol", globalId.getProtocol()).getSingleResult();
}

public boolean isGlobalIdLocallyUnique(GlobalId globalId) {
return em.createNamedQuery("DvObject.findByProtocolIdentifierAuthority")
.setParameter("identifier", globalId.getIdentifier())
Expand Down
15 changes: 5 additions & 10 deletions src/main/java/edu/harvard/iq/dataverse/util/SessionUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@
public class SessionUtil {

/**
* Changes the session id (jsessionId) - for use when the session's authority
* increases (i.e. at login) Servlet 3.1 Note: This method is needed while using
* Servlets 2.0. 3.1 has a HttpServletRequest.chageSessionId(); method that can
* be used instead.
*
* @param h
* the current HttpServletRequest e.g. for pages you can get this
* from (HttpServletRequest)
* FacesContext.getCurrentInstance().getExternalContext().getRequest();
* Changes the session id (jsessionId) - for use when the session's authority increases (i.e. at login)
* Servlet 3.1 Note: This method is needed while using Servlets 2.0. 3.1 has a HttpServletRequest.chageSessionId(); method that can be used instead.
*
* @param h the current HttpServletRequest
* e.g. for pages you can get this from (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
*/
public static void changeSessionId(HttpServletRequest h) {
HttpSession session = h.getSession(false);
Expand All @@ -34,6 +30,5 @@ public static void changeSessionId(HttpServletRequest h) {
for (Entry<String, Object> entry : sessionAttributes.entrySet()) {
session.setAttribute(entry.getKey(), entry.getValue());
}

}
}
Loading

0 comments on commit d876715

Please sign in to comment.