Skip to content

Commit

Permalink
Remove database column 'indexAction'
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-ronge committed Aug 28, 2024
1 parent 0ac8116 commit d2130d2
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 265 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,11 @@

package org.kitodo.data.database.beans;

import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.MappedSuperclass;

import org.kitodo.data.database.enums.IndexAction;

/**
* Base bean class.
*/
@MappedSuperclass
public abstract class BaseIndexedBean extends BaseBean {

@Column(name = "indexAction")
@Enumerated(EnumType.STRING)
private IndexAction indexAction;

/**
* Get action which should be performed on ElasticSearch index.
*
* @return action which needs to be performed on index
*/
public IndexAction getIndexAction() {
return indexAction;
}

/**
* Set DONE if record is already indexed in ElasticSearch, set INDEX if it
* needs to be indexed and DELETE if it needs to be deleted.
*
* @param indexAction
* index, delete or done
*/
public void setIndexAction(IndexAction indexAction) {
this.indexAction = indexAction;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.kitodo.config.ConfigMain;
import org.kitodo.data.database.beans.BaseBean;
import org.kitodo.data.database.beans.BaseIndexedBean;
import org.kitodo.data.database.enums.IndexAction;
import org.kitodo.data.database.exceptions.DAOException;

/**
Expand Down Expand Up @@ -390,7 +389,6 @@ void storeObject(T object) throws DAOException {
void storeAsIndexed(List<T> baseBeans) throws DAOException {
for (BaseBean baseBean : baseBeans) {
BaseIndexedBean entity = (BaseIndexedBean) getById(baseBean.getId());
entity.setIndexAction(IndexAction.DONE);
storeObject((T) entity);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--
-- (c) Kitodo. Key to digital objects e. V. <[email protected]>
--
-- This file is part of the Kitodo project.
--
-- It is licensed under GNU General Public License version 3 or later.
--
-- For the full copyright and license information, please read the
-- GPL3-License.txt file that was distributed with this source code.
--

--
-- Delete columns for index action

ALTER TABLE batch DROP COLUMN indexAction;
ALTER TABLE docket DROP COLUMN indexAction;
ALTER TABLE filter DROP COLUMN indexAction;
ALTER TABLE process DROP COLUMN indexAction;
ALTER TABLE project DROP COLUMN indexAction;
ALTER TABLE ruleset DROP COLUMN indexAction;
ALTER TABLE task DROP COLUMN indexAction;
ALTER TABLE template DROP COLUMN indexAction;
ALTER TABLE workflow DROP COLUMN indexAction;
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.kitodo.data.database.beans.Docket;
import org.kitodo.data.database.enums.IndexAction;
import org.kitodo.data.database.exceptions.DAOException;

public class DocketDaoIT {
Expand Down Expand Up @@ -53,11 +52,9 @@ public void runPersistenceSuitTest() throws DAOException {
private List<Docket> getAuthorities() {
Docket firstDocket = new Docket();
firstDocket.setTitle("first_docket");
firstDocket.setIndexAction(IndexAction.DONE);

Docket secondDocket = new Docket();
secondDocket.setTitle("second_docket");
secondDocket.setIndexAction(IndexAction.INDEX);

Docket thirdDocket = new Docket();
thirdDocket.setTitle("third_docket");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.kitodo.data.database.beans.Filter;
import org.kitodo.data.database.enums.IndexAction;
import org.kitodo.data.database.exceptions.DAOException;

public class FilterDaoIT {
Expand Down Expand Up @@ -53,11 +52,9 @@ public void runPersistenceSuitTest() throws DAOException {
private List<Filter> getAuthorities() {
Filter firstFilter = new Filter();
firstFilter.setValue("first_filter");
firstFilter.setIndexAction(IndexAction.DONE);

Filter secondFilter = new Filter();
secondFilter.setValue("second_filter");
secondFilter.setIndexAction(IndexAction.INDEX);

Filter thirdFilter = new Filter();
thirdFilter.setValue("third_filter");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.kitodo.data.database.beans.Property;
import org.kitodo.data.database.enums.IndexAction;
import org.kitodo.data.database.enums.PropertyType;
import org.kitodo.data.database.exceptions.DAOException;

Expand Down Expand Up @@ -58,11 +57,9 @@ private List<Property> getProperties() {
Property firstProperty = new Property();
firstProperty.setTitle("first_property");
firstProperty.setDataType(null);
firstProperty.setIndexAction(IndexAction.DONE);

Property secondProperty = new Property();
secondProperty.setTitle("second_property");
secondProperty.setIndexAction(IndexAction.INDEX);

Property thirdProperty = new Property();
thirdProperty.setTitle("third_property");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.kitodo.data.database.beans.Ruleset;
import org.kitodo.data.database.enums.IndexAction;
import org.kitodo.data.database.exceptions.DAOException;

public class RulesetDaoIT {
Expand Down Expand Up @@ -53,11 +52,9 @@ public void runPersistenceSuitTest() throws DAOException {
private List<Ruleset> getAuthorities() {
Ruleset firstRuleset = new Ruleset();
firstRuleset.setTitle("first_ruleset");
firstRuleset.setIndexAction(IndexAction.DONE);

Ruleset secondRuleset = new Ruleset();
secondRuleset.setTitle("second_ruleset");
secondRuleset.setIndexAction(IndexAction.INDEX);

Ruleset thirdRuleset = new Ruleset();
thirdRuleset.setTitle("third_ruleset");
Expand Down
Loading

0 comments on commit d2130d2

Please sign in to comment.