-
Notifications
You must be signed in to change notification settings - Fork 63
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
OCR-D Workflow integration #5697
Closed
Closed
Changes from all commits
Commits
Show all changes
76 commits
Select commit
Hold shift + click to select a range
3a5aaa6
add config parameter
markusweigelt 4672dd1
initial commit of ocr workflow entity
markusweigelt 8d6809a
add entities and db object for ocr workflow
markusweigelt 54f0d93
add ocr workflow edit
markusweigelt de02bb5
add bean to hibernate
markusweigelt c041fc3
select ocr workflow on project level and fix delete and editing of oc…
markusweigelt 35637f0
create ocr workflow file in process dir
markusweigelt b59203a
add config parameter
markusweigelt df3b6f5
initial commit of ocr workflow entity
markusweigelt 6ae0344
add entities and db object for ocr workflow
markusweigelt 805637a
add ocr workflow edit
markusweigelt c737e71
add bean to hibernate
markusweigelt a227bbd
select ocr workflow on project level and fix delete and editing of oc…
markusweigelt 922ae8e
add ocr workflwo tab to process edit
markusweigelt 464b861
improve selection and remove process ocr workflow tab
markusweigelt c450ad3
add comment and remove unused file
markusweigelt ff53014
improve messages
markusweigelt 18ff2d8
add config parameter
markusweigelt 7055ef3
initial commit of ocr workflow entity
markusweigelt 7380441
add entities and db object for ocr workflow
markusweigelt b57a3f2
add ocr workflow edit
markusweigelt 319727e
add bean to hibernate
markusweigelt bfd037e
select ocr workflow on project level and fix delete and editing of oc…
markusweigelt 3b23eb9
create ocr workflow file in process dir
markusweigelt 305bb06
add config parameter
markusweigelt d3e53ca
initial commit of ocr workflow entity
markusweigelt 980cfa0
add entities and db object for ocr workflow
markusweigelt 0a3ca19
add ocr workflow edit
markusweigelt 8197c62
add ocr workflwo tab to process edit
markusweigelt ac4883e
improve selection and remove process ocr workflow tab
markusweigelt 5a22270
add comment and remove unused file
markusweigelt 138c740
improve messages
markusweigelt 525091e
Merge branch 'ocrd-main' of github.com:markusweigelt/kitodo-productio…
markusweigelt 28ae981
improvements of review notes
markusweigelt 7f78c38
Merge branch 'ocrd-main' of github.com:markusweigelt/kitodo-productio…
markusweigelt 73f39e3
improve label
markusweigelt 980c322
Merge master into branch
markusweigelt abf063f
Rename V2_109__Add_authorities_to_manage_ocr_workflow.sql to V2_124__…
markusweigelt 8790fff
Improvements for checkstyle
markusweigelt 7e7ab3a
Change identifier of table
markusweigelt 2ec1b19
Revert "Change identifier of table"
markusweigelt 64203e0
Rename table idenifier
markusweigelt 3f76202
Add ocr workflow config to process settings
markusweigelt 2127a97
Improve process form
markusweigelt 3a736ef
Add ocrworkflow variable for scripts
markusweigelt ec84969
Fix checkstyle
markusweigelt b1de092
Remove copy to process dir
markusweigelt db660b4
Revert change of method
markusweigelt 23944ba
Revert unnecessary changes
markusweigelt 6686042
Revert unnecessary changes
markusweigelt 90b63e6
Revert unnecessary changes
markusweigelt 2cb746c
Improvements and changes of review
markusweigelt 540ed9d
Rename edit path
markusweigelt 0c7f4f6
Remove state of workflow
markusweigelt 2fc9af5
Rename ocr to ocrd
markusweigelt 5cb74c5
Rename ocr to ocrd
markusweigelt 20c3d4e
Rename ocr to ocrd
markusweigelt d39a62a
Rename ocr to ocrd
markusweigelt 17cbade
Rename ocr to ocrd
markusweigelt d57cd7b
Rename ocr to ocrd
markusweigelt 10d03b9
Rename ocr to ocrd
markusweigelt 651d710
Rename ocr to ocrd
markusweigelt 01d275d
Rename OCR-D Workflow to OCR Profile
markusweigelt 347f6ee
Rename OCR-D Workflow to OCR Profile
markusweigelt 8e389d4
Rename OCR-D Workflow to OCR Profile
markusweigelt 67e5ecc
Improve checkstyle
markusweigelt 453ab22
Fixes regarding renaming to OCR profiles
markusweigelt ecbae9e
Change first letter of converter reference
markusweigelt ffc58d1
Rename variable ocrprofile to ocrprofilefilename
markusweigelt e76a770
Improve checkstyle
markusweigelt aa4ac13
Add named parameter
markusweigelt 42480ff
Improve authorities and support relativ path to ocr profile
markusweigelt 93f6aa9
Improve java doc
markusweigelt 08c746f
Allow symlinks in file path
markusweigelt 587aa3e
Add file separator
markusweigelt 5a90f0d
Add project dms export path
markusweigelt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
91 changes: 91 additions & 0 deletions
91
Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/OcrProfile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* (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. | ||
*/ | ||
|
||
package org.kitodo.data.database.beans; | ||
|
||
import java.util.Objects; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.ForeignKey; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.ManyToOne; | ||
import javax.persistence.Table; | ||
|
||
@Entity | ||
@Table(name = "ocrprofile") | ||
public class OcrProfile extends BaseBean { | ||
|
||
@Column(name = "title") | ||
private String title; | ||
|
||
@Column(name = "file") | ||
private String file; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "client_id", foreignKey = @ForeignKey(name = "FK_ocrprofile_client_id")) | ||
private Client client; | ||
|
||
public String getTitle() { | ||
return this.title; | ||
} | ||
|
||
public void setTitle(String title) { | ||
this.title = title; | ||
} | ||
|
||
public String getFile() { | ||
return this.file; | ||
} | ||
|
||
public void setFile(String file) { | ||
this.file = file; | ||
} | ||
|
||
|
||
/** | ||
* Get client. | ||
* | ||
* @return Client object | ||
*/ | ||
public Client getClient() { | ||
return this.client; | ||
} | ||
|
||
/** | ||
* Set client. | ||
* | ||
* @param client | ||
* as Client object | ||
*/ | ||
public void setClient(Client client) { | ||
this.client = client; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object object) { | ||
if (this == object) { | ||
return true; | ||
} | ||
|
||
if (object instanceof OcrProfile) { | ||
OcrProfile ocrProfile = (OcrProfile) object; | ||
return Objects.equals(this.getId(), ocrProfile.getId()); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(title, file); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
Kitodo-DataManagement/src/main/java/org/kitodo/data/database/persistence/OcrProfileDAO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* (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. | ||
*/ | ||
|
||
package org.kitodo.data.database.persistence; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
import org.kitodo.data.database.beans.OcrProfile; | ||
import org.kitodo.data.database.exceptions.DAOException; | ||
|
||
public class OcrProfileDAO extends BaseDAO<OcrProfile> { | ||
|
||
@Override | ||
public OcrProfile getById(Integer id) throws DAOException { | ||
OcrProfile ocrProfile = retrieveObject(OcrProfile.class, id); | ||
if (Objects.isNull(ocrProfile)) { | ||
throw new DAOException("Object cannot be found in database"); | ||
} | ||
return ocrProfile; | ||
} | ||
|
||
@Override | ||
public List<OcrProfile> getAll() throws DAOException { | ||
return retrieveAllObjects(OcrProfile.class); | ||
} | ||
|
||
@Override | ||
public List<OcrProfile> getAll(int offset, int size) throws DAOException { | ||
return retrieveObjects("FROM OcrProfile ORDER BY id ASC", offset, size); | ||
} | ||
|
||
@Override | ||
public List<OcrProfile> getAllNotIndexed(int offset, int size) throws DAOException { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public void remove(Integer ocrProfileId) throws DAOException { | ||
removeObject(OcrProfile.class, ocrProfileId); | ||
} | ||
|
||
/** | ||
* Get available OCR profile - available means that OCR profile is assigned to client with given id. | ||
* | ||
* @param clientId | ||
* id of client to which searched OCR profiles should be assigned | ||
* @return list of available OCR profiles objects | ||
*/ | ||
public List<OcrProfile> getAvailableOcrProfiles(int clientId) { | ||
return getByQuery("SELECT w FROM OcrProfile AS w INNER JOIN w.client AS c WITH c.id = :clientId", | ||
Collections.singletonMap("clientId", clientId)); | ||
} | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
...gement/src/main/resources/db/migration/V2_124__Add_authorities_to_manage_ocr_profiles.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
-- | ||
-- (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. | ||
-- | ||
|
||
-- Add authorities to manage OCR profile | ||
INSERT IGNORE INTO authority (title) VALUES ('addOcrProfile_clientAssignable'); | ||
INSERT IGNORE INTO authority (title) VALUES ('editOcrProfile_clientAssignable'); | ||
INSERT IGNORE INTO authority (title) VALUES ('deleteOcrProfile_clientAssignable'); | ||
INSERT IGNORE INTO authority (title) VALUES ('viewOcrProfile_clientAssignable'); | ||
|
||
-- Add table "ocrprofile" | ||
CREATE TABLE IF NOT EXISTS ocrprofile ( | ||
id INT(10) NOT NULL AUTO_INCREMENT, | ||
title varchar(255) NOT NULL, | ||
file varchar(255) NOT NULL, | ||
client_id INT(10) NOT NULL, | ||
PRIMARY KEY(id) | ||
) DEFAULT CHARACTER SET = utf8mb4 | ||
COLLATE utf8mb4_unicode_ci; | ||
|
||
-- Add column related to OCR profile to process table | ||
ALTER TABLE process ADD ocr_profile_id INT(11) DEFAULT NULL; | ||
|
||
-- Add foreign key | ||
ALTER TABLE process add constraint `FK_process_ocr_profile_id` | ||
foreign key (ocr_profile_id) REFERENCES ocrprofile(id); | ||
|
||
-- Add column related to OCR profile to template table | ||
ALTER TABLE template ADD ocr_profile_id INT(11) DEFAULT NULL; | ||
|
||
-- Add foreign key | ||
ALTER TABLE template add constraint `FK_template_ocr_profile_id` | ||
foreign key (ocr_profile_id) REFERENCES ocrprofile(id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
Kitodo/src/main/java/org/kitodo/production/converter/OcrProfileConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* (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. | ||
*/ | ||
|
||
package org.kitodo.production.converter; | ||
|
||
import javax.faces.component.UIComponent; | ||
import javax.faces.context.FacesContext; | ||
import javax.faces.convert.Converter; | ||
import javax.inject.Named; | ||
|
||
import org.kitodo.production.services.ServiceManager; | ||
|
||
@Named("OcrProfileConverter") | ||
public class OcrProfileConverter extends BeanConverter implements Converter { | ||
|
||
@Override | ||
public Object getAsObject(FacesContext context, UIComponent component, String value) { | ||
return getAsObject(ServiceManager.getOcrProfileService(), value); | ||
} | ||
|
||
@Override | ||
public String getAsString(FacesContext context, UIComponent component, Object value) { | ||
return getAsString(value, "ocrProfile"); | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add corresponding
@OneToMany
relationship inOCRWorkflow
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have such a corresponding relationship for similar examples, for example Ruleset or Docket and we don't need this relationship atm. If the relationship is needed then we should add it later and provide an appropriate migration script. I want to customize the data structure only for the cases which are really needed.
@solth What do you mean?