Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

#6948 check file labels on new draft #7016

Merged
merged 1 commit into from
Jul 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/edu/harvard/iq/dataverse/Dataset.java
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ private DatasetVersion createNewDatasetVersion(Template template, FileMetadata f
newFm.setDataFile(fm.getDataFile());
newFm.setDatasetVersion(dsv);
newFm.setProvFreeForm(fm.getProvFreeForm());
newFm.setInPriorVersion(true);

//fmVarMet would be updated in DCT
if ((fmVarMet != null && !fmVarMet.getId().equals(fm.getId())) || (fmVarMet == null)) {
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/FileMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,17 @@ public Long getVersion() {
public void setVersion(Long version) {
this.version = version;
}

@Transient
private boolean inPriorVersion;

public boolean isInPriorVersion() {
return inPriorVersion;
}

public void setInPriorVersion(boolean inPriorVersion) {
this.inPriorVersion = inPriorVersion;
}

@Transient
private boolean selected;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,10 @@ private static Set<String> existingPathNamesAsSet(DatasetVersion version, FileMe
// create list of existing path names from all FileMetadata in the DatasetVersion
// (skipping the one specified fileMetadata, if supplied. That's in order to
// be able to call this method
// #6942 added proxy for existing files to a boolean set when dataset version copy is done
for (Iterator<FileMetadata> fmIt = version.getFileMetadatas().iterator(); fmIt.hasNext();) {
FileMetadata fm = fmIt.next();
if (fm.getId() != null && (fileMetadata == null || !fm.getId().equals(fileMetadata.getId()))) {
if ((fm.isInPriorVersion() || fm.getId() != null) && (fileMetadata == null || !fm.getId().equals(fileMetadata.getId()))) {
String existingName = fm.getLabel();
String existingDir = fm.getDirectoryLabel();

Expand Down