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] Part 1: Remove custom ElasticSearch integration #6209

Merged
merged 178 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
178 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
29d415d
Delete ElasticSearch support from Kitodo - Data Management
matthias-ronge Aug 28, 2024
24b727a
Delete ElasticSearch support from Kitodo - Core
matthias-ronge Aug 28, 2024
6de51d7
Delete ElasticSearch support from Kitodo Production
matthias-ronge Aug 28, 2024
eeef5b0
Remove database column 'indexAction'
matthias-ronge Aug 28, 2024
884d6a9
Remove data interfaces (1) - Rename DataInterface to BaseBeanInterface
matthias-ronge Aug 30, 2024
843028f
*Remove data interfaces (2) - Rewrite Imports from interfaces to beans
matthias-ronge Aug 30, 2024
762b8f2
*Remove data interfaces (3) - Rewrite "? extends ...Interface" expr.s
matthias-ronge Aug 30, 2024
e833f3c
*Remove data interfaces (4) - Delete "implements ...Interface" expr.s
matthias-ronge Aug 30, 2024
0b415cf
*Remove data interfaces (5) - Rewrite any other occ.s of ...Interfaces
matthias-ronge Aug 30, 2024
80758ba
Remove data interfaces (7) - Delete intefaces
matthias-ronge Aug 30, 2024
395b1b4
Fix checkstyle - Kitodo-DataManagement
matthias-ronge Aug 30, 2024
f30ce43
Fix checkstyle - Kitodo-Core
matthias-ronge Aug 30, 2024
dfdaf4e
Remove service interfaces (1) - Move default functions and Javadoc
matthias-ronge Aug 30, 2024
d690db2
Remove service interfaces (2) - Delete intefaces
matthias-ronge Aug 30, 2024
129adb3
Fix checkstyle - Kitodo-Core
matthias-ronge Aug 30, 2024
16cb9e8
Clean-up: Delete retired 'SearchService'
matthias-ronge Aug 30, 2024
202814e
Clean-up: Delete DTO objects
matthias-ronge Aug 30, 2024
6791ec9
Clean-up: Delete CustomResponseException
matthias-ronge Aug 30, 2024
10fefe8
Clean-up: Delete DataException
matthias-ronge Aug 30, 2024
37ff351
Clean-up: Delete DataException
matthias-ronge Aug 30, 2024
caacaf9
Clean-up: Move ProcessConverter to database.converter package
matthias-ronge Aug 30, 2024
46cb05c
Undo accidental unrelated change
matthias-ronge Sep 3, 2024
1da6055
Remove stub class BaseIndexedBean
matthias-ronge Sep 3, 2024
f7d6b69
Remove unnecessary imports
matthias-ronge Sep 3, 2024
9ad9e37
Undo unnecessary change
matthias-ronge Sep 3, 2024
a1eba7f
Remove unnecessary casts
matthias-ronge Sep 3, 2024
b4ca455
Add @return description to Javadoc
matthias-ronge Sep 3, 2024
c9a585e
Remove unnecessary casts
matthias-ronge Sep 3, 2024
fe5a1d0
Add @return description to Javadoc
matthias-ronge Sep 3, 2024
d05701d
Remove duplicate throws declaration
matthias-ronge Sep 3, 2024
a258548
Remove unnecessary load bean by ID of itself
matthias-ronge Sep 3, 2024
3dc3095
Undo unnecessary change
matthias-ronge Sep 3, 2024
95ba719
Compare booleans in HQL to true or false, not 0 or 1
matthias-ronge Sep 3, 2024
ec2cfb4
Reload template
matthias-ronge Sep 3, 2024
570b965
Remove deprecated getCreationTime()
matthias-ronge Sep 5, 2024
5f6e8e2
Return empty list of null
matthias-ronge Sep 5, 2024
1be06c3
Remove empty function addAllObjectsToIndex()
matthias-ronge Sep 5, 2024
c553a77
Remove empty function findAllIDs()
matthias-ronge Sep 5, 2024
6d51303
Remove empty unused functions
matthias-ronge Sep 5, 2024
be3ea8e
Remove empty function saveToIndex()
matthias-ronge Sep 5, 2024
85fb140
Simplify wording of save(), count() and remove() functions
matthias-ronge Sep 5, 2024
cbed65f
Remove save() with additional meaningless boolean flag
matthias-ronge Sep 5, 2024
17d883d
Delete lazy class ClientSearchDatabaseService
matthias-ronge Sep 5, 2024
05679d9
Rename SearchDatabaseService to BaseBeanService
matthias-ronge Sep 5, 2024
806b5a7
Return bodies for tests for functionality no longer needed in the future
matthias-ronge Sep 10, 2024
1ff02f1
Fix refresh of process
matthias-ronge Sep 10, 2024
07ba672
Remove unnecessary throws of DAOException
matthias-ronge Sep 10, 2024
2d9b488
Display amount from table data model
matthias-ronge Sep 10, 2024
6bcb523
Remove property selectedProcessesOrProcessDTOs and obsolete DTO handling
matthias-ronge Sep 10, 2024
ca462e3
Remove unnecessary variable assignment
matthias-ronge Sep 10, 2024
6460da1
Remove dead parameters from method signature
matthias-ronge Sep 10, 2024
3b50723
Rename LazyDTOModel to LazyBeanModel
matthias-ronge Sep 10, 2024
cc9c3e6
Add final to class fields
matthias-ronge Sep 10, 2024
a84ca16
Use BeanQuery for Docket, Ruleset, Template, and Workflow
matthias-ronge Sep 10, 2024
30d2efa
Add TODO string to BeanQuery.restrictWithUserFilterString()
matthias-ronge Sep 10, 2024
7491f7f
Use StringBuilder in BeanQuery
matthias-ronge Sep 10, 2024
b5469c0
Access static method in static way
matthias-ronge Sep 10, 2024
66c6b04
Count results for comparison with given function
matthias-ronge Sep 10, 2024
74e5b2d
Fix a typo
matthias-ronge Sep 10, 2024
4da1012
Remove unnecessary method
matthias-ronge Sep 10, 2024
436ec64
Spell logged-in with hyphen
matthias-ronge Sep 10, 2024
02670bc
Remove unused functions
matthias-ronge Sep 10, 2024
220605f
Remove no longer necessary mapping DTOs to beans
matthias-ronge Sep 10, 2024
2dba023
Fix Javadoc comment
matthias-ronge Sep 10, 2024
b5ec8d2
Bring back find... functions
matthias-ronge Sep 11, 2024
385a6e2
Support Workflow in BeanQuery
matthias-ronge Sep 11, 2024
71706d5
Add back setSelectedProcesses()
matthias-ronge Sep 11, 2024
d5a847f
Fix extended search page
matthias-ronge Sep 11, 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
14 changes: 6 additions & 8 deletions Kitodo-DataManagement/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
Expand All @@ -87,6 +83,12 @@
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jcache</artifactId>
</dependency>
<dependency>
matthias-ronge marked this conversation as resolved.
Show resolved Hide resolved
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>${spotbugs-maven-plugin.version}</version>
<scope>provided</scope>
</dependency>
Comment on lines +86 to +91
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🛈 I use SpotBugs Annotations to mark special properties in the code, for example whether parameters or function results can be null or not, and especially with BaseBean.merge(), that the return value must be used. Of course, one could also just document this in the Javadoc, but this way it can be used by the FindBugs engine to check whether the condition is met and produce (more precise) reports.

