Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused code #9915

Closed
wants to merge 11 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
package edu.harvard.iq.dataverse;

import jakarta.ejb.EJB;
import jakarta.enterprise.inject.spi.CDI;

import jakarta.faces.component.UIComponent;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/DashboardPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import java.util.logging.Logger;
import jakarta.ejb.EJB;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.context.FacesContext;
import jakarta.faces.view.ViewScoped;
import jakarta.inject.Inject;
import jakarta.inject.Named;
Expand Down
45 changes: 0 additions & 45 deletions src/main/java/edu/harvard/iq/dataverse/DataCitation.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import jakarta.ejb.EJBException;
Expand Down Expand Up @@ -680,49 +678,6 @@ private String formatURL(String text, String url, boolean html) {
}
}

/** This method flattens html for the textual export formats.
* It removes <b> and <i> tags, replaces <br>, <p> and headers <hX> with
* line breaks, converts lists to form where items start with an indented '* ',
* and converts links to simple text showing the label and, if different,
* the url in parenthesis after it. Since these operations may create
* multiple line breaks, a final step limits the changes and compacts multiple
* line breaks into one.
*
* @param html input string
* @return the flattened text output
*/
private String flattenHtml(String html) {
html = html.replaceAll("<[pP]>", "\r\n");
html = html.replaceAll("<\\/[pP]>", "\r\n");
html = html.replaceAll("<[hH]\\d>", "\r\n");
html = html.replaceAll("<\\/[hH]\\d>", "\r\n");
html = html.replaceAll("<[\\/]?[bB]>", "");
html = html.replaceAll("<[\\/]?[iI]>", "\r\n");

html = html.replaceAll("<[bB][rR][\\/]?>", "\r\n");
html = html.replaceAll("<[uU][lL]>", "\r\n");
html = html.replaceAll("<\\/[uU][lL]>", "\r\n");
html = html.replaceAll("<[lL][iI]>", "\t* ");
html = html.replaceAll("<\\/[lL][iI]>", "\r\n");
Pattern p = Pattern.compile("<a\\W+href=\\\"(.*?)\\\".*?>(.*?)<\\/a>");
Matcher m = p.matcher(html);
String url = null;
String label = null;
while(m.find()) {
url = m.group(1); // this variable should contain the link URL
label = m.group(2); // this variable should contain the label
//display either the label or label(url)
if(!url.equals(label)) {
label = label + "(" + url +")";
}
html = html.replaceFirst("<a\\W+href=\\\"(.*?)\\\".*?>(.*?)<\\/a>", label);
}
//Note, this does not affect single '\n' chars originally in the text
html=html.replaceAll("(\\r\\n?)+", "\r\n");

return html;
}

