Skip to content

Commit

Permalink
Merged dspace-cris-2023_02_x into dspace-cris-2023_02_x-DSC-1526
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattia Vianelli committed Feb 5, 2024
2 parents 0e16cb5 + 302ab35 commit dc3e81c
Show file tree
Hide file tree
Showing 25 changed files with 852 additions and 83 deletions.
29 changes: 12 additions & 17 deletions dspace-api/src/main/java/org/dspace/layout/CrisLayoutBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import javax.persistence.Cacheable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
Expand Down Expand Up @@ -79,13 +80,8 @@ public class CrisLayoutBox implements ReloadableEntity<Integer> {
)
private Set<MetadataField> metadataSecurityFields = new HashSet<>();

@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(
name = "cris_layout_box2securitygroup",
joinColumns = {@JoinColumn(name = "box_id")},
inverseJoinColumns = {@JoinColumn(name = "group_id")}
)
private Set<Group> groupSecurityFields = new HashSet<>();
@OneToMany(fetch = FetchType.LAZY, mappedBy = "box", cascade = CascadeType.ALL, orphanRemoval = true)
private Set<CrisLayoutBox2SecurityGroup> box2SecurityGroups = new HashSet<>();

@OneToMany(fetch = FetchType.LAZY, mappedBy = "box", cascade = CascadeType.ALL)
@OrderBy(value = "row, cell, priority")
Expand Down Expand Up @@ -288,20 +284,19 @@ public void setContainer(Boolean container) {
this.container = container;
}

public void setGroupSecurityFields(Set<Group> groupSecurityFields) {
this.groupSecurityFields = groupSecurityFields;
}

public void addGroupSecurityFields(Set<Group> groupSecurityFields) {
this.groupSecurityFields.addAll(groupSecurityFields);
public Set<Group> getGroupSecurityFields() {
return box2SecurityGroups.stream()
.map(crisLayoutBox2SecurityGroup ->
crisLayoutBox2SecurityGroup.getGroup())
.collect(Collectors.toSet());
}

public void addGroupSecurityFields(Group group) {
this.groupSecurityFields.add(group);
public Set<CrisLayoutBox2SecurityGroup> getBox2SecurityGroups() {
return box2SecurityGroups;
}

public Set<Group> getGroupSecurityFields() {
return groupSecurityFields;
public void setBox2SecurityGroups(Set<CrisLayoutBox2SecurityGroup> box2SecurityGroups) {
this.box2SecurityGroups = box2SecurityGroups;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.layout;

import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MapsId;
import javax.persistence.Table;

import org.dspace.eperson.Group;

@Entity
@Table(name = "cris_layout_box2securitygroup")
public class CrisLayoutBox2SecurityGroup implements Serializable {

@Embeddable
public static class CrisLayoutBox2SecurityGroupId implements Serializable {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "box_id")
private CrisLayoutBox boxId;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "group_id")
private Group groupId;

public CrisLayoutBox2SecurityGroupId() {

}

public CrisLayoutBox2SecurityGroupId(CrisLayoutBox boxId, Group groupId) {
this.boxId = boxId;
this.groupId = groupId;
}

public CrisLayoutBox getBoxId() {
return boxId;
}

public void setBoxId(CrisLayoutBox boxId) {
this.boxId = boxId;
}

public Group getGroupId() {
return groupId;
}

public void setGroupId(Group groupId) {
this.groupId = groupId;
}
}

@EmbeddedId
private CrisLayoutBox2SecurityGroupId id;

@ManyToOne(fetch = FetchType.LAZY)
@MapsId("boxId")
@JoinColumn(name = "box_id", insertable = false, updatable = false)
private CrisLayoutBox box;

@ManyToOne(fetch = FetchType.LAZY)
@MapsId("groupId")
@JoinColumn(name = "group_id", insertable = false, updatable = false)
private Group group;

@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "alternative_box_id", nullable = true)
private CrisLayoutBox alternativeBox;

public CrisLayoutBox2SecurityGroup() {

}

public CrisLayoutBox2SecurityGroup(CrisLayoutBox2SecurityGroupId id,
CrisLayoutBox box, Group group,
CrisLayoutBox alternativeBox) {
this.id = id;
this.box = box;
this.group = group;
this.alternativeBox = alternativeBox;
}

public CrisLayoutBox2SecurityGroupId getId() {
return id;
}

public void setId(CrisLayoutBox2SecurityGroupId id) {
this.id = id;
}

public CrisLayoutBox getBox() {
return box;
}

public void setBox(CrisLayoutBox box) {
this.box = box;
}

public Group getGroup() {
return group;
}

public void setGroup(Group group) {
this.group = group;
}

public CrisLayoutBox getAlternativeBox() {
return alternativeBox;
}

public void setAlternativeBox(CrisLayoutBox alternativeBox) {
this.alternativeBox = alternativeBox;
}
}
29 changes: 11 additions & 18 deletions dspace-api/src/main/java/org/dspace/layout/CrisLayoutTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,8 @@ public class CrisLayoutTab implements ReloadableEntity<Integer> {
@JoinColumn(name = "tab_id") }, inverseJoinColumns = { @JoinColumn(name = "metadata_field_id") })
private Set<MetadataField> metadataSecurityFields = new HashSet<>();

