• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IQSS / dataverse / #22929

15 Aug 2024 06:49PM CUT coverage: 20.791% (-0.009%) from 20.8%
#22929

push

github

web-flow
IQSS/7068 Reserve File Pids (#7334)

* file pid reservation

* add file pid reservation step to publish

(analogous to dataset pid register if needed)

Conflicts:
	src/main/java/edu/harvard/iq/dataverse/engine/command/impl/UpdateDatasetVersionCommand.java
	src/main/java/propertyFiles/Bundle.properties

* comment change

* check if file PIDs used once, use constants - per comments

* adding release note

* release notes, API doc update

* reflecting datasets and files for the PID endpoint

* removing release note about pre-reg for file PIDs as this is not supported

* file pid pre-reservation

Conflicts:
	src/main/java/edu/harvard/iq/dataverse/engine/command/impl/AbstractDatasetCommand.java
	src/main/java/propertyFiles/Bundle.properties

* avoid problem when GlobalIDServiceBean implicitly merges

@kcondon sees a DB error persisting a file with null createtime during
the GlobalIDServiceBean.getBean call which uses a set namedQuery to find
the :DoiProvider. Create times for files are set above, but not merged
prior to calling registerFilePidsIfNeeded. Assuming the namedQuery is
forcing the file (without a merge) to persist which triggers the error.
In #7337, the code is reworked so there is a merge prior to
registerFilePidsIfNeeded. This commit adds one temporarily so this PR
works indepdently of the other.

* update theDataset

* noting that PID reservation can cause old timeouts to be too short

* more specifics

* release note update

* cleanup reformatting

* further cleanup

* set createTime earlier

---------

Co-authored-by: Danny Brooke <danny_brooke@harvard.edu>

0 of 54 new or added lines in 4 files covered. (0.0%)

3 existing lines in 1 file now uncovered.

17524 of 84285 relevant lines covered (20.79%)

0.21 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/ReservePidCommand.java
1
package edu.harvard.iq.dataverse.engine.command.impl;
2

3
import edu.harvard.iq.dataverse.Dataset;
4
import edu.harvard.iq.dataverse.authorization.Permission;
5
import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser;
6
import edu.harvard.iq.dataverse.engine.command.CommandContext;
7
import edu.harvard.iq.dataverse.engine.command.DataverseRequest;
8
import edu.harvard.iq.dataverse.engine.command.RequiredPermissions;
9
import edu.harvard.iq.dataverse.engine.command.exception.CommandException;
10
import edu.harvard.iq.dataverse.engine.command.exception.PermissionException;
11
import edu.harvard.iq.dataverse.util.BundleUtil;
12
import java.util.Collections;
13
import java.util.logging.Logger;
14

15
/**
16
 * No required permissions because we check for superuser status.
17
 * @param <T>
18
 */
19
@RequiredPermissions({})
20
public class ReservePidCommand extends AbstractDatasetCommand<Dataset> {
21

22
    private static final Logger logger = Logger.getLogger(ReservePidCommand.class.getCanonicalName());
×
23

24
    private final Dataset dataset;
25

26
    public ReservePidCommand(DataverseRequest request, Dataset dataset) {
27
        super(request, dataset);
×
28
        this.dataset = dataset;
×
29
    }
×
30

31
    @Override
32
    public Dataset execute(CommandContext ctxt) throws CommandException {
33

34
        if (!(getUser() instanceof AuthenticatedUser) || !getUser().isSuperuser()) {
×
35
            throw new PermissionException(BundleUtil.getStringFromBundle("admin.api.auth.mustBeSuperUser"),
×
36
                    this, Collections.singleton(Permission.EditDataset), dataset);
×
37
        }
NEW
38
        registerExternalIdentifier(getDataset(), ctxt, true);
×
NEW
39
        registerFilePidsIfNeeded(getDataset(), ctxt, true);
×
NEW
40
        return dataset;
×
41
    }
42

43
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc