diff --git a/Kitodo-DataEditor/src/test/java/org/kitodo/dataeditor/ruleset/RulesetManagementIT.java b/Kitodo-DataEditor/src/test/java/org/kitodo/dataeditor/ruleset/RulesetManagementIT.java index fd7402da1ef..7c9700b273d 100644 --- a/Kitodo-DataEditor/src/test/java/org/kitodo/dataeditor/ruleset/RulesetManagementIT.java +++ b/Kitodo-DataEditor/src/test/java/org/kitodo/dataeditor/ruleset/RulesetManagementIT.java @@ -1206,8 +1206,8 @@ private ComplexMetadataViewInterface getCmvi( List metadataViewWithValuesInterfaceList, String keyId) { return (ComplexMetadataViewInterface) metadataViewWithValuesInterfaceList.stream() .filter(mvwvi -> mvwvi.getMetadata().isPresent()) - .filter(metadataViewWithValuesInterface -> keyId - .equals(metadataViewWithValuesInterface.getMetadata().get().getId())) + .filter(metadataViewWithValues -> keyId + .equals(metadataViewWithValues.getMetadata().get().getId())) .findAny().get().getMetadata().get(); } @@ -1235,8 +1235,8 @@ private List ids(Collection mviColl) { */ private List ids(List metadataViewWithValuesInterfaceList) { return metadataViewWithValuesInterfaceList.stream() - .filter(metadataViewWithValuesInterface -> metadataViewWithValuesInterface.getMetadata().isPresent()) - .map(metadataViewWithValuesInterface -> metadataViewWithValuesInterface.getMetadata().get().getId()) + .filter(metadataViewWithValues -> metadataViewWithValues.getMetadata().isPresent()) + .map(metadataViewWithValues -> metadataViewWithValues.getMetadata().get().getId()) .collect(Collectors.toList()); } diff --git a/Kitodo/src/main/java/org/kitodo/production/dto/DocketDTO.java b/Kitodo/src/main/java/org/kitodo/production/dto/DocketDTO.java index f81a79b8d50..46e24ad50ab 100644 --- a/Kitodo/src/main/java/org/kitodo/production/dto/DocketDTO.java +++ b/Kitodo/src/main/java/org/kitodo/production/dto/DocketDTO.java @@ -84,7 +84,7 @@ public void setActive(boolean active) { /** * Get client object. * - * @return value of clientInterface + * @return value of client */ public ClientInterface getClient() { return client; diff --git a/Kitodo/src/main/java/org/kitodo/production/dto/ProcessDTO.java b/Kitodo/src/main/java/org/kitodo/production/dto/ProcessDTO.java index 85db6ebbc76..9ecb95fd51c 100644 --- a/Kitodo/src/main/java/org/kitodo/production/dto/ProcessDTO.java +++ b/Kitodo/src/main/java/org/kitodo/production/dto/ProcessDTO.java @@ -69,11 +69,11 @@ public ProjectInterface getProject() { /** * Set project. * - * @param projectInterface + * @param project * as ProjectInterface */ - public void setProject(ProjectInterface projectInterface) { - this.project = (ProjectInterface) projectInterface; + public void setProject(ProjectInterface project) { + this.project = (ProjectInterface) project; } /** diff --git a/Kitodo/src/main/java/org/kitodo/production/dto/RulesetDTO.java b/Kitodo/src/main/java/org/kitodo/production/dto/RulesetDTO.java index 9196240951f..d9f75645442 100644 --- a/Kitodo/src/main/java/org/kitodo/production/dto/RulesetDTO.java +++ b/Kitodo/src/main/java/org/kitodo/production/dto/RulesetDTO.java @@ -104,7 +104,7 @@ public void setActive(boolean active) { /** * Get client object. * - * @return value of clientInterface + * @return value of client */ public ClientInterface getClient() { return client; diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/BatchForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/BatchForm.java index 9bd0f864629..26d38ab6207 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/BatchForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/BatchForm.java @@ -108,7 +108,7 @@ public void loadProcessData() { * Filter processes. */ public void filterProcesses() { - List processInterfaces = new ArrayList<>(); + List processes = new ArrayList<>(); QueryBuilder query = new BoolQueryBuilder(); if (Objects.nonNull(this.processfilter)) { @@ -123,17 +123,17 @@ public void filterProcesses() { int batchMaxSize = ConfigCore.getIntParameter(ParameterCore.BATCH_DISPLAY_LIMIT, -1); try { if (batchMaxSize > 0) { - processInterfaces = ServiceManager.getProcessService().findByQuery(query, + processes = ServiceManager.getProcessService().findByQuery(query, ServiceManager.getProcessService().sortByCreationDate(SortOrder.DESC), 0, batchMaxSize, false); } else { - processInterfaces = ServiceManager.getProcessService().findByQuery(query, + processes = ServiceManager.getProcessService().findByQuery(query, ServiceManager.getProcessService().sortByCreationDate(SortOrder.DESC), false); } } catch (DataException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); } try { - this.currentProcesses = ServiceManager.getProcessService().convertDtosToBeans(processInterfaces); + this.currentProcesses = ServiceManager.getProcessService().convertDtosToBeans(processes); } catch (DAOException e) { this.currentProcesses = new ArrayList<>(); Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/CommentTooltipView.java b/Kitodo/src/main/java/org/kitodo/production/forms/CommentTooltipView.java index 996f711b175..3949e639bb5 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/CommentTooltipView.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/CommentTooltipView.java @@ -43,16 +43,16 @@ public CommentTooltipView() { /** * Get comments of given process. * - * @param processInterface process as ProcessInterface + * @param process process as ProcessInterface * @return List of Comment objects */ - public List getComments(ProcessInterface processInterface) { - if (comments.containsKey(processInterface)) { - return comments.get(processInterface); + public List getComments(ProcessInterface process) { + if (comments.containsKey(process)) { + return comments.get(process); } try { - comments.put(processInterface, ServiceManager.getProcessService().getComments(processInterface)); - return comments.get(processInterface); + comments.put(process, ServiceManager.getProcessService().getComments(process)); + return comments.get(process); } catch (DAOException e) { Helper.setErrorMessage(e); return Collections.emptyList(); @@ -62,10 +62,10 @@ public List getComments(ProcessInterface processInterface) { /** * Get comments of process containing the given task. * - * @param taskInterface task as TaskInterface + * @param task task as TaskInterface * @return List of Comment objects */ - public List getComments(TaskInterface taskInterface) { - return getComments(taskInterface.getProcess()); + public List getComments(TaskInterface task) { + return getComments(task.getProcess()); } } diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/ProcessForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/ProcessForm.java index 2e5a65c3ea9..3c5d400262e 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/ProcessForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/ProcessForm.java @@ -167,12 +167,12 @@ public static String getPropertyValue(ProcessInterface process, String propertyN /** * Calculate and return age of given process as a String. * - * @param processInterface + * @param process * ProcessInterface object whose duration/age is calculated * @return process age of given process */ - public static String getProcessDuration(ProcessInterface processInterface) { - return ProcessService.getProcessDuration(processInterface); + public static String getProcessDuration(ProcessInterface process) { + return ProcessService.getProcessDuration(process); } /** @@ -202,15 +202,15 @@ public String save() { /** * Create Child for given Process. - * @param processInterface the process to create a child for. + * @param process the process to create a child for. * @return path to createProcessForm */ - public String createProcessAsChild(ProcessInterface processInterface) { + public String createProcessAsChild(ProcessInterface process) { try { - Process process = ServiceManager.getProcessService().getById(processInterface.getId()); - if (Objects.nonNull(process.getTemplate()) && Objects.nonNull(process.getProject())) { - return CREATE_PROCESS_PATH + "&templateId=" + process.getTemplate().getId() + "&projectId=" - + process.getProject().getId() + "&parentId=" + process.getId(); + Process processBean = ServiceManager.getProcessService().getById(process.getId()); + if (Objects.nonNull(processBean.getTemplate()) && Objects.nonNull(processBean.getProject())) { + return CREATE_PROCESS_PATH + "&templateId=" + processBean.getTemplate().getId() + "&projectId=" + + processBean.getProject().getId() + "&parentId=" + processBean.getId(); } } catch (DAOException e) { Helper.setErrorMessage(ERROR_READING, new Object[] {ObjectType.PROCESS.getTranslationSingular() }, logger, @@ -1073,12 +1073,12 @@ public void setFilter(String filter) { * Returns a String containing titles of all current tasks of the given process, e.g. "OPEN" tasks and tasks * "INWORK". * - * @param processInterface + * @param process * process for which current task titles are returned * @return String containing titles of current tasks of given process */ - public String getCurrentTaskTitles(ProcessInterface processInterface) { - return ServiceManager.getProcessService().createProgressTooltip(processInterface); + public String getCurrentTaskTitles(ProcessInterface process) { + return ServiceManager.getProcessService().createProgressTooltip(process); } /** @@ -1130,11 +1130,11 @@ public String convertProcessingDate(Date date) { /** * Get all tasks of given process which should be visible to the user. - * @param processInterface process as Interface object + * @param process process as Interface object * @return List of filtered tasks as Interface objects */ - public List getCurrentTasksForUser(ProcessInterface processInterface) { - return ServiceManager.getProcessService().getCurrentTasksForUser(processInterface, + public List getCurrentTasksForUser(ProcessInterface process) { + return ServiceManager.getProcessService().getCurrentTasksForUser(process, ServiceManager.getUserService().getCurrentUser()); } diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/ProcessListBaseView.java b/Kitodo/src/main/java/org/kitodo/production/forms/ProcessListBaseView.java index 2ce4060e50d..8fc89af75ff 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/ProcessListBaseView.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/ProcessListBaseView.java @@ -59,7 +59,7 @@ public class ProcessListBaseView extends BaseForm { private int numberOfGlobalImages; private int numberOfGlobalStructuralElements; private int numberOfGlobalMetadata; - List selectedProcessesOrProcessDTOs = new ArrayList<>(); + List selectedProcesses = new ArrayList<>(); private final String doneDirectoryName = ConfigCore.getParameterOrDefaultValue(ParameterCore.DONE_DIRECTORY_NAME); DeleteProcessDialog deleteProcessDialog = new DeleteProcessDialog(); @@ -121,33 +121,33 @@ public void setAllSelected(boolean allSelected) { */ @SuppressWarnings("unchecked") public List getSelectedProcesses() { - List selectedProcesses = new ArrayList<>(); + List result = new ArrayList<>(); ProcessService processService = ServiceManager.getProcessService(); if (allSelected) { try { - this.selectedProcessesOrProcessDTOs = processService.findByQuery(processService.getQueryForFilter( + this.selectedProcesses = processService.findByQuery(processService.getQueryForFilter( this.isShowClosedProcesses(), isShowInactiveProjects(), getFilter()) .mustNot(processService.createSetQueryForIds(new ArrayList<>(excludedProcessIds))), false); } catch (DataException e) { logger.error(e.getMessage()); } } - if (!selectedProcessesOrProcessDTOs.isEmpty()) { - if (selectedProcessesOrProcessDTOs.get(0) instanceof ProcessInterface) { + if (!selectedProcesses.isEmpty()) { + if (selectedProcesses.get(0) instanceof ProcessInterface) { // list contains ProcessInterface instances try { - selectedProcesses = ServiceManager.getProcessService() - .convertDtosToBeans((List) selectedProcessesOrProcessDTOs); + result = ServiceManager.getProcessService() + .convertDtosToBeans((List) selectedProcesses); } catch (DAOException e) { Helper.setErrorMessage(ERROR_LOADING_MANY, new Object[]{ObjectType.PROCESS.getTranslationPlural()}, logger, e); } - } else if (selectedProcessesOrProcessDTOs.get(0) instanceof Process) { + } else if (selectedProcesses.get(0) instanceof Process) { // list contains Process instances - selectedProcesses = (List) selectedProcessesOrProcessDTOs; + result = (List) selectedProcesses; } } - return selectedProcesses; + return result; } /** @@ -432,13 +432,13 @@ private void exportDMSForProcesses(List processes) { /** * If processes are generated with calendar. * - * @param processInterface + * @param process * the process dto to check. * @return true if processes are created with calendar, false otherwise */ - public boolean createProcessesWithCalendar(ProcessInterface processInterface) { + public boolean createProcessesWithCalendar(ProcessInterface process) { try { - return ProcessService.canCreateProcessWithCalendar(processInterface); + return ProcessService.canCreateProcessWithCalendar(process); } catch (IOException | DAOException e) { Helper.setErrorMessage(ERROR_READING, new Object[] {ObjectType.PROCESS.getTranslationSingular() }, logger, e); @@ -449,13 +449,13 @@ public boolean createProcessesWithCalendar(ProcessInterface processInterface) { /** * If a process can be created as child. * - * @param processInterface + * @param process * the process dto to check. * @return true if processes can be created as child, false otherwise */ - public boolean createProcessAsChildPossible(ProcessInterface processInterface) { + public boolean createProcessAsChildPossible(ProcessInterface process) { try { - return ProcessService.canCreateChildProcess(processInterface); + return ProcessService.canCreateChildProcess(process); } catch (IOException | DAOException e) { Helper.setErrorMessage(ERROR_READING, new Object[] {ObjectType.PROCESS.getTranslationSingular() }, logger, e); @@ -479,9 +479,9 @@ public void downloadToHome(int processId) { /** * Starts generation of xml logfile for current process. */ - public void createXML(ProcessInterface processInterface) { + public void createXML(ProcessInterface process) { try { - ProcessService.createXML(ServiceManager.getProcessService().getById(processInterface.getId()), getUser()); + ProcessService.createXML(ServiceManager.getProcessService().getById(process.getId()), getUser()); } catch (IOException | DAOException e) { Helper.setErrorMessage("Error creating log file in home directory", logger, e); } @@ -529,36 +529,36 @@ public void downloadDocket(int id) { /** * Upload from home for single process. */ - public void uploadFromHome(ProcessInterface processInterface) { + public void uploadFromHome(ProcessInterface process) { try { WebDav myDav = new WebDav(); - myDav.uploadFromHome(ServiceManager.getProcessService().getById(processInterface.getId())); - Helper.setMessage("directoryRemoved", processInterface.getTitle()); + myDav.uploadFromHome(ServiceManager.getProcessService().getById(process.getId())); + Helper.setMessage("directoryRemoved", process.getTitle()); } catch (DAOException e) { Helper.setErrorMessage(ERROR_LOADING_ONE, - new Object[] {ObjectType.PROCESS.getTranslationSingular(), processInterface.getId() }, logger, e); + new Object[] {ObjectType.PROCESS.getTranslationSingular(), process.getId() }, logger, e); } } /** * Delete Process. * - * @param processInterface + * @param process * process to delete. */ - public void delete(ProcessInterface processInterface) { + public void delete(ProcessInterface process) { try { - Process process = ServiceManager.getProcessService().getById(processInterface.getId()); - if (process.getChildren().isEmpty()) { + Process processBean = ServiceManager.getProcessService().getById(process.getId()); + if (processBean.getChildren().isEmpty()) { try { - ProcessService.deleteProcess(process); + ProcessService.deleteProcess(processBean.getId()); } catch (DataException | IOException e) { Helper.setErrorMessage(ERROR_DELETING, new Object[] {ObjectType.PROCESS.getTranslationSingular() }, logger, e); } } else { this.deleteProcessDialog = new DeleteProcessDialog(); - this.deleteProcessDialog.setProcess(process); + this.deleteProcessDialog.setProcess(processBean); PrimeFaces.current().executeScript("PF('deleteChildrenDialog').show();"); } } catch (DAOException e) { @@ -602,17 +602,18 @@ public boolean canBeExported(int processId) { * @return list of instances of Process or ProcessInterface */ public List getSelectedProcessesOrProcessDTOs() { - return selectedProcessesOrProcessDTOs; + return selectedProcesses; } - public void setSelectedProcessesOrProcessDTOs(List selectedProcessesOrProcessInterfaces) { - this.selectedProcessesOrProcessDTOs = selectedProcessesOrProcessInterfaces; + public void setSelectedProcessesOrProcessDTOs(List selectedProcesses) { + this.selectedProcesses = selectedProcesses; } /** * Update selection and first row to show in datatable on PageEvent. * @param pageEvent PageEvent triggered by data tables paginator */ + @Override public void onPageChange(PageEvent pageEvent) { this.setFirstRow(((DataTable) pageEvent.getSource()).getFirst()); if (allSelected) { diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/SearchResultForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/SearchResultForm.java index ec1ef9f7f50..da51826a7a2 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/SearchResultForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/SearchResultForm.java @@ -68,8 +68,8 @@ public String searchForProcessesBySearchQuery() { List results; try { results = processService.findByAnything(searchQuery); - for (ProcessInterface processInterface : results) { - resultHash.put(processInterface.getId(), processInterface); + for (ProcessInterface process : results) { + resultHash.put(process.getId(), process); } this.resultList = new ArrayList<>(resultHash.values()); refreshFilteredList(); @@ -99,9 +99,9 @@ void filterListByProject() { */ void filterListByTaskAndStatus() { if (Objects.nonNull(currentTaskFilter) && Objects.nonNull(currentTaskStatusFilter)) { - for (ProcessInterface processInterface : new ArrayList<>(this.filteredList)) { + for (ProcessInterface process : new ArrayList<>(this.filteredList)) { boolean remove = true; - for (TaskInterface task : processInterface.getTasks()) { + for (TaskInterface task : process.getTasks()) { if (task.getTitle().equalsIgnoreCase(currentTaskFilter) && task.getProcessingStatus().getValue().equals(currentTaskStatusFilter)) { remove = false; @@ -109,7 +109,7 @@ void filterListByTaskAndStatus() { } } if (remove) { - this.filteredList.remove(processInterface); + this.filteredList.remove(process); } } @@ -146,8 +146,8 @@ public Collection getProjectsForFiltering() { */ public Collection getTasksForFiltering() { HashMap tasksForFiltering = new HashMap<>(); - for (ProcessInterface processInterface : this.resultList) { - for (TaskInterface currentTask : processInterface.getTasks()) { + for (ProcessInterface process : this.resultList) { + for (TaskInterface currentTask : process.getTasks()) { tasksForFiltering.put(currentTask.getTitle(), currentTask); } } @@ -170,24 +170,24 @@ private void refreshFilteredList() { /** * Delete Process. * - * @param processInterface + * @param process * process to delete. */ @Override - public void delete(ProcessInterface processInterface) { + public void delete(ProcessInterface process) { try { - Process process = ServiceManager.getProcessService().getById(processInterface.getId()); - if (process.getChildren().isEmpty()) { + Process processBean = ServiceManager.getProcessService().getById(process.getId()); + if (processBean.getChildren().isEmpty()) { try { - ProcessService.deleteProcess(process); - this.filteredList.remove(processInterface); + ProcessService.deleteProcess(processBean); + this.filteredList.remove(processBean); } catch (DataException | IOException e) { Helper.setErrorMessage(ERROR_DELETING, new Object[] {ObjectType.PROCESS.getTranslationSingular() }, logger, e); } } else { this.deleteProcessDialog = new DeleteProcessDialog(); - this.deleteProcessDialog.setProcess(process); + this.deleteProcessDialog.setProcess(processBean); PrimeFaces.current().executeScript("PF('deleteChildrenDialog').show();"); } } catch (DAOException e) { diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/SelectProjectDialogView.java b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/SelectProjectDialogView.java index f3fabea722d..859e0cc7ed6 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/SelectProjectDialogView.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/createprocess/SelectProjectDialogView.java @@ -39,26 +39,26 @@ public class SelectProjectDialogView implements Serializable { private static final Logger logger = LogManager.getLogger(SelectProjectDialogView.class); private int selectedProjectId = 0; - private TemplateInterface templateInterface; + private TemplateInterface template; protected static final String ERROR_LOADING_ONE = "errorLoadingOne"; private static final String CREATE_PROCESS_PATH = "/pages/processFromTemplate.jsf?faces-redirect=true"; /** * Get template. * - * @return value of templateInterface + * @return value of template */ public TemplateInterface getTemplate() { - return templateInterface; + return template; } /** - * Set templateInterface. + * Set template. * - * @param templateInterface as org.kitodo.production.dto.TemplateInterface + * @param template as org.kitodo.data.interfaces.TemplateInterface */ - public void setTemplateInterface(TemplateInterface templateInterface) { - this.templateInterface = templateInterface; + public void setTemplate(TemplateInterface template) { + this.template = template; } /** @@ -86,12 +86,12 @@ public void setSelectedProjectId(int projectId) { */ public List getTemplateProjects() { try { - Template template = ServiceManager.getTemplateService().getById(this.templateInterface.getId()); + Template template = ServiceManager.getTemplateService().getById(this.template.getId()); return template.getProjects().stream().sorted(Comparator.comparing(Project::getTitle)) .collect(Collectors.toList()); } catch (DAOException e) { Helper.setErrorMessage(ERROR_LOADING_ONE, new Object[] {ObjectType.TEMPLATE.getTranslationSingular(), - this.templateInterface.getId()}, logger, e); + this.template.getId()}, logger, e); } return Collections.emptyList(); } @@ -103,20 +103,20 @@ public List getTemplateProjects() { * Display error message if the current template is not used in any project. */ public void createProcessFromTemplate() { - if (this.templateInterface.getProjects().size() == 1) { - this.selectedProjectId = this.templateInterface.getProjects().get(0).getId(); + if (this.template.getProjects().size() == 1) { + this.selectedProjectId = this.template.getProjects().get(0).getId(); } if (this.selectedProjectId > 0) { try { FacesContext context = FacesContext.getCurrentInstance(); String path = context.getExternalContext().getRequestContextPath() + CREATE_PROCESS_PATH - + "&templateId=" + this.templateInterface.getId() + "&projectId=" + this.selectedProjectId + + "&templateId=" + this.template.getId() + "&projectId=" + this.selectedProjectId + "&referrer=" + context.getViewRoot().getViewId(); context.getExternalContext().redirect(path); } catch (IOException e) { Helper.setErrorMessage(e.getLocalizedMessage()); } - } else if (templateInterface.getProjects().size() > 1) { + } else if (template.getProjects().size() > 1) { PrimeFaces.current().ajax().update("selectProjectDialog"); PrimeFaces.current().executeScript("PF('selectProjectDialog').show();"); } else { diff --git a/Kitodo/src/main/java/org/kitodo/production/helper/ProcessHelper.java b/Kitodo/src/main/java/org/kitodo/production/helper/ProcessHelper.java index 5989a243daa..a259be3fc49 100644 --- a/Kitodo/src/main/java/org/kitodo/production/helper/ProcessHelper.java +++ b/Kitodo/src/main/java/org/kitodo/production/helper/ProcessHelper.java @@ -79,7 +79,7 @@ public static List transformToProcessDetails(TempProcess tempProc /** * Create and return an instance of 'ProcessFieldedMetadata' for the given * LogicalDivision 'structure', RulesetManagementInterface - * 'managementInterface', acquisition stage String 'stage' and List of + * 'management', acquisition stage String 'stage' and List of * LanguageRange 'priorityList'. * * @param structure diff --git a/Kitodo/src/main/java/org/kitodo/production/helper/SearchResultGeneration.java b/Kitodo/src/main/java/org/kitodo/production/helper/SearchResultGeneration.java index cba8d385ca9..f92305ce3f1 100644 --- a/Kitodo/src/main/java/org/kitodo/production/helper/SearchResultGeneration.java +++ b/Kitodo/src/main/java/org/kitodo/production/helper/SearchResultGeneration.java @@ -61,15 +61,15 @@ public HSSFWorkbook getResult() { } private List getResultsWithFilter() { - List processInterfaces = new ArrayList<>(); + List processes = new ArrayList<>(); try { - processInterfaces = ServiceManager.getProcessService().findByQuery(getQueryForFilter(ObjectType.PROCESS), + processes = ServiceManager.getProcessService().findByQuery(getQueryForFilter(ObjectType.PROCESS), ServiceManager.getProcessService().sortById(SortOrder.ASC), true); } catch (DataException e) { logger.error(e.getMessage(), e); } - return processInterfaces; + return processes; } /** @@ -121,26 +121,26 @@ private void insertRowData(HSSFSheet sheet) { Long numberOfExpectedProcesses = ServiceManager.getProcessService() .count(getQueryForFilter(ObjectType.PROCESS)); if (numberOfExpectedProcesses > elasticsearchLimit) { - List processInterfaces; + List processes; int queriedIds = 0; while (numberOfProcessedProcesses < numberOfExpectedProcesses) { RangeQueryBuilder rangeQueryBuilder = new RangeQueryBuilder(ProcessTypeField.ID.toString()); rangeQueryBuilder.gte(queriedIds).lt(queriedIds + elasticsearchLimit); BoolQueryBuilder queryForFilter = getQueryForFilter(ObjectType.PROCESS); queryForFilter.must(rangeQueryBuilder); - processInterfaces = ServiceManager.getProcessService().findByQuery(queryForFilter, + processes = ServiceManager.getProcessService().findByQuery(queryForFilter, ServiceManager.getProcessService().sortById(SortOrder.ASC), true); queriedIds += elasticsearchLimit; - for (ProcessInterface processDTO : processInterfaces) { - prepareRow(rowCounter, sheet, processDTO); + for (ProcessInterface process : processes) { + prepareRow(rowCounter, sheet, process); rowCounter++; } - numberOfProcessedProcesses += processInterfaces.size(); + numberOfProcessedProcesses += processes.size(); } } else { List resultsWithFilter = getResultsWithFilter(); - for (ProcessInterface processDTO : resultsWithFilter) { - prepareRow(rowCounter, sheet, processDTO); + for (ProcessInterface process : resultsWithFilter) { + prepareRow(rowCounter, sheet, process); rowCounter++; } } @@ -161,15 +161,15 @@ private void setRowHeader(HSSFSheet sheet) { rowHeader.createCell(7).setCellValue(Helper.getTranslation("Status")); } - private void prepareRow(int rowCounter, HSSFSheet sheet, ProcessInterface processInterface) { + private void prepareRow(int rowCounter, HSSFSheet sheet, ProcessInterface process) { HSSFRow row = sheet.createRow(rowCounter); - row.createCell(0).setCellValue(processInterface.getTitle()); - row.createCell(1).setCellValue(processInterface.getId()); - row.createCell(2).setCellValue(processInterface.getCreationTime()); - row.createCell(3).setCellValue(processInterface.getNumberOfImages()); - row.createCell(4).setCellValue(processInterface.getNumberOfStructures()); - row.createCell(5).setCellValue(processInterface.getNumberOfMetadata()); - row.createCell(6).setCellValue(processInterface.getProject().getTitle()); - row.createCell(7).setCellValue(processInterface.getSortHelperStatus()); + row.createCell(0).setCellValue(process.getTitle()); + row.createCell(1).setCellValue(process.getId()); + row.createCell(2).setCellValue(process.getCreationTime()); + row.createCell(3).setCellValue(process.getNumberOfImages()); + row.createCell(4).setCellValue(process.getNumberOfStructures()); + row.createCell(5).setCellValue(process.getNumberOfMetadata()); + row.createCell(6).setCellValue(process.getProject().getTitle()); + row.createCell(7).setCellValue(process.getSortHelperStatus()); } } diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/BatchService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/BatchService.java index 253d97777a5..2214ae0aa34 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/BatchService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/BatchService.java @@ -151,18 +151,18 @@ public List> findByProcessTitle(String title) throws DataExc } @Override - public BatchInterface convertJSONObjectToInterface(Map jsonObject, boolean related) throws DataException { - BatchInterface batchInterface = DTOFactory.instance().newBatch(); - batchInterface.setId(getIdFromJSONObject(jsonObject)); - batchInterface.setTitle(BatchTypeField.TITLE.getStringValue(jsonObject)); + public BatchInterface convertJSONObjectTo(Map jsonObject, boolean related) throws DataException { + BatchInterface batch = DTOFactory.instance().newBatch(); + batch.setId(getIdFromJSONObject(jsonObject)); + batch.setTitle(BatchTypeField.TITLE.getStringValue(jsonObject)); if (!related) { - convertRelatedJSONObjects(jsonObject, batchInterface); + convertRelatedJSONObjects(jsonObject, batch); } - return batchInterface; + return batch; } - private void convertRelatedJSONObjects(Map jsonObject, BatchInterface batchInterface) throws DataException { - batchInterface.setProcesses(convertRelatedJSONObjectToInterface(jsonObject, BatchTypeField.PROCESSES.getKey(), + private void convertRelatedJSONObjects(Map jsonObject, BatchInterface batch) throws DataException { + batch.setProcesses(convertRelatedJSONObjectTo(jsonObject, BatchTypeField.PROCESSES.getKey(), ServiceManager.getProcessService())); } diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/DocketService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/DocketService.java index e8479d60b3e..cd91f8e866c 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/DocketService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/DocketService.java @@ -99,18 +99,18 @@ public List getAllForSelectedClient() { } @Override - public DocketInterface convertJSONObjectToInterface(Map jsonObject, boolean related) throws DataException { - DocketInterface docketInterface = DTOFactory.instance().newDocket(); - docketInterface.setId(getIdFromJSONObject(jsonObject)); - docketInterface.setTitle(DocketTypeField.TITLE.getStringValue(jsonObject)); - docketInterface.setFile(DocketTypeField.FILE.getStringValue(jsonObject)); - - ClientInterface clientInterface = DTOFactory.instance().newClient(); - clientInterface.setId(DocketTypeField.CLIENT_ID.getIntValue(jsonObject)); - clientInterface.setName(DocketTypeField.CLIENT_NAME.getStringValue(jsonObject)); - - docketInterface.setClient(clientInterface); - return docketInterface; + public DocketInterface convertJSONObjectTo(Map jsonObject, boolean related) throws DataException { + DocketInterface docket = DTOFactory.instance().newDocket(); + docket.setId(getIdFromJSONObject(jsonObject)); + docket.setTitle(DocketTypeField.TITLE.getStringValue(jsonObject)); + docket.setFile(DocketTypeField.FILE.getStringValue(jsonObject)); + + ClientInterface client = DTOFactory.instance().newClient(); + client.setId(DocketTypeField.CLIENT_ID.getIntValue(jsonObject)); + client.setName(DocketTypeField.CLIENT_NAME.getStringValue(jsonObject)); + + docket.setClient(client); + return docket; } /** diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/FilterService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/FilterService.java index da006a8ea76..0bb006bc03a 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/FilterService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/FilterService.java @@ -140,11 +140,11 @@ List> findByValue(String value, boolean contains) throws Dat } @Override - public FilterInterface convertJSONObjectToInterface(Map jsonObject, boolean related) throws DataException { - FilterInterface filterInterface = DTOFactory.instance().newFilter(); - filterInterface.setId(getIdFromJSONObject(jsonObject)); - filterInterface.setValue(FilterTypeField.VALUE.getStringValue(jsonObject)); - return filterInterface; + public FilterInterface convertJSONObjectTo(Map jsonObject, boolean related) throws DataException { + FilterInterface filter = DTOFactory.instance().newFilter(); + filter.setId(getIdFromJSONObject(jsonObject)); + filter.setValue(FilterTypeField.VALUE.getStringValue(jsonObject)); + return filter; } /** @@ -275,8 +275,8 @@ private BoolQueryBuilder buildTaskQuery(Boolean onlyOpenTasks, Boolean onlyUserA Set collectIds(List dtos) { Set ids = new HashSet<>(); - for (DataInterface processInterface : dtos) { - ids.add(processInterface.getId()); + for (DataInterface process : dtos) { + ids.add(process.getId()); } return ids; } @@ -552,9 +552,9 @@ private QueryBuilder createBatchIdFilter(String filter, ObjectType objectType, b if (objectType == ObjectType.PROCESS) { return createSetQuery("batches.id", filterValuesAsIntegers(filter, FilterString.BATCH), negate); } else if (objectType == ObjectType.TASK) { - List processInterfaces = ServiceManager.getProcessService().findByQuery( + List processes = ServiceManager.getProcessService().findByQuery( createSetQuery("batches.id", filterValuesAsIntegers(filter, FilterString.BATCH), negate), true); - return createSetQuery(TaskTypeField.PROCESS_ID.getKey(), collectIds(processInterfaces), negate); + return createSetQuery(TaskTypeField.PROCESS_ID.getKey(), collectIds(processes), negate); } return new BoolQueryBuilder(); } @@ -851,20 +851,20 @@ private QueryBuilder filterTaskDoneUser(String filter, ObjectType objectType) { /* * filtering by a certain done step, which the current user finished */ - /*List taskInterfaces = new ArrayList<>(); + /*List tasks = new ArrayList<>(); String login = getFilterValueFromFilterString(filter, FilterString.TASKDONEUSER); try { Map user = ServiceManager.getUserService().findByLogin(login); - UserInterface userInterface = ServiceManager.getUserService().convertJSONObjectToInterface(user, false); - taskInterfaces = userInterface.getProcessingTasks(); + UserInterface user = ServiceManager.getUserService().convertJSONObjectTo(user, false); + tasks = user.getProcessingTasks(); } catch (DataException e) { logger.error(e.getMessage(), e); } if (objectType == ObjectType.PROCESS) { - return createSetQuery("tasks.id", collectIds(taskInterfaces), true); + return createSetQuery("tasks.id", collectIds(tasks), true); } else if (objectType == ObjectType.TASK) { - return createSetQuery("_id", collectIds(taskInterfaces), true); + return createSetQuery("_id", collectIds(tasks), true); }*/ return new BoolQueryBuilder(); } @@ -964,8 +964,8 @@ private QueryBuilder getQueryAccordingToObjectTypeAndSearchInObject(ObjectType o private QueryBuilder getQueryAccordingToObjectTypeAndSearchInTask(ObjectType objectType, QueryBuilder query) throws DataException { if (objectType == ObjectType.PROCESS) { - List taskInterfaces = ServiceManager.getTaskService().findByQuery(query, true); - return createSetQuery("tasks.id", collectIds(taskInterfaces), true); + List tasks = ServiceManager.getTaskService().findByQuery(query, true); + return createSetQuery("tasks.id", collectIds(tasks), true); } else if (objectType == ObjectType.TASK) { return query; } @@ -977,8 +977,8 @@ private QueryBuilder getQueryAccordingToObjectTypeAndSearchInProcess(ObjectType if (objectType == ObjectType.PROCESS) { return query; } else if (objectType == ObjectType.TASK) { - List processInterfaces = ServiceManager.getProcessService().findByQuery(query, true); - return createSetQuery(TaskTypeField.PROCESS_ID.getKey(), collectIds(processInterfaces), true); + List processes = ServiceManager.getProcessService().findByQuery(query, true); + return createSetQuery(TaskTypeField.PROCESS_ID.getKey(), collectIds(processes), true); } return new BoolQueryBuilder(); } diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/ImportService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/ImportService.java index b43b5e4e8cd..35c5187bc47 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/ImportService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/ImportService.java @@ -956,15 +956,15 @@ private Process loadParentProcess(Ruleset ruleset, int projectId, String parentI HashMap parentIDMetadata = new HashMap<>(); parentIDMetadata.put(identifierMetadata, parentId); try { - for (ProcessInterface processInterface : ServiceManager.getProcessService().findByMetadata(parentIDMetadata, true)) { - Process process = ServiceManager.getProcessService().getById(processInterface.getId()); - if (Objects.isNull(process.getRuleset()) || Objects.isNull(process.getRuleset().getId())) { + for (ProcessInterface process : ServiceManager.getProcessService().findByMetadata(parentIDMetadata, true)) { + Process processBean = ServiceManager.getProcessService().getById(process.getId()); + if (Objects.isNull(processBean.getRuleset()) || Objects.isNull(processBean.getRuleset().getId())) { throw new ProcessGenerationException("Ruleset or ruleset ID of potential parent process " - + process.getId() + " is null!"); + + processBean.getId() + " is null!"); } - if (process.getProject().getId() == projectId - && process.getRuleset().getId().equals(ruleset.getId())) { - parentProcess = process; + if (processBean.getProject().getId() == projectId + && processBean.getRuleset().getId().equals(ruleset.getId())) { + parentProcess = processBean; break; } } diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/ProcessService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/ProcessService.java index 4b2226c9876..6a290008518 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/ProcessService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/ProcessService.java @@ -782,8 +782,8 @@ public List findLinkableChildProcesses(String searchInput, int .must(new MatchQueryBuilder(ProcessTypeField.RULESET.getKey(), rulesetId)); List linkableProcesses = new LinkedList<>(); - List processInterfaces = findByQuery(query, false); - for (ProcessInterface process : processInterfaces) { + List processes = findByQuery(query, false); + for (ProcessInterface process : processes) { if (allowedStructuralElementTypes.contains(getBaseType(process.getId()))) { linkableProcesses.add(process); } @@ -906,125 +906,125 @@ public SortBuilder sortByCreationDate(SortOrder sortOrder) { */ public List convertDtosToBeans(List dtos) throws DAOException { List processes = new ArrayList<>(); - for (ProcessInterface processInterface : dtos) { - processes.add(getById(processInterface.getId())); + for (ProcessInterface process : dtos) { + processes.add(getById(process.getId())); } return processes; } @Override - public ProcessInterface convertJSONObjectToInterface(Map jsonObject, boolean related) throws DataException { - ProcessInterface processInterface = DTOFactory.instance().newProcess(); + public ProcessInterface convertJSONObjectTo(Map jsonObject, boolean related) throws DataException { + ProcessInterface process = DTOFactory.instance().newProcess(); if (!jsonObject.isEmpty()) { - processInterface.setId(getIdFromJSONObject(jsonObject)); - processInterface.setTitle(ProcessTypeField.TITLE.getStringValue(jsonObject)); - processInterface.setWikiField(ProcessTypeField.WIKI_FIELD.getStringValue(jsonObject)); + process.setId(getIdFromJSONObject(jsonObject)); + process.setTitle(ProcessTypeField.TITLE.getStringValue(jsonObject)); + process.setWikiField(ProcessTypeField.WIKI_FIELD.getStringValue(jsonObject)); try { - processInterface.setCreationTime(ProcessTypeField.CREATION_DATE.getStringValue(jsonObject)); + process.setCreationTime(ProcessTypeField.CREATION_DATE.getStringValue(jsonObject)); } catch (ParseException e) { throw new DataException(e); } - processInterface.setSortHelperArticles(ProcessTypeField.SORT_HELPER_ARTICLES.getIntValue(jsonObject)); - processInterface.setSortHelperDocstructs(ProcessTypeField.SORT_HELPER_DOCSTRUCTS.getIntValue(jsonObject)); - processInterface.setSortHelperImages(ProcessTypeField.SORT_HELPER_IMAGES.getIntValue(jsonObject)); - processInterface.setSortHelperMetadata(ProcessTypeField.SORT_HELPER_METADATA.getIntValue(jsonObject)); - processInterface.setSortHelperStatus(ProcessTypeField.SORT_HELPER_STATUS.getStringValue(jsonObject)); - processInterface.setProcessBase(ProcessTypeField.PROCESS_BASE_URI.getStringValue(jsonObject)); - processInterface.setHasChildren(ProcessTypeField.HAS_CHILDREN.getBooleanValue(jsonObject)); - processInterface.setParentID(ProcessTypeField.PARENT_ID.getIntValue(jsonObject)); - processInterface.setNumberOfImages(ProcessTypeField.NUMBER_OF_IMAGES.getIntValue(jsonObject)); - processInterface.setNumberOfMetadata(ProcessTypeField.NUMBER_OF_METADATA.getIntValue(jsonObject)); - processInterface.setNumberOfStructures(ProcessTypeField.NUMBER_OF_STRUCTURES.getIntValue(jsonObject)); - processInterface.setBaseType(ProcessTypeField.BASE_TYPE.getStringValue(jsonObject)); - processInterface.setLastEditingUser(ProcessTypeField.LAST_EDITING_USER.getStringValue(jsonObject)); - processInterface.setCorrectionCommentStatus(ProcessTypeField.CORRECTION_COMMENT_STATUS.getIntValue(jsonObject)); - processInterface.setHasComments(!ProcessTypeField.COMMENTS_MESSAGE.getStringValue(jsonObject).isEmpty()); - convertLastProcessingDates(jsonObject, processInterface); - convertTaskProgress(jsonObject, processInterface); - - processInterface.setProperties(convertProperties(jsonObject)); + process.setSortHelperArticles(ProcessTypeField.SORT_HELPER_ARTICLES.getIntValue(jsonObject)); + process.setSortHelperDocstructs(ProcessTypeField.SORT_HELPER_DOCSTRUCTS.getIntValue(jsonObject)); + process.setSortHelperImages(ProcessTypeField.SORT_HELPER_IMAGES.getIntValue(jsonObject)); + process.setSortHelperMetadata(ProcessTypeField.SORT_HELPER_METADATA.getIntValue(jsonObject)); + process.setSortHelperStatus(ProcessTypeField.SORT_HELPER_STATUS.getStringValue(jsonObject)); + process.setProcessBase(ProcessTypeField.PROCESS_BASE_URI.getStringValue(jsonObject)); + process.setHasChildren(ProcessTypeField.HAS_CHILDREN.getBooleanValue(jsonObject)); + process.setParentID(ProcessTypeField.PARENT_ID.getIntValue(jsonObject)); + process.setNumberOfImages(ProcessTypeField.NUMBER_OF_IMAGES.getIntValue(jsonObject)); + process.setNumberOfMetadata(ProcessTypeField.NUMBER_OF_METADATA.getIntValue(jsonObject)); + process.setNumberOfStructures(ProcessTypeField.NUMBER_OF_STRUCTURES.getIntValue(jsonObject)); + process.setBaseType(ProcessTypeField.BASE_TYPE.getStringValue(jsonObject)); + process.setLastEditingUser(ProcessTypeField.LAST_EDITING_USER.getStringValue(jsonObject)); + process.setCorrectionCommentStatus(ProcessTypeField.CORRECTION_COMMENT_STATUS.getIntValue(jsonObject)); + process.setHasComments(!ProcessTypeField.COMMENTS_MESSAGE.getStringValue(jsonObject).isEmpty()); + convertLastProcessingDates(jsonObject, process); + convertTaskProgress(jsonObject, process); + + process.setProperties(convertProperties(jsonObject)); if (!related) { - convertRelatedJSONObjects(jsonObject, processInterface); + convertRelatedJSONObjects(jsonObject, process); } else { - ProjectInterface projectInterface = DTOFactory.instance().newProject(); - projectInterface.setId(ProcessTypeField.PROJECT_ID.getIntValue(jsonObject)); - projectInterface.setTitle(ProcessTypeField.PROJECT_TITLE.getStringValue(jsonObject)); - projectInterface.setActive(ProcessTypeField.PROJECT_ACTIVE.getBooleanValue(jsonObject)); - processInterface.setProject(projectInterface); + ProjectInterface project = DTOFactory.instance().newProject(); + project.setId(ProcessTypeField.PROJECT_ID.getIntValue(jsonObject)); + project.setTitle(ProcessTypeField.PROJECT_TITLE.getStringValue(jsonObject)); + project.setActive(ProcessTypeField.PROJECT_ACTIVE.getBooleanValue(jsonObject)); + process.setProject(project); } } - return processInterface; + return process; } /** - * Parses last processing dates from the jsonObject and adds them to the processInterface bean. + * Parses last processing dates from the jsonObject and adds them to the process bean. * * @param jsonObject the json object retrieved from elastic search - * @param processInterface the processInterface bean that will receive the processing dates + * @param process the process bean that will receive the processing dates */ - private void convertLastProcessingDates(Map jsonObject, ProcessInterface processInterface) throws DataException { + private void convertLastProcessingDates(Map jsonObject, ProcessInterface process) throws DataException { String processingBeginLastTask = ProcessTypeField.PROCESSING_BEGIN_LAST_TASK.getStringValue(jsonObject); - processInterface.setProcessingBeginLastTask(Helper.parseDateFromFormattedString(processingBeginLastTask)); + process.setProcessingBeginLastTask(Helper.parseDateFromFormattedString(processingBeginLastTask)); String processingEndLastTask = ProcessTypeField.PROCESSING_END_LAST_TASK.getStringValue(jsonObject); - processInterface.setProcessingEndLastTask(Helper.parseDateFromFormattedString(processingEndLastTask)); + process.setProcessingEndLastTask(Helper.parseDateFromFormattedString(processingEndLastTask)); } /** - * Parses task progress properties from the jsonObject and adds them to the processInterface bean. + * Parses task progress properties from the jsonObject and adds them to the process bean. * * @param jsonObject the json object retrieved from elastic search - * @param processInterface the processInterface bean that will receive the progress information + * @param process the process bean that will receive the progress information */ - private void convertTaskProgress(Map jsonObject, ProcessInterface processInterface) throws DataException { - processInterface.setProgressClosed(ProcessTypeField.PROGRESS_CLOSED.getDoubleValue(jsonObject)); - processInterface.setProgressInProcessing(ProcessTypeField.PROGRESS_IN_PROCESSING.getDoubleValue(jsonObject)); - processInterface.setProgressOpen(ProcessTypeField.PROGRESS_OPEN.getDoubleValue(jsonObject)); - processInterface.setProgressLocked(ProcessTypeField.PROGRESS_LOCKED.getDoubleValue(jsonObject)); - processInterface.setProgressCombined(ProcessTypeField.PROGRESS_COMBINED.getStringValue(jsonObject)); + private void convertTaskProgress(Map jsonObject, ProcessInterface process) throws DataException { + process.setProgressClosed(ProcessTypeField.PROGRESS_CLOSED.getDoubleValue(jsonObject)); + process.setProgressInProcessing(ProcessTypeField.PROGRESS_IN_PROCESSING.getDoubleValue(jsonObject)); + process.setProgressOpen(ProcessTypeField.PROGRESS_OPEN.getDoubleValue(jsonObject)); + process.setProgressLocked(ProcessTypeField.PROGRESS_LOCKED.getDoubleValue(jsonObject)); + process.setProgressCombined(ProcessTypeField.PROGRESS_COMBINED.getStringValue(jsonObject)); } private List convertProperties(Map jsonObject) throws DataException { List> jsonArray = ProcessTypeField.PROPERTIES.getJsonArray(jsonObject); List properties = new ArrayList<>(); for (Map stringObjectMap : jsonArray) { - PropertyInterface propertyInterface = DTOFactory.instance().newProperty(); + PropertyInterface property = DTOFactory.instance().newProperty(); Object title = stringObjectMap.get(JSON_TITLE); Object value = stringObjectMap.get(JSON_VALUE); if (Objects.nonNull(title)) { - propertyInterface.setTitle(title.toString()); - propertyInterface.setValue(Objects.nonNull(value) ? value.toString() : ""); - properties.add(propertyInterface); + property.setTitle(title.toString()); + property.setValue(Objects.nonNull(value) ? value.toString() : ""); + properties.add(property); } } return properties; } - private void convertRelatedJSONObjects(Map jsonObject, ProcessInterface processInterface) throws DataException { + private void convertRelatedJSONObjects(Map jsonObject, ProcessInterface process) throws DataException { int project = ProcessTypeField.PROJECT_ID.getIntValue(jsonObject); if (project > 0) { - processInterface.setProject(ServiceManager.getProjectService().findById(project, true)); + process.setProject(ServiceManager.getProjectService().findById(project, true)); } int ruleset = ProcessTypeField.RULESET.getIntValue(jsonObject); if (ruleset > 0) { - processInterface.setRuleset(ServiceManager.getRulesetService().findById(ruleset, true)); + process.setRuleset(ServiceManager.getRulesetService().findById(ruleset, true)); } - processInterface.setBatchID(getBatchID(processInterface)); - processInterface.setBatches(getBatchesForProcessInterface(jsonObject)); + process.setBatchID(getBatchID(process)); + process.setBatches(getBatchesForProcess(jsonObject)); // TODO: leave it for now - right now it displays only status - processInterface.setTasks(convertRelatedJSONObjectToInterface(jsonObject, ProcessTypeField.TASKS.getKey(), + process.setTasks(convertRelatedJSONObjectTo(jsonObject, ProcessTypeField.TASKS.getKey(), ServiceManager.getTaskService())); } - private List getBatchesForProcessInterface(Map jsonObject) throws DataException { + private List getBatchesForProcess(Map jsonObject) throws DataException { List> jsonArray = ProcessTypeField.BATCHES.getJsonArray(jsonObject); List batchInterfaceList = new ArrayList<>(); for (Map singleObject : jsonArray) { - BatchInterface batchInterface = DTOFactory.instance().newBatch(); - batchInterface.setId(BatchTypeField.ID.getIntValue(singleObject)); - batchInterface.setTitle(BatchTypeField.TITLE.getStringValue(singleObject)); - batchInterfaceList.add(batchInterface); + BatchInterface batch = DTOFactory.instance().newBatch(); + batch.setId(BatchTypeField.ID.getIntValue(singleObject)); + batch.setTitle(BatchTypeField.TITLE.getStringValue(singleObject)); + batchInterfaceList.add(batch); } return batchInterfaceList; } @@ -1203,15 +1203,15 @@ public URI getProcessDataDirectory(Process process, boolean forIndexingAll) { * Get process data directory. * Don't save it to the database, if it is for indexingAll. * - * @param processInterface - * processInterface to get the dataDirectory from + * @param process + * process to get the dataDirectory from * @return path */ - public String getProcessDataDirectory(ProcessInterface processInterface) { - if (Objects.isNull(processInterface.getProcessBase())) { - processInterface.setProcessBase(fileService.getProcessBaseUriForExistingProcess(processInterface)); + public String getProcessDataDirectory(ProcessInterface process) { + if (Objects.isNull(process.getProcessBase())) { + process.setProcessBase(fileService.getProcessBaseUriForExistingProcess(process)); } - return processInterface.getProcessBase(); + return process.getProcessBase(); } /** @@ -1322,17 +1322,17 @@ private List getTasksInWork(ProcessInterface process) { * Create and return String used as progress tooltip for a given process. Tooltip contains OPEN tasks and tasks * INWORK. * - * @param processInterface + * @param process * process for which the tooltop is created * @return String containing the progress tooltip for the given process */ - public String createProgressTooltip(ProcessInterface processInterface) { - String openTasks = getOpenTasks(processInterface).stream() + public String createProgressTooltip(ProcessInterface process) { + String openTasks = getOpenTasks(process).stream() .map(t -> " - " + Helper.getTranslation(t.getTitle())).collect(Collectors.joining(NEW_LINE_ENTITY)); if (!openTasks.isEmpty()) { openTasks = Helper.getTranslation(TaskStatus.OPEN.getTitle()) + ":" + NEW_LINE_ENTITY + openTasks; } - String tasksInWork = getTasksInWork(processInterface).stream() + String tasksInWork = getTasksInWork(process).stream() .map(t -> " - " + Helper.getTranslation(t.getTitle())).collect(Collectors.joining(NEW_LINE_ENTITY)); if (!tasksInWork.isEmpty()) { tasksInWork = Helper.getTranslation(TaskStatus.INWORK.getTitle()) + ":" + NEW_LINE_ENTITY + tasksInWork; @@ -1351,12 +1351,12 @@ public String createProgressTooltip(ProcessInterface processInterface) { /** * Get current task. * - * @param processInterface + * @param process * Interfaceobject * @return current task */ - public TaskInterface getCurrentTaskInterface(ProcessInterface processInterface) { - for (TaskInterface task : processInterface.getTasks()) { + public TaskInterface getCurrentTask(ProcessInterface process) { + for (TaskInterface task : process.getTasks()) { if (task.getProcessingStatus().equals(TaskStatus.OPEN) || task.getProcessingStatus().equals(TaskStatus.INWORK)) { return task; @@ -1712,9 +1712,9 @@ public String getBaseType(Workpiece workpiece) { * cannot be found in the index) */ public String getBaseType(int processId) throws DataException { - ProcessInterface processInterface = findById(processId, true); - if (Objects.nonNull(processInterface)) { - return processInterface.getBaseType(); + ProcessInterface process = findById(processId, true); + if (Objects.nonNull(process)) { + return process.getBaseType(); } return ""; } @@ -2502,32 +2502,32 @@ public static CorrectionComments hasCorrectionComment(int processID) throws DAOE /** * Retrieve comments for the given process. * - * @param processInterface + * @param process * process for which the tooltip is created * @return List containing comments of given process * * @throws DAOException thrown when process cannot be loaded from database */ - public List getComments(ProcessInterface processInterface) throws DAOException { - Process process = ServiceManager.getProcessService().getById(processInterface.getId()); - return ServiceManager.getCommentService().getAllCommentsByProcess(process); + public List getComments(ProcessInterface process) throws DAOException { + Process processBean = ServiceManager.getProcessService().getById(process.getId()); + return ServiceManager.getCommentService().getAllCommentsByProcess(processBean); } /** - * Check and return if child process for given ProcessInterface processInterface can be created via calendar or not. + * Check and return if child process for given ProcessInterface process can be created via calendar or not. * - * @param processInterface ProcessInterface for which child processes may be created via calendar + * @param process ProcessInterface for which child processes may be created via calendar * @return whether child processes for the given ProcessInterface can be created via the calendar or not * @throws DAOException if process could not be loaded from database * @throws IOException if ruleset file could not be read */ - public static boolean canCreateProcessWithCalendar(ProcessInterface processInterface) + public static boolean canCreateProcessWithCalendar(ProcessInterface process) throws DAOException, IOException { Collection functionalDivisions; - if (Objects.isNull(processInterface.getRuleset())) { + if (Objects.isNull(process.getRuleset())) { return false; } - Integer rulesetId = processInterface.getRuleset().getId(); + Integer rulesetId = process.getRuleset().getId(); if (RULESET_CACHE_FOR_CREATE_FROM_CALENDAR.containsKey(rulesetId)) { functionalDivisions = RULESET_CACHE_FOR_CREATE_FROM_CALENDAR.get(rulesetId); } else { @@ -2536,24 +2536,24 @@ public static boolean canCreateProcessWithCalendar(ProcessInterface processInter .getFunctionalDivisions(FunctionalDivision.CREATE_CHILDREN_WITH_CALENDAR); RULESET_CACHE_FOR_CREATE_FROM_CALENDAR.put(rulesetId, functionalDivisions); } - return functionalDivisions.contains(processInterface.getBaseType()); + return functionalDivisions.contains(process.getBaseType()); } /** - * Check and return if child process for given ProcessInterface processInterface can be created or not. + * Check and return if child process for given ProcessInterface process can be created or not. * - * @param processInterface ProcessInterface for which child processes may be created + * @param process ProcessInterface for which child processes may be created * @return whether child processes for the given ProcessInterface can be created via the calendar or not * @throws DAOException if process could not be loaded from database * @throws IOException if ruleset file could not be read */ - public static boolean canCreateChildProcess(ProcessInterface processInterface) throws DAOException, + public static boolean canCreateChildProcess(ProcessInterface process) throws DAOException, IOException { Collection functionalDivisions; - if (Objects.isNull(processInterface.getRuleset())) { + if (Objects.isNull(process.getRuleset())) { return false; } - Integer rulesetId = processInterface.getRuleset().getId(); + Integer rulesetId = process.getRuleset().getId(); if (RULESET_CACHE_FOR_CREATE_CHILD_FROM_PARENT.containsKey(rulesetId)) { functionalDivisions = RULESET_CACHE_FOR_CREATE_CHILD_FROM_PARENT.get(rulesetId); } else { @@ -2562,7 +2562,7 @@ public static boolean canCreateChildProcess(ProcessInterface processInterface) t .getFunctionalDivisions(FunctionalDivision.CREATE_CHILDREN_FROM_PARENT); RULESET_CACHE_FOR_CREATE_CHILD_FROM_PARENT.put(rulesetId, functionalDivisions); } - return functionalDivisions.contains(processInterface.getBaseType()); + return functionalDivisions.contains(process.getBaseType()); } /** @@ -2691,15 +2691,15 @@ public Map getProcessTaskStates(List processes) { /** * Get all tasks of given process which should be visible to the user. - * @param processInterface process as Interface object + * @param process process as Interface object * @param user user to filter the tasks for * @return List of filtered tasks as Interface objects */ - public List getCurrentTasksForUser(ProcessInterface processInterface, User user) { + public List getCurrentTasksForUser(ProcessInterface process, User user) { Set userRoles = user.getRoles().stream() .map(Role::getId) .collect(Collectors.toSet()); - return processInterface.getTasks().stream() + return process.getTasks().stream() .filter(task -> TaskStatus.OPEN.equals(task.getProcessingStatus()) || TaskStatus.INWORK.equals(task.getProcessingStatus())) .filter(task -> !task.getRoleIds().stream() .filter(userRoles::contains) @@ -2736,8 +2736,8 @@ public List getTemplateProcesses() throws DataException, DAOException { BoolQueryBuilder inChoiceListShownQuery = new BoolQueryBuilder(); MatchQueryBuilder matchQuery = matchQuery(ProcessTypeField.IN_CHOICE_LIST_SHOWN.getKey(), true); inChoiceListShownQuery.must(matchQuery); - for (ProcessInterface processInterface : ServiceManager.getProcessService().findByQuery(matchQuery, true)) { - templateProcesses.add(getById(processInterface.getId())); + for (ProcessInterface process : ServiceManager.getProcessService().findByQuery(matchQuery, true)) { + templateProcesses.add(getById(process.getId())); } templateProcesses.sort(Comparator.comparing(Process::getTitle)); return templateProcesses; diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/ProjectService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/ProjectService.java index f333f0e5a53..b3e1551b481 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/ProjectService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/ProjectService.java @@ -185,61 +185,62 @@ private List findAvailableForAssignToUser(User user) throws Da query.should(createSimpleQuery(ProjectTypeField.CLIENT_ID.getKey(), client.getId(), true)); } - List projectInterfaces = findByQuery(query, true); + List projects = findByQuery(query, true); List alreadyAssigned = new ArrayList<>(); for (Project project : user.getProjects()) { - alreadyAssigned.addAll(projectInterfaces.stream().filter(projectInterface -> projectInterface.getId().equals(project.getId())) - .collect(Collectors.toList())); + alreadyAssigned.addAll( + projects.stream().filter(currentProject -> currentProject.getId().equals(project.getId())) + .collect(Collectors.toList())); } - projectInterfaces.removeAll(alreadyAssigned); - return projectInterfaces; + projects.removeAll(alreadyAssigned); + return projects; } @Override - public ProjectInterface convertJSONObjectToInterface(Map jsonObject, boolean related) throws DataException { - ProjectInterface projectInterface = DTOFactory.instance().newProject(); - projectInterface.setId(getIdFromJSONObject(jsonObject)); - projectInterface.setTitle(ProjectTypeField.TITLE.getStringValue(jsonObject)); + public ProjectInterface convertJSONObjectTo(Map jsonObject, boolean related) throws DataException { + ProjectInterface project = DTOFactory.instance().newProject(); + project.setId(getIdFromJSONObject(jsonObject)); + project.setTitle(ProjectTypeField.TITLE.getStringValue(jsonObject)); try { - projectInterface.setStartTime(ProjectTypeField.START_DATE.getStringValue(jsonObject)); - projectInterface.setEndTime(ProjectTypeField.END_DATE.getStringValue(jsonObject)); + project.setStartTime(ProjectTypeField.START_DATE.getStringValue(jsonObject)); + project.setEndTime(ProjectTypeField.END_DATE.getStringValue(jsonObject)); } catch (ParseException e) { throw new DataException(e); } - projectInterface.setMetsRightsOwner(ProjectTypeField.METS_RIGTS_OWNER.getStringValue(jsonObject)); - projectInterface.setNumberOfPages(ProjectTypeField.NUMBER_OF_PAGES.getIntValue(jsonObject)); - projectInterface.setNumberOfVolumes(ProjectTypeField.NUMBER_OF_VOLUMES.getIntValue(jsonObject)); - projectInterface.setActive(ProjectTypeField.ACTIVE.getBooleanValue(jsonObject)); - ClientInterface clientInterface = DTOFactory.instance().newClient(); - clientInterface.setId(ProjectTypeField.CLIENT_ID.getIntValue(jsonObject)); - clientInterface.setName(ProjectTypeField.CLIENT_NAME.getStringValue(jsonObject)); - projectInterface.setClient(clientInterface); - projectInterface.setHasProcesses(ProjectTypeField.HAS_PROCESSES.getBooleanValue(jsonObject)); + project.setMetsRightsOwner(ProjectTypeField.METS_RIGTS_OWNER.getStringValue(jsonObject)); + project.setNumberOfPages(ProjectTypeField.NUMBER_OF_PAGES.getIntValue(jsonObject)); + project.setNumberOfVolumes(ProjectTypeField.NUMBER_OF_VOLUMES.getIntValue(jsonObject)); + project.setActive(ProjectTypeField.ACTIVE.getBooleanValue(jsonObject)); + ClientInterface client = DTOFactory.instance().newClient(); + client.setId(ProjectTypeField.CLIENT_ID.getIntValue(jsonObject)); + client.setName(ProjectTypeField.CLIENT_NAME.getStringValue(jsonObject)); + project.setClient(client); + project.setHasProcesses(ProjectTypeField.HAS_PROCESSES.getBooleanValue(jsonObject)); if (!related) { - convertRelatedJSONObjects(jsonObject, projectInterface); + convertRelatedJSONObjects(jsonObject, project); } else { - projectInterface.setActiveTemplates(getTemplatesForProjectInterface(jsonObject)); + project.setActiveTemplates(getTemplatesForProject(jsonObject)); } - return projectInterface; + return project; } - private List getTemplatesForProjectInterface(Map jsonObject) throws DataException { - List templateInterfaces = new ArrayList<>(); + private List getTemplatesForProject(Map jsonObject) throws DataException { + List templates = new ArrayList<>(); List> jsonArray = ProjectTypeField.TEMPLATES.getJsonArray(jsonObject); for (Map singleObject : jsonArray) { - TemplateInterface templateInterface = DTOFactory.instance().newTemplate(); - templateInterface.setId(TemplateTypeField.ID.getIntValue(singleObject)); - templateInterface.setTitle(TemplateTypeField.TITLE.getStringValue(singleObject)); - templateInterfaces.add(templateInterface); + TemplateInterface template = DTOFactory.instance().newTemplate(); + template.setId(TemplateTypeField.ID.getIntValue(singleObject)); + template.setTitle(TemplateTypeField.TITLE.getStringValue(singleObject)); + templates.add(template); } - return templateInterfaces.stream().filter(TemplateInterface::isActive).collect(Collectors.toList()); + return templates.stream().filter(TemplateInterface::isActive).collect(Collectors.toList()); } - private void convertRelatedJSONObjects(Map jsonObject, ProjectInterface projectInterface) throws DataException { + private void convertRelatedJSONObjects(Map jsonObject, ProjectInterface project) throws DataException { // TODO: not clear if project lists will need it - projectInterface.setUsers(new ArrayList<>()); - projectInterface.setActiveTemplates(convertRelatedJSONObjectToInterface(jsonObject, ProjectTypeField.TEMPLATES.getKey(), + project.setUsers(new ArrayList<>()); + project.setActiveTemplates(convertRelatedJSONObjectTo(jsonObject, ProjectTypeField.TEMPLATES.getKey(), ServiceManager.getTemplateService()).stream().filter(TemplateInterface::isActive).collect(Collectors.toList())); } diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/RulesetService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/RulesetService.java index 778a8a9de09..b043ef22993 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/RulesetService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/RulesetService.java @@ -115,20 +115,20 @@ public List getAllForSelectedClient() { } @Override - public RulesetInterface convertJSONObjectToInterface(Map jsonObject, boolean related) throws DataException { - RulesetInterface rulesetInterface = DTOFactory.instance().newRuleset(); - rulesetInterface.setId(getIdFromJSONObject(jsonObject)); - rulesetInterface.setTitle(RulesetTypeField.TITLE.getStringValue(jsonObject)); - rulesetInterface.setFile(RulesetTypeField.FILE.getStringValue(jsonObject)); - rulesetInterface.setOrderMetadataByRuleset( + public RulesetInterface convertJSONObjectTo(Map jsonObject, boolean related) throws DataException { + RulesetInterface ruleset = DTOFactory.instance().newRuleset(); + ruleset.setId(getIdFromJSONObject(jsonObject)); + ruleset.setTitle(RulesetTypeField.TITLE.getStringValue(jsonObject)); + ruleset.setFile(RulesetTypeField.FILE.getStringValue(jsonObject)); + ruleset.setOrderMetadataByRuleset( RulesetTypeField.ORDER_METADATA_BY_RULESET.getBooleanValue(jsonObject)); - ClientInterface clientInterface = DTOFactory.instance().newClient(); - clientInterface.setId(RulesetTypeField.CLIENT_ID.getIntValue(jsonObject)); - clientInterface.setName(RulesetTypeField.CLIENT_NAME.getStringValue(jsonObject)); + ClientInterface client = DTOFactory.instance().newClient(); + client.setId(RulesetTypeField.CLIENT_ID.getIntValue(jsonObject)); + client.setName(RulesetTypeField.CLIENT_NAME.getStringValue(jsonObject)); - rulesetInterface.setClient(clientInterface); - return rulesetInterface; + ruleset.setClient(client); + return ruleset; } /** diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/TaskService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/TaskService.java index 3477d52a7cc..9b9f2301c8b 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/TaskService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/TaskService.java @@ -301,9 +301,9 @@ public List findTaskTitlesDistinct() throws DataException, DAOException } @Override - public TaskInterface convertJSONObjectToInterface(Map jsonObject, boolean related) throws DataException { - TaskInterface taskInterface = createTaskInterface(jsonObject); - convertTaskProjectFromJsonObjectToInterface(jsonObject, taskInterface); + public TaskInterface convertJSONObjectTo(Map jsonObject, boolean related) throws DataException { + TaskInterface task = createTask(jsonObject); + convertTaskProjectFromJsonObjectTo(jsonObject, task); /* * We read the list of the process but not the list of templates, because only process tasks @@ -312,68 +312,68 @@ public TaskInterface convertJSONObjectToInterface(Map jsonObject */ int process = TaskTypeField.PROCESS_ID.getIntValue(jsonObject); if (process > 0 && !related) { - taskInterface.setProcess(ServiceManager.getProcessService().findById(process, true)); - taskInterface.setBatchAvailable(ServiceManager.getProcessService() - .isProcessAssignedToOnlyOneBatch(taskInterface.getProcess().getBatches())); + task.setProcess(ServiceManager.getProcessService().findById(process, true)); + task.setBatchAvailable(ServiceManager.getProcessService() + .isProcessAssignedToOnlyOneBatch(task.getProcess().getBatches())); } int processingUser = TaskTypeField.PROCESSING_USER_ID.getIntValue(jsonObject); if (processingUser > 0) { - UserInterface userInterface = DTOFactory.instance().newUser(); - userInterface.setId(processingUser); - userInterface.setLogin(TaskTypeField.PROCESSING_USER_LOGIN.getStringValue(jsonObject)); - userInterface.setName(TaskTypeField.PROCESSING_USER_NAME.getStringValue(jsonObject)); - userInterface.setSurname(TaskTypeField.PROCESSING_USER_SURNAME.getStringValue(jsonObject)); - userInterface.setFullName(TaskTypeField.PROCESSING_USER_FULLNAME.getStringValue(jsonObject)); - taskInterface.setProcessingUser(userInterface); + UserInterface user = DTOFactory.instance().newUser(); + user.setId(processingUser); + user.setLogin(TaskTypeField.PROCESSING_USER_LOGIN.getStringValue(jsonObject)); + user.setName(TaskTypeField.PROCESSING_USER_NAME.getStringValue(jsonObject)); + user.setSurname(TaskTypeField.PROCESSING_USER_SURNAME.getStringValue(jsonObject)); + user.setFullName(TaskTypeField.PROCESSING_USER_FULLNAME.getStringValue(jsonObject)); + task.setProcessingUser(user); } - return taskInterface; + return task; } - private TaskInterface createTaskInterface(Map jsonObject) throws DataException { - TaskInterface taskInterface = DTOFactory.instance().newTask(); - taskInterface.setId(getIdFromJSONObject(jsonObject)); - taskInterface.setTitle(TaskTypeField.TITLE.getStringValue(jsonObject)); - taskInterface.setLocalizedTitle(getLocalizedTitle(taskInterface.getTitle())); - taskInterface.setOrdering(TaskTypeField.ORDERING.getIntValue(jsonObject)); + private TaskInterface createTask(Map jsonObject) throws DataException { + TaskInterface task = DTOFactory.instance().newTask(); + task.setId(getIdFromJSONObject(jsonObject)); + task.setTitle(TaskTypeField.TITLE.getStringValue(jsonObject)); + task.setLocalizedTitle(getLocalizedTitle(task.getTitle())); + task.setOrdering(TaskTypeField.ORDERING.getIntValue(jsonObject)); int taskStatus = TaskTypeField.PROCESSING_STATUS.getIntValue(jsonObject); - taskInterface.setProcessingStatus(TaskStatus.getStatusFromValue(taskStatus)); - taskInterface.setProcessingStatusTitle(Helper.getTranslation(taskInterface.getProcessingStatus().getTitle())); + task.setProcessingStatus(TaskStatus.getStatusFromValue(taskStatus)); + task.setProcessingStatusTitle(Helper.getTranslation(task.getProcessingStatus().getTitle())); int editType = TaskTypeField.EDIT_TYPE.getIntValue(jsonObject); - taskInterface.setEditType(TaskEditType.getTypeFromValue(editType)); - taskInterface.setEditTypeTitle(Helper.getTranslation(taskInterface.getEditType().getTitle())); + task.setEditType(TaskEditType.getTypeFromValue(editType)); + task.setEditTypeTitle(Helper.getTranslation(task.getEditType().getTitle())); try { - taskInterface.setProcessingMoment(TaskTypeField.PROCESSING_TIME.getStringValue(jsonObject)); - taskInterface.setProcessingBeginTime(TaskTypeField.PROCESSING_BEGIN.getStringValue(jsonObject)); - taskInterface.setProcessingEndTime(TaskTypeField.PROCESSING_END.getStringValue(jsonObject)); + task.setProcessingMoment(TaskTypeField.PROCESSING_TIME.getStringValue(jsonObject)); + task.setProcessingBeginTime(TaskTypeField.PROCESSING_BEGIN.getStringValue(jsonObject)); + task.setProcessingEndTime(TaskTypeField.PROCESSING_END.getStringValue(jsonObject)); } catch (ParseException e) { throw new DataException(e); } - taskInterface.setCorrection(TaskTypeField.CORRECTION.getBooleanValue(jsonObject)); - taskInterface.setTypeAutomatic(TaskTypeField.TYPE_AUTOMATIC.getBooleanValue(jsonObject)); - taskInterface.setTypeMetadata(TaskTypeField.TYPE_METADATA.getBooleanValue(jsonObject)); - taskInterface.setTypeImagesWrite(TaskTypeField.TYPE_IMAGES_WRITE.getBooleanValue(jsonObject)); - taskInterface.setTypeImagesRead(TaskTypeField.TYPE_IMAGES_READ.getBooleanValue(jsonObject)); - taskInterface.setBatchStep(TaskTypeField.BATCH_STEP.getBooleanValue(jsonObject)); - taskInterface.setRoleIds(convertJSONValuesToList(TaskTypeField.ROLES.getJsonArray(jsonObject))); - taskInterface.setRolesSize(TaskTypeField.ROLES.getSizeOfProperty(jsonObject)); - taskInterface.setCorrectionCommentStatus(TaskTypeField.CORRECTION_COMMENT_STATUS.getIntValue(jsonObject)); - return taskInterface; + task.setCorrection(TaskTypeField.CORRECTION.getBooleanValue(jsonObject)); + task.setTypeAutomatic(TaskTypeField.TYPE_AUTOMATIC.getBooleanValue(jsonObject)); + task.setTypeMetadata(TaskTypeField.TYPE_METADATA.getBooleanValue(jsonObject)); + task.setTypeImagesWrite(TaskTypeField.TYPE_IMAGES_WRITE.getBooleanValue(jsonObject)); + task.setTypeImagesRead(TaskTypeField.TYPE_IMAGES_READ.getBooleanValue(jsonObject)); + task.setBatchStep(TaskTypeField.BATCH_STEP.getBooleanValue(jsonObject)); + task.setRoleIds(convertJSONValuesToList(TaskTypeField.ROLES.getJsonArray(jsonObject))); + task.setRolesSize(TaskTypeField.ROLES.getSizeOfProperty(jsonObject)); + task.setCorrectionCommentStatus(TaskTypeField.CORRECTION_COMMENT_STATUS.getIntValue(jsonObject)); + return task; } /** - * Parses and adds properties related to the project of a task to the taskInterface. + * Parses and adds properties related to the project of a task to the task. * * @param jsonObject the jsonObject retrieved from the ElasticSearch index for a task - * @param taskInterface the taskInterface + * @param task the task */ - private void convertTaskProjectFromJsonObjectToInterface(Map jsonObject, - TaskInterface taskInterface) throws DataException { + private void convertTaskProjectFromJsonObjectTo(Map jsonObject, + TaskInterface task) throws DataException { - ProjectInterface projectInterface = DTOFactory.instance().newProject(); - projectInterface.setId(TaskTypeField.PROJECT_ID.getIntValue(jsonObject)); - projectInterface.setTitle(TaskTypeField.PROJECT_TITLE.getStringValue(jsonObject)); - taskInterface.setProject(projectInterface); + ProjectInterface project = DTOFactory.instance().newProject(); + project.setId(TaskTypeField.PROJECT_ID.getIntValue(jsonObject)); + project.setTitle(TaskTypeField.PROJECT_TITLE.getStringValue(jsonObject)); + task.setProject(project); } private List convertJSONValuesToList(List> jsonObject) { diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/TemplateService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/TemplateService.java index 3076312028c..d2d7b75f530 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/TemplateService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/TemplateService.java @@ -182,37 +182,37 @@ public Template duplicateTemplate(Template baseTemplate) { } @Override - public TemplateInterface convertJSONObjectToInterface(Map jsonObject, boolean related) throws DataException { - TemplateInterface templateInterface = DTOFactory.instance().newTemplate(); - templateInterface.setId(getIdFromJSONObject(jsonObject)); - templateInterface.setTitle(TemplateTypeField.TITLE.getStringValue(jsonObject)); - templateInterface.setActive(TemplateTypeField.ACTIVE.getBooleanValue(jsonObject)); + public TemplateInterface convertJSONObjectTo(Map jsonObject, boolean related) throws DataException { + TemplateInterface template = DTOFactory.instance().newTemplate(); + template.setId(getIdFromJSONObject(jsonObject)); + template.setTitle(TemplateTypeField.TITLE.getStringValue(jsonObject)); + template.setActive(TemplateTypeField.ACTIVE.getBooleanValue(jsonObject)); try { - templateInterface.setCreationTime(TemplateTypeField.CREATION_DATE.getStringValue(jsonObject)); + template.setCreationTime(TemplateTypeField.CREATION_DATE.getStringValue(jsonObject)); } catch (ParseException e) { throw new DataException(e); } - templateInterface.setDocket( + template.setDocket( ServiceManager.getDocketService().findById(TemplateTypeField.DOCKET.getIntValue(jsonObject))); - templateInterface.setRuleset( + template.setRuleset( ServiceManager.getRulesetService().findById(TemplateTypeField.RULESET_ID.getIntValue(jsonObject))); - WorkflowInterface workflowInterface = DTOFactory.instance().newWorkflow(); - workflowInterface.setTitle(TemplateTypeField.WORKFLOW_TITLE.getStringValue(jsonObject)); - templateInterface.setWorkflow(workflowInterface); - templateInterface.setTasks(convertRelatedJSONObjectToInterface(jsonObject, TemplateTypeField.TASKS.getKey(), + WorkflowInterface workflow = DTOFactory.instance().newWorkflow(); + workflow.setTitle(TemplateTypeField.WORKFLOW_TITLE.getStringValue(jsonObject)); + template.setWorkflow(workflow); + template.setTasks(convertRelatedJSONObjectTo(jsonObject, TemplateTypeField.TASKS.getKey(), ServiceManager.getTaskService())); - templateInterface.setCanBeUsedForProcess(hasCompleteTasks(templateInterface.getTasks())); + template.setCanBeUsedForProcess(hasCompleteTasks(template.getTasks())); if (!related) { - convertRelatedJSONObjects(jsonObject, templateInterface); + convertRelatedJSONObjects(jsonObject, template); } - return templateInterface; + return template; } - private void convertRelatedJSONObjects(Map jsonObject, TemplateInterface templateInterface) + private void convertRelatedJSONObjects(Map jsonObject, TemplateInterface template) throws DataException { - templateInterface.setProjects(convertRelatedJSONObjectToInterface(jsonObject, TemplateTypeField.PROJECTS.getKey(), + template.setProjects(convertRelatedJSONObjectTo(jsonObject, TemplateTypeField.PROJECTS.getKey(), ServiceManager.getProjectService()).stream().sorted(Comparator.comparing(ProjectInterface::getTitle)) .collect(Collectors.toList())); } diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/WorkflowService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/WorkflowService.java index de8ea61b0b5..625b3b4a6fe 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/WorkflowService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/WorkflowService.java @@ -99,12 +99,12 @@ public List getAllForSelectedClient() { } @Override - public WorkflowInterface convertJSONObjectToInterface(Map jsonObject, boolean related) throws DataException { - WorkflowInterface workflowInterface = DTOFactory.instance().newWorkflow(); - workflowInterface.setId(getIdFromJSONObject(jsonObject)); - workflowInterface.setTitle(WorkflowTypeField.TITLE.getStringValue(jsonObject)); - workflowInterface.setWorkflowStatus(WorkflowTypeField.STATUS.getStringValue(jsonObject)); - return workflowInterface; + public WorkflowInterface convertJSONObjectTo(Map jsonObject, boolean related) throws DataException { + WorkflowInterface workflow = DTOFactory.instance().newWorkflow(); + workflow.setId(getIdFromJSONObject(jsonObject)); + workflow.setTitle(WorkflowTypeField.TITLE.getStringValue(jsonObject)); + workflow.setWorkflowStatus(WorkflowTypeField.STATUS.getStringValue(jsonObject)); + return workflow; } private QueryBuilder getWorkflowsForCurrentUserQuery() { diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/base/SearchService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/base/SearchService.java index 11841f6a42a..3b1b8bc65ab 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/base/SearchService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/base/SearchService.java @@ -100,7 +100,7 @@ public SearchService(V dao, BaseType type, Indexer indexer, Searcher searcher) { * true or false * @return Interface object */ - public abstract S convertJSONObjectToInterface(Map jsonObject, boolean related) throws DataException; + public abstract S convertJSONObjectTo(Map jsonObject, boolean related) throws DataException; /** * Count all not indexed rows in database. Not indexed means that row has index @@ -452,7 +452,7 @@ public S findById(Integer id) throws DataException { */ public S findById(Integer id, boolean related) throws DataException { try { - return convertJSONObjectToInterface(searcher.findDocument(id), related); + return convertJSONObjectTo(searcher.findDocument(id), related); } catch (CustomResponseException e) { throw new DataException(e); } @@ -537,7 +537,7 @@ protected List convertJSONObjectsToInterfaces(List> jsonO List results = new ArrayList<>(); for (Map jsonObject : jsonObjects) { - results.add(convertJSONObjectToInterface(jsonObject, related)); + results.add(convertJSONObjectTo(jsonObject, related)); } return results; @@ -552,9 +552,9 @@ protected List convertJSONObjectsToInterfaces(List> jsonO * name of related property * @return bean object */ - protected List convertRelatedJSONObjectToInterface(Map jsonObject, String key, + protected List convertRelatedJSONObjectTo(Map jsonObject, String key, SearchService service) throws DataException { - List ids = getRelatedPropertyForInterface(jsonObject, key); + List ids = getRelatedPropertyFor(jsonObject, key); if (ids.isEmpty()) { return new ArrayList<>(); } @@ -905,7 +905,7 @@ protected List> findDocuments(QueryBuilder query, SortBuilde * @return display properties as list of Integers */ @SuppressWarnings("unchecked") - private List getRelatedPropertyForInterface(Map object, String key) { + private List getRelatedPropertyFor(Map object, String key) { if (Objects.nonNull(object)) { List> jsonArray = (List>) object.get(key); List ids = new ArrayList<>(); diff --git a/Kitodo/src/main/java/org/kitodo/production/services/dataeditor/DataEditorService.java b/Kitodo/src/main/java/org/kitodo/production/services/dataeditor/DataEditorService.java index 3824f994d07..1a42402da4a 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/dataeditor/DataEditorService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/dataeditor/DataEditorService.java @@ -213,9 +213,9 @@ public static List getAddableMetadataForStructureElement(StructuralE Collection existingMetadata, Collection additionalFields, Ruleset ruleset) { List addableMetadata = new ArrayList<>(); - Collection viewInterfaces = structureView + Collection views = structureView .getAddableMetadata(existingMetadata, additionalFields); - for (MetadataViewInterface keyView : viewInterfaces) { + for (MetadataViewInterface keyView : views) { addableMetadata.add( new SelectItem(keyView.getId(), keyView.getLabel(), keyView instanceof SimpleMetadataViewInterface diff --git a/Kitodo/src/main/java/org/kitodo/production/services/file/FileService.java b/Kitodo/src/main/java/org/kitodo/production/services/file/FileService.java index c3418dc41fc..f4b2cb19718 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/file/FileService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/file/FileService.java @@ -724,14 +724,14 @@ public URI getMetadataFilePath(Process process) throws IOException { } /** - * Gets the URI of the metadata.xml of a given processInterface. + * Gets the URI of the metadata.xml of a given process. * - * @param processInterface + * @param process * the process to get the metadata.xml for. * @return The URI to the metadata.xml */ - public URI getMetadataFilePath(ProcessInterface processInterface) throws IOException { - return getMetadataFilePath(processInterface, true); + public URI getMetadataFilePath(ProcessInterface process) throws IOException { + return getMetadataFilePath(process, true); } /** @@ -752,16 +752,16 @@ public URI getMetadataFilePath(Process process, boolean mustExist, boolean forIn } /** - * Gets the URI of the metadata.xml of a given processInterface. + * Gets the URI of the metadata.xml of a given process. * - * @param processInterface + * @param process * the process to get the metadata.xml for. * @param mustExist * whether the file must exist * @return The URI to the metadata.xml */ - public URI getMetadataFilePath(ProcessInterface processInterface, boolean mustExist) throws IOException { - URI metadataFilePath = getProcessSubTypeURI(processInterface, ProcessSubType.META_XML, null); + public URI getMetadataFilePath(ProcessInterface process, boolean mustExist) throws IOException { + URI metadataFilePath = getProcessSubTypeURI(process, ProcessSubType.META_XML, null); if (mustExist && !fileExist(metadataFilePath)) { throw new IOException(Helper.getTranslation("metadataFileNotFound", metadataFilePath.getPath())); } @@ -901,17 +901,17 @@ public URI getProcessBaseUriForExistingProcess(Process process) { * to the correct URI. File.separator doesn't work because on Windows it * appends backslash to URI. * - * @param processInterface + * @param process * the process, the uri is needed for. * @return the URI. */ - public String getProcessBaseUriForExistingProcess(ProcessInterface processInterface) { - String processBaseUri = processInterface.getProcessBase(); - if (Objects.isNull(processBaseUri) && Objects.nonNull(processInterface.getId())) { - processInterface.setProcessBase( - fileManagementModule.createUriForExistingProcess(processInterface.getId().toString()).toString()); + public String getProcessBaseUriForExistingProcess(ProcessInterface process) { + String processBaseUri = process.getProcessBase(); + if (Objects.isNull(processBaseUri) && Objects.nonNull(process.getId())) { + process.setProcessBase( + fileManagementModule.createUriForExistingProcess(process.getId().toString()).toString()); } - return processInterface.getProcessBase(); + return process.getProcessBase(); } /** @@ -996,7 +996,7 @@ private URI getProcessSubTypeURI(Process process, ProcessSubType processSubType, * Gets the URI for a Process Sub-location. Possible Locations are listed * in ProcessSubType * - * @param processInterface + * @param process * the process to get the sublocation for. * @param processSubType * The subType. @@ -1005,15 +1005,15 @@ private URI getProcessSubTypeURI(Process process, ProcessSubType processSubType, * folder of the sublocation is returned * @return The URI of the requested location */ - private URI getProcessSubTypeURI(ProcessInterface processInterface, ProcessSubType processSubType, String resourceName) { + private URI getProcessSubTypeURI(ProcessInterface process, ProcessSubType processSubType, String resourceName) { - String processDataDirectory = ServiceManager.getProcessService().getProcessDataDirectory(processInterface); + String processDataDirectory = ServiceManager.getProcessService().getProcessDataDirectory(process); if (Objects.isNull(resourceName)) { resourceName = ""; } return fileManagementModule.getProcessSubTypeUri(URI.create(processDataDirectory), - Helper.getNormalizedTitle(processInterface.getTitle()), processSubType, resourceName); + Helper.getNormalizedTitle(process.getTitle()), processSubType, resourceName); } /** diff --git a/Kitodo/src/test/java/org/kitodo/production/services/data/ImportServiceIT.java b/Kitodo/src/test/java/org/kitodo/production/services/data/ImportServiceIT.java index 703d7691c3a..b94a4d225b1 100644 --- a/Kitodo/src/test/java/org/kitodo/production/services/data/ImportServiceIT.java +++ b/Kitodo/src/test/java/org/kitodo/production/services/data/ImportServiceIT.java @@ -353,14 +353,14 @@ public void shouldProcessTempProcess() throws DAOException, IOException, Process InvalidMetadataValueException, NoSuchMetadataFieldException, ParserConfigurationException, SAXException, TransformerException { Ruleset ruleset = ServiceManager.getRulesetService().getById(RULESET_ID); - RulesetManagementInterface managementInterface = ServiceManager.getRulesetService().openRuleset(ruleset); + RulesetManagementInterface management = ServiceManager.getRulesetService().openRuleset(ruleset); ImportConfiguration importConfiguration = MockDatabase.getK10PlusImportConfiguration(); try (InputStream inputStream = Files.newInputStream(Paths.get(TEST_KITODO_METADATA_FILE_PATH))) { String fileContent = IOUtils.toString(inputStream, StandardCharsets.UTF_8); Document xmlDocument = XMLUtils.parseXMLString(fileContent); TempProcess tempProcess = ServiceManager.getImportService().createTempProcessFromDocument( importConfiguration, xmlDocument, TEMPLATE_ID, PROJECT_ID); - ImportService.processTempProcess(tempProcess, managementInterface, + ImportService.processTempProcess(tempProcess, management, ImportService.ACQUISITION_STAGE_CREATE, ServiceManager.getUserService() .getCurrentMetadataLanguage(), null); Assert.assertFalse("Process should have some properties", @@ -507,13 +507,13 @@ private static List loadProcessDetailsFromTestProcess(String file NoSuchMetadataFieldException, ParserConfigurationException, SAXException { ImportConfiguration importConfiguration = MockDatabase.getK10PlusImportConfiguration(); Ruleset ruleset = ServiceManager.getRulesetService().getById(RULESET_ID); - RulesetManagementInterface managementInterface = ServiceManager.getRulesetService().openRuleset(ruleset); + RulesetManagementInterface management = ServiceManager.getRulesetService().openRuleset(ruleset); try (InputStream inputStream = Files.newInputStream(Paths.get(filepath))) { String fileContent = IOUtils.toString(inputStream, StandardCharsets.UTF_8); Document xmlDocument = XMLUtils.parseXMLString(fileContent); TempProcess tempProcess = ServiceManager.getImportService().createTempProcessFromDocument( importConfiguration, xmlDocument, TEMPLATE_ID, PROJECT_ID); - return ProcessHelper.transformToProcessDetails(tempProcess, managementInterface, + return ProcessHelper.transformToProcessDetails(tempProcess, management, ImportService.ACQUISITION_STAGE_CREATE, ServiceManager.getUserService() .getCurrentMetadataLanguage()); } diff --git a/Kitodo/src/test/java/org/kitodo/production/services/data/ProcessServiceIT.java b/Kitodo/src/test/java/org/kitodo/production/services/data/ProcessServiceIT.java index 957563c096e..e0d0ad3ea92 100644 --- a/Kitodo/src/test/java/org/kitodo/production/services/data/ProcessServiceIT.java +++ b/Kitodo/src/test/java/org/kitodo/production/services/data/ProcessServiceIT.java @@ -597,14 +597,14 @@ public void shouldGetDigitalDocument() throws Exception { @Test public void shouldBeProcessAssignedToOnlyOneBatch() throws Exception { - ProcessInterface processInterface = processService.findById(2); - assertTrue(processService.isProcessAssignedToOnlyOneBatch(processInterface.getBatches())); + ProcessInterface process = processService.findById(2); + assertTrue(processService.isProcessAssignedToOnlyOneBatch(process.getBatches())); } @Test public void shouldNotBeProcessAssignedToOnlyOneBatch() throws Exception { - ProcessInterface processInterface = processService.findById(1); - assertFalse(processService.isProcessAssignedToOnlyOneBatch(processInterface.getBatches())); + ProcessInterface process = processService.findById(1); + assertFalse(processService.isProcessAssignedToOnlyOneBatch(process.getBatches())); } @Test diff --git a/Kitodo/src/test/java/org/kitodo/production/services/data/ProcessServiceTest.java b/Kitodo/src/test/java/org/kitodo/production/services/data/ProcessServiceTest.java index f29b5ce6751..d1286b3ddc5 100644 --- a/Kitodo/src/test/java/org/kitodo/production/services/data/ProcessServiceTest.java +++ b/Kitodo/src/test/java/org/kitodo/production/services/data/ProcessServiceTest.java @@ -28,45 +28,45 @@ public class ProcessServiceTest { @Test public void shouldGetSortedCorrectionSolutionMessages() throws ParseException { - final ProcessInterface processInterface = new ProcessDTO(); - - PropertyInterface firstPropertyInterface = new PropertyDTO(); - firstPropertyInterface.setId(1); - firstPropertyInterface.setTitle("Korrektur notwendig"); - firstPropertyInterface.setValue("Fix it"); - firstPropertyInterface.setCreationTime(null); - - PropertyInterface secondPropertyInterface = new PropertyDTO(); - secondPropertyInterface.setId(2); - secondPropertyInterface.setTitle("Korrektur notwendig"); - secondPropertyInterface.setValue("Fix it also"); - secondPropertyInterface.setCreationTime(null); - - PropertyInterface thirdPropertyInterface = new PropertyDTO(); - thirdPropertyInterface.setId(3); - thirdPropertyInterface.setTitle("Other title"); - thirdPropertyInterface.setValue("Other value"); - thirdPropertyInterface.setCreationTime("2017-12-01"); - - PropertyInterface fourthPropertyInterface = new PropertyDTO(); - fourthPropertyInterface.setId(4); - fourthPropertyInterface.setTitle("Korrektur durchgef\u00FChrt"); - fourthPropertyInterface.setValue("Fixed second"); - fourthPropertyInterface.setCreationTime("2017-12-05"); - - PropertyInterface fifthPropertyInterface = new PropertyDTO(); - fifthPropertyInterface.setId(5); - fifthPropertyInterface.setTitle("Korrektur durchgef\u00FChrt"); - fifthPropertyInterface.setValue("Fixed first"); - fifthPropertyInterface.setCreationTime("2017-12-03"); + final ProcessInterface process = new ProcessDTO(); + + PropertyInterface firstProperty = new PropertyDTO(); + firstProperty.setId(1); + firstProperty.setTitle("Korrektur notwendig"); + firstProperty.setValue("Fix it"); + firstProperty.setCreationTime(null); + + PropertyInterface secondProperty = new PropertyDTO(); + secondProperty.setId(2); + secondProperty.setTitle("Korrektur notwendig"); + secondProperty.setValue("Fix it also"); + secondProperty.setCreationTime(null); + + PropertyInterface thirdProperty = new PropertyDTO(); + thirdProperty.setId(3); + thirdProperty.setTitle("Other title"); + thirdProperty.setValue("Other value"); + thirdProperty.setCreationTime("2017-12-01"); + + PropertyInterface fourthProperty = new PropertyDTO(); + fourthProperty.setId(4); + fourthProperty.setTitle("Korrektur durchgef\u00FChrt"); + fourthProperty.setValue("Fixed second"); + fourthProperty.setCreationTime("2017-12-05"); + + PropertyInterface fifthProperty = new PropertyDTO(); + fifthProperty.setId(5); + fifthProperty.setTitle("Korrektur durchgef\u00FChrt"); + fifthProperty.setValue("Fixed first"); + fifthProperty.setCreationTime("2017-12-03"); @SuppressWarnings("unchecked") - List properties = (List) processInterface.getProperties(); - properties.add(firstPropertyInterface); - properties.add(secondPropertyInterface); - properties.add(thirdPropertyInterface); - properties.add(fourthPropertyInterface); - properties.add(fifthPropertyInterface); + List properties = (List) process.getProperties(); + properties.add(firstProperty); + properties.add(secondProperty); + properties.add(thirdProperty); + properties.add(fourthProperty); + properties.add(fifthProperty); } diff --git a/Kitodo/src/test/java/org/kitodo/production/services/data/TemplateServiceIT.java b/Kitodo/src/test/java/org/kitodo/production/services/data/TemplateServiceIT.java index 29d8e6efb2a..e1722b480c0 100644 --- a/Kitodo/src/test/java/org/kitodo/production/services/data/TemplateServiceIT.java +++ b/Kitodo/src/test/java/org/kitodo/production/services/data/TemplateServiceIT.java @@ -92,12 +92,12 @@ public void shouldCheckForUnreachableTasksWithException() throws Exception { @Test public void shouldHasCompleteTasks() throws Exception { - TemplateInterface templateInterface = templateService.findById(1); - boolean condition = templateService.hasCompleteTasks(templateInterface.getTasks()); + TemplateInterface template = templateService.findById(1); + boolean condition = templateService.hasCompleteTasks(template.getTasks()); assertTrue("Process Interface doesn't have complete tasks!", condition); - templateInterface = templateService.findById(3); - condition = templateService.hasCompleteTasks(templateInterface.getTasks()); + template = templateService.findById(3); + condition = templateService.hasCompleteTasks(template.getTasks()); assertFalse("Process Interface has complete tasks!", condition); } }