Skip to content

Commit

Permalink
Merge pull request #4834 from effective-webwork/import-wizard-Design
Browse files Browse the repository at this point in the history
Import process design
  • Loading branch information
Kathrin-Huber authored Dec 14, 2021
2 parents 220e680 + b56e42a commit e75b8c1
Show file tree
Hide file tree
Showing 17 changed files with 159 additions and 143 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public LinkedList<ExemplarRecord> getExemplarRecords() {
public void setSelectedExemplarRecord(ExemplarRecord selectedExemplarRecord) {
try {
ImportService.setSelectedExemplarRecord(selectedExemplarRecord, this.hitModel.getSelectedCatalog(),
this.createProcessForm.getProcessMetadataTab().getProcessDetailsElements());
this.createProcessForm.getProcessMetadata().getProcessDetailsElements());
String summary = Helper.getTranslation("newProcess.catalogueSearch.exemplarRecordSelectedSummary");
String detail = Helper.getTranslation("newProcess.catalogueSearch.exemplarRecordSelectedDetail",
selectedExemplarRecord.getOwner(), selectedExemplarRecord.getSignature());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ public class CreateProcessForm extends BaseForm implements RulesetSetupInterface

private final CatalogImportDialog catalogImportDialog = new CatalogImportDialog(this);
private final FileUploadDialog fileUploadDialog = new FileUploadDialog(this);
private final SearchDialog searchDialog = new SearchDialog(this);
private final ProcessDataTab processDataTab = new ProcessDataTab(this);
private final ProcessMetadataTab processMetadataTab = new ProcessMetadataTab(this);
private final SearchTab searchTab = new SearchTab(this);
private final TitleRecordLinkTab titleRecordLinkTab = new TitleRecordLinkTab(this);
private final ProcessMetadata processMetadata = new ProcessMetadata(this);

private RulesetManagementInterface rulesetManagement;
private final List<Locale.LanguageRange> priorityList = ServiceManager.getUserService()
Expand All @@ -82,8 +82,7 @@ public class CreateProcessForm extends BaseForm implements RulesetSetupInterface
private String referringView = "";
private int progress;

static final int ADDITIONAL_FIELDS_TAB_INDEX = 1;
static final int TITLE_RECORD_LINK_TAB_INDEX = 3;
static final int TITLE_RECORD_LINK_TAB_INDEX = 1;

/**
* Returns the ruleset management to access the ruleset.
Expand Down Expand Up @@ -169,21 +168,21 @@ public ProcessDataTab getProcessDataTab() {
}

/**
* Get processMetadataTab.
* Get processMetadata.
*
* @return value of processMetadataTab
* @return value of processMetadata
*/
public ProcessMetadataTab getProcessMetadataTab() {
return processMetadataTab;
public ProcessMetadata getProcessMetadata() {
return processMetadata;
}

/**
* Get searchTab.
* Get searchDialog.
*
* @return value of searchTab
* @return value of searchDialog
*/
public SearchTab getSearchTab() {
return searchTab;
public SearchDialog getSearchDialog() {
return searchDialog;
}

/**
Expand Down Expand Up @@ -485,14 +484,14 @@ private void processAncestors() throws ProcessGenerationException {
ProcessService.setParentRelations(this.processes.get(index + 1).getProcess(), process);
}
if (index == 0) {
List<ProcessDetail> processDetails = processMetadataTab.getProcessDetailsElements();
List<ProcessDetail> processDetails = processMetadata.getProcessDetailsElements();
process.setSortHelperImages(processDataTab.getGuessedImages());
// FIXME: this always triggers 'processTitleAlreadyInUse' now, because the process has already been saved
// with this title in ImportService.processProcessChildren (line 884)!
if (!ProcessValidator.isContentValid(process.getTitle(), processDetails, true)) {
throw new ProcessGenerationException("Error creating process hierarchy: invalid process content!");
}
processMetadataTab.preserve();
processMetadata.preserve();
ImportService.addProperties(process, template, processDetails, processDataTab.getDocType(),
processDataTab.getTiffHeaderImageDescription());
ImportService.updateTasks(process);
Expand All @@ -516,7 +515,7 @@ private void saveProcessHierarchyMetadata() {
// save ancestor processes meta.xml files
for (TempProcess tempProcess : this.processes) {
if (this.processes.indexOf(tempProcess) == 0) {
processMetadataTab.preserve();
processMetadata.preserve();
}
saveTempProcessMetadata(tempProcess);
}
Expand Down Expand Up @@ -567,7 +566,7 @@ public void initializeProcesses() {
processGenerator.generateProcess(template.getId(), project.getId());
this.processes = new LinkedList<>(Collections.singletonList(
new TempProcess(processGenerator.getGeneratedProcess(), new Workpiece())));
this.processMetadataTab.initializeProcessDetails(getProcesses().get(0).getWorkpiece().getLogicalStructure());
this.processMetadata.initializeProcessDetails(getProcesses().get(0).getWorkpiece().getLogicalStructure());
} catch (ProcessGenerationException e) {
logger.error(e.getLocalizedMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ void showRecord() {
if (Objects.nonNull(parentTempProcess)) {
this.createProcessForm.getProcesses().add(parentTempProcess);
}
this.createProcessForm.setEditActiveTabIndex(CreateProcessForm.ADDITIONAL_FIELDS_TAB_INDEX);
}
}

Expand Down Expand Up @@ -117,7 +116,7 @@ void fillCreateProcessForm(LinkedList<TempProcess> processes) {
&& firstProcess.getMetadataNodes().getLength() > 0) {
Collection<Metadata> metadata = ImportService.importMetadata(firstProcess.getMetadataNodes(),
MdSec.DMD_SEC);
createProcessForm.getProcessMetadataTab().getProcessDetails().setMetadata(metadata);
createProcessForm.getProcessMetadata().getProcessDetails().setMetadata(metadata);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ public void setDocType(String docType) {
if (!this.createProcessForm.getProcesses().isEmpty()) {
this.createProcessForm.getProcesses().get(0).getWorkpiece().getLogicalStructure().setType(this.docType);
if (this.docType.isEmpty()) {
this.createProcessForm.getProcessMetadataTab().setProcessDetails(ProcessFieldedMetadata.EMPTY);
this.createProcessForm.getProcessMetadata().setProcessDetails(ProcessFieldedMetadata.EMPTY);
} else {
ProcessFieldedMetadata metadata = this.createProcessForm.getProcessMetadataTab()
ProcessFieldedMetadata metadata = this.createProcessForm.getProcessMetadata()
.initializeProcessDetails(this.createProcessForm.getProcesses().get(0).getWorkpiece().getLogicalStructure());
this.createProcessForm.getProcessMetadataTab().setProcessDetails(metadata);
this.createProcessForm.getProcessMetadata().setProcessDetails(metadata);
}
}
}
Expand Down Expand Up @@ -197,7 +197,7 @@ void setAllDocTypes(List<SelectItem> allDocTypes) {
* Generate process titles and other details.
*/
public void generateProcessTitleAndTiffHeader() {
List<ProcessDetail> processDetails = this.createProcessForm.getProcessMetadataTab().getProcessDetailsElements();
List<ProcessDetail> processDetails = this.createProcessForm.getProcessMetadata().getProcessDetailsElements();
Process process = this.createProcessForm.getMainProcess();
try {
StructuralElementViewInterface docTypeView = createProcessForm.getRulesetManagement().getStructuralElementView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public ProcessFieldedMetadata() {

/**
* Creates a new root metadata group representing the metadata table
* content in the processMetadataTab.
* content in the processMetadata.
*
* @param structure
* structure selected by the user
Expand Down Expand Up @@ -502,7 +502,7 @@ public boolean isValid() {
}

/**
* Reads the contents of the processMetadataTab and stores the values in the
* Reads the contents of the processMetadata and stores the values in the
* appropriate place. If the line is used to edit a field of the METS
* structure, this field is set, otherwise the metadata will be stored in
* the list. The hidden metadata is also written back there again.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
import org.kitodo.production.services.data.ImportService;
import org.primefaces.model.TreeNode;

public class ProcessMetadataTab {
private static final Logger logger = LogManager.getLogger(ProcessMetadataTab.class);
public class ProcessMetadata {
private static final Logger logger = LogManager.getLogger(ProcessMetadata.class);

private final CreateProcessForm createProcessForm;

private ProcessFieldedMetadata processDetails = ProcessFieldedMetadata.EMPTY;

public ProcessMetadataTab(CreateProcessForm createProcessForm) {
public ProcessMetadata(CreateProcessForm createProcessForm) {
this.createProcessForm = createProcessForm;
}

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

package org.kitodo.production.forms.createprocess;

import static org.elasticsearch.index.query.QueryBuilders.matchQuery;

import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
Expand All @@ -32,14 +30,14 @@
import org.kitodo.production.helper.Helper;
import org.kitodo.production.services.ServiceManager;

public class SearchTab {
public class SearchDialog {

private static final Logger logger = LogManager.getLogger(SearchTab.class);
private static final Logger logger = LogManager.getLogger(SearchDialog.class);

private final CreateProcessForm createProcessForm;
private Process originalProcess;

SearchTab(CreateProcessForm createProcessForm) {
SearchDialog(CreateProcessForm createProcessForm) {
this.createProcessForm = createProcessForm;
}

Expand Down Expand Up @@ -96,8 +94,7 @@ public void copyMetadata() {
if (Objects.nonNull(originalProcess.getParent())) {
this.createProcessForm.getTitleRecordLinkTab().setParentAsTitleRecord(originalProcess.getParent());
}
this.createProcessForm.getProcessMetadataTab().getProcessDetails().setMetadata(root.getMetadata());
this.createProcessForm.setEditActiveTabIndex(CreateProcessForm.ADDITIONAL_FIELDS_TAB_INDEX);
this.createProcessForm.getProcessMetadata().getProcessDetails().setMetadata(root.getMetadata());
} catch (IOException e) {
Helper.setErrorMessage(CreateProcessForm.ERROR_READING, new Object[] {"template-metadata" }, logger, e);
}
Expand Down
2 changes: 2 additions & 0 deletions Kitodo/src/main/resources/messages/messages_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ author=Autor
available=Verf\u00fcgbar
back=Zur\u00FCck
backToTask=Zur\u00FCck zu Aufgabe
basicData=Basisdaten
batch=Batch
batchProperties=Batch Eigenschaften
batchStep=Batch Schritt
Expand Down Expand Up @@ -258,6 +259,7 @@ currentFolder=Aktueller Ordner
currentPageReportTemplate={currentPage} von {totalPages}
currentRepresentative=Aktueller Repr\u00E4sentant\:
currentTask=Aktuelle Aufgabe
dataTransfer=Daten\u00FCbernahme
dataCopier.runtimeException=Fehler beim Kopieren der Daten\:
dataEditor.addElement.assignPagesToSingleDocStruc=Seiten k\u00F6nnen nur zu einem einzelnen Strukturelement hinzugef\u00FCgt werden!
dataEditor.addElement.createMultipleDocStrucWithoutPages=Mehrere Strukturelemente k\u00F6nnen nur erzeugt werden, wenn keine Seiten f\u00FCr eine automatische Zuweisung ausgew\u00E4hlt sind!
Expand Down
2 changes: 2 additions & 0 deletions Kitodo/src/main/resources/messages/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ author=Author
available=Available
back=Back
backToTask=Back to task
basicData=Basic data
batch=Batch
batchProperties=Batch properties
batchStep=Batch task
Expand Down Expand Up @@ -262,6 +263,7 @@ currentFolder=Current folder
currentPageReportTemplate={currentPage} of {totalPages}
currentRepresentative=Current representative\:
currentTask=Current task
dataTransfer=Data transfer
dataCopier.runtimeException=Copying the data failed\:
dataEditor.addElement.assignPagesToSingleDocStruc=Pages can only be assigned to a single element!
dataEditor.addElement.createMultipleDocStrucWithoutPages=Multiple elements can only be created at once when no pages are selected for assignment!
Expand Down
8 changes: 7 additions & 1 deletion Kitodo/src/main/webapp/WEB-INF/resources/css/kitodo.css
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ section#content-section {

.content-header .ui-panel-content > form,
.content-header .ui-panel-content > button,
.ui-menubutton,
.ui-selectbooleanbutton {
float: right;
margin-left: var(--default-full-size);
Expand Down Expand Up @@ -1312,7 +1313,7 @@ Import form
padding-right: var(--default-half-size);
}

#fileUploadForm {
#fileUploadForm, #searchEditForm {
padding: 0 var(--default-double-size);
}

Expand Down Expand Up @@ -3134,6 +3135,11 @@ footer {
width: calc(100% - 64px);
}

.basicDataTitle {
font-weight: bold;
padding: var(--default-half-size) var(--default-full-size);
}

#tasksTabView\:actionForm {
padding: 0 var(--default-full-size);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,18 +192,21 @@ input.ui-state-error {

.ui-button.secondary,
.ui-widget-content .ui-button.secondary,
.ui-menubutton.secondary > button,
.ui-selectcheckboxmenu.secondary .ui-selectcheckboxmenu-label {
background: var(--pure-white);
border: solid var(--default-border-width) var(--light-blue);
color: var(--light-blue);
}

.ui-button.secondary .ui-icon,
ui-menubutton.secondary .ui-icon,
.ui-widget-content .ui-button.secondary .ui-icon {
color: var(--light-blue);
}

.ui-button.secondary.ui-state-hover,
.ui-menubutton.secondary > button.ui-state-hover,
.ui-widget-content .ui-button.secondary.ui-state-hover {
background: var(--pure-white);
border: solid var(--default-border-width) var(--focused-blue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:p="http://primefaces.org/ui">

<div class="basicDataTitle">
<h:outputText value="#{msgs.basicData}"/>
</div>
<p:panelGrid id="processDataEditGrid" layout="grid" columns="2">
<p:row>
<div>
Expand Down Expand Up @@ -103,4 +106,14 @@
</p:row>

</p:panelGrid>
<div class="ot-folder-use">
<h:outputText value="#{msgs.metadata}"/>
</div>

<p:panelGrid id="processMetadata" layout="grid" columns="1">
<ui:include src="/WEB-INF/templates/includes/metadataTreeTable.xhtml">
<ui:param name="root" value="#{CreateProcessForm.processMetadata.logicalMetadataTree}"/>
<ui:param name="readOnly" value="#{false}"/>
</ui:include>
</p:panelGrid>
</ui:composition>
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!--
*
* (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.
*
-->

<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:p="http://primefaces.org/ui">

<p:dialog widgetVar="searchEditDialog"
id="searchEditDialog"
width="578"
modal="true"
resizable="false">
<h3>#{msgs.processTemplate}</h3>
<h:form id="searchEditForm">

<h:outputScript name="js/opacImport.js" target="body"/>
<p:panelGrid layout="grid" columns="1" cellpadding="10">
<!-- choose from existing processes -->
<p:row rendered="#{CreateProcessForm.processDataTab.usingTemplates}">
<div>
<p:outputLabel for="processSelect" value="#{msgs.selectFromExistingProcesses}"/>
<p:selectOneMenu id="processSelect" value="#{CreateProcessForm.searchDialog.originalProcess}"
converter="#{processConverter}">
<f:selectItem itemValue="#{null}" itemLabel="-- #{msgs.selectProcess} --" noSelectionOption="true"/>
<f:selectItems value="#{CreateProcessForm.searchDialog.processesForChoiceList}"
var="process"
itemLabel="#{process.title}"
itemValue="#{process}"/>
<p:ajax update="searchEditForm"/>
</p:selectOneMenu>
</div>
</p:row>
</p:panelGrid>
<h:panelGroup layout="block">
<p:commandButton id="copyProcessData"
styleClass="primary right"
disabled="#{CreateProcessForm.searchDialog.originalProcess eq null}"
action="#{CreateProcessForm.searchDialog.copyMetadata}"
oncomplete="PF('searchEditDialog').hide();"
value="#{msgs.apply}"
title="#{msgs.selectFromExistingProcesses}"
update="editForm"
icon="fa fa-download" iconPos="right"/>
<p:commandButton id="close"
value="#{msgs.close}"
styleClass="secondary right"
icon="fa fa-times fa-lg"
iconPos="right"
onclick="PF('searchEditDialog').hide();"/>
</h:panelGroup>
</h:form>
</p:dialog>
</ui:composition>
Loading

0 comments on commit e75b8c1

Please sign in to comment.