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

[hibernate-search] Re-enable lazy loading #6199

Closed
wants to merge 110 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
177c25b
Introduce an interface for the DTO objects
matthias-ronge Apr 10, 2024
6b617e4
Use 'extends' in interface lists
matthias-ronge Apr 11, 2024
094e528
Fix type clashes
matthias-ronge Apr 11, 2024
59b47a8
Move image binary getter out of DTO object
matthias-ronge Apr 11, 2024
580f8e1
Fix more type clashes
matthias-ronge Apr 11, 2024
f39dab0
Use the interface in the data beans.
matthias-ronge Apr 12, 2024
d2a4bd1
Fix checkstyle
matthias-ronge Apr 12, 2024
c5cbf18
No longer use SimpleDateFormat from a constant
matthias-ronge Apr 12, 2024
5c00c6e
Fix Exception 'null' when retrieving int value for key numberOfImages
matthias-ronge Apr 15, 2024
e6dc1a5
Undo unnecessary changes
matthias-ronge Apr 15, 2024
35e29c0
Rename active templates property accordingly
matthias-ronge Apr 17, 2024
645277a
Fix enum comparison
matthias-ronge Apr 19, 2024
e793f1e
Fix LazyInitializationException
matthias-ronge Apr 23, 2024
9fccf2c
Fix several occurrences of PropertyNotWritableException
matthias-ronge Apr 23, 2024
f42fa94
Fix Javadoc
matthias-ronge Apr 23, 2024
22e8263
Fix displayed wrong task's processing begin
matthias-ronge Apr 23, 2024
bff6815
No longer import PropertyNotWritableException
matthias-ronge May 21, 2024
2cc1890
Remove an unused import
matthias-ronge May 21, 2024
797f7a4
Use apache.commons.lang3.StringUtils instead of log4j.util.Strings
matthias-ronge May 21, 2024
77ba25a
Use is(Not)Blank instead of is(Not)Empty
matthias-ronge May 21, 2024
14dbdc8
No longer use '...Interface' as part of variable names
matthias-ronge May 21, 2024
290b4c5
Improve reason messages in tests
matthias-ronge May 21, 2024
62f9258
Add database interfaces for services
matthias-ronge Apr 19, 2024
0b4b0ac
Implement the interfaces on the services
matthias-ronge Apr 23, 2024
fba94b8
Fix checkstyle
matthias-ronge Apr 23, 2024
242a716
Add database interfaces for services
matthias-ronge Apr 19, 2024
a94925a
Implement the interfaces on the services
matthias-ronge Apr 23, 2024
e85bfbd
Fix checkstyle
matthias-ronge Apr 23, 2024
e74d0b2
Qualify filters map
matthias-ronge May 13, 2024
7c55721
Base BatchService on SearchDatabaseService
matthias-ronge May 13, 2024
a0d46d1
Base DocketService on SearchDatabaseService
matthias-ronge May 13, 2024
62483ef
Base ProjectService on SearchDatabaseService
matthias-ronge May 14, 2024
c7662e7
Base RulesetService on SearchDatabaseService
matthias-ronge May 14, 2024
083da3f
Base ProjectService on SearchDatabaseService
matthias-ronge May 15, 2024
39aa1d5
Base WorkflowService on SearchDatabaseService
matthias-ronge May 15, 2024
2203bd5
Base TemplateService on SearchDatabaseService
matthias-ronge May 15, 2024
2cec534
Base FilterService on SearchDatabaseService
matthias-ronge May 15, 2024
5dec368
Base ProcessService on SearchDatabaseService -- not yet implemented
matthias-ronge May 16, 2024
a01f5ef
Remove duplicate Javadoc from overridden functions
matthias-ronge May 16, 2024
94d90bb
Base ProcessService on SearchDatabaseService
matthias-ronge May 16, 2024
8b7954c
Base TaskService on SearchDatabaseService
matthias-ronge May 16, 2024
fffa9f2
Remove ElasticSearch exceptions
matthias-ronge May 16, 2024
ec798ed
Delete base search services
matthias-ronge May 16, 2024
64abe9e
Clean up tests
matthias-ronge May 16, 2024
1c421e1
Remove comments and fix some things
matthias-ronge May 16, 2024
ca21607
Fix checkstyle
matthias-ronge May 17, 2024
9bc0a2f
[PR #5999] Fix build ignoring config-local/* files in Eclipse on Windows
matthias-ronge Mar 28, 2024
7cf612d
Replace LIMIT and OFFSET with the corresponding Hibernate commands (1)
matthias-ronge May 28, 2024
4f932d0
Replace LIMIT and OFFSET with the corresponding Hibernate commands (2)
matthias-ronge May 28, 2024
cb7a766
Replace LIMIT and OFFSET with the corresponding Hibernate commands (3)
matthias-ronge May 28, 2024
cdd6648
Replace LIMIT and OFFSET with the corresponding Hibernate commands (4)
matthias-ronge May 28, 2024
78b6227
Replace LIMIT and OFFSET with the corresponding Hibernate commands (5)
matthias-ronge May 28, 2024
9391168
Replace LIMIT and OFFSET with the corresponding Hibernate commands (6)
matthias-ronge May 28, 2024
702016b
Replace LIMIT and OFFSET with the corresponding Hibernate commands (7)
matthias-ronge May 28, 2024
d15477d
Base search queries on objects
matthias-ronge May 29, 2024
0d9f297
Use only one placeholder for sort order
matthias-ronge May 29, 2024
113c688
Disable lazy loading where necessary
matthias-ronge May 29, 2024
67c1ad1
Add missing sort mapping
matthias-ronge May 29, 2024
77555b9
Fix checkstyle problems
matthias-ronge May 29, 2024
4e82549
Fixes endless loop of saving processes
matthias-ronge Jul 3, 2024
0384232
Fix EntityNotFoundException: deleted object would be re-saved by cascade
matthias-ronge Jul 4, 2024
8a1d662
Fix HibernateException: could not re-associate uninitialized transient
matthias-ronge Jul 8, 2024
a93454b
Fix checkstyle
matthias-ronge Jul 8, 2024
26306d2
Disable currently not working tests
matthias-ronge Jul 8, 2024
33698c9
Delete test for functionality no longer implemented
matthias-ronge Jul 8, 2024
a10ae69
Disable tests by removing @Test annotation
matthias-ronge Jul 9, 2024
e2092b2
Remove tests, where functionallity will not be supported further on
matthias-ronge Jul 9, 2024
9b8ec03
Disable another currently not working test
matthias-ronge Jul 9, 2024
9a2ec8a
Fix ProcessFormIT.testProcessesSelection()
matthias-ronge Jul 9, 2024
7b60533
Fix CreateProcessFormIT.shouldCreateNewProcessWithoutWorkflow()
matthias-ronge Jul 9, 2024
c36a79a
Fix CreateProcessFormIT.shouldCreateNewProcess()
matthias-ronge Jul 9, 2024
af5d869
Fix LazyDTOModelIT.shouldLoadFromIndex()
matthias-ronge Jul 9, 2024
1c968d6
Fix NewspaperProcessesGeneratorIT.shouldNotGenerateDuplicateProcessTi…
matthias-ronge Jul 9, 2024
6f4711a
Fix ImportProcessesIT.shouldImport()
matthias-ronge Jul 9, 2024
603d1da
Fix ProcessServiceIT.shouldFindLinkableParentProcesses()
matthias-ronge Jul 9, 2024
beae6dd
Fix ProcessServiceIT.shouldSaveProcess()
matthias-ronge Jul 9, 2024
b8ef32b
Fix TemplateServiceIT.shouldHasCompleteTasks()
matthias-ronge Jul 9, 2024
f3e280d
Use @Ignore annotation instead of @Disabled
matthias-ronge Jul 11, 2024
7949012
Sort order into query string (H2 database doesn't support parameter)
matthias-ronge Jul 11, 2024
b82684c
Reference objects by field, not database row
matthias-ronge Jul 11, 2024
48315cb
Compare processingStatus to enum elements
matthias-ronge Jul 11, 2024
30605c9
Filter task by user's roles
matthias-ronge Jul 11, 2024
832785c
Fix filter quotes
matthias-ronge Jul 11, 2024
c187360
Immediately load tasks of template
matthias-ronge Aug 21, 2024
4c24341
Use BeanQuery class to form query, fix issue with LIKE query
matthias-ronge Aug 21, 2024
54f61dd
Do not show inactive projects
matthias-ronge Aug 21, 2024
cf34cd3
Add missing task to template
matthias-ronge Aug 22, 2024
c2e7506
Don't print additional square brackets in log statements
matthias-ronge Aug 23, 2024
b8bf393
Support explicit search for "id:nnn"
matthias-ronge Aug 23, 2024
4b77e73
ImportingST: Disable test breaking with unrelated reason
matthias-ronge Aug 29, 2024
2b79481
Fix NullPointerException
matthias-ronge Aug 26, 2024
8db32d6
Disable listTasksTest: displaying task's edit type not available
matthias-ronge Aug 26, 2024
9eac939
Different order when displaying from the database
matthias-ronge Aug 26, 2024
25660ee
Delete searchForProcesses: no longer provided this way
matthias-ronge Aug 26, 2024
0746141
Delete searchForProcessesAnd Sort: no longer provided this way
matthias-ronge Aug 26, 2024
9054880
Disable testExtendedSearch: not yet implemented
matthias-ronge Aug 26, 2024
fd3f550
Delete caseInsensitiveSearchForProcesses: no longer provided this way
matthias-ronge Aug 26, 2024
8889434
Disable tests: currently not implemented
matthias-ronge Aug 26, 2024
c11840c
Query projects for logged-in user
matthias-ronge Aug 27, 2024
8d89d88
Fix ProcessSortingST
matthias-ronge Aug 28, 2024
1d2d758
In Task objects, use "id:" to search for the ID of the process
matthias-ronge Aug 28, 2024
db8dc63
Deduplicate try / catch
matthias-ronge Aug 28, 2024
9b0782f
Disable CalendarST - currently not implemented
matthias-ronge Aug 28, 2024
050daa4
Use BeanQuery in SearchResultGeneration.getResultsWithFilter()
matthias-ronge Aug 29, 2024
cfd88bf
Workflow needs unique name for reliable order in "ORDER BY title ASC"
matthias-ronge Aug 29, 2024
84b3fd4
Fix misspelled task title
matthias-ronge Aug 29, 2024
427a0fa
Use the constant value from the class for 100000000000 value
matthias-ronge Aug 29, 2024
bc85dab
Workflow needs unique name for reliable order in "ORDER BY title ASC"
matthias-ronge Aug 29, 2024
e064a5f
Bring back lazy loading for projects' processes
matthias-ronge Aug 28, 2024
0e8cfbf
Bring back lazy loading for processes' children
matthias-ronge Aug 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1206,8 +1206,8 @@ private ComplexMetadataViewInterface getCmvi(
List<MetadataViewWithValuesInterface> metadataViewWithValuesInterfaceList, String keyId) {
return (ComplexMetadataViewInterface) metadataViewWithValuesInterfaceList.stream()
.filter(mvwvi -> mvwvi.getMetadata().isPresent())
.filter(metadataViewWithValuesInterface -> keyId
.equals(metadataViewWithValuesInterface.getMetadata().get().getId()))
.filter(metadataViewWithValues -> keyId
.equals(metadataViewWithValues.getMetadata().get().getId()))
.findAny().get().getMetadata().get();
}

Expand Down Expand Up @@ -1235,8 +1235,8 @@ private List<String> ids(Collection<MetadataViewInterface> mviColl) {
*/
private List<String> ids(List<MetadataViewWithValuesInterface> metadataViewWithValuesInterfaceList) {
return metadataViewWithValuesInterfaceList.stream()
.filter(metadataViewWithValuesInterface -> metadataViewWithValuesInterface.getMetadata().isPresent())
.map(metadataViewWithValuesInterface -> metadataViewWithValuesInterface.getMetadata().get().getId())
.filter(metadataViewWithValues -> metadataViewWithValues.getMetadata().isPresent())
.map(metadataViewWithValues -> metadataViewWithValues.getMetadata().get().getId())
.collect(Collectors.toList());
}

Expand Down
6 changes: 6 additions & 0 deletions Kitodo-DataManagement/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jcache</artifactId>
</dependency>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>${spotbugs-maven-plugin.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,25 @@

import org.hibernate.Hibernate;
import org.kitodo.data.database.persistence.BaseDAO;
import org.kitodo.data.interfaces.DataInterface;

/**
* Base bean class.
*/
@MappedSuperclass
public abstract class BaseBean implements Serializable {
public abstract class BaseBean implements DataInterface, Serializable {

@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
protected Integer id;

@Override
public Integer getId() {
return id;
}

@Override
public void setId(Integer id) {
this.id = id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

import org.kitodo.data.database.enums.BatchType;
import org.kitodo.data.database.persistence.BatchDAO;
import org.kitodo.data.interfaces.BatchInterface;
import org.kitodo.data.interfaces.ProcessInterface;

/**
* A user-definable, unordered collection of processes whose batch-type tasks
Expand All @@ -39,7 +41,7 @@
*/
@Entity
@Table(name = "batch")
public class Batch extends BaseIndexedBean {
public class Batch extends BaseIndexedBean implements BatchInterface {

/**
* The batch title. Using titles for batches is optional, the field may be
Expand Down Expand Up @@ -105,22 +107,12 @@ public Batch(String title, Collection<? extends Process> processes) {
this.processes = new ArrayList<>(processes);
}

/**
* Returns the batch title. Using titles for batches is optional, the field
* may be {@code null}. If so, the function returns null.
*
* @return the batch title
*/
@Override
public String getTitle() {
return title;
}

/**
* Sets a batch title.
*
* @param title
* title of the batch
*/
@Override
public void setTitle(String title) {
this.title = title;
}
Expand All @@ -134,11 +126,7 @@ public BatchType getType() {
return type;
}

/**
* Return the processes that belong to the batch.
*
* @return the processes of the batch
*/
@Override
public List<Process> getProcesses() {
initialize(new BatchDAO(), this.processes);
if (Objects.isNull(this.processes)) {
Expand All @@ -147,18 +135,14 @@ public List<Process> getProcesses() {
return this.processes;
}

/**
* Sets the processes that belong to the batch.
*
* @param processes
* processes of the batch
*/
public void setProcesses(List<Process> processes) {
@Override
@SuppressWarnings("unchecked")
public void setProcesses(List<? extends ProcessInterface> processes) {
if (this.processes == null) {
this.processes = processes;
this.processes = (List<Process>) processes;
} else {
this.processes.clear();
this.processes.addAll(processes);
this.processes.addAll((List<? extends Process>) processes);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.kitodo.data.database.persistence.ClientDAO;
import org.kitodo.data.interfaces.ClientInterface;
import org.kitodo.data.interfaces.ProjectInterface;
import org.kitodo.data.interfaces.UserInterface;

@Entity
@Table(name = "client")
public class Client extends BaseBean {
public class Client extends BaseBean implements ClientInterface {

@Column(name = "name")
private String name;
Expand All @@ -40,21 +44,18 @@ public class Client extends BaseBean {
foreignKey = @ForeignKey(name = "FK_column_id"))})
private List<ListColumn> listColumns;

/**
* Gets name.
*
* @return The name.
*/
@ManyToMany(mappedBy = "clients", cascade = CascadeType.PERSIST)
private List<User> users;

@OneToMany(mappedBy = "client", cascade = CascadeType.ALL, orphanRemoval = true)
private List<Project> projects;

@Override
public String getName() {
return name;
}

/**
* Sets name.
*
* @param name
* The name.
*/
@Override
public void setName(String name) {
this.name = name;
}
Expand Down Expand Up @@ -99,4 +100,26 @@ public List<ListColumn> getListColumns() {
public void setListColumns(List<ListColumn> columns) {
this.listColumns = columns;
}

@Override
public List<User> getUsers() {
return users;
}

@Override
@SuppressWarnings("unchecked")
public void setUsers(List<? extends UserInterface> users) {
this.users = (List<User>) users;
}

@Override
public List<Project> getProjects() {
return projects;
}

@Override
@SuppressWarnings("unchecked")
public void setProjects(List<? extends ProjectInterface> projects) {
this.projects = (List<Project>) projects;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import javax.persistence.Table;

import org.kitodo.data.database.enums.CommentType;
import org.kitodo.data.interfaces.TaskInterface;

@Entity
@Table(name = "comment")
Expand Down Expand Up @@ -216,10 +217,10 @@ public Task getCurrentTask() {
/**
* Set currentTask.
*
* @param currentTask as org.kitodo.data.database.beans.Task
* @param currentTask as org.kitodo.data.interfaces.TaskInterface
*/
public void setCurrentTask(Task currentTask) {
this.currentTask = currentTask;
public void setCurrentTask(TaskInterface currentTask) {
this.currentTask = (Task) currentTask;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.kitodo.data.interfaces.ClientInterface;
import org.kitodo.data.interfaces.DocketInterface;

@Entity
@Table(name = "docket")
public class Docket extends BaseIndexedBean {
public class Docket extends BaseIndexedBean implements DocketInterface {

@Column(name = "title")
private String title;
Expand All @@ -37,18 +40,22 @@ public class Docket extends BaseIndexedBean {
@JoinColumn(name = "client_id", foreignKey = @ForeignKey(name = "FK_docket_client_id"))
private Client client;

@Override
public String getTitle() {
return title;
}

@Override
public void setTitle(String title) {
this.title = title;
}

@Override
public String getFile() {
return file;
}

@Override
public void setFile(String file) {
this.file = file;
}
Expand All @@ -74,23 +81,14 @@ public void setActive(boolean active) {
this.active = active;
}

/**
* Get client.
*
* @return Client object
*/
@Override
public Client getClient() {
return this.client;
}

/**
* Set client.
*
* @param client
* as Client object
*/
public void setClient(Client client) {
this.client = client;
@Override
public void setClient(ClientInterface client) {
this.client = (Client) client;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.kitodo.data.interfaces.FilterInterface;

/**
* Filter bean.
*/
@Entity
@Table(name = "filter")
public class Filter extends BaseIndexedBean {
public class Filter extends BaseIndexedBean implements FilterInterface {

@Column(name = "value", columnDefinition = "longtext")
private String value;
Expand All @@ -38,21 +40,12 @@ public class Filter extends BaseIndexedBean {
@JoinColumn(name = "user_id", foreignKey = @ForeignKey(name = "FK_filter_user_id"))
private User user;

/**
* Get filter value.
*
* @return filter value
*/
@Override
public String getValue() {
return value;
}

/**
* Set filter value.
*
* @param value
* filter
*/
@Override
public void setValue(String value) {
this.value = value;
}
Expand Down
Loading