<scope>provided</scope> means that this jar file will not be packed into the application war. (It is not needed at runtime.)

<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
Expand Down Expand Up @@ -119,10 +121,6 @@
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch.plugin</groupId>
<artifactId>transport-netty4-client</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,32 @@
@MappedSuperclass
public abstract class BaseBean implements Serializable {

public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
matthias-ronge marked this conversation as resolved.
Show resolved Hide resolved

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

/**
* Returns the record number of the object in the database. Can be
* {@code null} if the object has not yet been persisted.
*
* @return the record number
*/
public Integer getId() {
return id;
}

/**
* Sets the data record number of the object. This should only happen when
* data from a third-party source is integrated during operation, or in
* tests. Normally the data record number is assigned by the database when
* the object is saved.
*
* @param id
* data record number to use
*/
public void setId(Integer id) {
this.id = id;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

package org.kitodo.data.database.beans;

import java.text.ParseException;
import java.util.Date;

import javax.persistence.Column;
Expand All @@ -20,7 +21,7 @@
* This bean contains properties common for Template and Process.
*/
@MappedSuperclass
public abstract class BaseTemplateBean extends BaseIndexedBean {
public abstract class BaseTemplateBean extends BaseBean {

@Column(name = "title")
protected String title;
Expand All @@ -32,60 +33,82 @@ public abstract class BaseTemplateBean extends BaseIndexedBean {
private String sortHelperStatus;

/**
* Get title.
* Returns the process or process template name.
*
* @return value of title
* @return the process or process template name
*/
public String getTitle() {
return this.title;
}

/**
* Set title.
* Sets the process or process template name. Since the process name is used
* in file paths, it should only contain characters compatible with the
* operating file system. Also, for scripting, there should be no spaces in
* the process name.
*
* @param title as String
* @param title
* the process or process template name
*/
public void setTitle(String title) {
this.title = title.trim();
}

/**
* Get sortHelperStatus.
*
* @return value of sortHelperStatus
* Returns a coded overview of the progress of the process. The larger the
* number, the more advanced the process is, so it can be used to sort by
* progress. The numeric code consists of twelve digits, each three digits
* from 000 to 100 indicate the percentage of tasks completed, currently in
* progress, ready to start and not yet ready, in that order. For example,
* 000000025075 means that 25% of the tasks are ready to be started and 75%
* of the tasks are not yet ready to be started because previous tasks have
* not yet been processed.
*
* @return overview of the processing status
*/
public String getSortHelperStatus() {
return this.sortHelperStatus;
}

/**
* Set sortHelperStatus.
*
* @param sortHelperStatus as java.lang.String
* Sets the coded overview of the processing status of the process. This
* should only be set manually if this information comes from a third-party
* source. Typically, sorting progress is determined from the progress
* properties of the tasks in the process. The numeric code consists of
* twelve digits, each three digits from 000 to 100 indicate the percentage
* of tasks completed, currently in progress, ready to start and not yet
* ready, in that order. The sum of the four groups of numbers must be 100.
*
* @param sortHelperStatus
* coded overview of the progress with pattern
* <code>([01]\d{2}){4}</code>
*/
public void setSortHelperStatus(String sortHelperStatus) {
this.sortHelperStatus = sortHelperStatus;
}

/**
* Get creationDate.
* Returns the time the process or process template was created.
* {@link Date} is a specific instant in time, with millisecond precision.
*
* @return value of creationDate
* @return the creation time
*/
public Date getCreationDate() {
return this.creationDate;
}

/**
* Set creationDate.
* Sets the time the process or process template was created.
*
* @param creationDate as java.util.Date
* @param creationDate
* creation time to set
* @throws ParseException
* if the time cannot be converted
*/
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}


/**
* Returns a string that textually represents this object.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*/
@Entity
@Table(name = "batch")
public class Batch extends BaseIndexedBean {
public class Batch extends BaseBean {

/**
* The batch title. Using titles for batches is optional, the field may be
Expand Down Expand Up @@ -106,20 +106,20 @@ public Batch(String title, Collection<? extends Process> processes) {
}

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

/**
* Sets a batch title.
* Gives the batch a text-based title.
*
* @param title
* title of the batch
* title to use
*/
public void setTitle(String title) {
this.title = title;
Expand All @@ -135,9 +135,10 @@ public BatchType getType() {
}

/**
* Return the processes that belong to the batch.
* Returns the processes belonging to the batch. This list is not guaranteed
* to be in reliable order.
*
* @return the processes of the batch
* @return the processes belonging to the batch
*/
public List<Process> getProcesses() {
initialize(new BatchDAO(), this.processes);
Expand All @@ -148,10 +149,12 @@ public List<Process> getProcesses() {
}

/**
* Sets the processes that belong to the batch.
* Sets the list of processes belonging to the batch. The list should not
* contain duplicates, and must not contain {@code null}s.
*
* @param processes
* processes of the batch
* contain the list of processes belonging to the batch to be
* determined
*/
public void setProcesses(List<Process> processes) {
if (this.processes == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
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;
Expand All @@ -40,20 +41,26 @@ public class Client extends BaseBean {
foreignKey = @ForeignKey(name = "FK_column_id"))})
private List<ListColumn> listColumns;

@ManyToMany(mappedBy = "clients", cascade = CascadeType.PERSIST)
private List<User> users;

@OneToMany(mappedBy = "client", cascade = CascadeType.ALL, orphanRemoval = true)
private List<Project> projects;
Comment on lines +44 to +48
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🛈 These lists (via cross tables) already exist in reverse, they are just missing here. This does not involve any database changes.


/**
* Gets name.
* Returns the name of the client.
*
* @return The name.
* @return the name of the client
*/
public String getName() {
return name;
}

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

/**
* Specifies the users who work for this client. This list is not guaranteed
* to be in reliable order.
*
* @return the users who work for this client
*/
public List<User> getUsers() {
return users;
}

/**
* Sets the list of users working for this client. The list should not
* contain duplicates, and must not contain {@code null}s.
*
* @param users
* The users.
*/
public void setUsers(List<User> users) {
this.users = users;
}

/**
* Returns the client's projects. This list is not guaranteed to be in
* reliable order.
*
* @return the client's projects
*/
public List<Project> getProjects() {
return projects;
}

/**
* Sets the lists of the client's projects. The list should not contain
* duplicates, and must not contain {@code null}s.
*
* @param projects
* The projects.
*/
public void setProjects(List<Project> projects) {
this.projects = (List<Project>) projects;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public Task getCurrentTask() {
/**
* Set currentTask.
*
* @param currentTask as org.kitodo.data.database.beans.Task
* @param currentTask as org.kitodo.data.database.beans.Task
*/
public void setCurrentTask(Task currentTask) {
this.currentTask = currentTask;
Expand Down
Loading