private Date getDateFrom(DatasetVersion dsv) {
Date citationDate = null;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package edu.harvard.iq.dataverse;

import java.util.logging.Logger;
import jakarta.ejb.EJB;
import jakarta.enterprise.inject.spi.CDI;

import jakarta.faces.component.UIComponent;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/DataTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.validation.constraints.Size;
import jakarta.persistence.OrderBy;

import edu.harvard.iq.dataverse.datavariable.DataVariable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

package edu.harvard.iq.dataverse;

import jakarta.ejb.EJB;
import jakarta.enterprise.inject.spi.CDI;
import jakarta.faces.component.UIComponent;
import jakarta.faces.context.FacesContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import jakarta.persistence.EntityManager;
import jakarta.persistence.NoResultException;
import jakarta.persistence.PersistenceContext;
import jakarta.persistence.Query;
import jakarta.persistence.TypedQuery;

/**
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -1811,10 +1811,6 @@ public boolean isShapefileType(FileMetadata fm) {
return fm.getDataFile().isShapefileType();
}

private void msg(String s){
// System.out.println(s);
}

private List<FileMetadata> displayFileMetadata;

public List<FileMetadata> getDisplayFileMetadata() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@

package edu.harvard.iq.dataverse;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Version;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import jakarta.ejb.TransactionAttributeType;
import jakarta.inject.Named;
import jakarta.persistence.EntityManager;
import jakarta.persistence.LockModeType;
import jakarta.persistence.NoResultException;
import jakarta.persistence.PersistenceContext;
import jakarta.persistence.Query;
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/edu/harvard/iq/dataverse/DatasetTopicClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

package edu.harvard.iq.dataverse;

import jakarta.persistence.Column;
import jakarta.persistence.Version;

/**
*
* @author skraffmiller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
package edu.harvard.iq.dataverse;

import jakarta.ejb.EJB;
import jakarta.enterprise.inject.spi.CDI;
import jakarta.faces.component.UIComponent;
import jakarta.faces.context.FacesContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,15 +440,6 @@ private void getTermsDifferences() {
}
}
}

private DifferenceSummaryItem createSummaryItem(){
return null;
}

private List addToSummaryGroup(String displayName, DifferenceSummaryItem differenceSummaryItem){

return null;
}

private List<String[]> addToTermsChangedList(List<String[]> listIn, String label, String origVal, String newVal) {
String[] diffArray;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/Dataverse.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import jakarta.persistence.OneToOne;
import jakarta.persistence.OrderBy;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

package edu.harvard.iq.dataverse;

import jakarta.ejb.EJB;
import jakarta.enterprise.inject.spi.CDI;
import jakarta.faces.component.UIComponent;
import jakarta.faces.context.FacesContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import jakarta.inject.Named;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import jakarta.persistence.Query;
import jakarta.persistence.TypedQuery;

/**
Expand Down
26 changes: 1 addition & 25 deletions src/main/java/edu/harvard/iq/dataverse/DataversePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -827,31 +827,7 @@ private List<String> getSuccessMessageArguments() {
return arguments;
}

@Deprecated
private SavedSearch createSavedOfCurrentDataverse(AuthenticatedUser savedSearchCreator) {
/**
* Please note that we are relying on the fact that the Solr ID of a
* dataverse never changes, unlike datasets and files, which will change
* from "dataset_10_draft" to "dataset_10" when published, for example.
*/
String queryForCurrentDataverse = SearchFields.ID + ":" + IndexServiceBean.solrDocIdentifierDataverse + dataverse.getId();
SavedSearch savedSearchToPersist = new SavedSearch(queryForCurrentDataverse, linkingDataverse, savedSearchCreator);
SavedSearch savedSearchCreated = savedSearchService.add(savedSearchToPersist);
return savedSearchCreated;
}

private SavedSearch createSavedSearchForChildren(AuthenticatedUser savedSearchCreator) {
String wildcardQuery = "*";
SavedSearch savedSearchToPersist = new SavedSearch(wildcardQuery, linkingDataverse, savedSearchCreator);
String dataversePath = dataverseService.determineDataversePath(dataverse);
String filterDownToSubtree = SearchFields.SUBTREE + ":\"" + dataversePath + "\"";
SavedSearchFilterQuery filterDownToSubtreeFilterQuery = new SavedSearchFilterQuery(filterDownToSubtree, savedSearchToPersist);
savedSearchToPersist.setSavedSearchFilterQueries(Arrays.asList(filterDownToSubtreeFilterQuery));
SavedSearch savedSearchCreated = savedSearchService.add(savedSearchToPersist);
return savedSearchCreated;
}

