Skip to content

Commit

Permalink
Merge pull request IQSS#11052 from IQSS/11044-edit-facet-bug
Browse files Browse the repository at this point in the history
11044 edit facet bug
  • Loading branch information
ofahimIQSS authored Dec 4, 2024
2 parents 1b5a1ea + ca95ad8 commit a36db2d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,24 @@ public void delete(DataverseFacet dataverseFacet) {
cache.invalidate();
}

public void deleteFacetsFor( Dataverse d ) {
em.createNamedQuery("DataverseFacet.removeByOwnerId")
.setParameter("ownerId", d.getId())
.executeUpdate();
public void deleteFacetsFor(Dataverse d) {
em.createNamedQuery("DataverseFacet.removeByOwnerId")
.setParameter("ownerId", d.getId())
.executeUpdate();
cache.invalidate(d.getId());
}

}

public DataverseFacet create(int displayOrder, DatasetFieldType fieldType, Dataverse ownerDv) {
DataverseFacet dataverseFacet = new DataverseFacet();

dataverseFacet.setDisplayOrder(displayOrder);
dataverseFacet.setDatasetFieldType(fieldType);
dataverseFacet.setDataverse(ownerDv);

ownerDv.getDataverseFacets().add(dataverseFacet);
em.persist(dataverseFacet);

cache.invalidate(ownerDv.getId());
return dataverseFacet;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ private void processMetadataBlocks() {
private void processFacets(CommandContext ctxt) {
if (facets != null) {
ctxt.facets().deleteFacetsFor(dataverse);

dataverse.setDataverseFacets(new ArrayList<>());

if (!facets.isEmpty()) {
dataverse.setFacetRoot(true);
}
Expand Down

0 comments on commit a36db2d

Please sign in to comment.