@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(
name = "cris_layout_tab2securitygroup",
joinColumns = {@JoinColumn(name = "tab_id")},
inverseJoinColumns = {@JoinColumn(name = "group_id")}
)
private Set<Group> groupSecurityFields = new HashSet<>();

@OneToMany(fetch = FetchType.LAZY, mappedBy = "tab", cascade = CascadeType.ALL)
private Set<CrisLayoutTab2SecurityGroup> tab2SecurityGroups = new HashSet<>();

@Column(name = "is_leading")
private Boolean leading;
Expand Down Expand Up @@ -230,20 +224,19 @@ public List<CrisLayoutBox> getBoxes() {
.collect(Collectors.toList());
}

public void setGroupSecurityFields(Set<Group> groupSecurityFields) {
this.groupSecurityFields = groupSecurityFields;
}

public void addGroupSecurityFields(Set<Group> groupSecurityFields) {
this.groupSecurityFields.addAll(groupSecurityFields);
public Set<Group> getGroupSecurityFields() {
return tab2SecurityGroups.stream()
.map(crisLayoutTab2SecurityGroup ->
crisLayoutTab2SecurityGroup.getGroup())
.collect(Collectors.toSet());
}

public void addGroupSecurityFields(Group group) {
this.groupSecurityFields.add(group);
public Set<CrisLayoutTab2SecurityGroup> getTab2SecurityGroups() {
return tab2SecurityGroups;
}

public Set<Group> getGroupSecurityFields() {
return groupSecurityFields;
public void setTab2SecurityGroups(Set<CrisLayoutTab2SecurityGroup> tab2SecurityGroups) {
this.tab2SecurityGroups = tab2SecurityGroups;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.layout;

import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MapsId;
import javax.persistence.Table;

import org.dspace.eperson.Group;

@Entity
@Table(name = "cris_layout_tab2securitygroup")
public class CrisLayoutTab2SecurityGroup implements Serializable {

@Embeddable
public static class CrisLayoutTab2SecurityGroupId implements Serializable {
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "tab_id")
private CrisLayoutTab tabId;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "group_id")
private Group groupId;

public CrisLayoutTab2SecurityGroupId() {

}

public CrisLayoutTab2SecurityGroupId(CrisLayoutTab tabId, Group groupId) {
this.tabId = tabId;
this.groupId = groupId;
}

public CrisLayoutTab getTabId() {
return tabId;
}

public void setTabId(CrisLayoutTab tabId) {
this.tabId = tabId;
}

public Group getGroupId() {
return groupId;
}

public void setGroupId(Group groupId) {
this.groupId = groupId;
}
}

@EmbeddedId
private CrisLayoutTab2SecurityGroupId id;

@ManyToOne(fetch = FetchType.LAZY)
@MapsId("tabId")
@JoinColumn(name = "tab_id", insertable = false, updatable = false)
private CrisLayoutTab tab;

@ManyToOne(fetch = FetchType.LAZY)
@MapsId("groupId")
@JoinColumn(name = "group_id", insertable = false, updatable = false)
private Group group;

@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "alternative_tab_id")
private CrisLayoutTab alternativeTab;

public CrisLayoutTab2SecurityGroup() {

}

public CrisLayoutTab2SecurityGroup(CrisLayoutTab2SecurityGroupId id,
CrisLayoutTab tab, Group group,
CrisLayoutTab alternativeTab) {
this.id = id;
this.tab = tab;
this.group = group;
this.alternativeTab = alternativeTab;
}

public CrisLayoutTab2SecurityGroupId getId() {
return id;
}

public void setId(CrisLayoutTab2SecurityGroupId id) {
this.id = id;
}

public CrisLayoutTab getTab() {
return tab;
}

public void setTab(CrisLayoutTab tab) {
this.tab = tab;
}

public Group getGroup() {
return group;
}

public void setGroup(Group group) {
this.group = group;
}

public CrisLayoutTab getAlternativeTab() {
return alternativeTab;
}

public void setAlternativeTab(CrisLayoutTab alternativeTab) {
this.alternativeTab = alternativeTab;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ public interface CrisLayoutToolValidator {

String GROUP_COLUMN = "GROUP";

String ALTERNATIVE_TO_COLUMN = "ALTERNATIVE_TO";

String METADATA_TYPE = "METADATA";

String BITSTREAM_TYPE = "BITSTREAM";
Expand Down
Loading

0 comments on commit dc3e81c

Please sign in to comment.