Skip to content

Commit

Permalink
simplify to just class name, not jakarta namespace #8305
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Aug 3, 2023
1 parent 911775b commit b689f67
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import jakarta.ejb.Stateless;
import jakarta.inject.Named;
import jakarta.persistence.EntityManager;
import jakarta.persistence.NoResultException;
import jakarta.persistence.PersistenceContext;
import jakarta.persistence.Query;
import jakarta.persistence.TypedQuery;
Expand Down Expand Up @@ -63,7 +64,7 @@ public DatasetLinkingDataverse findDatasetLinkingDataverse(Long datasetId, Long
.setParameter("datasetId", datasetId)
.setParameter("linkingDataverseId", linkingDataverseId)
.getSingleResult();
} catch (jakarta.persistence.NoResultException e) {
} catch (NoResultException e) {
logger.fine("no datasetLinkingDataverse found for datasetId " + datasetId + " and linkingDataverseId " + linkingDataverseId);
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public Dataset findByGlobalId(String globalId) {
* in the dataset components, a ConstraintViolationException will be thrown,
* which can be further parsed to detect the specific offending values.
* @param id the id of the dataset
* @throws jakarta.validation.ConstraintViolationException
* @throws ConstraintViolationException
*/

@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
Expand Down Expand Up @@ -398,7 +398,7 @@ public DatasetVersionUser getDatasetVersionUser(DatasetVersion version, User use
query.setParameter("userId", au.getId());
try {
return query.getSingleResult();
} catch (jakarta.persistence.NoResultException e) {
} catch (NoResultException e) {
return null;
}
}
Expand Down Expand Up @@ -513,7 +513,7 @@ public List<DatasetLock> listLocks(DatasetLock.Reason lockType, AuthenticatedUse
}
try {
return query.getResultList();
} catch (jakarta.persistence.NoResultException e) {
} catch (NoResultException e) {
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import jakarta.json.Json;
import jakarta.json.JsonObjectBuilder;
import jakarta.persistence.EntityManager;
import jakarta.persistence.NoResultException;
import jakarta.persistence.PersistenceContext;
import jakarta.persistence.Query;
import jakarta.persistence.TypedQuery;
Expand Down Expand Up @@ -179,7 +180,7 @@ public DatasetVersion findByFriendlyVersionNumber(Long datasetId, String friendl
query.setParameter("majorVersionNumber", majorVersionNumber);
query.setParameter("minorVersionNumber", minorVersionNumber);
foundDatasetVersion = (DatasetVersion) query.getSingleResult();
} catch (jakarta.persistence.NoResultException e) {
} catch (NoResultException e) {
logger.warning("no ds version found: " + datasetId + " " + friendlyVersionNumber);
// DO nothing, just return null.
}
Expand Down Expand Up @@ -207,7 +208,7 @@ public DatasetVersion findByFriendlyVersionNumber(Long datasetId, String friendl
}
}
return retVal;
} catch (jakarta.persistence.NoResultException e) {
} catch (NoResultException e) {
logger.warning("no ds version found: " + datasetId + " " + friendlyVersionNumber);
// DO nothing, just return null.
}
Expand Down Expand Up @@ -434,7 +435,7 @@ private DatasetVersion getDatasetVersionByQuery(String queryString){
msg("Found: " + ds);
return ds;

} catch (jakarta.persistence.NoResultException e) {
} catch (NoResultException e) {
msg("DatasetVersion not found: " + queryString);
logger.log(Level.FINE, "DatasetVersion not found: {0}", queryString);
return null;
Expand Down Expand Up @@ -1200,7 +1201,7 @@ public List<DatasetVersion> getUnarchivedDatasetVersions(){
try {
List<DatasetVersion> dsl = em.createNamedQuery("DatasetVersion.findUnarchivedReleasedVersion", DatasetVersion.class).getResultList();
return dsl;
} catch (jakarta.persistence.NoResultException e) {
} catch (NoResultException e) {
logger.log(Level.FINE, "No unarchived DatasetVersions found: {0}");
return null;
} catch (EJBException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private DvObject runFindByGlobalId(Query query, GlobalId gid, DvObject.DType dty
query.setParameter("authority", gid.getAuthority());
query.setParameter("dtype", dtype.getDType());
foundDvObject = (DvObject) query.getSingleResult();
} catch (jakarta.persistence.NoResultException e) {
} catch (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());
Expand All @@ -154,7 +154,7 @@ private Long runFindIdByGlobalId(Query query, GlobalId gid, DvObject.DType dtype
query.setParameter("authority", gid.getAuthority());
query.setParameter("dtype", dtype.getDType());
foundDvObject = (Long) query.getSingleResult();
} catch (jakarta.persistence.NoResultException e) {
} catch (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());
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/MailServiceBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import jakarta.mail.internet.MimeMessage;

import edu.harvard.iq.dataverse.validation.EMailValidator;
import jakarta.json.JsonObject;
import org.apache.commons.lang3.StringUtils;

/**
Expand Down Expand Up @@ -612,7 +613,7 @@ public String getMessageTextBasedOnNotification(UserNotification userNotificatio
case DATASETMENTIONED:
String additionalInfo = userNotification.getAdditionalInfo();
dataset = (Dataset) targetObject;
jakarta.json.JsonObject citingResource = null;
JsonObject citingResource = null;
citingResource = JsonUtil.getJsonObject(additionalInfo);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
import jakarta.ejb.EJB;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.context.FacesContext;
import jakarta.faces.event.AbortProcessingException;
import jakarta.faces.event.ActionEvent;
import jakarta.faces.event.AjaxBehaviorEvent;
import jakarta.faces.view.ViewScoped;
import jakarta.inject.Inject;
import jakarta.inject.Named;
Expand Down Expand Up @@ -325,7 +327,7 @@ public void setDisplayDownloadAll(boolean displayDownloadAll) {
this.displayDownloadAll = displayDownloadAll;
}

public String updateGuestbooksRoot(jakarta.faces.event.AjaxBehaviorEvent event) throws jakarta.faces.event.AbortProcessingException {
public String updateGuestbooksRoot(AjaxBehaviorEvent event) throws AbortProcessingException {
try {
dataverse = engineService.submit(
new UpdateDataverseGuestbookRootCommand(!isInheritGuestbooksValue(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import edu.harvard.iq.dataverse.util.BundleUtil;
import jakarta.faces.event.AbortProcessingException;
import jakarta.faces.event.AjaxBehaviorEvent;
/**
*
* @author skraffmiller
Expand Down Expand Up @@ -237,7 +239,7 @@ public void viewSelectedTemplate(Template selectedTemplate) {
tempPage.setTemplate(selectedTemplate);
}

public String updateTemplatesRoot(jakarta.faces.event.AjaxBehaviorEvent event) throws jakarta.faces.event.AbortProcessingException {
public String updateTemplatesRoot(AjaxBehaviorEvent event) throws AbortProcessingException {
try {
if (dataverse.getOwner() != null) {
if (isInheritTemplatesValue() && dataverse.getDefaultTemplate() == null && dataverse.getOwner().getDefaultTemplate() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import jakarta.persistence.PersistenceContext;

import edu.harvard.iq.dataverse.util.BundleUtil;
import jakarta.faces.event.AbortProcessingException;
import jakarta.faces.event.AjaxBehaviorEvent;
import org.apache.commons.text.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;

Expand Down Expand Up @@ -92,7 +94,7 @@ public void setInheritAssignments(boolean inheritAssignments) {
this.inheritAssignments = inheritAssignments;
}

public void updatePermissionRoot(jakarta.faces.event.AjaxBehaviorEvent event) throws jakarta.faces.event.AbortProcessingException {
public void updatePermissionRoot(AjaxBehaviorEvent event) throws AbortProcessingException {
try {
dvObject = commandEngine.submit(
new UpdatePermissionRootCommand(!inheritAssignments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import jakarta.ejb.EJB;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.FilterConfig;
import jakarta.servlet.ServletException;
Expand All @@ -24,7 +25,7 @@
* A web filter to block API administration calls.
* @author michael
*/
public class ApiBlockingFilter implements jakarta.servlet.Filter {
public class ApiBlockingFilter implements Filter {
public static final String UNBLOCK_KEY_QUERYPARAM = "unblock-key";

interface BlockPolicy {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/api/ApiRouter.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package edu.harvard.iq.dataverse.api;

import jakarta.servlet.Filter;
import java.io.IOException;
import java.util.logging.Logger;
import jakarta.servlet.FilterChain;
Expand All @@ -15,7 +16,7 @@
*
* @author michael
*/
public class ApiRouter implements jakarta.servlet.Filter {
public class ApiRouter implements Filter {
private static final Logger logger = Logger.getLogger(ApiRouter.class.getName());

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public Response showControlledVocabularyForSubject() {
@GET
@Path("loadNAControlledVocabularyValue")
public Response loadNAControlledVocabularyValue() {
// the find will throw a jakarta.persistence.NoResultException if no values are in db
// the find will throw a NoResultException if no values are in db
// datasetFieldService.findNAControlledVocabularyValue();
TypedQuery<ControlledVocabularyValue> naValueFinder = em.createQuery("SELECT OBJECT(o) FROM ControlledVocabularyValue AS o WHERE o.datasetFieldType is null AND o.strValue = :strvalue", ControlledVocabularyValue.class);
naValueFinder.setParameter("strvalue", DatasetField.NA_VALUE);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package edu.harvard.iq.dataverse.api.datadeposit;

import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
Expand All @@ -8,7 +9,7 @@
import jakarta.servlet.http.HttpServletRequestWrapper;
import java.io.IOException;

public class SwordFilter implements jakarta.servlet.Filter {
public class SwordFilter implements Filter {

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public BuiltinUser findByUserName(String userName) {
return em.createNamedQuery("BuiltinUser.findByUserName", BuiltinUser.class)
.setParameter("userName", userName)
.getSingleResult();
} catch (jakarta.persistence.NoResultException e) {
} catch (NoResultException e) {
return null;
} catch (NonUniqueResultException ex) {
logger.log(Level.WARNING, "multiple accounts found for username {0}", userName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ public JsonArray filesByType(Dataverse d) {
jab.add(stats);
}

} catch (jakarta.persistence.NoResultException nr) {
} catch (NoResultException nr) {
// do nothing
}
return jab.build();
Expand Down Expand Up @@ -518,7 +518,7 @@ public JsonArray fileDownloads(String yyyymm, Dataverse d, boolean uniqueCounts)
job.add(MetricsUtil.COUNT, (long) result[2]);
jab.add(job);
}
} catch (jakarta.persistence.NoResultException nr) {
} catch (NoResultException nr) {
// do nothing
}
return jab.build();
Expand Down Expand Up @@ -557,7 +557,7 @@ public JsonArray uniqueDatasetDownloads(String yyyymm, Dataverse d) {
jab.add(job);
}

} catch (jakarta.persistence.NoResultException nr) {
} catch (NoResultException nr) {
// do nothing
}
return jab.build();
Expand Down Expand Up @@ -717,7 +717,7 @@ public Metric getMetric(String name, String dataLocation, String dayString, Data
Metric metric = null;
try {
metric = (Metric) query.getSingleResult();
} catch (jakarta.persistence.NoResultException nr) {
} catch (NoResultException nr) {
// do nothing
logger.fine("No result");
} catch (NonUniqueResultException nur) {
Expand Down

0 comments on commit b689f67

Please sign in to comment.