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

WIP: MetadataBlock refactoring #9932

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
97 changes: 0 additions & 97 deletions src/main/java/edu/harvard/iq/dataverse/DatasetDistributor.java

This file was deleted.

136 changes: 0 additions & 136 deletions src/main/java/edu/harvard/iq/dataverse/DatasetFieldDefaultValue.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,12 @@ public DatasetFieldType save(DatasetFieldType dsfType) {
return em.merge(dsfType);
}

/**
* Not sure why this method is here, better use the metadataBlockServiceBean
* @param mdb
* @return
*/
@Deprecated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add the @deprecated tag to the javadoc and provide a reason in the @Deprecated annotation, according to Sonarcloud.

public MetadataBlock save(MetadataBlock mdb) {
return em.merge(mdb);
}
Expand Down
36 changes: 19 additions & 17 deletions src/main/java/edu/harvard/iq/dataverse/DatasetFieldType.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,18 @@ public void setId(Long id) {

private String validationFormat;

/**
* The user can configure facets and their order on a per dataverse basis.
* This member setups the needed connection in the domain model.
*/
@OneToMany(mappedBy = "datasetFieldType")
private Set<DataverseFacet> dataverseFacets;


/**
* If the definition of the DatasetFieldType does not already define `required` the user can change the obligation per dataverse.
* Furthermore, the user can `hide` DatasetFields on a per dataverse basis.
* This member setups the needed connection in the domain model.
*/
@OneToMany(mappedBy = "datasetFieldType")
private Set<DataverseFieldTypeInputLevel> dataverseFieldTypeInputLevels;

Expand Down Expand Up @@ -322,10 +331,10 @@ public JsonLDTerm getJsonLDTerm() {
public void setUri(String uri) {
this.uri=uri;
}

/**
* The list of controlled vocabulary terms that may be used as values for
* fields of this field type.
* If the definition of the DatasetFieldType includes a definition for a controlled Vocabulary, i.e. a list of allowed values.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a complete sentence – I expect another part starting with "then", because of "If".

* This member setups the needed connection in the domain model.
*/
@OneToMany(mappedBy = "datasetFieldType", cascade = {CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST})
@OrderBy("displayOrder ASC")
Expand Down Expand Up @@ -356,6 +365,7 @@ public ControlledVocabularyValue getControlledVocabularyValue( String strValue )
* Collection of field types that are children of this field type.
* A field type may consist of one or more child field types, but only one
* parent.
* Definition of the value via `parentDatasetFieldType`
*/
@OneToMany(mappedBy = "parentDatasetFieldType", cascade = {CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST})
@OrderBy("displayOrder ASC")
Expand All @@ -369,6 +379,9 @@ public void setChildDatasetFieldTypes(Collection<DatasetFieldType> childDatasetF
this.childDatasetFieldTypes = childDatasetFieldTypes;
}

/**
* Defines the parent of this DatasetFieldType, if no parent is defined `null` is used.
*/
@ManyToOne(cascade = CascadeType.MERGE)
private DatasetFieldType parentDatasetFieldType;

Expand Down Expand Up @@ -490,8 +503,8 @@ public boolean equals(Object object) {
}

/**
* List of fields that use this field type. If this field type is removed,
* these fields will be removed too.
* If DatasetFieldType is used by a DatasetField to gather metadata we reference the type.
* This member setups the needed connection in the domain model, but is not activilty used.
*/
@OneToMany(mappedBy = "datasetFieldType", cascade = {CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST})
private List<DatasetField> datasetFields;
Expand All @@ -504,17 +517,6 @@ public void setDatasetFields(List<DatasetField> datasetFieldValues) {
this.datasetFields = datasetFieldValues;
}

@OneToMany(mappedBy = "datasetField", cascade = {CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST})
private List<DatasetFieldDefaultValue> datasetFieldDefaultValues;

public List<DatasetFieldDefaultValue> getDatasetFieldDefaultValues() {
return datasetFieldDefaultValues;
}

public void setDatasetFieldDefaultValues(List<DatasetFieldDefaultValue> datasetFieldDefaultValues) {
this.datasetFieldDefaultValues = datasetFieldDefaultValues;
}

@Override
public int compareTo(DatasetFieldType o) {
return Integer.compare(this.getDisplayOrder(), (o.getDisplayOrder()));
Expand Down
68 changes: 0 additions & 68 deletions src/main/java/edu/harvard/iq/dataverse/DatasetKeyword.java

This file was deleted.

Loading
Loading