public String saveSavedSearch() {
public String saveSavedSearch() {
if (linkingDataverseId == null) {
JsfHelper.addErrorMessage(BundleUtil.getStringFromBundle("dataverse.link.select"));
return "";
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/edu/harvard/iq/dataverse/EditDatafilesPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -695,10 +695,6 @@ public String init() {
return null;
}

private void msg(String s) {
System.out.println(s);
}

/**
* For single file replacement, load the file to replace
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import static jakarta.ejb.TransactionAttributeType.SUPPORTS;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.ConstraintViolationException;

/**
Expand Down Expand Up @@ -197,12 +196,6 @@ public class EjbDataverseEngine {
public <R> R submitInNewTransaction(Command<R> aCommand) throws CommandException {
return submit(aCommand);
}

private DvObject getRetType(Object r){

return (DvObject) r;

}


@TransactionAttribute(SUPPORTS)
Expand Down
1 change: 0 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/FacetConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
package edu.harvard.iq.dataverse;

import jakarta.ejb.EJB;
import jakarta.enterprise.inject.spi.CDI;

import jakarta.faces.component.UIComponent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ public FileDownloadHelper() {
this.filesForRequestAccess = new ArrayList<>();
}

// See also @Size(max = 255) in GuestbookResponse
private boolean testResponseLength(String value) {
return !(value != null && value.length() > 255);
}

// This helper method is called from the Download terms/guestbook/etc. popup,
// when the user clicks the "ok" button. We use it, instead of calling
// downloadServiceBean directly, in order to differentiate between single
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import jakarta.inject.Named;
import jakarta.persistence.EntityManager;
import jakarta.persistence.PersistenceContext;
import jakarta.persistence.Query;
import jakarta.servlet.ServletOutputStream;
import jakarta.servlet.http.HttpServletResponse;

Expand Down
5 changes: 0 additions & 5 deletions src/main/java/edu/harvard/iq/dataverse/FilePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,10 @@
import jakarta.ejb.EJB;
import jakarta.ejb.EJBException;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.component.UIComponent;
import jakarta.faces.context.FacesContext;
import jakarta.faces.validator.ValidatorException;
import jakarta.faces.view.ViewScoped;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.json.JsonArray;
import jakarta.json.JsonObject;
import jakarta.json.JsonValue;
import jakarta.validation.ConstraintViolation;

import org.primefaces.PrimeFaces;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/GlobalId.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import java.net.URL;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
Expand Down Expand Up @@ -542,30 +541,6 @@ private List<Object[]> convertIntegerToLong(List<Object[]> list, int index) {
return list;
}

private String generateTempTableString(List<Long> datasetIds) {
// first step: create the temp table with the ids

em.createNativeQuery(" BEGIN; SET TRANSACTION READ WRITE; DROP TABLE IF EXISTS tempid; END;").executeUpdate();
em.createNativeQuery(" BEGIN; SET TRANSACTION READ WRITE; CREATE TEMPORARY TABLE tempid (tempid integer primary key, orderby integer); END;").executeUpdate();
em.createNativeQuery(" BEGIN; SET TRANSACTION READ WRITE; INSERT INTO tempid VALUES " + generateIDsforTempInsert(datasetIds) + "; END;").executeUpdate();
return "select tempid from tempid";
}

private String generateIDsforTempInsert(List<Long> idList) {
int count = 0;
StringBuilder sb = new StringBuilder();
Iterator<Long> iter = idList.iterator();
while (iter.hasNext()) {
Long id = iter.next();
sb.append("(").append(id).append(",").append(count++).append(")");
if (iter.hasNext()) {
sb.append(",");
}
}

return sb.toString();
}


public List<Object[]> findCustomResponsePerGuestbookResponse(Long gbrId) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
package edu.harvard.iq.dataverse;

import jakarta.ejb.EJB;
import jakarta.enterprise.inject.spi.CDI;

import jakarta.faces.component.UIComponent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package edu.harvard.iq.dataverse;

import edu.harvard.iq.dataverse.authorization.RoleAssignee;
import jakarta.ejb.EJB;
import jakarta.enterprise.inject.spi.CDI;

import jakarta.faces.component.UIComponent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,4 @@ private void msg(String s) {
//System.out.println(s);
}

private void msgt(String s) {
msg("-------------------------------");
msg(s);
msg("-------------------------------");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

package edu.harvard.iq.dataverse;

import jakarta.ejb.EJB;
import jakarta.enterprise.inject.spi.CDI;
import jakarta.faces.component.UIComponent;
import jakarta.faces.context.FacesContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.util.Map;
import jakarta.ejb.EJB;
import jakarta.enterprise.context.RequestScoped;
import jakarta.faces.view.ViewScoped;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import org.apache.commons.io.IOUtils;
Expand Down
Loading
Loading