Skip to content

Commit

Permalink
Merge pull request #6209 from matthias-ronge/5760_1
Browse files Browse the repository at this point in the history
[hibernate-search] Part 1: Remove custom ElasticSearch integration
  • Loading branch information
solth authored Sep 13, 2024
2 parents cf673cd + d5a847f commit ee5fe13
Show file tree
Hide file tree
Showing 296 changed files with 4,877 additions and 15,530 deletions.
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>
<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 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";

@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;

/**
* 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

0 comments on commit ee5fe13

Please sign in to comment.