From 2d0862f4749ca85751be67363c8a2477d20b823d Mon Sep 17 00:00:00 2001 From: Ben Companjen Date: Thu, 14 Sep 2023 13:57:14 +0200 Subject: [PATCH 1/9] Remove unused import statements This does not check for imports that are covered by `import *` --- .../ControlledVocabularyValueConverter.java | 1 - .../edu/harvard/iq/dataverse/DashboardPage.java | 1 - .../harvard/iq/dataverse/DataFileConverter.java | 1 - .../java/edu/harvard/iq/dataverse/DataTable.java | 1 - .../edu/harvard/iq/dataverse/DatasetConverter.java | 1 - .../iq/dataverse/DatasetLinkingServiceBean.java | 1 - .../harvard/iq/dataverse/DatasetRelMaterial.java | 7 ------- .../harvard/iq/dataverse/DatasetServiceBean.java | 1 - .../harvard/iq/dataverse/DatasetTopicClass.java | 3 --- .../iq/dataverse/DatasetVersionConverter.java | 1 - .../java/edu/harvard/iq/dataverse/Dataverse.java | 1 - .../harvard/iq/dataverse/DataverseConverter.java | 1 - .../iq/dataverse/DataverseLinkingServiceBean.java | 1 - .../harvard/iq/dataverse/EjbDataverseEngine.java | 1 - .../edu/harvard/iq/dataverse/FacetConverter.java | 1 - .../edu/harvard/iq/dataverse/FileDownload.java | 4 ---- .../iq/dataverse/FileDownloadServiceBean.java | 1 - .../java/edu/harvard/iq/dataverse/FilePage.java | 5 ----- .../java/edu/harvard/iq/dataverse/GlobalId.java | 1 - .../iq/dataverse/MetadataBlockConverter.java | 1 - .../iq/dataverse/RoleAssigneeConverter.java | 1 - .../harvard/iq/dataverse/TemplateConverter.java | 1 - .../iq/dataverse/ThumbnailServiceWrapper.java | 1 - .../iq/dataverse/UserNotificationServiceBean.java | 1 - .../java/edu/harvard/iq/dataverse/api/Access.java | 1 - .../edu/harvard/iq/dataverse/api/DataTagsAPI.java | 1 - .../edu/harvard/iq/dataverse/api/DownloadInfo.java | 1 - .../harvard/iq/dataverse/api/DownloadInstance.java | 1 - .../java/edu/harvard/iq/dataverse/api/Groups.java | 1 - .../iq/dataverse/api/HarvestingClients.java | 1 - .../edu/harvard/iq/dataverse/api/Metadata.java | 3 --- .../java/edu/harvard/iq/dataverse/api/Prov.java | 1 - .../edu/harvard/iq/dataverse/api/TestIngest.java | 1 - .../ConstraintViolationExceptionHandler.java | 1 - .../errorhandlers/JsonParseExceptionHandler.java | 1 - .../authorization/AuthenticationServiceBean.java | 1 - .../DataverseRolePermissionHelper.java | 3 --- .../authorization/groups/GroupServiceBean.java | 1 - .../providers/builtin/BuiltinUser.java | 1 - .../oauth2/OAuth2TokenDataServiceBean.java | 1 - .../providers/shib/ShibServiceBean.java | 1 - .../iq/dataverse/dataaccess/DataConverter.java | 8 -------- .../iq/dataverse/dataaccess/FileAccessIO.java | 2 -- .../dataverse/dataaccess/ImageThumbConverter.java | 1 - .../iq/dataverse/dataaccess/SwiftAccessIO.java | 1 - .../datasetutility/AddReplaceFileHelper.java | 1 - .../datasetutility/OptionalFileParams.java | 2 -- .../command/impl/AbstractCreateDatasetCommand.java | 7 ------- .../impl/AbstractSubmitToArchiveCommand.java | 1 - .../engine/command/impl/AssignRoleCommand.java | 1 - .../command/impl/ChangeUserIdentifierCommand.java | 1 - .../command/impl/CreateDataverseCommand.java | 6 ------ .../impl/CuratePublishedDatasetVersionCommand.java | 2 -- .../impl/DeaccessionDatasetVersionCommand.java | 6 ------ .../impl/DeleteDatasetLinkingDataverseCommand.java | 1 - .../command/impl/DeleteDatasetVersionCommand.java | 4 ---- .../engine/command/impl/DestroyDatasetCommand.java | 1 - .../impl/FinalizeDatasetPublicationCommand.java | 3 --- .../command/impl/GetDatasetStorageSizeCommand.java | 1 - .../GetDraftFileMetadataIfAvailableCommand.java | 1 - .../command/impl/GrantSuperuserStatusCommand.java | 2 -- .../engine/command/impl/ImportDatasetCommand.java | 3 --- .../engine/command/impl/LinkDatasetCommand.java | 3 --- .../engine/command/impl/LinkDataverseCommand.java | 1 - .../engine/command/impl/MergeInAccountCommand.java | 2 -- .../engine/command/impl/MoveDatasetCommand.java | 1 - .../engine/command/impl/MoveDataverseCommand.java | 3 --- .../engine/command/impl/PublishDatasetCommand.java | 6 ------ .../engine/command/impl/PublishDatasetResult.java | 1 - .../command/impl/PublishDataverseCommand.java | 1 - .../command/impl/RegisterDvObjectCommand.java | 4 ---- .../command/impl/ReturnDatasetToAuthorCommand.java | 4 ---- .../command/impl/RevokeSuperuserStatusCommand.java | 2 -- .../command/impl/SetCurationStatusCommand.java | 14 -------------- .../impl/SetDatasetCitationDateCommand.java | 4 ---- .../impl/SubmitDatasetForReviewCommand.java | 6 ------ .../command/impl/UpdateDatasetVersionCommand.java | 1 - .../command/impl/UpdateDataverseCommand.java | 1 - .../iq/dataverse/export/DCTermsExporter.java | 1 - .../harvard/iq/dataverse/export/DDIExporter.java | 1 - .../iq/dataverse/export/DublinCoreExporter.java | 1 - .../iq/dataverse/export/HtmlCodeBookExporter.java | 1 - .../harvard/iq/dataverse/export/JSONExporter.java | 1 - .../iq/dataverse/export/OAI_DDIExporter.java | 1 - .../iq/dataverse/export/OAI_OREExporter.java | 1 - .../iq/dataverse/export/OpenAireExporter.java | 1 - .../iq/dataverse/export/ddi/DdiExportUtil.java | 3 --- .../externaltools/ExternalToolServiceBean.java | 2 -- .../harvard/iq/dataverse/feedback/Feedback.java | 1 - .../dataverse/harvest/client/HarvestingClient.java | 3 --- .../iq/dataverse/harvest/server/OAISet.java | 2 -- .../harvard/iq/dataverse/ingest/IngestRequest.java | 1 - .../harvard/iq/dataverse/ingest/IngestUtil.java | 3 --- .../metadataextraction/FileMetadataExtractor.java | 4 +--- .../metadataextraction/FileMetadataIngest.java | 2 -- .../plugins/fits/FITSFileMetadataExtractorSpi.java | 2 -- .../ingest/plugin/spi/IngestServiceProvider.java | 1 - .../impl/plugins/csv/CSVFileReader.java | 3 --- .../impl/plugins/rdata/RDATAFileReader.java | 3 --- .../impl/plugins/sav/SAVFileReader.java | 3 --- .../iq/dataverse/mydata/DataRetrieverAPI.java | 1 - .../iq/dataverse/mydata/SolrQueryFormatter.java | 3 --- .../passwordreset/PasswordResetInitResponse.java | 4 ---- .../provenance/ProvEntityFileDataConverter.java | 1 - .../harvard/iq/dataverse/userdata/UserUtil.java | 4 ---- .../iq/dataverse/util/DatasetFieldWalker.java | 1 - .../edu/harvard/iq/dataverse/util/DateUtil.java | 3 --- .../harvard/iq/dataverse/util/WebloaderUtil.java | 3 --- .../iq/dataverse/util/json/JsonLDNamespace.java | 3 --- .../iq/dataverse/util/json/JsonPrinter.java | 2 -- .../internalspi/AuthorizedExternalStep.java | 3 --- .../workflow/internalspi/PauseWithMessageStep.java | 1 - .../edu/harvard/iq/dataverse/api/AccessIT.java | 2 -- .../harvard/iq/dataverse/api/FileMetadataIT.java | 1 - .../java/edu/harvard/iq/dataverse/api/FilesIT.java | 2 -- .../java/edu/harvard/iq/dataverse/api/RolesIT.java | 1 - .../edu/harvard/iq/dataverse/api/SearchIT.java | 1 - .../java/edu/harvard/iq/dataverse/api/UsersIT.java | 1 - .../java/edu/harvard/iq/dataverse/api/UtilIT.java | 2 -- .../iq/dataverse/dataaccess/S3AccessIOTest.java | 3 --- .../datasetutility/DuplicateFileCheckerTest.java | 1 - .../command/impl/CreatePrivateUrlCommandTest.java | 1 - .../command/impl/MoveDatasetCommandTest.java | 2 -- .../command/impl/MoveDataverseCommandTest.java | 2 -- .../impl/ReturnDatasetToAuthorCommandTest.java | 1 - .../iq/dataverse/export/ddi/DdiExportUtilTest.java | 1 - .../ingest/IngestableDataCheckerTest.java | 3 --- .../MakeDataCountLoggingServiceBeanTest.java | 1 - .../iq/dataverse/metrics/MetricsUtilTest.java | 3 --- .../dataverse/mydata/SolrQueryFormatterTest.java | 4 ---- .../iq/dataverse/sitemap/SiteMapUtilTest.java | 1 - .../harvard/iq/dataverse/util/StringUtilTest.java | 1 - .../validation/PasswordValidatorTest.java | 2 -- 133 files changed, 1 insertion(+), 274 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/ControlledVocabularyValueConverter.java b/src/main/java/edu/harvard/iq/dataverse/ControlledVocabularyValueConverter.java index eadc13721b3..9e94d6c1c00 100644 --- a/src/main/java/edu/harvard/iq/dataverse/ControlledVocabularyValueConverter.java +++ b/src/main/java/edu/harvard/iq/dataverse/ControlledVocabularyValueConverter.java @@ -5,7 +5,6 @@ */ package edu.harvard.iq.dataverse; -import jakarta.ejb.EJB; import jakarta.enterprise.inject.spi.CDI; import jakarta.faces.component.UIComponent; diff --git a/src/main/java/edu/harvard/iq/dataverse/DashboardPage.java b/src/main/java/edu/harvard/iq/dataverse/DashboardPage.java index c37c3f52bc7..b49bae4faa1 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DashboardPage.java +++ b/src/main/java/edu/harvard/iq/dataverse/DashboardPage.java @@ -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; diff --git a/src/main/java/edu/harvard/iq/dataverse/DataFileConverter.java b/src/main/java/edu/harvard/iq/dataverse/DataFileConverter.java index 701e826f12e..228f51bdfc2 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DataFileConverter.java +++ b/src/main/java/edu/harvard/iq/dataverse/DataFileConverter.java @@ -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; diff --git a/src/main/java/edu/harvard/iq/dataverse/DataTable.java b/src/main/java/edu/harvard/iq/dataverse/DataTable.java index a17d8c65138..836fae42602 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DataTable.java +++ b/src/main/java/edu/harvard/iq/dataverse/DataTable.java @@ -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; diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetConverter.java b/src/main/java/edu/harvard/iq/dataverse/DatasetConverter.java index b779e084250..8909899144c 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetConverter.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetConverter.java @@ -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; diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetLinkingServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/DatasetLinkingServiceBean.java index 39c82bfa3f1..514ecb1dc4d 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetLinkingServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetLinkingServiceBean.java @@ -13,7 +13,6 @@ import jakarta.persistence.EntityManager; import jakarta.persistence.NoResultException; import jakarta.persistence.PersistenceContext; -import jakarta.persistence.Query; import jakarta.persistence.TypedQuery; /** diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetRelMaterial.java b/src/main/java/edu/harvard/iq/dataverse/DatasetRelMaterial.java index 53ea62f566a..7b72e52ef4e 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetRelMaterial.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetRelMaterial.java @@ -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; /** diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/DatasetServiceBean.java index 52eb5868c35..cec9b3fabb4 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetServiceBean.java @@ -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; diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetTopicClass.java b/src/main/java/edu/harvard/iq/dataverse/DatasetTopicClass.java index 91a4ff3cf5a..53e2fee46cf 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetTopicClass.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetTopicClass.java @@ -6,9 +6,6 @@ package edu.harvard.iq.dataverse; -import jakarta.persistence.Column; -import jakarta.persistence.Version; - /** * * @author skraffmiller diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetVersionConverter.java b/src/main/java/edu/harvard/iq/dataverse/DatasetVersionConverter.java index b670fb18afc..633d28cb6fa 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetVersionConverter.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetVersionConverter.java @@ -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; diff --git a/src/main/java/edu/harvard/iq/dataverse/Dataverse.java b/src/main/java/edu/harvard/iq/dataverse/Dataverse.java index 682c1dc6744..3bb2e1b7f10 100644 --- a/src/main/java/edu/harvard/iq/dataverse/Dataverse.java +++ b/src/main/java/edu/harvard/iq/dataverse/Dataverse.java @@ -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; diff --git a/src/main/java/edu/harvard/iq/dataverse/DataverseConverter.java b/src/main/java/edu/harvard/iq/dataverse/DataverseConverter.java index d802117043b..489034ddeba 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DataverseConverter.java +++ b/src/main/java/edu/harvard/iq/dataverse/DataverseConverter.java @@ -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; diff --git a/src/main/java/edu/harvard/iq/dataverse/DataverseLinkingServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/DataverseLinkingServiceBean.java index 834ff96e392..8873cf2fa7a 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DataverseLinkingServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/DataverseLinkingServiceBean.java @@ -13,7 +13,6 @@ import jakarta.inject.Named; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; -import jakarta.persistence.Query; import jakarta.persistence.TypedQuery; /** diff --git a/src/main/java/edu/harvard/iq/dataverse/EjbDataverseEngine.java b/src/main/java/edu/harvard/iq/dataverse/EjbDataverseEngine.java index bad8903c091..2b7b54201c5 100644 --- a/src/main/java/edu/harvard/iq/dataverse/EjbDataverseEngine.java +++ b/src/main/java/edu/harvard/iq/dataverse/EjbDataverseEngine.java @@ -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; /** diff --git a/src/main/java/edu/harvard/iq/dataverse/FacetConverter.java b/src/main/java/edu/harvard/iq/dataverse/FacetConverter.java index fd41315dbc0..d627d2809f8 100644 --- a/src/main/java/edu/harvard/iq/dataverse/FacetConverter.java +++ b/src/main/java/edu/harvard/iq/dataverse/FacetConverter.java @@ -5,7 +5,6 @@ */ package edu.harvard.iq.dataverse; -import jakarta.ejb.EJB; import jakarta.enterprise.inject.spi.CDI; import jakarta.faces.component.UIComponent; diff --git a/src/main/java/edu/harvard/iq/dataverse/FileDownload.java b/src/main/java/edu/harvard/iq/dataverse/FileDownload.java index a79281f71f0..9cc52e2ad2f 100644 --- a/src/main/java/edu/harvard/iq/dataverse/FileDownload.java +++ b/src/main/java/edu/harvard/iq/dataverse/FileDownload.java @@ -7,17 +7,13 @@ import java.io.Serializable; import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; import jakarta.persistence.Id; import jakarta.persistence.Temporal; import jakarta.persistence.TemporalType; import jakarta.persistence.Transient; -import jakarta.persistence.CascadeType; import jakarta.persistence.OneToOne; import jakarta.persistence.MapsId; import jakarta.persistence.FetchType; -import jakarta.persistence.JoinColumn; import java.util.Date; diff --git a/src/main/java/edu/harvard/iq/dataverse/FileDownloadServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/FileDownloadServiceBean.java index e2b07717358..f0b7224a009 100644 --- a/src/main/java/edu/harvard/iq/dataverse/FileDownloadServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/FileDownloadServiceBean.java @@ -35,7 +35,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; diff --git a/src/main/java/edu/harvard/iq/dataverse/FilePage.java b/src/main/java/edu/harvard/iq/dataverse/FilePage.java index 49c904c3ac3..f8bfa0827a7 100644 --- a/src/main/java/edu/harvard/iq/dataverse/FilePage.java +++ b/src/main/java/edu/harvard/iq/dataverse/FilePage.java @@ -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; diff --git a/src/main/java/edu/harvard/iq/dataverse/GlobalId.java b/src/main/java/edu/harvard/iq/dataverse/GlobalId.java index 890b146a61c..626161c5aae 100644 --- a/src/main/java/edu/harvard/iq/dataverse/GlobalId.java +++ b/src/main/java/edu/harvard/iq/dataverse/GlobalId.java @@ -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; diff --git a/src/main/java/edu/harvard/iq/dataverse/MetadataBlockConverter.java b/src/main/java/edu/harvard/iq/dataverse/MetadataBlockConverter.java index 49c50e82efb..1c30dc3ac7f 100644 --- a/src/main/java/edu/harvard/iq/dataverse/MetadataBlockConverter.java +++ b/src/main/java/edu/harvard/iq/dataverse/MetadataBlockConverter.java @@ -5,7 +5,6 @@ */ package edu.harvard.iq.dataverse; -import jakarta.ejb.EJB; import jakarta.enterprise.inject.spi.CDI; import jakarta.faces.component.UIComponent; diff --git a/src/main/java/edu/harvard/iq/dataverse/RoleAssigneeConverter.java b/src/main/java/edu/harvard/iq/dataverse/RoleAssigneeConverter.java index 0d863f47324..f15acc1af47 100644 --- a/src/main/java/edu/harvard/iq/dataverse/RoleAssigneeConverter.java +++ b/src/main/java/edu/harvard/iq/dataverse/RoleAssigneeConverter.java @@ -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; diff --git a/src/main/java/edu/harvard/iq/dataverse/TemplateConverter.java b/src/main/java/edu/harvard/iq/dataverse/TemplateConverter.java index 1d855e029ce..b92f1638417 100644 --- a/src/main/java/edu/harvard/iq/dataverse/TemplateConverter.java +++ b/src/main/java/edu/harvard/iq/dataverse/TemplateConverter.java @@ -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; diff --git a/src/main/java/edu/harvard/iq/dataverse/ThumbnailServiceWrapper.java b/src/main/java/edu/harvard/iq/dataverse/ThumbnailServiceWrapper.java index 319ae06eefb..8b4c797ad6c 100644 --- a/src/main/java/edu/harvard/iq/dataverse/ThumbnailServiceWrapper.java +++ b/src/main/java/edu/harvard/iq/dataverse/ThumbnailServiceWrapper.java @@ -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; diff --git a/src/main/java/edu/harvard/iq/dataverse/UserNotificationServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/UserNotificationServiceBean.java index a2a71ff8b40..f27d004c0b1 100644 --- a/src/main/java/edu/harvard/iq/dataverse/UserNotificationServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/UserNotificationServiceBean.java @@ -18,7 +18,6 @@ import jakarta.ejb.Stateless; import jakarta.ejb.TransactionAttribute; import jakarta.ejb.TransactionAttributeType; -import jakarta.inject.Inject; import jakarta.inject.Named; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; diff --git a/src/main/java/edu/harvard/iq/dataverse/api/Access.java b/src/main/java/edu/harvard/iq/dataverse/api/Access.java index 0341f8c1127..9061387fd22 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/Access.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/Access.java @@ -122,7 +122,6 @@ import static edu.harvard.iq.dataverse.util.json.JsonPrinter.json; import java.net.URISyntaxException; -import jakarta.json.JsonObjectBuilder; import jakarta.ws.rs.RedirectionException; import jakarta.ws.rs.ServerErrorException; import jakarta.ws.rs.core.MediaType; diff --git a/src/main/java/edu/harvard/iq/dataverse/api/DataTagsAPI.java b/src/main/java/edu/harvard/iq/dataverse/api/DataTagsAPI.java index d7c8bd827d1..4a409c07fe8 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/DataTagsAPI.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/DataTagsAPI.java @@ -8,7 +8,6 @@ import jakarta.ejb.EJB; import jakarta.ejb.Stateless; import jakarta.json.JsonObject; -import jakarta.ws.rs.GET; import jakarta.ws.rs.POST; import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; diff --git a/src/main/java/edu/harvard/iq/dataverse/api/DownloadInfo.java b/src/main/java/edu/harvard/iq/dataverse/api/DownloadInfo.java index aa67f358a63..8d1a82b06b8 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/DownloadInfo.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/DownloadInfo.java @@ -20,7 +20,6 @@ package edu.harvard.iq.dataverse.api; -import java.io.File; import java.util.List; import java.util.ArrayList; diff --git a/src/main/java/edu/harvard/iq/dataverse/api/DownloadInstance.java b/src/main/java/edu/harvard/iq/dataverse/api/DownloadInstance.java index e9f869ad8b9..bc0454da165 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/DownloadInstance.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/DownloadInstance.java @@ -14,7 +14,6 @@ import java.util.logging.Logger; import edu.harvard.iq.dataverse.dataaccess.OptionalAccessService; -import jakarta.faces.context.FacesContext; import jakarta.ws.rs.core.HttpHeaders; import jakarta.ws.rs.core.UriInfo; diff --git a/src/main/java/edu/harvard/iq/dataverse/api/Groups.java b/src/main/java/edu/harvard/iq/dataverse/api/Groups.java index d56a787c7ff..1ac5bc1898d 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/Groups.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/Groups.java @@ -10,7 +10,6 @@ import edu.harvard.iq.dataverse.util.json.JsonParser; import jakarta.ejb.Stateless; -import jakarta.interceptor.Interceptors; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.core.Response; diff --git a/src/main/java/edu/harvard/iq/dataverse/api/HarvestingClients.java b/src/main/java/edu/harvard/iq/dataverse/api/HarvestingClients.java index d7eec9f5757..c21c80c473c 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/HarvestingClients.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/HarvestingClients.java @@ -16,7 +16,6 @@ import edu.harvard.iq.dataverse.util.StringUtil; import edu.harvard.iq.dataverse.util.json.JsonParseException; import edu.harvard.iq.dataverse.util.json.JsonPrinter; -import jakarta.json.JsonObjectBuilder; import static edu.harvard.iq.dataverse.util.json.NullSafeJsonBuilder.jsonObjectBuilder; import java.io.IOException; import java.io.StringReader; diff --git a/src/main/java/edu/harvard/iq/dataverse/api/Metadata.java b/src/main/java/edu/harvard/iq/dataverse/api/Metadata.java index bd937878286..f69b44c59a7 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/Metadata.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/Metadata.java @@ -10,9 +10,6 @@ import java.util.logging.Logger; import jakarta.ejb.EJB; -import jakarta.json.Json; -import jakarta.json.JsonArrayBuilder; -import jakarta.json.JsonObjectBuilder; import jakarta.ws.rs.*; import jakarta.ws.rs.core.Response; diff --git a/src/main/java/edu/harvard/iq/dataverse/api/Prov.java b/src/main/java/edu/harvard/iq/dataverse/api/Prov.java index 37b4792920f..488c02d02cb 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/Prov.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/Prov.java @@ -15,7 +15,6 @@ import java.io.StringReader; import java.util.HashMap; import java.util.logging.Logger; -import jakarta.inject.Inject; import jakarta.json.Json; import jakarta.json.JsonException; import jakarta.json.JsonObject; diff --git a/src/main/java/edu/harvard/iq/dataverse/api/TestIngest.java b/src/main/java/edu/harvard/iq/dataverse/api/TestIngest.java index 05ba150df8e..2d17ec3a672 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/TestIngest.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/TestIngest.java @@ -27,7 +27,6 @@ import java.nio.file.StandardCopyOption; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.HttpHeaders; diff --git a/src/main/java/edu/harvard/iq/dataverse/api/errorhandlers/ConstraintViolationExceptionHandler.java b/src/main/java/edu/harvard/iq/dataverse/api/errorhandlers/ConstraintViolationExceptionHandler.java index bb57059a99a..3725c8c35f4 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/errorhandlers/ConstraintViolationExceptionHandler.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/errorhandlers/ConstraintViolationExceptionHandler.java @@ -3,7 +3,6 @@ import jakarta.json.Json; import jakarta.json.JsonArray; import jakarta.json.JsonArrayBuilder; -import jakarta.json.JsonObject; import jakarta.validation.ConstraintViolation; import jakarta.validation.ConstraintViolationException; import jakarta.ws.rs.core.MediaType; diff --git a/src/main/java/edu/harvard/iq/dataverse/api/errorhandlers/JsonParseExceptionHandler.java b/src/main/java/edu/harvard/iq/dataverse/api/errorhandlers/JsonParseExceptionHandler.java index 2f974a1c5be..433991eef10 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/errorhandlers/JsonParseExceptionHandler.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/errorhandlers/JsonParseExceptionHandler.java @@ -4,7 +4,6 @@ import jakarta.json.Json; import jakarta.servlet.http.HttpServletRequest; -import jakarta.ws.rs.BadRequestException; import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; diff --git a/src/main/java/edu/harvard/iq/dataverse/authorization/AuthenticationServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/authorization/AuthenticationServiceBean.java index 106a83a4ad1..816e808abc1 100644 --- a/src/main/java/edu/harvard/iq/dataverse/authorization/AuthenticationServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/authorization/AuthenticationServiceBean.java @@ -44,7 +44,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; -import jakarta.annotation.PostConstruct; import jakarta.ejb.EJB; import jakarta.ejb.EJBException; import jakarta.ejb.Stateless; diff --git a/src/main/java/edu/harvard/iq/dataverse/authorization/DataverseRolePermissionHelper.java b/src/main/java/edu/harvard/iq/dataverse/authorization/DataverseRolePermissionHelper.java index 966247bce2e..ad51eeccf29 100644 --- a/src/main/java/edu/harvard/iq/dataverse/authorization/DataverseRolePermissionHelper.java +++ b/src/main/java/edu/harvard/iq/dataverse/authorization/DataverseRolePermissionHelper.java @@ -12,9 +12,6 @@ import java.util.Map.Entry; import java.util.Set; import java.util.logging.Logger; -import jakarta.ejb.EJB; -import jakarta.ejb.Stateless; -import jakarta.inject.Named; import org.apache.commons.lang3.StringUtils; /* diff --git a/src/main/java/edu/harvard/iq/dataverse/authorization/groups/GroupServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/authorization/groups/GroupServiceBean.java index a746eee0a60..61a9eb9170b 100644 --- a/src/main/java/edu/harvard/iq/dataverse/authorization/groups/GroupServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/authorization/groups/GroupServiceBean.java @@ -29,7 +29,6 @@ import jakarta.annotation.PostConstruct; import jakarta.ejb.EJB; import jakarta.ejb.Stateless; -import jakarta.inject.Inject; import jakarta.inject.Named; /** diff --git a/src/main/java/edu/harvard/iq/dataverse/authorization/providers/builtin/BuiltinUser.java b/src/main/java/edu/harvard/iq/dataverse/authorization/providers/builtin/BuiltinUser.java index 2ce36997ea9..416add8b64e 100644 --- a/src/main/java/edu/harvard/iq/dataverse/authorization/providers/builtin/BuiltinUser.java +++ b/src/main/java/edu/harvard/iq/dataverse/authorization/providers/builtin/BuiltinUser.java @@ -18,7 +18,6 @@ import jakarta.persistence.Table; import jakarta.persistence.Transient; import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.Size; /** * diff --git a/src/main/java/edu/harvard/iq/dataverse/authorization/providers/oauth2/OAuth2TokenDataServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/authorization/providers/oauth2/OAuth2TokenDataServiceBean.java index b1dcb6df8cc..424aad38fc8 100644 --- a/src/main/java/edu/harvard/iq/dataverse/authorization/providers/oauth2/OAuth2TokenDataServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/authorization/providers/oauth2/OAuth2TokenDataServiceBean.java @@ -3,7 +3,6 @@ import java.util.List; import java.util.Optional; import jakarta.ejb.Stateless; -import jakarta.inject.Named; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; diff --git a/src/main/java/edu/harvard/iq/dataverse/authorization/providers/shib/ShibServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/authorization/providers/shib/ShibServiceBean.java index 0921b2c6683..31a4a4186eb 100644 --- a/src/main/java/edu/harvard/iq/dataverse/authorization/providers/shib/ShibServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/authorization/providers/shib/ShibServiceBean.java @@ -20,7 +20,6 @@ import java.util.UUID; import java.util.logging.Logger; import jakarta.ejb.EJB; -import jakarta.ejb.EJBException; import jakarta.ejb.Stateless; import jakarta.inject.Named; import jakarta.servlet.http.HttpServletRequest; diff --git a/src/main/java/edu/harvard/iq/dataverse/dataaccess/DataConverter.java b/src/main/java/edu/harvard/iq/dataverse/dataaccess/DataConverter.java index 2c60b51a525..2c8d18ee26e 100644 --- a/src/main/java/edu/harvard/iq/dataverse/dataaccess/DataConverter.java +++ b/src/main/java/edu/harvard/iq/dataverse/dataaccess/DataConverter.java @@ -27,13 +27,9 @@ import java.util.logging.Logger; -import org.apache.commons.io.IOUtils; - import java.util.List; import java.util.Map; import java.util.HashMap; -import java.util.Arrays; -import java.util.ArrayList; import java.util.LinkedHashMap; import edu.harvard.iq.dataverse.DataFile; @@ -44,15 +40,11 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStream; -import java.nio.channels.Channel; import java.nio.channels.Channels; import java.nio.channels.FileChannel; import java.nio.channels.ReadableByteChannel; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.HashSet; -import java.util.Set; -import java.util.logging.Level; diff --git a/src/main/java/edu/harvard/iq/dataverse/dataaccess/FileAccessIO.java b/src/main/java/edu/harvard/iq/dataverse/dataaccess/FileAccessIO.java index d95df1567bd..24426a47149 100644 --- a/src/main/java/edu/harvard/iq/dataverse/dataaccess/FileAccessIO.java +++ b/src/main/java/edu/harvard/iq/dataverse/dataaccess/FileAccessIO.java @@ -35,8 +35,6 @@ import java.util.List; import java.util.function.Predicate; import java.util.logging.Logger; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import java.util.stream.Collectors; // Dataverse imports: diff --git a/src/main/java/edu/harvard/iq/dataverse/dataaccess/ImageThumbConverter.java b/src/main/java/edu/harvard/iq/dataverse/dataaccess/ImageThumbConverter.java index 2b4aed3a9a5..b89dbc6c431 100644 --- a/src/main/java/edu/harvard/iq/dataverse/dataaccess/ImageThumbConverter.java +++ b/src/main/java/edu/harvard/iq/dataverse/dataaccess/ImageThumbConverter.java @@ -38,7 +38,6 @@ import edu.harvard.iq.dataverse.util.FileUtil; import edu.harvard.iq.dataverse.util.SystemConfig; import java.io.ByteArrayOutputStream; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.OutputStream; import java.nio.channels.Channel; diff --git a/src/main/java/edu/harvard/iq/dataverse/dataaccess/SwiftAccessIO.java b/src/main/java/edu/harvard/iq/dataverse/dataaccess/SwiftAccessIO.java index 6c84009de3e..638469d7be6 100644 --- a/src/main/java/edu/harvard/iq/dataverse/dataaccess/SwiftAccessIO.java +++ b/src/main/java/edu/harvard/iq/dataverse/dataaccess/SwiftAccessIO.java @@ -21,7 +21,6 @@ import java.util.Collection; import java.util.Formatter; import java.util.List; -import java.util.Properties; import java.util.function.Predicate; import java.util.logging.Logger; import java.util.stream.Collectors; diff --git a/src/main/java/edu/harvard/iq/dataverse/datasetutility/AddReplaceFileHelper.java b/src/main/java/edu/harvard/iq/dataverse/datasetutility/AddReplaceFileHelper.java index 98d5afc47e6..0b33e49dd85 100644 --- a/src/main/java/edu/harvard/iq/dataverse/datasetutility/AddReplaceFileHelper.java +++ b/src/main/java/edu/harvard/iq/dataverse/datasetutility/AddReplaceFileHelper.java @@ -47,7 +47,6 @@ import java.util.logging.Level; import java.util.logging.Logger; -import jakarta.ejb.Asynchronous; import jakarta.ejb.EJBException; import jakarta.json.Json; import jakarta.json.JsonArrayBuilder; diff --git a/src/main/java/edu/harvard/iq/dataverse/datasetutility/OptionalFileParams.java b/src/main/java/edu/harvard/iq/dataverse/datasetutility/OptionalFileParams.java index 959dbc4e262..1334677f171 100644 --- a/src/main/java/edu/harvard/iq/dataverse/datasetutility/OptionalFileParams.java +++ b/src/main/java/edu/harvard/iq/dataverse/datasetutility/OptionalFileParams.java @@ -22,9 +22,7 @@ import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; -import java.util.ResourceBundle; import java.util.logging.Logger; -import java.util.stream.Collectors; /** * This is used in conjunction with the AddReplaceFileHelper diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/AbstractCreateDatasetCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/AbstractCreateDatasetCommand.java index 303d8e1c25f..6fb4d29577f 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/AbstractCreateDatasetCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/AbstractCreateDatasetCommand.java @@ -3,22 +3,15 @@ import edu.harvard.iq.dataverse.*; import edu.harvard.iq.dataverse.authorization.Permission; import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser; -import edu.harvard.iq.dataverse.batch.util.LoggingUtil; import edu.harvard.iq.dataverse.dataaccess.DataAccess; -import edu.harvard.iq.dataverse.datacapturemodule.DataCaptureModuleUtil; -import edu.harvard.iq.dataverse.datacapturemodule.ScriptRequestResponse; import edu.harvard.iq.dataverse.engine.command.CommandContext; import edu.harvard.iq.dataverse.engine.command.DataverseRequest; import edu.harvard.iq.dataverse.engine.command.RequiredPermissions; import edu.harvard.iq.dataverse.engine.command.exception.CommandException; -import edu.harvard.iq.dataverse.engine.command.exception.CommandExecutionException; import edu.harvard.iq.dataverse.settings.SettingsServiceBean; import static edu.harvard.iq.dataverse.util.StringUtil.isEmpty; -import java.io.IOException; import java.util.Objects; -import java.util.logging.Level; import java.util.logging.Logger; -import org.apache.solr.client.solrj.SolrServerException; /**; * An abstract base class for commands that creates {@link Dataset}s. diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/AbstractSubmitToArchiveCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/AbstractSubmitToArchiveCommand.java index b988fd05f03..d5d5af26986 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/AbstractSubmitToArchiveCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/AbstractSubmitToArchiveCommand.java @@ -4,7 +4,6 @@ import edu.harvard.iq.dataverse.DataCitation; import edu.harvard.iq.dataverse.Dataset; import edu.harvard.iq.dataverse.DatasetVersion; -import edu.harvard.iq.dataverse.DvObject; import edu.harvard.iq.dataverse.SettingsWrapper; import edu.harvard.iq.dataverse.authorization.Permission; import edu.harvard.iq.dataverse.authorization.users.ApiToken; diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/AssignRoleCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/AssignRoleCommand.java index 5577d541012..f19f37880e6 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/AssignRoleCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/AssignRoleCommand.java @@ -3,7 +3,6 @@ */ package edu.harvard.iq.dataverse.engine.command.impl; -import edu.harvard.iq.dataverse.DataFile; import edu.harvard.iq.dataverse.Dataset; import edu.harvard.iq.dataverse.Dataverse; import edu.harvard.iq.dataverse.authorization.DataverseRole; diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ChangeUserIdentifierCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ChangeUserIdentifierCommand.java index 94aff3e3f5d..7568f3eabb2 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ChangeUserIdentifierCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ChangeUserIdentifierCommand.java @@ -22,7 +22,6 @@ import jakarta.validation.Validation; import jakarta.validation.Validator; import jakarta.validation.ValidatorFactory; -import jakarta.ws.rs.core.Response; /** * diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CreateDataverseCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CreateDataverseCommand.java index 3efefe90681..2ffb86b4b41 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CreateDataverseCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CreateDataverseCommand.java @@ -7,11 +7,8 @@ import edu.harvard.iq.dataverse.RoleAssignment; import edu.harvard.iq.dataverse.authorization.Permission; import edu.harvard.iq.dataverse.authorization.groups.Group; -import edu.harvard.iq.dataverse.authorization.groups.GroupProvider; -import edu.harvard.iq.dataverse.authorization.groups.impl.explicit.ExplicitGroupProvider; import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser; import edu.harvard.iq.dataverse.authorization.users.User; -import edu.harvard.iq.dataverse.batch.util.LoggingUtil; import edu.harvard.iq.dataverse.engine.command.AbstractCommand; import edu.harvard.iq.dataverse.engine.command.CommandContext; import edu.harvard.iq.dataverse.engine.command.DataverseRequest; @@ -19,15 +16,12 @@ import edu.harvard.iq.dataverse.engine.command.exception.CommandException; import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException; import edu.harvard.iq.dataverse.settings.SettingsServiceBean; -import java.io.IOException; - import java.sql.Timestamp; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.logging.Logger; -import org.apache.solr.client.solrj.SolrServerException; /** * TODO make override the date and user more active, so prevent code errors. diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java index b8adc8e23e8..03d2b15c384 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/CuratePublishedDatasetVersionCommand.java @@ -1,7 +1,6 @@ package edu.harvard.iq.dataverse.engine.command.impl; import edu.harvard.iq.dataverse.authorization.Permission; -import edu.harvard.iq.dataverse.datavariable.VarGroup; import edu.harvard.iq.dataverse.engine.command.CommandContext; import edu.harvard.iq.dataverse.engine.command.DataverseRequest; import edu.harvard.iq.dataverse.engine.command.RequiredPermissions; @@ -20,7 +19,6 @@ import edu.harvard.iq.dataverse.DataFileCategory; import edu.harvard.iq.dataverse.DatasetVersionDifference; -import java.util.Collection; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/DeaccessionDatasetVersionCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/DeaccessionDatasetVersionCommand.java index 8c643d5cd65..8533412e96a 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/DeaccessionDatasetVersionCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/DeaccessionDatasetVersionCommand.java @@ -15,16 +15,10 @@ import edu.harvard.iq.dataverse.engine.command.DataverseRequest; import edu.harvard.iq.dataverse.engine.command.RequiredPermissions; import edu.harvard.iq.dataverse.engine.command.exception.CommandException; -import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException; import edu.harvard.iq.dataverse.export.ExportService; import io.gdcc.spi.export.ExportException; -import edu.harvard.iq.dataverse.settings.SettingsServiceBean; -import edu.harvard.iq.dataverse.util.BundleUtil; import java.io.IOException; import java.util.logging.Logger; -import edu.harvard.iq.dataverse.batch.util.LoggingUtil; -import java.util.concurrent.Future; -import org.apache.solr.client.solrj.SolrServerException; /** * diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/DeleteDatasetLinkingDataverseCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/DeleteDatasetLinkingDataverseCommand.java index f21a2782609..ce7cbf85df2 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/DeleteDatasetLinkingDataverseCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/DeleteDatasetLinkingDataverseCommand.java @@ -18,7 +18,6 @@ import edu.harvard.iq.dataverse.engine.command.exception.PermissionException; import java.io.IOException; import java.util.Collections; -import java.util.concurrent.Future; import org.apache.solr.client.solrj.SolrServerException; /** diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/DeleteDatasetVersionCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/DeleteDatasetVersionCommand.java index a67d7008ef8..8c94ae75fe0 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/DeleteDatasetVersionCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/DeleteDatasetVersionCommand.java @@ -6,8 +6,6 @@ import edu.harvard.iq.dataverse.RoleAssignment; import edu.harvard.iq.dataverse.authorization.Permission; import edu.harvard.iq.dataverse.authorization.users.PrivateUrlUser; -import edu.harvard.iq.dataverse.batch.util.LoggingUtil; - import edu.harvard.iq.dataverse.engine.command.AbstractVoidCommand; import edu.harvard.iq.dataverse.engine.command.CommandContext; import edu.harvard.iq.dataverse.engine.command.DataverseRequest; @@ -15,11 +13,9 @@ import edu.harvard.iq.dataverse.engine.command.exception.CommandException; import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException; import edu.harvard.iq.dataverse.privateurl.PrivateUrl; -import java.io.IOException; import java.util.Iterator; import java.util.List; import java.util.logging.Logger; -import org.apache.solr.client.solrj.SolrServerException; /** * diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/DestroyDatasetCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/DestroyDatasetCommand.java index 41093444360..1e795b39b97 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/DestroyDatasetCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/DestroyDatasetCommand.java @@ -25,7 +25,6 @@ import edu.harvard.iq.dataverse.GlobalIdServiceBean; import edu.harvard.iq.dataverse.batch.util.LoggingUtil; import java.io.IOException; -import java.util.concurrent.Future; import org.apache.solr.client.solrj.SolrServerException; /** diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/FinalizeDatasetPublicationCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/FinalizeDatasetPublicationCommand.java index f5e70209744..4ff920ed706 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/FinalizeDatasetPublicationCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/FinalizeDatasetPublicationCommand.java @@ -37,9 +37,6 @@ import java.util.concurrent.Future; import org.apache.solr.client.solrj.SolrServerException; -import jakarta.ejb.EJB; -import jakarta.inject.Inject; - /** * diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/GetDatasetStorageSizeCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/GetDatasetStorageSizeCommand.java index f1f27fdcee2..29ac606966c 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/GetDatasetStorageSizeCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/GetDatasetStorageSizeCommand.java @@ -7,7 +7,6 @@ import edu.harvard.iq.dataverse.Dataset; import edu.harvard.iq.dataverse.DatasetVersion; -import edu.harvard.iq.dataverse.Dataverse; import edu.harvard.iq.dataverse.authorization.Permission; import edu.harvard.iq.dataverse.engine.command.AbstractCommand; import edu.harvard.iq.dataverse.engine.command.CommandContext; diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/GetDraftFileMetadataIfAvailableCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/GetDraftFileMetadataIfAvailableCommand.java index 14999548b34..bc887c4b08e 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/GetDraftFileMetadataIfAvailableCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/GetDraftFileMetadataIfAvailableCommand.java @@ -1,7 +1,6 @@ package edu.harvard.iq.dataverse.engine.command.impl; import edu.harvard.iq.dataverse.DataFile; -import edu.harvard.iq.dataverse.Dataset; import edu.harvard.iq.dataverse.DatasetVersion; import edu.harvard.iq.dataverse.FileMetadata; import edu.harvard.iq.dataverse.authorization.Permission; diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/GrantSuperuserStatusCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/GrantSuperuserStatusCommand.java index 42af43b7247..47334c34c11 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/GrantSuperuserStatusCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/GrantSuperuserStatusCommand.java @@ -6,7 +6,6 @@ package edu.harvard.iq.dataverse.engine.command.impl; import edu.harvard.iq.dataverse.Dataset; -import edu.harvard.iq.dataverse.authorization.Permission; import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser; import edu.harvard.iq.dataverse.engine.command.AbstractVoidCommand; import edu.harvard.iq.dataverse.engine.command.CommandContext; @@ -14,7 +13,6 @@ import edu.harvard.iq.dataverse.engine.command.RequiredPermissions; import edu.harvard.iq.dataverse.engine.command.exception.CommandException; import edu.harvard.iq.dataverse.engine.command.exception.PermissionException; -import edu.harvard.iq.dataverse.GlobalIdServiceBean; /** * diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ImportDatasetCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ImportDatasetCommand.java index 478272950bd..bc58c2cacf4 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ImportDatasetCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ImportDatasetCommand.java @@ -8,9 +8,6 @@ import edu.harvard.iq.dataverse.engine.command.exception.CommandExecutionException; import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException; import edu.harvard.iq.dataverse.engine.command.exception.PermissionException; -import edu.harvard.iq.dataverse.pidproviders.FakePidProviderServiceBean; - -import java.io.IOException; import java.util.Collections; import java.util.logging.Level; import java.util.logging.Logger; diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/LinkDatasetCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/LinkDatasetCommand.java index aef749d7e26..d6e52fecd85 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/LinkDatasetCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/LinkDatasetCommand.java @@ -9,7 +9,6 @@ import edu.harvard.iq.dataverse.DatasetLinkingDataverse; import edu.harvard.iq.dataverse.Dataverse; import edu.harvard.iq.dataverse.authorization.Permission; -import edu.harvard.iq.dataverse.batch.util.LoggingUtil; import edu.harvard.iq.dataverse.engine.command.AbstractCommand; import edu.harvard.iq.dataverse.engine.command.CommandContext; import edu.harvard.iq.dataverse.engine.command.DataverseRequest; @@ -17,10 +16,8 @@ import edu.harvard.iq.dataverse.engine.command.exception.CommandException; import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException; import edu.harvard.iq.dataverse.util.BundleUtil; -import java.io.IOException; import java.sql.Timestamp; import java.util.Date; -import org.apache.solr.client.solrj.SolrServerException; /** * diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/LinkDataverseCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/LinkDataverseCommand.java index 55fe96556a5..582afec932a 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/LinkDataverseCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/LinkDataverseCommand.java @@ -24,7 +24,6 @@ import java.util.Collections; import java.util.Date; -import jakarta.ws.rs.core.Response; import org.apache.solr.client.solrj.SolrServerException; /** diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/MergeInAccountCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/MergeInAccountCommand.java index 1ec51764d73..812c2b39691 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/MergeInAccountCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/MergeInAccountCommand.java @@ -14,7 +14,6 @@ import edu.harvard.iq.dataverse.UserNotification; import edu.harvard.iq.dataverse.authorization.AuthenticatedUserLookup; import edu.harvard.iq.dataverse.authorization.providers.builtin.BuiltinUser; -import edu.harvard.iq.dataverse.authorization.providers.oauth2.OAuth2TokenData; import edu.harvard.iq.dataverse.authorization.users.ApiToken; import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser; import edu.harvard.iq.dataverse.batch.util.LoggingUtil; @@ -25,7 +24,6 @@ import edu.harvard.iq.dataverse.engine.command.RequiredPermissions; import edu.harvard.iq.dataverse.engine.command.exception.CommandException; import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException; -import edu.harvard.iq.dataverse.passwordreset.PasswordResetData; import edu.harvard.iq.dataverse.search.IndexResponse; import edu.harvard.iq.dataverse.search.savedsearch.SavedSearch; import edu.harvard.iq.dataverse.workflows.WorkflowComment; diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/MoveDatasetCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/MoveDatasetCommand.java index 94bcfa2f5b7..14fdc390a29 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/MoveDatasetCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/MoveDatasetCommand.java @@ -25,7 +25,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.logging.Level; import java.util.logging.Logger; /** diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/MoveDataverseCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/MoveDataverseCommand.java index ea38f5a7af7..c8b59b1818a 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/MoveDataverseCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/MoveDataverseCommand.java @@ -10,7 +10,6 @@ import edu.harvard.iq.dataverse.Template; import edu.harvard.iq.dataverse.authorization.Permission; import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser; -import edu.harvard.iq.dataverse.batch.util.LoggingUtil; import edu.harvard.iq.dataverse.engine.command.AbstractVoidCommand; import edu.harvard.iq.dataverse.engine.command.CommandContext; import edu.harvard.iq.dataverse.engine.command.DataverseRequest; @@ -20,14 +19,12 @@ import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException; import edu.harvard.iq.dataverse.engine.command.exception.PermissionException; import edu.harvard.iq.dataverse.util.BundleUtil; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.logging.Logger; -import org.apache.solr.client.solrj.SolrServerException; /** * A command to move a {@link Dataverse} between two {@link Dataverse}s. diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/PublishDatasetCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/PublishDatasetCommand.java index f5ef121dee2..4f23d540664 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/PublishDatasetCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/PublishDatasetCommand.java @@ -2,22 +2,16 @@ import edu.harvard.iq.dataverse.Dataset; import edu.harvard.iq.dataverse.DatasetLock; -import edu.harvard.iq.dataverse.GlobalIdServiceBean; import edu.harvard.iq.dataverse.authorization.Permission; import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser; -import edu.harvard.iq.dataverse.engine.command.Command; import edu.harvard.iq.dataverse.engine.command.CommandContext; import edu.harvard.iq.dataverse.engine.command.DataverseRequest; import edu.harvard.iq.dataverse.engine.command.RequiredPermissions; import edu.harvard.iq.dataverse.engine.command.exception.CommandException; import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException; -import edu.harvard.iq.dataverse.privateurl.PrivateUrl; import edu.harvard.iq.dataverse.settings.SettingsServiceBean; -import edu.harvard.iq.dataverse.util.BundleUtil; import edu.harvard.iq.dataverse.workflow.Workflow; import edu.harvard.iq.dataverse.workflow.WorkflowContext.TriggerType; -import java.util.Date; -import java.util.List; import java.util.Optional; import java.util.logging.Logger; import static java.util.stream.Collectors.joining; diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/PublishDatasetResult.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/PublishDatasetResult.java index 2d59da53ed0..6a46faec214 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/PublishDatasetResult.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/PublishDatasetResult.java @@ -1,7 +1,6 @@ package edu.harvard.iq.dataverse.engine.command.impl; import edu.harvard.iq.dataverse.Dataset; -import edu.harvard.iq.dataverse.DatasetLock; /** * The result of an attempt to publish a dataset. diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/PublishDataverseCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/PublishDataverseCommand.java index d4b91f5940d..1a2a9bc6e93 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/PublishDataverseCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/PublishDataverseCommand.java @@ -12,7 +12,6 @@ import edu.harvard.iq.dataverse.engine.command.RequiredPermissions; import edu.harvard.iq.dataverse.engine.command.exception.CommandException; import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException; -import edu.harvard.iq.dataverse.settings.SettingsServiceBean; import java.sql.Timestamp; import java.util.Date; import java.util.List; diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/RegisterDvObjectCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/RegisterDvObjectCommand.java index 779bc7fb7fe..e8289702c3d 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/RegisterDvObjectCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/RegisterDvObjectCommand.java @@ -4,7 +4,6 @@ import edu.harvard.iq.dataverse.DataFile; import edu.harvard.iq.dataverse.Dataset; import edu.harvard.iq.dataverse.DvObject; -import edu.harvard.iq.dataverse.GlobalId; import edu.harvard.iq.dataverse.engine.command.AbstractVoidCommand; import edu.harvard.iq.dataverse.engine.command.CommandContext; import edu.harvard.iq.dataverse.engine.command.DataverseRequest; @@ -15,9 +14,6 @@ import java.util.Date; import edu.harvard.iq.dataverse.GlobalIdServiceBean; import edu.harvard.iq.dataverse.HandlenetServiceBean; -import edu.harvard.iq.dataverse.batch.util.LoggingUtil; -import java.io.IOException; -import org.apache.solr.client.solrj.SolrServerException; /** * diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ReturnDatasetToAuthorCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ReturnDatasetToAuthorCommand.java index caf37ad4de1..5fdb7826c47 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ReturnDatasetToAuthorCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ReturnDatasetToAuthorCommand.java @@ -5,7 +5,6 @@ import edu.harvard.iq.dataverse.UserNotification; import edu.harvard.iq.dataverse.authorization.Permission; import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser; -import edu.harvard.iq.dataverse.batch.util.LoggingUtil; import edu.harvard.iq.dataverse.engine.command.CommandContext; import edu.harvard.iq.dataverse.engine.command.DataverseRequest; import edu.harvard.iq.dataverse.engine.command.RequiredPermissions; @@ -13,10 +12,7 @@ import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException; import edu.harvard.iq.dataverse.util.BundleUtil; import edu.harvard.iq.dataverse.workflows.WorkflowComment; -import java.io.IOException; import java.util.List; -import java.util.concurrent.Future; -import org.apache.solr.client.solrj.SolrServerException; @RequiredPermissions(Permission.PublishDataset) public class ReturnDatasetToAuthorCommand extends AbstractDatasetCommand { diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/RevokeSuperuserStatusCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/RevokeSuperuserStatusCommand.java index 0abb53ea4fb..6e2d40dd43a 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/RevokeSuperuserStatusCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/RevokeSuperuserStatusCommand.java @@ -6,7 +6,6 @@ package edu.harvard.iq.dataverse.engine.command.impl; import edu.harvard.iq.dataverse.Dataset; -import edu.harvard.iq.dataverse.authorization.Permission; import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser; import edu.harvard.iq.dataverse.engine.command.AbstractVoidCommand; import edu.harvard.iq.dataverse.engine.command.CommandContext; @@ -14,7 +13,6 @@ import edu.harvard.iq.dataverse.engine.command.RequiredPermissions; import edu.harvard.iq.dataverse.engine.command.exception.CommandException; import edu.harvard.iq.dataverse.engine.command.exception.PermissionException; -import edu.harvard.iq.dataverse.GlobalIdServiceBean; /** * diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/SetCurationStatusCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/SetCurationStatusCommand.java index 557f9dff622..4d2e4173eff 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/SetCurationStatusCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/SetCurationStatusCommand.java @@ -1,35 +1,21 @@ package edu.harvard.iq.dataverse.engine.command.impl; import edu.harvard.iq.dataverse.Dataset; -import edu.harvard.iq.dataverse.DatasetLock; -import edu.harvard.iq.dataverse.DatasetVersionUser; import edu.harvard.iq.dataverse.UserNotification; import edu.harvard.iq.dataverse.authorization.Permission; import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser; -import edu.harvard.iq.dataverse.batch.util.LoggingUtil; -import edu.harvard.iq.dataverse.engine.command.AbstractCommand; import edu.harvard.iq.dataverse.engine.command.CommandContext; import edu.harvard.iq.dataverse.engine.command.DataverseRequest; import edu.harvard.iq.dataverse.engine.command.RequiredPermissions; import edu.harvard.iq.dataverse.engine.command.exception.CommandException; import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException; -import edu.harvard.iq.dataverse.settings.SettingsServiceBean; import edu.harvard.iq.dataverse.util.BundleUtil; import edu.harvard.iq.dataverse.util.SystemConfig; -import java.io.IOException; import java.sql.Timestamp; -import java.util.Arrays; import java.util.Date; import java.util.List; -import java.util.concurrent.Future; import java.util.logging.Logger; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.solr.client.solrj.SolrServerException; - -import com.google.api.LabelDescriptor; @RequiredPermissions(Permission.PublishDataset) public class SetCurationStatusCommand extends AbstractDatasetCommand { diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/SetDatasetCitationDateCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/SetDatasetCitationDateCommand.java index 2cae9e51896..48c2e9bdd86 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/SetDatasetCitationDateCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/SetDatasetCitationDateCommand.java @@ -4,16 +4,12 @@ import edu.harvard.iq.dataverse.DatasetFieldType; import edu.harvard.iq.dataverse.DatasetFieldType.FieldType; import edu.harvard.iq.dataverse.authorization.Permission; -import edu.harvard.iq.dataverse.batch.util.LoggingUtil; import edu.harvard.iq.dataverse.engine.command.AbstractCommand; import edu.harvard.iq.dataverse.engine.command.CommandContext; import edu.harvard.iq.dataverse.engine.command.DataverseRequest; import edu.harvard.iq.dataverse.engine.command.RequiredPermissions; import edu.harvard.iq.dataverse.engine.command.exception.CommandException; import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException; -import java.io.IOException; -import java.util.concurrent.Future; -import org.apache.solr.client.solrj.SolrServerException; /** * diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/SubmitDatasetForReviewCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/SubmitDatasetForReviewCommand.java index 77a4bf5b8ba..8a31eddabf5 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/SubmitDatasetForReviewCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/SubmitDatasetForReviewCommand.java @@ -2,24 +2,18 @@ import edu.harvard.iq.dataverse.Dataset; import edu.harvard.iq.dataverse.DatasetLock; -import edu.harvard.iq.dataverse.DatasetVersionUser; import edu.harvard.iq.dataverse.UserNotification; import edu.harvard.iq.dataverse.authorization.Permission; import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser; -import edu.harvard.iq.dataverse.batch.util.LoggingUtil; -import edu.harvard.iq.dataverse.engine.command.AbstractCommand; import edu.harvard.iq.dataverse.engine.command.CommandContext; import edu.harvard.iq.dataverse.engine.command.DataverseRequest; import edu.harvard.iq.dataverse.engine.command.RequiredPermissions; import edu.harvard.iq.dataverse.engine.command.exception.CommandException; import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException; import edu.harvard.iq.dataverse.util.BundleUtil; -import java.io.IOException; import java.sql.Timestamp; import java.util.Date; import java.util.List; -import java.util.concurrent.Future; -import org.apache.solr.client.solrj.SolrServerException; @RequiredPermissions(Permission.EditDataset) public class SubmitDatasetForReviewCommand extends AbstractDatasetCommand { diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/UpdateDatasetVersionCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/UpdateDatasetVersionCommand.java index 7591bebe796..801266d0f17 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/UpdateDatasetVersionCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/UpdateDatasetVersionCommand.java @@ -8,7 +8,6 @@ import edu.harvard.iq.dataverse.engine.command.RequiredPermissions; import edu.harvard.iq.dataverse.engine.command.exception.CommandException; import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException; -import edu.harvard.iq.dataverse.settings.SettingsServiceBean; import edu.harvard.iq.dataverse.util.DatasetFieldUtil; import edu.harvard.iq.dataverse.util.FileMetadataUtil; diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/UpdateDataverseCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/UpdateDataverseCommand.java index 56c76f04c05..c040cbcce90 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/UpdateDataverseCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/UpdateDataverseCommand.java @@ -18,7 +18,6 @@ import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; -import jakarta.persistence.TypedQuery; /** * Update an existing dataverse. diff --git a/src/main/java/edu/harvard/iq/dataverse/export/DCTermsExporter.java b/src/main/java/edu/harvard/iq/dataverse/export/DCTermsExporter.java index f82c0d9ad3d..22e00d42220 100644 --- a/src/main/java/edu/harvard/iq/dataverse/export/DCTermsExporter.java +++ b/src/main/java/edu/harvard/iq/dataverse/export/DCTermsExporter.java @@ -12,7 +12,6 @@ import java.util.Locale; import java.util.Optional; -import jakarta.json.JsonObject; import javax.xml.stream.XMLStreamException; /** diff --git a/src/main/java/edu/harvard/iq/dataverse/export/DDIExporter.java b/src/main/java/edu/harvard/iq/dataverse/export/DDIExporter.java index d48ce3a537d..b214bdb0884 100644 --- a/src/main/java/edu/harvard/iq/dataverse/export/DDIExporter.java +++ b/src/main/java/edu/harvard/iq/dataverse/export/DDIExporter.java @@ -12,7 +12,6 @@ import java.util.Locale; import java.util.Optional; -import jakarta.json.JsonObject; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import javax.xml.stream.XMLOutputFactory; diff --git a/src/main/java/edu/harvard/iq/dataverse/export/DublinCoreExporter.java b/src/main/java/edu/harvard/iq/dataverse/export/DublinCoreExporter.java index 0fa32dd4bfa..c3c33d74734 100644 --- a/src/main/java/edu/harvard/iq/dataverse/export/DublinCoreExporter.java +++ b/src/main/java/edu/harvard/iq/dataverse/export/DublinCoreExporter.java @@ -12,7 +12,6 @@ import java.util.Locale; import java.util.Optional; -import jakarta.json.JsonObject; import javax.xml.stream.XMLStreamException; /** diff --git a/src/main/java/edu/harvard/iq/dataverse/export/HtmlCodeBookExporter.java b/src/main/java/edu/harvard/iq/dataverse/export/HtmlCodeBookExporter.java index 9d0b107299e..e8557579533 100644 --- a/src/main/java/edu/harvard/iq/dataverse/export/HtmlCodeBookExporter.java +++ b/src/main/java/edu/harvard/iq/dataverse/export/HtmlCodeBookExporter.java @@ -7,7 +7,6 @@ import io.gdcc.spi.export.Exporter; import edu.harvard.iq.dataverse.util.BundleUtil; -import jakarta.json.JsonObject; import jakarta.ws.rs.core.MediaType; import javax.xml.stream.XMLStreamException; import java.io.IOException; diff --git a/src/main/java/edu/harvard/iq/dataverse/export/JSONExporter.java b/src/main/java/edu/harvard/iq/dataverse/export/JSONExporter.java index a54e61c7c1e..666d080b4b6 100644 --- a/src/main/java/edu/harvard/iq/dataverse/export/JSONExporter.java +++ b/src/main/java/edu/harvard/iq/dataverse/export/JSONExporter.java @@ -10,7 +10,6 @@ import java.util.Locale; import java.util.Optional; -import jakarta.json.JsonObject; import jakarta.ws.rs.core.MediaType; diff --git a/src/main/java/edu/harvard/iq/dataverse/export/OAI_DDIExporter.java b/src/main/java/edu/harvard/iq/dataverse/export/OAI_DDIExporter.java index 0b4121c6025..c3f0a8cd355 100644 --- a/src/main/java/edu/harvard/iq/dataverse/export/OAI_DDIExporter.java +++ b/src/main/java/edu/harvard/iq/dataverse/export/OAI_DDIExporter.java @@ -12,7 +12,6 @@ import java.util.Locale; import java.util.Optional; -import jakarta.json.JsonObject; import javax.xml.stream.XMLStreamException; /** diff --git a/src/main/java/edu/harvard/iq/dataverse/export/OAI_OREExporter.java b/src/main/java/edu/harvard/iq/dataverse/export/OAI_OREExporter.java index feec4403570..e294b798756 100644 --- a/src/main/java/edu/harvard/iq/dataverse/export/OAI_OREExporter.java +++ b/src/main/java/edu/harvard/iq/dataverse/export/OAI_OREExporter.java @@ -11,7 +11,6 @@ import java.util.Optional; import java.util.logging.Logger; -import jakarta.json.JsonObject; import jakarta.ws.rs.core.MediaType; @AutoService(Exporter.class) diff --git a/src/main/java/edu/harvard/iq/dataverse/export/OpenAireExporter.java b/src/main/java/edu/harvard/iq/dataverse/export/OpenAireExporter.java index 8bd4ae6a042..54c6c7f0dd6 100644 --- a/src/main/java/edu/harvard/iq/dataverse/export/OpenAireExporter.java +++ b/src/main/java/edu/harvard/iq/dataverse/export/OpenAireExporter.java @@ -3,7 +3,6 @@ import java.io.OutputStream; import java.util.Locale; -import jakarta.json.JsonObject; import javax.xml.stream.XMLStreamException; import com.google.auto.service.AutoService; diff --git a/src/main/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtil.java b/src/main/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtil.java index 24449e8010a..c774ab54747 100644 --- a/src/main/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtil.java +++ b/src/main/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtil.java @@ -34,10 +34,7 @@ import java.util.Map.Entry; import java.util.logging.Level; import java.util.logging.Logger; -import jakarta.ejb.EJB; -import jakarta.json.Json; import jakarta.json.JsonArray; -import jakarta.json.JsonArrayBuilder; import jakarta.json.JsonObject; import jakarta.json.JsonString; import jakarta.json.JsonValue; diff --git a/src/main/java/edu/harvard/iq/dataverse/externaltools/ExternalToolServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/externaltools/ExternalToolServiceBean.java index e13843eadfa..c8e0d8deeec 100644 --- a/src/main/java/edu/harvard/iq/dataverse/externaltools/ExternalToolServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/externaltools/ExternalToolServiceBean.java @@ -16,11 +16,9 @@ import java.util.logging.Logger; import jakarta.ejb.Stateless; import jakarta.inject.Named; -import jakarta.json.Json; import jakarta.json.JsonArray; import jakarta.json.JsonObject; import jakarta.json.JsonObjectBuilder; -import jakarta.json.JsonReader; import jakarta.persistence.EntityManager; import jakarta.persistence.NoResultException; import jakarta.persistence.NonUniqueResultException; diff --git a/src/main/java/edu/harvard/iq/dataverse/feedback/Feedback.java b/src/main/java/edu/harvard/iq/dataverse/feedback/Feedback.java index c1162eb8db6..9cc0657d3ac 100644 --- a/src/main/java/edu/harvard/iq/dataverse/feedback/Feedback.java +++ b/src/main/java/edu/harvard/iq/dataverse/feedback/Feedback.java @@ -1,6 +1,5 @@ package edu.harvard.iq.dataverse.feedback; -import jakarta.json.Json; import jakarta.json.JsonObjectBuilder; import edu.harvard.iq.dataverse.util.json.NullSafeJsonBuilder; diff --git a/src/main/java/edu/harvard/iq/dataverse/harvest/client/HarvestingClient.java b/src/main/java/edu/harvard/iq/dataverse/harvest/client/HarvestingClient.java index 40db55f2a0c..06d7e58e1ce 100644 --- a/src/main/java/edu/harvard/iq/dataverse/harvest/client/HarvestingClient.java +++ b/src/main/java/edu/harvard/iq/dataverse/harvest/client/HarvestingClient.java @@ -29,11 +29,8 @@ import jakarta.persistence.NamedQueries; import jakarta.persistence.NamedQuery; import jakarta.persistence.OneToMany; -import jakarta.persistence.OneToOne; import jakarta.persistence.OrderBy; import jakarta.persistence.Table; -import jakarta.persistence.Temporal; -import jakarta.persistence.TemporalType; import jakarta.validation.constraints.Pattern; import jakarta.validation.constraints.Size; import org.hibernate.validator.constraints.NotBlank; diff --git a/src/main/java/edu/harvard/iq/dataverse/harvest/server/OAISet.java b/src/main/java/edu/harvard/iq/dataverse/harvest/server/OAISet.java index 8d6b04effef..b1fea317c82 100644 --- a/src/main/java/edu/harvard/iq/dataverse/harvest/server/OAISet.java +++ b/src/main/java/edu/harvard/iq/dataverse/harvest/server/OAISet.java @@ -25,8 +25,6 @@ import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.OneToOne; import jakarta.persistence.Version; import jakarta.validation.constraints.Pattern; import jakarta.validation.constraints.Size; diff --git a/src/main/java/edu/harvard/iq/dataverse/ingest/IngestRequest.java b/src/main/java/edu/harvard/iq/dataverse/ingest/IngestRequest.java index a5d6a1af75c..6e96244f6bf 100644 --- a/src/main/java/edu/harvard/iq/dataverse/ingest/IngestRequest.java +++ b/src/main/java/edu/harvard/iq/dataverse/ingest/IngestRequest.java @@ -14,7 +14,6 @@ import jakarta.persistence.Id; import jakarta.persistence.Index; import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; import jakarta.persistence.OneToOne; import jakarta.persistence.Table; diff --git a/src/main/java/edu/harvard/iq/dataverse/ingest/IngestUtil.java b/src/main/java/edu/harvard/iq/dataverse/ingest/IngestUtil.java index 3d30f7e6ec3..253055501de 100644 --- a/src/main/java/edu/harvard/iq/dataverse/ingest/IngestUtil.java +++ b/src/main/java/edu/harvard/iq/dataverse/ingest/IngestUtil.java @@ -33,9 +33,6 @@ import java.util.List; import java.util.Set; import java.util.logging.Logger; -import jakarta.json.Json; -import jakarta.json.JsonArrayBuilder; -import jakarta.json.JsonObjectBuilder; import org.dataverse.unf.UNFUtil; import org.dataverse.unf.UnfException; diff --git a/src/main/java/edu/harvard/iq/dataverse/ingest/metadataextraction/FileMetadataExtractor.java b/src/main/java/edu/harvard/iq/dataverse/ingest/metadataextraction/FileMetadataExtractor.java index e064817dac1..1b7af5652e8 100644 --- a/src/main/java/edu/harvard/iq/dataverse/ingest/metadataextraction/FileMetadataExtractor.java +++ b/src/main/java/edu/harvard/iq/dataverse/ingest/metadataextraction/FileMetadataExtractor.java @@ -7,9 +7,7 @@ package edu.harvard.iq.dataverse.ingest.metadataextraction; import edu.harvard.iq.dataverse.ingest.metadataextraction.spi.*; -import java.io.*; -import java.util.Map; -import java.util.Set; +import java.io.*; /** * diff --git a/src/main/java/edu/harvard/iq/dataverse/ingest/metadataextraction/FileMetadataIngest.java b/src/main/java/edu/harvard/iq/dataverse/ingest/metadataextraction/FileMetadataIngest.java index f2ffb41f19a..08495a8404c 100644 --- a/src/main/java/edu/harvard/iq/dataverse/ingest/metadataextraction/FileMetadataIngest.java +++ b/src/main/java/edu/harvard/iq/dataverse/ingest/metadataextraction/FileMetadataIngest.java @@ -19,8 +19,6 @@ */ package edu.harvard.iq.dataverse.ingest.metadataextraction; -import java.io.File; -import edu.harvard.iq.dataverse.DataTable; import java.util.Set; import java.util.HashSet; import java.util.Map; diff --git a/src/main/java/edu/harvard/iq/dataverse/ingest/metadataextraction/impl/plugins/fits/FITSFileMetadataExtractorSpi.java b/src/main/java/edu/harvard/iq/dataverse/ingest/metadataextraction/impl/plugins/fits/FITSFileMetadataExtractorSpi.java index 6be0a7d4169..c18d07788bb 100644 --- a/src/main/java/edu/harvard/iq/dataverse/ingest/metadataextraction/impl/plugins/fits/FITSFileMetadataExtractorSpi.java +++ b/src/main/java/edu/harvard/iq/dataverse/ingest/metadataextraction/impl/plugins/fits/FITSFileMetadataExtractorSpi.java @@ -10,8 +10,6 @@ import edu.harvard.iq.dataverse.ingest.metadataextraction.spi.*; import java.io.*; -import java.nio.*; -import java.nio.channels.*; import java.util.logging.Logger; import java.util.Locale; diff --git a/src/main/java/edu/harvard/iq/dataverse/ingest/plugin/spi/IngestServiceProvider.java b/src/main/java/edu/harvard/iq/dataverse/ingest/plugin/spi/IngestServiceProvider.java index c792156d648..d0c83070915 100644 --- a/src/main/java/edu/harvard/iq/dataverse/ingest/plugin/spi/IngestServiceProvider.java +++ b/src/main/java/edu/harvard/iq/dataverse/ingest/plugin/spi/IngestServiceProvider.java @@ -20,7 +20,6 @@ package edu.harvard.iq.dataverse.ingest.plugin.spi; -import static java.lang.System.*; import java.util.Locale; /** diff --git a/src/main/java/edu/harvard/iq/dataverse/ingest/tabulardata/impl/plugins/csv/CSVFileReader.java b/src/main/java/edu/harvard/iq/dataverse/ingest/tabulardata/impl/plugins/csv/CSVFileReader.java index 57f76df3802..3d335a6f2ca 100644 --- a/src/main/java/edu/harvard/iq/dataverse/ingest/tabulardata/impl/plugins/csv/CSVFileReader.java +++ b/src/main/java/edu/harvard/iq/dataverse/ingest/tabulardata/impl/plugins/csv/CSVFileReader.java @@ -35,7 +35,6 @@ import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; -import java.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; import java.text.ParseException; @@ -44,10 +43,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Date; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.logging.Logger; import org.apache.commons.csv.CSVFormat; import org.apache.commons.lang3.StringUtils; diff --git a/src/main/java/edu/harvard/iq/dataverse/ingest/tabulardata/impl/plugins/rdata/RDATAFileReader.java b/src/main/java/edu/harvard/iq/dataverse/ingest/tabulardata/impl/plugins/rdata/RDATAFileReader.java index eb1353fd792..424c46e07d5 100644 --- a/src/main/java/edu/harvard/iq/dataverse/ingest/tabulardata/impl/plugins/rdata/RDATAFileReader.java +++ b/src/main/java/edu/harvard/iq/dataverse/ingest/tabulardata/impl/plugins/rdata/RDATAFileReader.java @@ -26,9 +26,6 @@ import java.util.logging.*; import java.util.*; -import jakarta.inject.Inject; - -// Rosuda Wrappers and Methods for R-calls to Rserve import edu.harvard.iq.dataverse.settings.JvmSettings; import org.rosuda.REngine.REXP; import org.rosuda.REngine.REXPMismatchException; diff --git a/src/main/java/edu/harvard/iq/dataverse/ingest/tabulardata/impl/plugins/sav/SAVFileReader.java b/src/main/java/edu/harvard/iq/dataverse/ingest/tabulardata/impl/plugins/sav/SAVFileReader.java index 682b8f1166c..78d689083de 100644 --- a/src/main/java/edu/harvard/iq/dataverse/ingest/tabulardata/impl/plugins/sav/SAVFileReader.java +++ b/src/main/java/edu/harvard/iq/dataverse/ingest/tabulardata/impl/plugins/sav/SAVFileReader.java @@ -58,10 +58,7 @@ import edu.harvard.iq.dataverse.DataTable; import edu.harvard.iq.dataverse.datavariable.DataVariable; -import edu.harvard.iq.dataverse.datavariable.SummaryStatistic; import edu.harvard.iq.dataverse.datavariable.VariableCategory; -import edu.harvard.iq.dataverse.datavariable.VariableRange; - import edu.harvard.iq.dataverse.ingest.tabulardata.TabularDataFileReader; import edu.harvard.iq.dataverse.ingest.tabulardata.spi.TabularDataFileReaderSpi; import edu.harvard.iq.dataverse.ingest.tabulardata.TabularDataIngest; diff --git a/src/main/java/edu/harvard/iq/dataverse/mydata/DataRetrieverAPI.java b/src/main/java/edu/harvard/iq/dataverse/mydata/DataRetrieverAPI.java index e9898031343..878a44c72f0 100644 --- a/src/main/java/edu/harvard/iq/dataverse/mydata/DataRetrieverAPI.java +++ b/src/main/java/edu/harvard/iq/dataverse/mydata/DataRetrieverAPI.java @@ -39,7 +39,6 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.DefaultValue; import jakarta.ws.rs.container.ContainerRequestContext; import jakarta.ws.rs.core.Context; diff --git a/src/main/java/edu/harvard/iq/dataverse/mydata/SolrQueryFormatter.java b/src/main/java/edu/harvard/iq/dataverse/mydata/SolrQueryFormatter.java index 1c3fca1537b..acfe157057d 100644 --- a/src/main/java/edu/harvard/iq/dataverse/mydata/SolrQueryFormatter.java +++ b/src/main/java/edu/harvard/iq/dataverse/mydata/SolrQueryFormatter.java @@ -5,9 +5,6 @@ */ package edu.harvard.iq.dataverse.mydata; -import com.google.common.collect.ContiguousSet; -import com.google.common.collect.DiscreteDomain; -import com.google.common.collect.Range; import edu.harvard.iq.dataverse.search.SearchFields; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/edu/harvard/iq/dataverse/passwordreset/PasswordResetInitResponse.java b/src/main/java/edu/harvard/iq/dataverse/passwordreset/PasswordResetInitResponse.java index a11287792ce..e01135c1ace 100644 --- a/src/main/java/edu/harvard/iq/dataverse/passwordreset/PasswordResetInitResponse.java +++ b/src/main/java/edu/harvard/iq/dataverse/passwordreset/PasswordResetInitResponse.java @@ -1,9 +1,5 @@ package edu.harvard.iq.dataverse.passwordreset; -import edu.harvard.iq.dataverse.util.SystemConfig; -import java.net.InetAddress; -import java.net.UnknownHostException; - public class PasswordResetInitResponse { /** diff --git a/src/main/java/edu/harvard/iq/dataverse/provenance/ProvEntityFileDataConverter.java b/src/main/java/edu/harvard/iq/dataverse/provenance/ProvEntityFileDataConverter.java index ba5aba1b69b..dc41c86119b 100644 --- a/src/main/java/edu/harvard/iq/dataverse/provenance/ProvEntityFileDataConverter.java +++ b/src/main/java/edu/harvard/iq/dataverse/provenance/ProvEntityFileDataConverter.java @@ -5,7 +5,6 @@ import jakarta.faces.context.FacesContext; import jakarta.faces.convert.Converter; import jakarta.faces.convert.FacesConverter; -import jakarta.inject.Inject; /** * diff --git a/src/main/java/edu/harvard/iq/dataverse/userdata/UserUtil.java b/src/main/java/edu/harvard/iq/dataverse/userdata/UserUtil.java index 8ab07cbc1a1..325c2fb8b5e 100644 --- a/src/main/java/edu/harvard/iq/dataverse/userdata/UserUtil.java +++ b/src/main/java/edu/harvard/iq/dataverse/userdata/UserUtil.java @@ -5,11 +5,7 @@ */ package edu.harvard.iq.dataverse.userdata; -import edu.harvard.iq.dataverse.UserNotification.Type; import java.sql.Timestamp; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; /** * diff --git a/src/main/java/edu/harvard/iq/dataverse/util/DatasetFieldWalker.java b/src/main/java/edu/harvard/iq/dataverse/util/DatasetFieldWalker.java index 25032860d11..bc4197c8a36 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/DatasetFieldWalker.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/DatasetFieldWalker.java @@ -13,7 +13,6 @@ import java.util.Map; import java.util.logging.Logger; -import jakarta.json.Json; import jakarta.json.JsonObject; /** diff --git a/src/main/java/edu/harvard/iq/dataverse/util/DateUtil.java b/src/main/java/edu/harvard/iq/dataverse/util/DateUtil.java index 669780b9436..9b2233d6db3 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/DateUtil.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/DateUtil.java @@ -4,11 +4,8 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.Locale; -import java.util.TimeZone; /** * diff --git a/src/main/java/edu/harvard/iq/dataverse/util/WebloaderUtil.java b/src/main/java/edu/harvard/iq/dataverse/util/WebloaderUtil.java index acbdc6aa3c6..e8f936ffdf4 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/WebloaderUtil.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/WebloaderUtil.java @@ -2,9 +2,6 @@ import java.util.logging.Logger; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpSession; - import edu.harvard.iq.dataverse.Dataset; import edu.harvard.iq.dataverse.authorization.users.ApiToken; diff --git a/src/main/java/edu/harvard/iq/dataverse/util/json/JsonLDNamespace.java b/src/main/java/edu/harvard/iq/dataverse/util/json/JsonLDNamespace.java index 904419775c9..0594f7f8e29 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/json/JsonLDNamespace.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/json/JsonLDNamespace.java @@ -4,9 +4,6 @@ import java.util.Arrays; import java.util.List; import java.util.Map; -import java.util.Objects; - -import edu.harvard.iq.dataverse.DataFile; public class JsonLDNamespace { diff --git a/src/main/java/edu/harvard/iq/dataverse/util/json/JsonPrinter.java b/src/main/java/edu/harvard/iq/dataverse/util/json/JsonPrinter.java index b6026998bb7..59ce51e95ba 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/json/JsonPrinter.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/json/JsonPrinter.java @@ -57,8 +57,6 @@ import jakarta.json.Json; import jakarta.json.JsonArrayBuilder; import jakarta.json.JsonObjectBuilder; -import jakarta.json.JsonValue; - import java.util.function.BiConsumer; import java.util.function.BinaryOperator; import java.util.function.Function; diff --git a/src/main/java/edu/harvard/iq/dataverse/workflow/internalspi/AuthorizedExternalStep.java b/src/main/java/edu/harvard/iq/dataverse/workflow/internalspi/AuthorizedExternalStep.java index ee770d4057e..f9d06ee1cc7 100644 --- a/src/main/java/edu/harvard/iq/dataverse/workflow/internalspi/AuthorizedExternalStep.java +++ b/src/main/java/edu/harvard/iq/dataverse/workflow/internalspi/AuthorizedExternalStep.java @@ -16,9 +16,6 @@ import java.util.logging.Level; import java.util.logging.Logger; -import jakarta.json.Json; -import jakarta.json.JsonObject; - import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpMethodBase; import org.apache.commons.httpclient.URI; diff --git a/src/main/java/edu/harvard/iq/dataverse/workflow/internalspi/PauseWithMessageStep.java b/src/main/java/edu/harvard/iq/dataverse/workflow/internalspi/PauseWithMessageStep.java index f7332611697..aa0e621c1f5 100644 --- a/src/main/java/edu/harvard/iq/dataverse/workflow/internalspi/PauseWithMessageStep.java +++ b/src/main/java/edu/harvard/iq/dataverse/workflow/internalspi/PauseWithMessageStep.java @@ -9,7 +9,6 @@ import java.util.HashMap; import java.util.Map; -import java.util.logging.Logger; /** diff --git a/src/test/java/edu/harvard/iq/dataverse/api/AccessIT.java b/src/test/java/edu/harvard/iq/dataverse/api/AccessIT.java index 606e8fa120e..4721c030555 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/AccessIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/AccessIT.java @@ -6,7 +6,6 @@ package edu.harvard.iq.dataverse.api; import io.restassured.RestAssured; -import static io.restassured.RestAssured.given; import io.restassured.path.json.JsonPath; import io.restassured.response.Response; import edu.harvard.iq.dataverse.DataFile; @@ -14,7 +13,6 @@ import java.io.IOException; import java.util.zip.ZipInputStream; -import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; diff --git a/src/test/java/edu/harvard/iq/dataverse/api/FileMetadataIT.java b/src/test/java/edu/harvard/iq/dataverse/api/FileMetadataIT.java index 619a7594244..9587b558da4 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/FileMetadataIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/FileMetadataIT.java @@ -6,7 +6,6 @@ import org.apache.commons.io.IOUtils; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; diff --git a/src/test/java/edu/harvard/iq/dataverse/api/FilesIT.java b/src/test/java/edu/harvard/iq/dataverse/api/FilesIT.java index d0f20a8642b..d6e10e7f19a 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/FilesIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/FilesIT.java @@ -16,8 +16,6 @@ import java.io.File; import java.io.IOException; -import static java.lang.Thread.sleep; - import java.nio.file.Path; import java.nio.file.Paths; import java.text.MessageFormat; diff --git a/src/test/java/edu/harvard/iq/dataverse/api/RolesIT.java b/src/test/java/edu/harvard/iq/dataverse/api/RolesIT.java index 8b5ac917dea..68d0d4ae616 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/RolesIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/RolesIT.java @@ -8,7 +8,6 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; diff --git a/src/test/java/edu/harvard/iq/dataverse/api/SearchIT.java b/src/test/java/edu/harvard/iq/dataverse/api/SearchIT.java index 125753296a2..e20f1d50b20 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/SearchIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/SearchIT.java @@ -25,7 +25,6 @@ import edu.harvard.iq.dataverse.dataaccess.ImageThumbConverter; import java.awt.image.BufferedImage; import java.io.IOException; -import static java.lang.Thread.sleep; import javax.imageio.ImageIO; import static jakarta.ws.rs.core.Response.Status.CREATED; import static jakarta.ws.rs.core.Response.Status.NOT_FOUND; diff --git a/src/test/java/edu/harvard/iq/dataverse/api/UsersIT.java b/src/test/java/edu/harvard/iq/dataverse/api/UsersIT.java index 5880b08e5c2..c3879b8f108 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/UsersIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/UsersIT.java @@ -20,7 +20,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.Matchers.contains; import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; diff --git a/src/test/java/edu/harvard/iq/dataverse/api/UtilIT.java b/src/test/java/edu/harvard/iq/dataverse/api/UtilIT.java index e47971f9b92..ad719939564 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/UtilIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/UtilIT.java @@ -39,7 +39,6 @@ import org.hamcrest.Description; import org.hamcrest.Matcher; -import static io.restassured.RestAssured.put; import static io.restassured.path.xml.XmlPath.from; import static io.restassured.RestAssured.given; import edu.harvard.iq.dataverse.DatasetField; @@ -51,7 +50,6 @@ import java.util.Collections; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.*; -import static org.junit.jupiter.api.Assertions.*; public class UtilIT { diff --git a/src/test/java/edu/harvard/iq/dataverse/dataaccess/S3AccessIOTest.java b/src/test/java/edu/harvard/iq/dataverse/dataaccess/S3AccessIOTest.java index 0e8e8500a1e..ef8170ae5b9 100644 --- a/src/test/java/edu/harvard/iq/dataverse/dataaccess/S3AccessIOTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/dataaccess/S3AccessIOTest.java @@ -20,9 +20,6 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.mockito.junit.jupiter.MockitoSettings; import org.mockito.quality.Strictness; -import static org.mockito.Mockito.*; -import static org.mockito.BDDMockito.*; - import java.io.FileNotFoundException; import java.io.IOException; diff --git a/src/test/java/edu/harvard/iq/dataverse/datasetutility/DuplicateFileCheckerTest.java b/src/test/java/edu/harvard/iq/dataverse/datasetutility/DuplicateFileCheckerTest.java index ced15594f85..19ff583861e 100644 --- a/src/test/java/edu/harvard/iq/dataverse/datasetutility/DuplicateFileCheckerTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/datasetutility/DuplicateFileCheckerTest.java @@ -1,6 +1,5 @@ package edu.harvard.iq.dataverse.datasetutility; -import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.mock; diff --git a/src/test/java/edu/harvard/iq/dataverse/engine/command/impl/CreatePrivateUrlCommandTest.java b/src/test/java/edu/harvard/iq/dataverse/engine/command/impl/CreatePrivateUrlCommandTest.java index 33f9acd0e1a..9b893c884a9 100644 --- a/src/test/java/edu/harvard/iq/dataverse/engine/command/impl/CreatePrivateUrlCommandTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/engine/command/impl/CreatePrivateUrlCommandTest.java @@ -19,7 +19,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.*; -import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.assertTrue; public class CreatePrivateUrlCommandTest { diff --git a/src/test/java/edu/harvard/iq/dataverse/engine/command/impl/MoveDatasetCommandTest.java b/src/test/java/edu/harvard/iq/dataverse/engine/command/impl/MoveDatasetCommandTest.java index ed6112539ed..338403d3bf4 100644 --- a/src/test/java/edu/harvard/iq/dataverse/engine/command/impl/MoveDatasetCommandTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/engine/command/impl/MoveDatasetCommandTest.java @@ -50,8 +50,6 @@ import jakarta.ws.rs.core.Context; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.*; -import static org.junit.jupiter.api.Assertions.*; -import static org.junit.jupiter.api.Assertions.fail; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; diff --git a/src/test/java/edu/harvard/iq/dataverse/engine/command/impl/MoveDataverseCommandTest.java b/src/test/java/edu/harvard/iq/dataverse/engine/command/impl/MoveDataverseCommandTest.java index 3c3188da830..4970c3796dd 100644 --- a/src/test/java/edu/harvard/iq/dataverse/engine/command/impl/MoveDataverseCommandTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/engine/command/impl/MoveDataverseCommandTest.java @@ -29,8 +29,6 @@ import jakarta.servlet.http.HttpServletRequest; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.*; -import static org.junit.jupiter.api.Assertions.*; -import static org.junit.jupiter.api.Assertions.fail; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/src/test/java/edu/harvard/iq/dataverse/engine/command/impl/ReturnDatasetToAuthorCommandTest.java b/src/test/java/edu/harvard/iq/dataverse/engine/command/impl/ReturnDatasetToAuthorCommandTest.java index 23cc4547bc4..403ad4db31d 100644 --- a/src/test/java/edu/harvard/iq/dataverse/engine/command/impl/ReturnDatasetToAuthorCommandTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/engine/command/impl/ReturnDatasetToAuthorCommandTest.java @@ -29,7 +29,6 @@ import jakarta.servlet.http.HttpServletRequest; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.*; -import static org.junit.jupiter.api.Assertions.*; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/src/test/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtilTest.java b/src/test/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtilTest.java index 41e6be61bb8..dcacfd88d26 100644 --- a/src/test/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtilTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtilTest.java @@ -10,7 +10,6 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.logging.Logger; import edu.harvard.iq.dataverse.util.xml.html.HtmlPrinter; diff --git a/src/test/java/edu/harvard/iq/dataverse/ingest/IngestableDataCheckerTest.java b/src/test/java/edu/harvard/iq/dataverse/ingest/IngestableDataCheckerTest.java index 11257f188fe..4ffe1c840c0 100644 --- a/src/test/java/edu/harvard/iq/dataverse/ingest/IngestableDataCheckerTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/ingest/IngestableDataCheckerTest.java @@ -10,12 +10,9 @@ import java.io.IOException; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; -import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.util.List; - import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; diff --git a/src/test/java/edu/harvard/iq/dataverse/makedatacount/MakeDataCountLoggingServiceBeanTest.java b/src/test/java/edu/harvard/iq/dataverse/makedatacount/MakeDataCountLoggingServiceBeanTest.java index c1051a57db8..7eb0cbf48cc 100644 --- a/src/test/java/edu/harvard/iq/dataverse/makedatacount/MakeDataCountLoggingServiceBeanTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/makedatacount/MakeDataCountLoggingServiceBeanTest.java @@ -21,7 +21,6 @@ import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.MatcherAssert.assertThat; -import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.Test; /** diff --git a/src/test/java/edu/harvard/iq/dataverse/metrics/MetricsUtilTest.java b/src/test/java/edu/harvard/iq/dataverse/metrics/MetricsUtilTest.java index 484ce2ebe47..542b7a2a322 100644 --- a/src/test/java/edu/harvard/iq/dataverse/metrics/MetricsUtilTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/metrics/MetricsUtilTest.java @@ -6,8 +6,6 @@ import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; -import java.util.Arrays; -import java.util.Collection; import jakarta.json.Json; import jakarta.json.JsonArray; import jakarta.json.JsonArrayBuilder; @@ -19,7 +17,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.fail; public class MetricsUtilTest { diff --git a/src/test/java/edu/harvard/iq/dataverse/mydata/SolrQueryFormatterTest.java b/src/test/java/edu/harvard/iq/dataverse/mydata/SolrQueryFormatterTest.java index 789204c1db4..36701d1483b 100644 --- a/src/test/java/edu/harvard/iq/dataverse/mydata/SolrQueryFormatterTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/mydata/SolrQueryFormatterTest.java @@ -7,12 +7,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.fail; - import java.lang.NullPointerException; -import java.util.ArrayList; import java.util.Arrays; -import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Random; diff --git a/src/test/java/edu/harvard/iq/dataverse/sitemap/SiteMapUtilTest.java b/src/test/java/edu/harvard/iq/dataverse/sitemap/SiteMapUtilTest.java index 41b13417a23..145430b51f9 100644 --- a/src/test/java/edu/harvard/iq/dataverse/sitemap/SiteMapUtilTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/sitemap/SiteMapUtilTest.java @@ -22,7 +22,6 @@ import java.util.Date; import java.util.List; import static org.junit.jupiter.api.Assertions.*; -import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; diff --git a/src/test/java/edu/harvard/iq/dataverse/util/StringUtilTest.java b/src/test/java/edu/harvard/iq/dataverse/util/StringUtilTest.java index b00b4afca7d..02cfb71704e 100644 --- a/src/test/java/edu/harvard/iq/dataverse/util/StringUtilTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/util/StringUtilTest.java @@ -5,7 +5,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Arrays; -import java.util.Collection; import java.util.Collections; import java.util.Optional; import java.util.stream.Stream; diff --git a/src/test/java/edu/harvard/iq/dataverse/validation/PasswordValidatorTest.java b/src/test/java/edu/harvard/iq/dataverse/validation/PasswordValidatorTest.java index 9d38a527199..df24630275c 100644 --- a/src/test/java/edu/harvard/iq/dataverse/validation/PasswordValidatorTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/validation/PasswordValidatorTest.java @@ -6,7 +6,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; -import java.util.Date; import java.util.List; import java.util.logging.Logger; import java.util.stream.Stream; @@ -19,7 +18,6 @@ import org.passay.EnglishCharacterData; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; /** * PasswordValidatorTest From a7976de45852f96ccabd9037631027fa396975ab Mon Sep 17 00:00:00 2001 From: Ben Companjen Date: Thu, 14 Sep 2023 14:43:49 +0200 Subject: [PATCH 2/9] Remove unused private methods --- .../harvard/iq/dataverse/DataCitation.java | 43 -- .../edu/harvard/iq/dataverse/DatasetPage.java | 4 - .../dataverse/DatasetVersionDifference.java | 9 - .../harvard/iq/dataverse/DataversePage.java | 26 +- .../iq/dataverse/EditDatafilesPage.java | 4 - .../iq/dataverse/EjbDataverseEngine.java | 6 - .../iq/dataverse/FileDownloadHelper.java | 5 - .../GuestbookResponseServiceBean.java | 24 -- .../iq/dataverse/RoleAssigneeServiceBean.java | 6 - .../harvard/iq/dataverse/UserServiceBean.java | 34 -- .../iq/dataverse/api/Notifications.java | 5 - .../edu/harvard/iq/dataverse/api/Search.java | 9 - .../api/imports/ImportDDIServiceBean.java | 166 -------- .../api/imports/ImportGenericServiceBean.java | 53 +-- .../api/imports/ImportServiceBean.java | 23 -- .../DataverseRolePermissionHelper.java | 10 - .../groups/GroupServiceBean.java | 36 -- .../dataaccess/TabularSubsetGenerator.java | 96 ----- .../datasetutility/FileVersionRetriever.java | 13 - .../datavariable/DataTableImportDDI.java | 391 ------------------ .../dataverse/export/ddi/DdiExportUtil.java | 15 - .../dublincore/DublinCoreExportUtil.java | 6 - .../dataverse/ingest/IngestServiceBean.java | 30 -- .../fits/FITSFileMetadataExtractor.java | 18 - .../impl/plugins/por/PORFileReader.java | 7 - .../impl/plugins/sav/SAVFileReader.java | 52 --- .../iq/dataverse/mydata/MyDataPage.java | 10 - .../harvard/iq/dataverse/mydata/Pager.java | 10 - .../mydata/RolePermissionHelperPage.java | 10 - .../search/SearchPermissionsServiceBean.java | 61 --- .../iq/dataverse/userdata/UserListMaker.java | 15 - .../iq/dataverse/util/ShapefileHandler.java | 15 - 32 files changed, 2 insertions(+), 1210 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/DataCitation.java b/src/main/java/edu/harvard/iq/dataverse/DataCitation.java index 9b4b89db44f..4d8d1a79cad 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DataCitation.java +++ b/src/main/java/edu/harvard/iq/dataverse/DataCitation.java @@ -680,49 +680,6 @@ private String formatURL(String text, String url, boolean html) { } } - /** This method flattens html for the textual export formats. - * It removes and tags, replaces
,

and headers 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>"); - 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>", 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; diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java index d20175b6e1a..9747775eaa4 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetPage.java @@ -1795,10 +1795,6 @@ public boolean isShapefileType(FileMetadata fm) { return fm.getDataFile().isShapefileType(); } - private void msg(String s){ - // System.out.println(s); - } - private List displayFileMetadata; public List getDisplayFileMetadata() { diff --git a/src/main/java/edu/harvard/iq/dataverse/DatasetVersionDifference.java b/src/main/java/edu/harvard/iq/dataverse/DatasetVersionDifference.java index eca0c84ae84..398e6365ca3 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DatasetVersionDifference.java +++ b/src/main/java/edu/harvard/iq/dataverse/DatasetVersionDifference.java @@ -440,15 +440,6 @@ private void getTermsDifferences() { } } } - - private DifferenceSummaryItem createSummaryItem(){ - return null; - } - - private List addToSummaryGroup(String displayName, DifferenceSummaryItem differenceSummaryItem){ - - return null; - } private List addToTermsChangedList(List listIn, String label, String origVal, String newVal) { String[] diffArray; diff --git a/src/main/java/edu/harvard/iq/dataverse/DataversePage.java b/src/main/java/edu/harvard/iq/dataverse/DataversePage.java index daf33f444d9..2ce0f06004e 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DataversePage.java +++ b/src/main/java/edu/harvard/iq/dataverse/DataversePage.java @@ -827,31 +827,7 @@ private List 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 ""; diff --git a/src/main/java/edu/harvard/iq/dataverse/EditDatafilesPage.java b/src/main/java/edu/harvard/iq/dataverse/EditDatafilesPage.java index 02a148f8cc5..d94e68f4c24 100644 --- a/src/main/java/edu/harvard/iq/dataverse/EditDatafilesPage.java +++ b/src/main/java/edu/harvard/iq/dataverse/EditDatafilesPage.java @@ -660,10 +660,6 @@ public String init() { return null; } - private void msg(String s) { - System.out.println(s); - } - /** * For single file replacement, load the file to replace * diff --git a/src/main/java/edu/harvard/iq/dataverse/EjbDataverseEngine.java b/src/main/java/edu/harvard/iq/dataverse/EjbDataverseEngine.java index 2b7b54201c5..a4d4681c9cf 100644 --- a/src/main/java/edu/harvard/iq/dataverse/EjbDataverseEngine.java +++ b/src/main/java/edu/harvard/iq/dataverse/EjbDataverseEngine.java @@ -196,12 +196,6 @@ public class EjbDataverseEngine { public R submitInNewTransaction(Command aCommand) throws CommandException { return submit(aCommand); } - - private DvObject getRetType(Object r){ - - return (DvObject) r; - - } @TransactionAttribute(SUPPORTS) diff --git a/src/main/java/edu/harvard/iq/dataverse/FileDownloadHelper.java b/src/main/java/edu/harvard/iq/dataverse/FileDownloadHelper.java index c4b4978e0f8..d008c9be8bf 100644 --- a/src/main/java/edu/harvard/iq/dataverse/FileDownloadHelper.java +++ b/src/main/java/edu/harvard/iq/dataverse/FileDownloadHelper.java @@ -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 diff --git a/src/main/java/edu/harvard/iq/dataverse/GuestbookResponseServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/GuestbookResponseServiceBean.java index bd598d2dca0..e8779488974 100644 --- a/src/main/java/edu/harvard/iq/dataverse/GuestbookResponseServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/GuestbookResponseServiceBean.java @@ -544,30 +544,6 @@ private List convertIntegerToLong(List list, int index) { return list; } - private String generateTempTableString(List 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 idList) { - int count = 0; - StringBuilder sb = new StringBuilder(); - Iterator 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 findCustomResponsePerGuestbookResponse(Long gbrId) { diff --git a/src/main/java/edu/harvard/iq/dataverse/RoleAssigneeServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/RoleAssigneeServiceBean.java index 059d5a8ffd3..6b87a3433cc 100644 --- a/src/main/java/edu/harvard/iq/dataverse/RoleAssigneeServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/RoleAssigneeServiceBean.java @@ -399,10 +399,4 @@ private void msg(String s) { //System.out.println(s); } - private void msgt(String s) { - msg("-------------------------------"); - msg(s); - msg("-------------------------------"); - } - } diff --git a/src/main/java/edu/harvard/iq/dataverse/UserServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/UserServiceBean.java index 93892376edc..478b46134c8 100644 --- a/src/main/java/edu/harvard/iq/dataverse/UserServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/UserServiceBean.java @@ -329,40 +329,6 @@ private HashMap> retrieveRolesForUsers(List userO return userRoleLookup; } - /** - * - * @param userId - * @return - */ - private String getUserRolesAsString(Integer userId) { - String retval = ""; - String userIdentifier = ""; - String qstr = "select useridentifier "; - qstr += " FROM authenticateduser"; - qstr += " WHERE id = " + userId.toString(); - qstr += ";"; - - Query nativeQuery = em.createNativeQuery(qstr); - - userIdentifier = '@' + (String) nativeQuery.getSingleResult(); - - qstr = " select distinct d.name from roleassignment a, dataverserole d"; - qstr += " where d.id = a.role_id and a.assigneeidentifier='" + userIdentifier + "'" - + " Order by d.name;"; - - nativeQuery = em.createNativeQuery(qstr); - - List roleList = nativeQuery.getResultList(); - - for (Object o : roleList) { - if (!retval.isEmpty()) { - retval += ", "; - } - retval += (String) o; - } - return retval; - } - /** * * Run a native query, returning a List containing diff --git a/src/main/java/edu/harvard/iq/dataverse/api/Notifications.java b/src/main/java/edu/harvard/iq/dataverse/api/Notifications.java index 37c894d3071..2a2bfd22854 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/Notifications.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/Notifications.java @@ -78,11 +78,6 @@ public Response getAllNotificationsForUser(@Context ContainerRequestContext crc) return ok(result); } - private JsonArrayBuilder getReasonsForReturn(UserNotification notification) { - Long objectId = notification.getObjectId(); - return WorkflowUtil.getAllWorkflowComments(datasetVersionSvc.find(objectId)); - } - @DELETE @AuthRequired @Path("/{id}") diff --git a/src/main/java/edu/harvard/iq/dataverse/api/Search.java b/src/main/java/edu/harvard/iq/dataverse/api/Search.java index c760534ca7b..409c012b2ed 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/Search.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/Search.java @@ -252,15 +252,6 @@ public boolean tokenLessSearchAllowed() { return tokenLessSearchAllowed; } - private boolean getDataRelatedToMe() { - /** - * @todo support Data Related To Me: - * https://github.com/IQSS/dataverse/issues/1299 - */ - boolean dataRelatedToMe = false; - return dataRelatedToMe; - } - private int getNumberOfResultsPerPage(int numResultsPerPage) { /** * @todo should maxLimit be configurable? diff --git a/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportDDIServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportDDIServiceBean.java index 8f7934dd528..e59f82bdaba 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportDDIServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportDDIServiceBean.java @@ -1850,171 +1850,5 @@ private void processFileDscrMinimal(XMLStreamReader xmlr, DatasetDTO datasetDTO) } } - private void processFileDscr(XMLStreamReader xmlr, DatasetDTO datasetDTO, Map filesMap) throws XMLStreamException { - FileMetadataDTO fmdDTO = new FileMetadataDTO(); - - datasetDTO.getDatasetVersion().getFileMetadatas().add(fmdDTO); - - //StudyFile sf = new OtherFile(studyVersion.getStudy()); // until we connect the sf and dt, we have to assume it's an other file - // as an experiment, I'm going to do it the other way around: - // assume that every fileDscr is a subsettable file now, and convert them - // to otherFiles later if no variables are referencing it -- L.A. - - - // TabularDataFile sf = new TabularDataFile(studyVersion.getStudy()); - DataFileDTO dfDTO = new DataFileDTO(); - DataTableDTO dtDTO = new DataTableDTO(); - dfDTO.getDataTables().add(dtDTO); - fmdDTO.setDataFile(dfDTO); - datasetDTO.getDataFiles().add(dfDTO); - - // EMK TODO: ask Gustavo about this property - //dfDTO.setFileSystemLocation( xmlr.getAttributeValue(null, "URI")); - String ddiFileId = xmlr.getAttributeValue(null, "ID"); - - /// the following Strings are used to determine the category - - String catName = null; - String icpsrDesc = null; - String icpsrId = null; - - for (int event = xmlr.next(); event != XMLStreamConstants.END_DOCUMENT; event = xmlr.next()) { - if (event == XMLStreamConstants.START_ELEMENT) { - if (xmlr.getLocalName().equals("fileTxt")) { - String tempDDIFileId = processFileTxt(xmlr, fmdDTO, dtDTO); - ddiFileId = ddiFileId != null ? ddiFileId : tempDDIFileId; - } - else if (xmlr.getLocalName().equals("notes")) { - String noteType = xmlr.getAttributeValue(null, "type"); - if (NOTE_TYPE_UNF.equalsIgnoreCase(noteType) ) { - String unf = parseUNF( parseText(xmlr) ); - dfDTO.setUNF(unf); - dtDTO.setUnf(unf); - } else if ("vdc:category".equalsIgnoreCase(noteType) ) { - catName = parseText(xmlr); - } else if ("icpsr:category".equalsIgnoreCase(noteType) ) { - String subjectType = xmlr.getAttributeValue(null, "subject"); - if ("description".equalsIgnoreCase(subjectType)) { - icpsrDesc = parseText(xmlr); - } else if ("id".equalsIgnoreCase(subjectType)) { - icpsrId = parseText(xmlr); - } - } - } - } else if (event == XMLStreamConstants.END_ELEMENT) {// - if (xmlr.getLocalName().equals("fileDscr")) { - // post process - if (fmdDTO.getLabel() == null || fmdDTO.getLabel().trim().equals("") ) { - fmdDTO.setLabel("file"); - } - - fmdDTO.setCategory(determineFileCategory(catName, icpsrDesc, icpsrId)); - - - if (ddiFileId != null) { - List filesMapEntry = new ArrayList<>(); - filesMapEntry.add(fmdDTO); - filesMapEntry.add(dtDTO); - filesMap.put( ddiFileId, filesMapEntry); - } - - return; - } - } - } - } - - private String determineFileCategory(String catName, String icpsrDesc, String icpsrId) { - if (catName == null) { - catName = icpsrDesc; - - if (catName != null) { - if (icpsrId != null && !icpsrId.trim().equals("") ) { - catName = icpsrId + ". " + catName; - } - } - } - - return (catName != null ? catName : ""); - } - /** - * sets fmdDTO.label, fmdDTO.description, fmdDTO.studyfile.subsettableFileType - * @param xmlr - * @param fmdDTO - * @param dtDTO - * @return fmdDTO.label (ddiFileId) - * @throws XMLStreamException - */ - private String processFileTxt(XMLStreamReader xmlr, FileMetadataDTO fmdDTO, DataTableDTO dtDTO) throws XMLStreamException { - String ddiFileId = null; - DataFileDTO dfDTO = fmdDTO.getDataFile(); - - for (int event = xmlr.next(); event != XMLStreamConstants.END_DOCUMENT; event = xmlr.next()) { - if (event == XMLStreamConstants.START_ELEMENT) { - if (xmlr.getLocalName().equals("fileName")) { - ddiFileId = xmlr.getAttributeValue(null, "ID"); - fmdDTO.setLabel( parseText(xmlr) ); - /*sf.setFileType( FileUtil.determineFileType( fmdDTO.getLabel() ) );*/ - - } else if (xmlr.getLocalName().equals("fileType")) { - String contentType = parseText(xmlr); - if (!StringUtil.isEmpty(contentType)) { - dfDTO.setContentType(contentType); - } - } else if (xmlr.getLocalName().equals("fileCont")) { - fmdDTO.setDescription( parseText(xmlr) ); - } else if (xmlr.getLocalName().equals("dimensns")) processDimensns(xmlr, dtDTO); - } else if (event == XMLStreamConstants.END_ELEMENT) { - if (xmlr.getLocalName().equals("fileTxt")) { - // If we still don't know the content type of this file - // (i.e., if there was no "" tag explicitly specifying - // the type), we can try and make an educated guess. We already - // now that this is a subsettable file. And now that the - // "" section has been parsed, we can further - // decide if it's a tab, or a fixed field: - if (StringUtil.isEmpty(dfDTO.getContentType())) { - String subsettableFileType = "text/tab-separated-values"; - if (dtDTO.getRecordsPerCase() != null) { - subsettableFileType = "text/x-fixed-field"; - } - } - //EMK TODO: ask Gustavo & Leonid what should be used here instead of setFileType - // dfDTO.setFileType( subsettableFileType ); - - return ddiFileId; - } - } - } - return ddiFileId; - } - - /** - * Set dtDTO. caseQuantity, varQuantity, recordsPerCase - * @param xmlr - * @param dtDTO - * @throws XMLStreamException - */ - private void processDimensns(XMLStreamReader xmlr, DataTableDTO dtDTO) throws XMLStreamException { - for (int event = xmlr.next(); event != XMLStreamConstants.END_DOCUMENT; event = xmlr.next()) { - if (event == XMLStreamConstants.START_ELEMENT) { - if (xmlr.getLocalName().equals("caseQnty")) { - try { - dtDTO.setCaseQuantity( new Long( parseText(xmlr) ) ); - } catch (NumberFormatException ex) {} - } else if (xmlr.getLocalName().equals("varQnty")) { - try{ - dtDTO.setVarQuantity( new Long( parseText(xmlr) ) ); - } catch (NumberFormatException ex) {} - } else if (xmlr.getLocalName().equals("recPrCas")) { - try { - dtDTO.setRecordsPerCase( new Long( parseText(xmlr) ) ); - } catch (NumberFormatException ex) {} - } - } else if (event == XMLStreamConstants.END_ELEMENT) {// - if (xmlr.getLocalName().equals("dimensns")) return; - } - } - } - } diff --git a/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportGenericServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportGenericServiceBean.java index f7a6cf54dd5..2fcba6effb9 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportGenericServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportGenericServiceBean.java @@ -616,14 +616,7 @@ private String parseText(XMLStreamReader xmlr, boolean scrubText) throws XMLStre tempString = tempString.trim().replace('\n',' '); } return tempString; - } - private String parseDate (XMLStreamReader xmlr, String endTag) throws XMLStreamException { - String date = xmlr.getAttributeValue(null, "date"); - if (date == null) { - date = parseText(xmlr); - } - return date; - } + } /* We had to add this method because the ref getElementText has a bug where it * would append a null before the text, if there was an escaped apostrophe; it appears * that the code finds an null ENTITY_REFERENCE in this case which seems like a bug; @@ -656,34 +649,6 @@ private String getElementText(XMLStreamReader xmlr) throws XMLStreamException { } return content.toString(); } - - - - private Map parseCompoundText (XMLStreamReader xmlr, String endTag) throws XMLStreamException { - Map returnMap = new HashMap<>(); - String text = ""; - - while (true) { - int event = xmlr.next(); - if (event == XMLStreamConstants.CHARACTERS) { - if (!text.isEmpty()) { - text += "\n"; - } - text += xmlr.getText().trim().replace('\n',' '); - } else if (event == XMLStreamConstants.START_ELEMENT) { - if (xmlr.getLocalName().equals("ExtLink")) { - String mapKey = ("image".equalsIgnoreCase( xmlr.getAttributeValue(null, "role") ) || "logo".equalsIgnoreCase(xmlr.getAttributeValue(null, "title")))? "logo" : "url"; - returnMap.put( mapKey, xmlr.getAttributeValue(null, "URI") ); - parseText(xmlr, "ExtLink"); // this line effectively just skips though until the end of the tag - } - } else if (event == XMLStreamConstants.END_ELEMENT) { - if (xmlr.getLocalName().equals(endTag)) break; - } - } - - returnMap.put( "name", text ); - return returnMap; - } private String parseText(XMLStreamReader xmlr, String endTag) throws XMLStreamException { return (String) parseTextNew(xmlr,endTag); @@ -736,14 +701,6 @@ private Object parseTextNew(XMLStreamReader xmlr, String endTag) throws XMLStrea // otherwise it's a standard section and just return the String like we always did return returnString.trim(); } - - private String parseNoteByType(XMLStreamReader xmlr, String type) throws XMLStreamException { - if (type.equalsIgnoreCase(xmlr.getAttributeValue(null, "type"))) { - return parseText(xmlr); - } else { - return null; - } - } private String parseText_list (XMLStreamReader xmlr) throws XMLStreamException { String listString = null; String listCloseTag = null; @@ -826,14 +783,6 @@ private String parseText_citation (XMLStreamReader xmlr) throws XMLStreamExcepti return citation; } - private String parseUNF(String unfString) { - if (unfString.contains("UNF:")) { - return unfString.substring( unfString.indexOf("UNF:") ); - } else { - return null; - } - } - private Map parseDVNCitation(XMLStreamReader xmlr) throws XMLStreamException { Map returnValues = new HashMap<>(); diff --git a/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportServiceBean.java index bcb67b180c8..840c15a0b96 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportServiceBean.java @@ -692,27 +692,4 @@ private String convertInvalidDateString(String inString){ return null; } - - private static class MyCustomFormatter extends Formatter { - - @Override - - public String format(LogRecord record) { - - StringBuffer sb = new StringBuffer(); - - sb.append("Prefixn"); - - sb.append(record.getMessage()); - - sb.append("Suffixn"); - - sb.append("n"); - - return sb.toString(); - - } - - } - } diff --git a/src/main/java/edu/harvard/iq/dataverse/authorization/DataverseRolePermissionHelper.java b/src/main/java/edu/harvard/iq/dataverse/authorization/DataverseRolePermissionHelper.java index ad51eeccf29..04926d3b929 100644 --- a/src/main/java/edu/harvard/iq/dataverse/authorization/DataverseRolePermissionHelper.java +++ b/src/main/java/edu/harvard/iq/dataverse/authorization/DataverseRolePermissionHelper.java @@ -246,16 +246,6 @@ public List getRoleInfoForCheckboxes(){ return roleInfoList; } - private void msg(String s){ - logger.info(s); - } - - private void msgt(String s){ - msg("-------------------------------"); - msg(s); - msg("-------------------------------"); - } - public List getRoleIdList(){ diff --git a/src/main/java/edu/harvard/iq/dataverse/authorization/groups/GroupServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/authorization/groups/GroupServiceBean.java index 61a9eb9170b..897fdedf77d 100644 --- a/src/main/java/edu/harvard/iq/dataverse/authorization/groups/GroupServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/authorization/groups/GroupServiceBean.java @@ -247,42 +247,6 @@ public Set collectAncestors( Collection groups ) { return retVal; } - /** - * Given a set of groups and a DV object, return all the groups that are - * reachable from the set. Effectively, if the initial set has an {@link ExplicitGroup}, - * recursively add all the groups it contains. - * - * @param groups - * @param dvo - * @return All the groups included in the groups in {@code groups}. - */ - private Set groupTransitiveClosure(Set groups, DvObject dvo) { - // now, get the explicit group transitive closure. - Set perimeter = new HashSet<>(); - Set visited = new HashSet<>(); - - groups.stream() - .filter((g) -> ( g instanceof ExplicitGroup )) - .forEachOrdered((g) -> perimeter.add((ExplicitGroup) g)); - visited.addAll(perimeter); - - while ( ! perimeter.isEmpty() ) { - ExplicitGroup g = perimeter.iterator().next(); - perimeter.remove(g); - groups.add(g); - - Set discovered = explicitGroupProvider.groupsFor(g, dvo); - discovered.removeAll(visited); // Ideally the conjunction is always empty, as we don't allow cycles. - // Still, coding defensively here, in case someone gets too - // smart on the SQL console. - - perimeter.addAll(discovered); - visited.addAll(discovered); - } - - return groups; - } - public Set findGlobalGroups() { Set groups = new HashSet<>(); groupProviders.values().forEach( diff --git a/src/main/java/edu/harvard/iq/dataverse/dataaccess/TabularSubsetGenerator.java b/src/main/java/edu/harvard/iq/dataverse/dataaccess/TabularSubsetGenerator.java index 782f7f3a52d..7ddea5b43f1 100644 --- a/src/main/java/edu/harvard/iq/dataverse/dataaccess/TabularSubsetGenerator.java +++ b/src/main/java/edu/harvard/iq/dataverse/dataaccess/TabularSubsetGenerator.java @@ -1276,102 +1276,6 @@ private File generateRotatedImage (File tabfile, int varcount, int casecount) th return new File(rotatedImageFileName); - } - - /* - * Test method for taking a "rotated" image, and reversing it, reassembling - * all the columns in the original order. Which should result in a file - * byte-for-byte identical file to the original tab-delimited version. - * - * (do note that this method is not efficiently implemented; it's only - * being used for experiments so far, to confirm the accuracy of the - * accuracy of generateRotatedImage(). It should not be used for any - * practical means in the application!) - */ - private void reverseRotatedImage (File rotfile, int varcount, int casecount) throws IOException { - // open the file, read in the offset header: - try (BufferedInputStream rotfileStream = new BufferedInputStream(new FileInputStream(rotfile))) { - byte[] offsetHeader = new byte[varcount * 8]; - long[] byteOffsets = new long[varcount]; - - int readlen = rotfileStream.read(offsetHeader); - - if (readlen != varcount * 8) { - throw new IOException ("Could not read "+varcount*8+" header bytes from the rotated file."); - } - - for (int varindex = 0; varindex < varcount; varindex++) { - byte[] offsetBytes = new byte[8]; - System.arraycopy(offsetHeader, varindex*8, offsetBytes, 0, 8); - - ByteBuffer offsetByteBuffer = ByteBuffer.wrap(offsetBytes); - byteOffsets[varindex] = offsetByteBuffer.getLong(); - - //System.out.println(byteOffsets[varindex]); - } - - String [][] reversedMatrix = new String[casecount][varcount]; - - long offset = varcount * 8; - byte[] columnBytes; - - for (int varindex = 0; varindex < varcount; varindex++) { - long columnLength = byteOffsets[varindex] - offset; - - - - columnBytes = new byte[(int)columnLength]; - readlen = rotfileStream.read(columnBytes); - - if (readlen != columnLength) { - throw new IOException ("Could not read "+columnBytes+" bytes for column "+varindex); - } - /* - String columnString = new String(columnBytes); - //System.out.print(columnString); - String[] values = columnString.split("\n", -1); - - if (values.length < casecount) { - throw new IOException("count mismatch: "+values.length+" tokens found for column "+varindex); - } - - for (int caseindex = 0; caseindex < casecount; caseindex++) { - reversedMatrix[caseindex][varindex] = values[caseindex]; - }*/ - - int bytecount = 0; - int byteoffset = 0; - int caseindex = 0; - //System.out.println("generating value vector for column "+varindex); - while (bytecount < columnLength) { - if (columnBytes[bytecount] == '\n') { - String token = new String(columnBytes, byteoffset, bytecount-byteoffset); - reversedMatrix[caseindex++][varindex] = token; - byteoffset = bytecount + 1; - } - bytecount++; - } - - if (caseindex != casecount) { - throw new IOException("count mismatch: "+caseindex+" tokens found for column "+varindex); - } - offset = byteOffsets[varindex]; - } - - for (int caseindex = 0; caseindex < casecount; caseindex++) { - for (int varindex = 0; varindex < varcount; varindex++) { - System.out.print(reversedMatrix[caseindex][varindex]); - if (varindex < varcount-1) { - System.out.print("\t"); - } else { - System.out.print("\n"); - } - } - } - - } - - } /** diff --git a/src/main/java/edu/harvard/iq/dataverse/datasetutility/FileVersionRetriever.java b/src/main/java/edu/harvard/iq/dataverse/datasetutility/FileVersionRetriever.java index f2126b4d545..3f3796c8fdd 100644 --- a/src/main/java/edu/harvard/iq/dataverse/datasetutility/FileVersionRetriever.java +++ b/src/main/java/edu/harvard/iq/dataverse/datasetutility/FileVersionRetriever.java @@ -63,19 +63,6 @@ public FileVersionRetriever(DataFileServiceBean fileService, DataFile selectedFi chosenFile = selectedFile; } - /** - * (1) Get all of the Dataset Versions - * - * - */ - private void buildFileVersionHistory(){ - - - //dataFileService. - - - } - } diff --git a/src/main/java/edu/harvard/iq/dataverse/datavariable/DataTableImportDDI.java b/src/main/java/edu/harvard/iq/dataverse/datavariable/DataTableImportDDI.java index 83739ddbcdb..e3a0621a849 100644 --- a/src/main/java/edu/harvard/iq/dataverse/datavariable/DataTableImportDDI.java +++ b/src/main/java/edu/harvard/iq/dataverse/datavariable/DataTableImportDDI.java @@ -39,395 +39,4 @@ public class DataTableImportDDI { public static final String NOTE_TYPE_UNF = "VDC:UNF"; - - // Method processDataDscr takes XMLStreamReader xmlr that has just - // encountered the DDI tag , processes all the variables and - // returns a Map of DataTables mapped by the strings found in the - // "location" attributes of the variables. The DataTables from the - // Map will need to be linked to the corresponding DataFiles by these - // file ids. The DataVariable objects found in this dataDscr section - // have already been linked to the corresponding DataTables in the Map. - // -- L.A. 4.0 beta 9 - - private Map processDataDscr(XMLStreamReader xmlr) throws XMLStreamException { - Map dataTablesMap = new HashMap<>(); - Map varsPerFileMap = new HashMap<>(); - - for (int event = xmlr.next(); event != XMLStreamConstants.END_DOCUMENT; event = xmlr.next()) { - if (event == XMLStreamConstants.START_ELEMENT) { - if (xmlr.getLocalName().equals("var")) { - processVar(xmlr, dataTablesMap, varsPerFileMap); - } - } else if (event == XMLStreamConstants.END_ELEMENT) { - if (xmlr.getLocalName().equals("dataDscr")) { - - for (String fileId : dataTablesMap.keySet()) { - Integer numberOfVariables = varsPerFileMap.get(fileId); - if (numberOfVariables != null && numberOfVariables > 0) { - // OK, this looks like we have found variables for this - // data file entry. - } else { - // TODO: - // otherwise, the studyfile needs to be converted - // from TabularFile to OtherFile; i.e., it should - // be treated as non-subsettable, if there are - // no variables in the section of the - // DDI referencing the file. - // This actually happens in real life. For example, - // Roper puts some of their files into the - // section, even though there's no - // provided for them. - // -- L.A. - // TODO: confirm that this works under 4.0 as is - // -- L.A. 4.0 beta 9 - } - } - - return dataTablesMap; - } - } - } - return null; - } - - private void processVar(XMLStreamReader xmlr, Map dataTablesMap, Map varsPerFileMap) throws XMLStreamException { - DataVariable dv = new DataVariable(0,null); - dv.setName( xmlr.getAttributeValue(null, "name") ); - - try { - dv.setNumberOfDecimalPoints( new Long( xmlr.getAttributeValue(null, "dcml") ) ); - } catch (NumberFormatException nfe) {} - - // interval type (DB value may be different than DDI value) - String _interval = xmlr.getAttributeValue(null, "intrvl"); - - if (VAR_INTERVAL_CONTIN.equals(_interval)) { - dv.setIntervalContinuous(); - } else if (VAR_INTERVAL_NOMINAL.equals(_interval)) { - dv.setIntervalNominal(); - } else if (VAR_INTERVAL_DICHOTOMOUS.equals(_interval)) { - dv.setIntervalDichotomous(); - } else { - // default is discrete - dv.setIntervalDiscrete(); - } - - dv.setWeighted( VAR_WEIGHTED.equals( xmlr.getAttributeValue(null, "wgt") ) ); - // default is not-wgtd, so null sets weighted to false - - - for (int event = xmlr.next(); event != XMLStreamConstants.END_DOCUMENT; event = xmlr.next()) { - if (event == XMLStreamConstants.START_ELEMENT) { - if (xmlr.getLocalName().equals("location")) { - processLocation(xmlr, dv, dataTablesMap, varsPerFileMap); - } - else if (xmlr.getLocalName().equals("labl")) { - String _labl = processLabl( xmlr, LEVEL_VARIABLE ); - if (_labl != null && !_labl.isEmpty()) { - dv.setLabel( _labl ); - } - //{ else if (xmlr.getLocalName().equals("universe")) { - // dv.setUniverse( parseText(xmlr) ); - } else if (xmlr.getLocalName().equals("invalrng")) { - processInvalrng( xmlr, dv ); - } else if (xmlr.getLocalName().equals("varFormat")) { - processVarFormat( xmlr, dv ); - } else if (xmlr.getLocalName().equals("sumStat")) { - processSumStat( xmlr, dv ); - } else if (xmlr.getLocalName().equals("catgry")) { - processCatgry( xmlr, dv ); - } else if (xmlr.getLocalName().equals("notes")) { - String _note = parseNoteByType( xmlr, NOTE_TYPE_UNF ); - if (_note != null && !_note.isEmpty()) { - dv.setUnf( parseUNF( _note ) ); - } - } - - } else if (event == XMLStreamConstants.END_ELEMENT) { - if (xmlr.getLocalName().equals("var")) return; - } - } - } - - - private void processLocation(XMLStreamReader xmlr, DataVariable dv, Map dataTablesMap, Map varsPerFileMap) throws XMLStreamException { - - // fileStartPos, FileEndPos, and RecSegNo - // if these fields don't convert to Long, just leave blank - try { - dv.setFileStartPosition( new Long( xmlr.getAttributeValue(null, "StartPos") ) ); - } catch (NumberFormatException ex) {} - try { - dv.setFileEndPosition( new Long( xmlr.getAttributeValue(null, "EndPos") ) ); - } catch (NumberFormatException ex) {} - try { - dv.setRecordSegmentNumber( new Long( xmlr.getAttributeValue(null, "RecSegNo") ) ); - } catch (NumberFormatException ex) {} - - - if (dv.getDataTable() == null) { - String fileId = xmlr.getAttributeValue(null, "fileid"); - - if (fileId != null && !fileId.isEmpty()) { - - DataTable datatable = null; - - if (dataTablesMap.get(fileId) != null) { - datatable = dataTablesMap.get(fileId); - } else { - datatable = new DataTable(); - dataTablesMap.put(fileId, datatable); - varsPerFileMap.put(fileId, 0); - } - - dv.setDataTable(datatable); - if (datatable.getDataVariables() == null) { - datatable.setDataVariables(new ArrayList<>()); - } - datatable.getDataVariables().add(dv); - - int filePosition = varsPerFileMap.get(fileId); - dv.setFileOrder(filePosition++); - varsPerFileMap.put(fileId, filePosition); - } - } else { - throw new XMLStreamException("Empty or NULL location attribute in a variable section."); - } - } - - - private void processInvalrng(XMLStreamReader xmlr, DataVariable dv) throws XMLStreamException { - for (int event = xmlr.next(); event != XMLStreamConstants.END_DOCUMENT; event = xmlr.next()) { - if (event == XMLStreamConstants.START_ELEMENT) { - if (xmlr.getLocalName().equals("item")) { - VariableRange range = new VariableRange(); - dv.getInvalidRanges().add(range); - range.setDataVariable(dv); - - range.setBeginValue( xmlr.getAttributeValue(null, "VALUE") ); - range.setBeginValueTypePoint(); - } else if (xmlr.getLocalName().equals("range")) { - VariableRange range = new VariableRange(); - dv.getInvalidRanges().add(range); - range.setDataVariable(dv); - - String min = xmlr.getAttributeValue(null, "min"); - String minExclsuive = xmlr.getAttributeValue(null, "minExclusive"); - String max = xmlr.getAttributeValue(null, "max"); - String maxExclusive = xmlr.getAttributeValue(null, "maxExclusive"); - - if ( !StringUtil.isEmpty(min) ) { - range.setBeginValue( min ); - range.setBeginValueTypeMin( ); - } else if ( !StringUtil.isEmpty(minExclsuive) ) { - range.setBeginValue( minExclsuive ); - range.setBeginValueTypeMinExcl(); - } - - if ( !StringUtil.isEmpty(max) ) { - range.setEndValue( max ); - range.setEndValueTypeMax(); - } else if ( !StringUtil.isEmpty(maxExclusive) ) { - range.setEndValue( maxExclusive ); - range.setEndValueTypeMaxExcl(); - } - } - } else if (event == XMLStreamConstants.END_ELEMENT) { - if (xmlr.getLocalName().equals("invalrng")) return; - } - } - } - - private void processVarFormat(XMLStreamReader xmlr, DataVariable dv) throws XMLStreamException { - String type = xmlr.getAttributeValue(null, "type"); - type = (type == null ? VAR_TYPE_NUMERIC : type); - - if (VAR_TYPE_CHARACTER.equals(type)) { - dv.setTypeCharacter(); - } else { - dv.setTypeNumeric(); // default is numeric - } - - dv.setFormat( xmlr.getAttributeValue(null, "formatname") ); - - String varFormatCategoryAtt = xmlr.getAttributeValue(null, "category"); - String varFormatText = parseText(xmlr); - - - - /* - * A somewhat hackish way of recognizing "boolean" variables; - * This is not a universally accepted convention - we (the DVN team) - * simply decided to handle it this way. Booleans are treated simply - * as categorical variables with integers 0 and 1 for the values, and - * "FALSE" and "TRUE" for the labels. On top of that, we make a note - * of the variable's "booleanness", in the DDI, like this: - * Boolean - * and in the database, by setting the value of dv.formatCategory to - * "Boolean". - * This information isn't used much in the application (as of May, 2013), - * except in the subsetting: when the column is subset and re-imported - * into an R data frame, we'll convert it into a logical vector. - * TODO: - * Add this to the export end! --L.A. - */ - - if ("Boolean".equalsIgnoreCase(varFormatText)) { - dv.setFormatCategory( "Boolean" ); - } else { - dv.setFormatCategory( varFormatCategoryAtt ); - } - } - - private void processSumStat(XMLStreamReader xmlr, DataVariable dv) throws XMLStreamException { - SummaryStatistic ss = new SummaryStatistic(); - ss.setTypeByLabel(xmlr.getAttributeValue(null, "type")); - ss.setValue( parseText(xmlr)) ; - ss.setDataVariable(dv); - dv.getSummaryStatistics().add(ss); - } - - private void processCatgry(XMLStreamReader xmlr, DataVariable dv) throws XMLStreamException { - VariableCategory cat = new VariableCategory(); - cat.setMissing( "Y".equals( xmlr.getAttributeValue(null, "missing") ) ); // default is N, so null sets missing to false - cat.setDataVariable(dv); - - if (dv.getCategories() == null || dv.getCategories().isEmpty()) { - // if this is the first category we encounter, we'll assume that this - // categorical data/"factor" variable is ordered. - // But we'll switch it back to unordered later, if we encounter - // *any* categories with no order attribute defined. - - dv.setOrderedCategorical(true); - } - - - // Process extra level order values, if available; - // Currently (as of 3.6) only available in R Data ingests. - // TODO: - // revisit this (for 4.0) - we've discussed encoding this order - // simply by the order in which the categories appear in the - // DDI. (-- L.A. 4.0 beta 9) - - String order = null; - order = xmlr.getAttributeValue(null, "order"); - Integer orderValue = null; - if (order != null) { - try { - orderValue = new Integer (order); - } catch (NumberFormatException ex) { - orderValue = null; - } - } - - if (orderValue != null && orderValue >= 0) { - cat.setOrder(orderValue); - } else if (!cat.isMissing()) { - // Everey category of an ordered categorical ("factor") variable - // must have the order rank defined. Which means that if we - // encounter a single NON-MISSING category with no ordered attribute, it - // will be processed as un-ordered. - - dv.setOrderedCategorical(false); - } - - - dv.getCategories().add(cat); - - for (int event = xmlr.next(); event != XMLStreamConstants.END_DOCUMENT; event = xmlr.next()) { - if (event == XMLStreamConstants.START_ELEMENT) { - if (xmlr.getLocalName().equals("labl")) { - String _labl = processLabl( xmlr, LEVEL_CATEGORY ); - if (_labl != null && !_labl.isEmpty()) { - cat.setLabel( _labl ); - } - } else if (xmlr.getLocalName().equals("catValu")) { - cat.setValue( parseText(xmlr, false) ); - } - else if (xmlr.getLocalName().equals("catStat")) { - String type = xmlr.getAttributeValue(null, "type"); - if (type == null || CAT_STAT_TYPE_FREQUENCY.equalsIgnoreCase( type ) ) { - String _freq = parseText(xmlr); - if (_freq != null && !_freq.isEmpty()) { - cat.setFrequency( new Double( _freq ) ); - } - } - } - } else if (event == XMLStreamConstants.END_ELEMENT) { - if (xmlr.getLocalName().equals("catgry")) return; - } - } - } - - private String processLabl(XMLStreamReader xmlr, String level) throws XMLStreamException { - if (level.equalsIgnoreCase( xmlr.getAttributeValue(null, "level") ) ) { - return parseText(xmlr); - } else { - return null; - } - } - - - private String parseNoteByType (XMLStreamReader xmlr, String type) throws XMLStreamException { - if (type.equalsIgnoreCase( xmlr.getAttributeValue(null, "type") ) ) { - return parseText(xmlr); - } else { - return null; - } - } - - private String parseUNF(String unfString) { - if (unfString.contains("UNF:")) { - return unfString.substring( unfString.indexOf("UNF:") ); - } else { - return null; - } - } - - private String parseText(XMLStreamReader xmlr) throws XMLStreamException { - return parseText(xmlr,true); - } - - private String parseText(XMLStreamReader xmlr, boolean scrubText) throws XMLStreamException { - String tempString = getElementText(xmlr); - if (scrubText) { - tempString = tempString.trim().replace('\n',' '); - } - return tempString; - } - - /* We had to add this method because the ref getElementText has a bug where it - * would append a null before the text, if there was an escaped apostrophe; it appears - * that the code finds an null ENTITY_REFERENCE in this case which seems like a bug; - * the workaround for the moment is to comment or handling ENTITY_REFERENCE in this case - */ - /* - * TODO: do we still need this method? ( -- L.A. 4.0 beta 9) - */ - private String getElementText(XMLStreamReader xmlr) throws XMLStreamException { - if(xmlr.getEventType() != XMLStreamConstants.START_ELEMENT) { - throw new XMLStreamException("parser must be on START_ELEMENT to read next text", xmlr.getLocation()); - } - int eventType = xmlr.next(); - StringBuilder content = new StringBuilder(); - while(eventType != XMLStreamConstants.END_ELEMENT ) { - if(eventType == XMLStreamConstants.CHARACTERS - || eventType == XMLStreamConstants.CDATA - || eventType == XMLStreamConstants.SPACE) { - content.append(xmlr.getText()); - } else if(eventType == XMLStreamConstants.PROCESSING_INSTRUCTION - || eventType == XMLStreamConstants.COMMENT - || eventType == XMLStreamConstants.ENTITY_REFERENCE) { - // skipping - } else if(eventType == XMLStreamConstants.END_DOCUMENT) { - throw new XMLStreamException("unexpected end of document when reading element text content"); - } else if(eventType == XMLStreamConstants.START_ELEMENT) { - throw new XMLStreamException("element text content may not contain START_ELEMENT", xmlr.getLocation()); - } else { - throw new XMLStreamException("Unexpected event type "+eventType, xmlr.getLocation()); - } - eventType = xmlr.next(); - } - return content.toString(); - } } diff --git a/src/main/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtil.java b/src/main/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtil.java index c774ab54747..1a8dffdaa26 100644 --- a/src/main/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtil.java +++ b/src/main/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtil.java @@ -1121,17 +1121,6 @@ private static void writeRelPublElement(XMLStreamWriter xmlw, DatasetVersionDTO } } - private static String appendCommaSeparatedValue(String inVal, String next) { - if (!next.isEmpty()) { - if (!inVal.isEmpty()) { - return inVal + ", " + next; - } else { - return next; - } - } - return inVal; - } - private static void writeAbstractElement(XMLStreamWriter xmlw, DatasetVersionDTO datasetVersionDTO, String lang) throws XMLStreamException { for (Map.Entry entry : datasetVersionDTO.getMetadataBlocks().entrySet()) { String key = entry.getKey(); @@ -1657,10 +1646,6 @@ private static boolean StringUtilisEmpty(String str) { } return false; } - - private static void saveJsonToDisk(String datasetVersionAsJson) throws IOException { - Files.write(Paths.get("/tmp/out.json"), datasetVersionAsJson.getBytes()); - } diff --git a/src/main/java/edu/harvard/iq/dataverse/export/dublincore/DublinCoreExportUtil.java b/src/main/java/edu/harvard/iq/dataverse/export/dublincore/DublinCoreExportUtil.java index 6b7cb844f3e..3191b7505cd 100644 --- a/src/main/java/edu/harvard/iq/dataverse/export/dublincore/DublinCoreExportUtil.java +++ b/src/main/java/edu/harvard/iq/dataverse/export/dublincore/DublinCoreExportUtil.java @@ -498,12 +498,6 @@ private static void writeFullElement (XMLStreamWriter xmlw, String name, String } } - private static void writeAttribute(XMLStreamWriter xmlw, String name, String value) throws XMLStreamException { - if (!StringUtilisEmpty(value)) { - xmlw.writeAttribute(name, value); - } - } - private static boolean StringUtilisEmpty(String str) { if (str == null || str.trim().equals("")) { return true; diff --git a/src/main/java/edu/harvard/iq/dataverse/ingest/IngestServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/ingest/IngestServiceBean.java index 40dc3d6fdd6..f23358d81f9 100644 --- a/src/main/java/edu/harvard/iq/dataverse/ingest/IngestServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/ingest/IngestServiceBean.java @@ -1087,24 +1087,6 @@ public boolean ingestAsTabular(Long datafile_id) { return ingestSuccessful; } - private BufferedInputStream openFile(DataFile dataFile) throws IOException { - BufferedInputStream inputStream; - StorageIO storageIO = dataFile.getStorageIO(); - storageIO.open(); - if (storageIO.isLocalFile()) { - inputStream = new BufferedInputStream(storageIO.getInputStream()); - } else { - File tempFile = File.createTempFile("tempIngestSourceFile", ".tmp"); - try (ReadableByteChannel dataFileChannel = storageIO.getReadChannel(); - FileChannel tempIngestSourceChannel = new FileOutputStream(tempFile).getChannel();) { - tempIngestSourceChannel.transferFrom(dataFileChannel, 0, storageIO.getSize()); - } - inputStream = new BufferedInputStream(new FileInputStream(tempFile)); - logger.fine("Saved "+storageIO.getSize()+" bytes in a local temp file."); - } - return inputStream; - } - private void restoreIngestedDataFile(DataFile dataFile, TabularDataIngest tabDataIngest, long originalSize, String originalFileName, String originalContentType) { dataFile.setDataTables(null); if (tabDataIngest != null && tabDataIngest.getDataTable() != null) { @@ -1768,18 +1750,6 @@ public void performPostProcessingTasks(DataFile dataFile) { } } } - - private Set selectContinuousVariableColumns(DataFile dataFile) { - Set contVarFields = new LinkedHashSet(); - - for (int i = 0; i < dataFile.getDataTable().getVarQuantity(); i++) { - if (dataFile.getDataTable().getDataVariables().get(i).isIntervalContinuous()) { - contVarFields.add(i); - } - } - - return contVarFields; - } private void calculateContinuousSummaryStatistics(DataFile dataFile, int varnum, Number[] dataVector) throws IOException { double[] sumStats = SumStatCalculator.calculateSummaryStatistics(dataVector); diff --git a/src/main/java/edu/harvard/iq/dataverse/ingest/metadataextraction/impl/plugins/fits/FITSFileMetadataExtractor.java b/src/main/java/edu/harvard/iq/dataverse/ingest/metadataextraction/impl/plugins/fits/FITSFileMetadataExtractor.java index 6846a4b6eda..c7dfb5820b9 100644 --- a/src/main/java/edu/harvard/iq/dataverse/ingest/metadataextraction/impl/plugins/fits/FITSFileMetadataExtractor.java +++ b/src/main/java/edu/harvard/iq/dataverse/ingest/metadataextraction/impl/plugins/fits/FITSFileMetadataExtractor.java @@ -999,24 +999,6 @@ private String createMetadataSummary (int nHDU, int nTableHDUs, int nImageHDUs, return summary; } - private int typeCount (List typeList, String typeToken) { - if (typeToken == null || typeToken.equals("")) { - return 0; - } - - int count = 0; - - if (typeList != null) { - for (int i = 0; i> valueLabelTable) { } } } - } - - private void print2Darray(Object[][] datatable, String title){ - dbgLog.fine(title); - for (Object[] datatable1 : datatable) { - dbgLog.fine(StringUtils.join(datatable1, "|")); - } } private Map createLabelMap (File extendedLabelsFile) { diff --git a/src/main/java/edu/harvard/iq/dataverse/ingest/tabulardata/impl/plugins/sav/SAVFileReader.java b/src/main/java/edu/harvard/iq/dataverse/ingest/tabulardata/impl/plugins/sav/SAVFileReader.java index 78d689083de..6a202b2c9f3 100644 --- a/src/main/java/edu/harvard/iq/dataverse/ingest/tabulardata/impl/plugins/sav/SAVFileReader.java +++ b/src/main/java/edu/harvard/iq/dataverse/ingest/tabulardata/impl/plugins/sav/SAVFileReader.java @@ -3576,58 +3576,6 @@ private void parseRT7SubTypefield(BufferedInputStream stream) throws IOException throw ex; } - } - - private List getRT7SubTypefieldData(BufferedInputStream stream) throws IOException { - int length_unit_length = 4; - int length_number_of_units = 4; - int storage_size = length_unit_length + length_number_of_units; - List dataList = new ArrayList(); - int[] headerSection = new int[2]; - - byte[] byteStorage = new byte[storage_size]; - - try{ - int nbytes = stream.read(byteStorage); - // to-do check against nbytes - - //printHexDump(byteStorage, "RT7:storage"); - - ByteBuffer bb_data_type = ByteBuffer.wrap(byteStorage, - 0, length_unit_length); - if (isLittleEndian){ - bb_data_type.order(ByteOrder.LITTLE_ENDIAN); - } - - int unitLength = bb_data_type.getInt(); - dbgLog.fine("parseRT7SubTypefield: unitLength="+unitLength); - - ByteBuffer bb_number_of_units = ByteBuffer.wrap(byteStorage, - length_unit_length, length_number_of_units); - if (isLittleEndian){ - bb_number_of_units.order(ByteOrder.LITTLE_ENDIAN); - } - - int numberOfUnits = bb_number_of_units.getInt(); - dbgLog.fine("parseRT7SubTypefield: numberOfUnits="+numberOfUnits); - - headerSection[0] = unitLength; - headerSection[1] = numberOfUnits; - - for (int i=0; i findDirectAssignments(DvObject dvObject) { - List permStrings = new ArrayList<>(); - List roleAssignees = findWhoHasDirectAssignments(dvObject); - for (RoleAssignee roleAssignee : roleAssignees) { - logger.fine("user or group (findDirectAssignments): " + roleAssignee.getIdentifier()); - String indexableUserOrGroupPermissionString = getIndexableStringForUserOrGroup(roleAssignee); - if (indexableUserOrGroupPermissionString != null) { - permStrings.add(indexableUserOrGroupPermissionString); - } - } - return permStrings; - } - - @Deprecated - private List findWhoHasDirectAssignments(DvObject dvObject) { - List emptyList = new ArrayList<>(); - List peopleWhoCanSearch = emptyList; - resetRoleAssigneeCache(); - - List assignmentsOn = permissionService.assignmentsOn(dvObject); - for (RoleAssignment roleAssignment : assignmentsOn) { - if (roleAssignment.getRole().permissions().contains(getRequiredSearchPermission(dvObject))) { - RoleAssignee userOrGroup = getRoleAssignee(roleAssignment.getAssigneeIdentifier()); - if (userOrGroup != null) { - peopleWhoCanSearch.add(userOrGroup); - } - } - } - resetRoleAssigneeCache(); - return peopleWhoCanSearch; - } - - @Deprecated - private List findImplicitAssignments(DvObject dvObject) { - List permStrings = new ArrayList<>(); - DvObject parent = dvObject.getOwner(); - while (parent != null) { - if (respectPermissionRoot()) { - if (parent.isEffectivelyPermissionRoot()) { - return permStrings; - } - } - if (parent.isInstanceofDataverse()) { - permStrings.addAll(findDirectAssignments(parent)); - } else if (parent.isInstanceofDataset()) { - // files get discoverability from their parent dataset - permStrings.addAll(findDirectAssignments(parent)); - } - parent = parent.getOwner(); - } - return permStrings; - } - public Map getDesiredCards(Dataset dataset) { Map desiredCards = new LinkedHashMap<>(); DatasetVersion latestVersion = dataset.getLatestVersion(); @@ -230,13 +176,6 @@ private Permission getRequiredSearchPermission(DvObject dvObject) { } - @Deprecated - private boolean respectPermissionRoot() { - boolean safeDefaultIfKeyNotFound = true; - // see javadoc of the key - return settingsService.isTrueForKey(SettingsServiceBean.Key.SearchRespectPermissionRoot, safeDefaultIfKeyNotFound); - } - /** * From a Solr perspective we can't just index any string when we go to do * the JOIN to enforce security. (Maybe putting quotes around the string at diff --git a/src/main/java/edu/harvard/iq/dataverse/userdata/UserListMaker.java b/src/main/java/edu/harvard/iq/dataverse/userdata/UserListMaker.java index 18ff033b337..bf3b8379019 100644 --- a/src/main/java/edu/harvard/iq/dataverse/userdata/UserListMaker.java +++ b/src/main/java/edu/harvard/iq/dataverse/userdata/UserListMaker.java @@ -142,19 +142,4 @@ public boolean hasError() { public String getErrorMessage() { return this.errorMessage; } - - private void addErrorMessage(String errMsg){ - this.errorFound = true; - this.errorMessage = errMsg; - } - - private void msg(String s) { - System.out.println(s); - } - - private void msgt(String s){ - msg("-------------------------------"); - msg(s); - msg("-------------------------------"); - } } diff --git a/src/main/java/edu/harvard/iq/dataverse/util/ShapefileHandler.java b/src/main/java/edu/harvard/iq/dataverse/util/ShapefileHandler.java index 3af562882f3..b82f4bd5d41 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/ShapefileHandler.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/ShapefileHandler.java @@ -208,21 +208,6 @@ private boolean createDirectory(File folder){ return false; } return true; - } // createDirectory - - - /* - Print out the key/value pairs of the Hash of filenames and sizes - */ - private void showFileNamesSizes(){ - msgt("Hash: file names + sizes"); - Iterator keySetIterator = this.filesizeHash.keySet().iterator(); - - while(keySetIterator.hasNext()){ - String key = keySetIterator.next(); - msg("key: [" + key + "] value: [" + this.filesizeHash.get(key)+"]"); - - } } // end showFileNamesSizes From 6a48307d498ed5c6af780f786a731faeb782a9d9 Mon Sep 17 00:00:00 2001 From: Ben Companjen Date: Thu, 14 Sep 2023 15:54:23 +0200 Subject: [PATCH 3/9] Remove more unused private methods --- .../dataverse/api/DownloadInstanceWriter.java | 40 -------------- .../dataaccess/DataAccessRequest.java | 4 -- .../search/SearchIncludeFragment.java | 19 ------- .../iq/dataverse/util/SumStatCalculator.java | 52 ------------------- .../iq/dataverse/util/json/JSONLDUtil.java | 20 ------- .../PasswordValidatorServiceBean.java | 21 -------- .../mydata/SolrQueryFormatterTest.java | 13 ----- 7 files changed, 169 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/api/DownloadInstanceWriter.java b/src/main/java/edu/harvard/iq/dataverse/api/DownloadInstanceWriter.java index af681234e82..0a6679531d7 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/DownloadInstanceWriter.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/DownloadInstanceWriter.java @@ -657,46 +657,6 @@ private long getContentSize(StorageIO accessObject) { return -1; } - private long getFileSize(DownloadInstance di) { - return getFileSize(di, null); - } - - private long getFileSize(DownloadInstance di, String extraHeader) { - if (di.getDownloadInfo() != null && di.getDownloadInfo().getDataFile() != null) { - DataFile df = di.getDownloadInfo().getDataFile(); - - // For non-tabular files, we probably know the file size: - // (except for when this is a thumbNail rquest on an image file - - // because the size will obviously be different... can still be - // figured out - but perhaps we shouldn't bother; since thumbnails - // are essentially guaranteed to be small) - if (!df.isTabularData() && (di.getConversionParam() == null || "".equals(di.getConversionParam()))) { - if (df.getFilesize() > 0) { - return df.getFilesize(); - } - } - - // For Tabular files: - // If it's just a straight file download, it's pretty easy - we - // already know the size of the file on disk (just like in the - // fragment above); we just need to make sure if we are also supplying - // the additional variable name header - then we need to add its - // size to the total... But the cases when it's a format conversion - // and, especially, subsets are of course trickier. (these are not - // supported yet). - if (df.isTabularData() && (di.getConversionParam() == null || "".equals(di.getConversionParam()))) { - long fileSize = df.getFilesize(); - if (fileSize > 0) { - if (extraHeader != null) { - fileSize += extraHeader.getBytes().length; - } - return fileSize; - } - } - } - return -1; - } - /** * @param range "bytes 0-10" for example. Found in the "Range" HTTP header. * @param fileSize File size in bytes. diff --git a/src/main/java/edu/harvard/iq/dataverse/dataaccess/DataAccessRequest.java b/src/main/java/edu/harvard/iq/dataverse/dataaccess/DataAccessRequest.java index 2bf0029b323..bc348591bc3 100644 --- a/src/main/java/edu/harvard/iq/dataverse/dataaccess/DataAccessRequest.java +++ b/src/main/java/edu/harvard/iq/dataverse/dataaccess/DataAccessRequest.java @@ -67,8 +67,4 @@ public String getParameter (String name) { } return null; } - - private DataAccessRequest(Object object) { - throw new UnsupportedOperationException("Not yet implemented"); - } } diff --git a/src/main/java/edu/harvard/iq/dataverse/search/SearchIncludeFragment.java b/src/main/java/edu/harvard/iq/dataverse/search/SearchIncludeFragment.java index 2ce06541afa..f787f31c503 100644 --- a/src/main/java/edu/harvard/iq/dataverse/search/SearchIncludeFragment.java +++ b/src/main/java/edu/harvard/iq/dataverse/search/SearchIncludeFragment.java @@ -632,25 +632,6 @@ public boolean isAllowedToClickAddData() { //return permissionService.userOn(session.getUser(), dataverse).has(Permission.UndoableEdit); } - private String getCreatedOrReleasedDate(DvObject dvObject, Date date) { - // the hedge is for https://redmine.hmdc.harvard.edu/issues/3806 - String hedge = ""; - if (dvObject instanceof Dataverse) { - hedge = ""; - } else if (dvObject instanceof Dataset) { - hedge = " maybe"; - } else if (dvObject instanceof DataFile) { - hedge = " maybe"; - } else { - hedge = " what object is this?"; - } - if (dvObject.isReleased()) { - return date + " released" + hedge; - } else { - return date + " created" + hedge; - } - } - public String getQuery() { return query; } diff --git a/src/main/java/edu/harvard/iq/dataverse/util/SumStatCalculator.java b/src/main/java/edu/harvard/iq/dataverse/util/SumStatCalculator.java index 545f2937f70..a1c854637c6 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/SumStatCalculator.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/SumStatCalculator.java @@ -74,11 +74,6 @@ public static double[] calculateSummaryStatistics(Number[] x){ nx[7] = Math.sqrt(StatUtils.variance(newx)); logger.fine("calculated stdev: "+nx[7]); return nx; - } - - private static double[] prepareForSummaryStats(Number[] x) { - Double[] z = numberToDouble(x); - return removeInvalidValues(z); } private static double[] prepareForSummaryStatsAlternative(Number[] x, int length) { @@ -99,36 +94,6 @@ private static double[] prepareForSummaryStatsAlternative(Number[] x, int length return retvector; } - /** - * Converts an array of primitive Number types to doubles - * - */ - private static Double[] numberToDouble(Number[] x){ - Double[] z= new Double[x.length]; - for (int i=0; i dl = new ArrayList(); - for (Double d : x){ - if (d != null && !Double.isNaN(d)){ - dl.add(d); - } - } - return ArrayUtils.toPrimitive( - dl.toArray(new Double[dl.size()])); - } - /** * Returns the number of Double.NaNs (or nulls) in a double-type array * @@ -144,23 +109,6 @@ private static int countInvalidValues(Number[] x){ return counter; } - /** - * Returns the number of Double.NaNs in a double-type array - * - * TODO: figure out if this is actually necessary - to count NaNs and - * nulls separately; - * -- L.A. 4.0 alpha 1 - */ - private static int countNaNs(double[] x){ - int NaNcounter=0; - for (int i=0; i properties = new HashMap<>(1); diff --git a/src/main/java/edu/harvard/iq/dataverse/validation/PasswordValidatorServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/validation/PasswordValidatorServiceBean.java index 41e7f1b8b22..17c9296f31a 100644 --- a/src/main/java/edu/harvard/iq/dataverse/validation/PasswordValidatorServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/validation/PasswordValidatorServiceBean.java @@ -231,27 +231,6 @@ private void addStandardValidator() { validators.put(ValidatorTypes.StandardValidator, passwordValidator); } } - - /** - * dictionaryRule - *

- * Reads in the getDictionaries from a file. - * - * @return A rule. - */ - private DictionaryRule dictionaryRule() { - DictionaryRule rule = null; - try { - rule = new DictionaryRule( - new WordListDictionary(WordLists.createFromReader( - getDictionaries(), - false, - new ArraysSort()))); - } catch (IOException e) { - logger.log(Level.CONFIG, e.getMessage()); - } - return rule; - } /** * dictionarySubstringRule diff --git a/src/test/java/edu/harvard/iq/dataverse/mydata/SolrQueryFormatterTest.java b/src/test/java/edu/harvard/iq/dataverse/mydata/SolrQueryFormatterTest.java index 36701d1483b..02f84072bcc 100644 --- a/src/test/java/edu/harvard/iq/dataverse/mydata/SolrQueryFormatterTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/mydata/SolrQueryFormatterTest.java @@ -25,19 +25,6 @@ public class SolrQueryFormatterTest { public static class SolrQueryFormatterNoParamTest { - private Long[] getRandomListOfLongs(int listCount, int topNumber){ - - Random r = new Random(); - - Long[] array = new Long[listCount]; - long last = 0; - for (int idx = 0; idx < listCount; idx++) { - last = r.nextInt(topNumber);// + 1; - array[idx] = last; - } - return array; - } - private Long[] getListOfLongs(int listCount){ Long[] array = new Long[listCount]; for (long a = 0; a < array.length; a++) { From 5491e4d2c6d6005398460b83b1a2c97d45044461 Mon Sep 17 00:00:00 2001 From: Ben Companjen Date: Thu, 14 Sep 2023 15:57:26 +0200 Subject: [PATCH 4/9] Remove newly unused imports Removing unused methods made some imports unused --- src/main/java/edu/harvard/iq/dataverse/DataCitation.java | 2 -- .../iq/dataverse/GuestbookResponseServiceBean.java | 1 - .../iq/dataverse/api/imports/ImportServiceBean.java | 2 -- .../iq/dataverse/datavariable/DataTableImportDDI.java | 9 --------- .../harvard/iq/dataverse/export/ddi/DdiExportUtil.java | 2 -- .../harvard/iq/dataverse/ingest/IngestServiceBean.java | 1 - .../iq/dataverse/search/SearchIncludeFragment.java | 3 --- .../edu/harvard/iq/dataverse/util/SumStatCalculator.java | 3 --- .../validation/PasswordValidatorServiceBean.java | 1 - .../iq/dataverse/mydata/SolrQueryFormatterTest.java | 1 - 10 files changed, 25 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/DataCitation.java b/src/main/java/edu/harvard/iq/dataverse/DataCitation.java index 4d8d1a79cad..bbc6d82e6ed 100644 --- a/src/main/java/edu/harvard/iq/dataverse/DataCitation.java +++ b/src/main/java/edu/harvard/iq/dataverse/DataCitation.java @@ -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; diff --git a/src/main/java/edu/harvard/iq/dataverse/GuestbookResponseServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/GuestbookResponseServiceBean.java index e8779488974..7c7c598100f 100644 --- a/src/main/java/edu/harvard/iq/dataverse/GuestbookResponseServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/GuestbookResponseServiceBean.java @@ -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; diff --git a/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportServiceBean.java index 840c15a0b96..cf183eaeb26 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/imports/ImportServiceBean.java @@ -47,9 +47,7 @@ import java.util.Date; import java.util.List; import java.util.Set; -import java.util.logging.Formatter; import java.util.logging.Level; -import java.util.logging.LogRecord; import java.util.logging.Logger; import jakarta.ejb.EJB; import jakarta.ejb.EJBException; diff --git a/src/main/java/edu/harvard/iq/dataverse/datavariable/DataTableImportDDI.java b/src/main/java/edu/harvard/iq/dataverse/datavariable/DataTableImportDDI.java index e3a0621a849..850072bf231 100644 --- a/src/main/java/edu/harvard/iq/dataverse/datavariable/DataTableImportDDI.java +++ b/src/main/java/edu/harvard/iq/dataverse/datavariable/DataTableImportDDI.java @@ -6,15 +6,6 @@ package edu.harvard.iq.dataverse.datavariable; -import edu.harvard.iq.dataverse.DataTable; -import edu.harvard.iq.dataverse.util.StringUtil; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - /** * * @author Leonid Andreev diff --git a/src/main/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtil.java b/src/main/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtil.java index 1a8dffdaa26..d119a23a511 100644 --- a/src/main/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtil.java +++ b/src/main/java/edu/harvard/iq/dataverse/export/ddi/DdiExportUtil.java @@ -27,8 +27,6 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; -import java.nio.file.Files; -import java.nio.file.Paths; import java.time.LocalDate; import java.util.*; import java.util.Map.Entry; diff --git a/src/main/java/edu/harvard/iq/dataverse/ingest/IngestServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/ingest/IngestServiceBean.java index f23358d81f9..f7a2582f21e 100644 --- a/src/main/java/edu/harvard/iq/dataverse/ingest/IngestServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/ingest/IngestServiceBean.java @@ -98,7 +98,6 @@ import java.util.Collection; import java.util.List; import java.util.Iterator; -import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; import java.util.Arrays; diff --git a/src/main/java/edu/harvard/iq/dataverse/search/SearchIncludeFragment.java b/src/main/java/edu/harvard/iq/dataverse/search/SearchIncludeFragment.java index f787f31c503..1a19ae76a93 100644 --- a/src/main/java/edu/harvard/iq/dataverse/search/SearchIncludeFragment.java +++ b/src/main/java/edu/harvard/iq/dataverse/search/SearchIncludeFragment.java @@ -3,7 +3,6 @@ import edu.harvard.iq.dataverse.DataFile; import edu.harvard.iq.dataverse.DataFileServiceBean; import edu.harvard.iq.dataverse.DataTable; -import edu.harvard.iq.dataverse.Dataset; import edu.harvard.iq.dataverse.DatasetFieldServiceBean; import edu.harvard.iq.dataverse.DatasetFieldType; import edu.harvard.iq.dataverse.DatasetFieldType.FieldType; @@ -14,7 +13,6 @@ import edu.harvard.iq.dataverse.DataversePage; import edu.harvard.iq.dataverse.DataverseServiceBean; import edu.harvard.iq.dataverse.DataverseSession; -import edu.harvard.iq.dataverse.DvObject; import edu.harvard.iq.dataverse.DvObjectServiceBean; import edu.harvard.iq.dataverse.PermissionServiceBean; import edu.harvard.iq.dataverse.PermissionsWrapper; @@ -27,7 +25,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; diff --git a/src/main/java/edu/harvard/iq/dataverse/util/SumStatCalculator.java b/src/main/java/edu/harvard/iq/dataverse/util/SumStatCalculator.java index a1c854637c6..aed6d5b20fa 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/SumStatCalculator.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/SumStatCalculator.java @@ -19,12 +19,9 @@ */ package edu.harvard.iq.dataverse.util; -import java.util.ArrayList; import java.util.Arrays; -import java.util.List; import java.util.logging.Logger; -import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.math.stat.StatUtils; diff --git a/src/main/java/edu/harvard/iq/dataverse/validation/PasswordValidatorServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/validation/PasswordValidatorServiceBean.java index 17c9296f31a..28fb9f766f2 100644 --- a/src/main/java/edu/harvard/iq/dataverse/validation/PasswordValidatorServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/validation/PasswordValidatorServiceBean.java @@ -23,7 +23,6 @@ import jakarta.inject.Named; import org.passay.CharacterCharacteristicsRule; import org.passay.CharacterRule; -import org.passay.DictionaryRule; import org.passay.DictionarySubstringRule; import org.passay.IllegalRegexRule; import org.passay.LengthRule; diff --git a/src/test/java/edu/harvard/iq/dataverse/mydata/SolrQueryFormatterTest.java b/src/test/java/edu/harvard/iq/dataverse/mydata/SolrQueryFormatterTest.java index 02f84072bcc..e694703ba6c 100644 --- a/src/test/java/edu/harvard/iq/dataverse/mydata/SolrQueryFormatterTest.java +++ b/src/test/java/edu/harvard/iq/dataverse/mydata/SolrQueryFormatterTest.java @@ -11,7 +11,6 @@ import java.util.Arrays; import java.util.HashSet; import java.util.List; -import java.util.Random; import java.util.Set; import java.util.stream.Stream; From c3ca4f9396c17e8ed3ed6dd22249e3536dcedb10 Mon Sep 17 00:00:00 2001 From: bencomp Date: Thu, 5 Oct 2023 02:16:00 +0200 Subject: [PATCH 5/9] Reimport JsonObjectBuilder While fixing the merge conflict I removed a used import --- src/main/java/edu/harvard/iq/dataverse/api/Access.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/edu/harvard/iq/dataverse/api/Access.java b/src/main/java/edu/harvard/iq/dataverse/api/Access.java index e728d28f660..a3a9474db61 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/Access.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/Access.java @@ -92,6 +92,7 @@ import jakarta.json.Json; import java.net.URI; import jakarta.json.JsonArrayBuilder; +import jakarta.json.JsonObjectBuilder; import jakarta.persistence.TypedQuery; import jakarta.ws.rs.GET; From 5fc06051484e2d7dde677352ca3e97c0fe12d080 Mon Sep 17 00:00:00 2001 From: bencomp Date: Thu, 5 Oct 2023 02:23:51 +0200 Subject: [PATCH 6/9] Reimport Thread.sleep --- src/test/java/edu/harvard/iq/dataverse/api/FilesIT.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/java/edu/harvard/iq/dataverse/api/FilesIT.java b/src/test/java/edu/harvard/iq/dataverse/api/FilesIT.java index 5129efb0046..0a16bca7008 100644 --- a/src/test/java/edu/harvard/iq/dataverse/api/FilesIT.java +++ b/src/test/java/edu/harvard/iq/dataverse/api/FilesIT.java @@ -16,6 +16,8 @@ import java.io.File; import java.io.IOException; +import static java.lang.Thread.sleep; + import java.nio.file.Path; import java.nio.file.Paths; import java.text.MessageFormat; From f47718180c70465c29dbd8b9d878141ff26669c1 Mon Sep 17 00:00:00 2001 From: bencomp Date: Thu, 5 Oct 2023 02:24:31 +0200 Subject: [PATCH 7/9] Remove commented code from Access --- .../edu/harvard/iq/dataverse/api/Access.java | 59 ------------------- 1 file changed, 59 deletions(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/api/Access.java b/src/main/java/edu/harvard/iq/dataverse/api/Access.java index a3a9474db61..61722283a5a 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/Access.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/Access.java @@ -1149,42 +1149,6 @@ public InputStream dvCardImage(@PathParam("dataverseId") Long dataverseId, @Cont // helper methods: - // What the method below does - going through all the files in the version - - // is too expensive! Instead we are now selecting an available thumbnail and - // giving the dataset card a direct link to that file thumbnail. -- L.A., 4.2.2 - /* - private StorageIO getThumbnailForDatasetVersion(DatasetVersion datasetVersion) { - logger.info("entering getThumbnailForDatasetVersion()"); - StorageIO thumbnailDataAccess = null; - if (datasetVersion != null) { - List fileMetadatas = datasetVersion.getFileMetadatas(); - - for (FileMetadata fileMetadata : fileMetadatas) { - DataFile dataFile = fileMetadata.getDataFile(); - logger.info("looking at file "+fileMetadata.getLabel()+" , file type "+dataFile.getContentType()); - - if (dataFile != null && dataFile.isImage()) { - - try { - StorageIO dataAccess = dataFile.getStorageIO(); - if (dataAccess != null && dataAccess.isLocalFile()) { - dataAccess.open(); - - thumbnailDataAccess = ImageThumbConverter.getImageThumb((FileAccessIO) dataAccess, 48); - } - } catch (IOException ioEx) { - thumbnailDataAccess = null; - } - } - if (thumbnailDataAccess != null) { - logger.info("successfully generated thumbnail, returning."); - break; - } - } - } - return thumbnailDataAccess; - } - */ // TODO: // put this method into the dataverseservice; use it there // -- L.A. 4.0 beta14 @@ -1211,29 +1175,6 @@ private File getLogo(Dataverse dataverse) { return null; } - /* - removing: - private String getWebappImageResource(String imageName) { - String imageFilePath = null; - String persistenceFilePath = null; - java.net.URL persistenceFileUrl = Thread.currentThread().getContextClassLoader().getResource("META-INF/persistence.xml"); - - if (persistenceFileUrl != null) { - persistenceFilePath = persistenceFileUrl.getDataFile(); - if (persistenceFilePath != null) { - persistenceFilePath = persistenceFilePath.replaceFirst("/[^/]*$", "/"); - imageFilePath = persistenceFilePath + "../../../resources/images/" + imageName; - return imageFilePath; - } - logger.warning("Null file path representation of the location of persistence.xml in the webapp root directory!"); - } else { - logger.warning("Could not find the location of persistence.xml in the webapp root directory!"); - } - - return null; - } - */ - /** * * @param fileId From d0778d08b8ee2d3fe102e976520aeb5995b8994a Mon Sep 17 00:00:00 2001 From: bencomp Date: Thu, 5 Oct 2023 02:24:47 +0200 Subject: [PATCH 8/9] Remove duplicate import --- src/main/java/edu/harvard/iq/dataverse/api/BuiltinUsers.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/api/BuiltinUsers.java b/src/main/java/edu/harvard/iq/dataverse/api/BuiltinUsers.java index 50862bc0d35..74b100ae391 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/BuiltinUsers.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/BuiltinUsers.java @@ -28,7 +28,6 @@ import jakarta.ws.rs.core.Response.Status; import java.util.Date; import static edu.harvard.iq.dataverse.util.json.JsonPrinter.json; -import static edu.harvard.iq.dataverse.util.json.JsonPrinter.json; /** * REST API bean for managing {@link BuiltinUser}s. From 1ebd2efcb1896e35fa0bc47ad1f1f0c7fb012af6 Mon Sep 17 00:00:00 2001 From: bencomp Date: Thu, 5 Oct 2023 02:25:12 +0200 Subject: [PATCH 9/9] Remove unused import --- .../dataverse/api/datadeposit/CollectionDepositManagerImpl.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/edu/harvard/iq/dataverse/api/datadeposit/CollectionDepositManagerImpl.java b/src/main/java/edu/harvard/iq/dataverse/api/datadeposit/CollectionDepositManagerImpl.java index 5bc50903be8..20163cb76f3 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/datadeposit/CollectionDepositManagerImpl.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/datadeposit/CollectionDepositManagerImpl.java @@ -22,7 +22,6 @@ import jakarta.ejb.EJBException; import jakarta.inject.Inject; import jakarta.servlet.http.HttpServletRequest; -import jakarta.validation.ConstraintViolation; import jakarta.validation.ConstraintViolationException; import org.apache.abdera.parser.ParseException; import org.swordapp.server.AuthCredentials;