Skip to content

Commit

Permalink
No longer use '...Interface' as part of variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-ronge committed May 21, 2024
1 parent 77ba25a commit 726bd3f
Show file tree
Hide file tree
Showing 29 changed files with 451 additions and 449 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1206,8 +1206,8 @@ private ComplexMetadataViewInterface getCmvi(
List<MetadataViewWithValuesInterface> 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();
}

Expand Down Expand Up @@ -1235,8 +1235,8 @@ private List<String> ids(Collection<MetadataViewInterface> mviColl) {
*/
private List<String> ids(List<MetadataViewWithValuesInterface> 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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void loadProcessData() {
* Filter processes.
*/
public void filterProcesses() {
List<ProcessInterface> processInterfaces = new ArrayList<>();
List<ProcessInterface> processes = new ArrayList<>();
QueryBuilder query = new BoolQueryBuilder();

if (Objects.nonNull(this.processfilter)) {
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Comment> getComments(ProcessInterface processInterface) {
if (comments.containsKey(processInterface)) {
return comments.get(processInterface);
public List<Comment> 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();
Expand All @@ -62,10 +62,10 @@ public List<Comment> 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<Comment> getComments(TaskInterface taskInterface) {
return getComments(taskInterface.getProcess());
public List<Comment> getComments(TaskInterface task) {
return getComments(task.getProcess());
}
}
30 changes: 15 additions & 15 deletions Kitodo/src/main/java/org/kitodo/production/forms/ProcessForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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<TaskInterface> getCurrentTasksForUser(ProcessInterface processInterface) {
return ServiceManager.getProcessService().getCurrentTasksForUser(processInterface,
public List<TaskInterface> getCurrentTasksForUser(ProcessInterface process) {
return ServiceManager.getProcessService().getCurrentTasksForUser(process,
ServiceManager.getUserService().getCurrentUser());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class ProcessListBaseView extends BaseForm {
private int numberOfGlobalImages;
private int numberOfGlobalStructuralElements;
private int numberOfGlobalMetadata;
List<? extends Object> selectedProcessesOrProcessDTOs = new ArrayList<>();
List<? extends Object> selectedProcesses = new ArrayList<>();
private final String doneDirectoryName = ConfigCore.getParameterOrDefaultValue(ParameterCore.DONE_DIRECTORY_NAME);
DeleteProcessDialog deleteProcessDialog = new DeleteProcessDialog();

Expand Down Expand Up @@ -121,33 +121,33 @@ public void setAllSelected(boolean allSelected) {
*/
@SuppressWarnings("unchecked")
public List<Process> getSelectedProcesses() {
List<Process> selectedProcesses = new ArrayList<>();
List<Process> 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<ProcessInterface>) selectedProcessesOrProcessDTOs);
result = ServiceManager.getProcessService()
.convertDtosToBeans((List<ProcessInterface>) 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<Process>) selectedProcessesOrProcessDTOs;
result = (List<Process>) selectedProcesses;
}
}
return selectedProcesses;
return result;
}

/**
Expand Down Expand Up @@ -432,13 +432,13 @@ private void exportDMSForProcesses(List<Process> 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);
Expand All @@ -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);
Expand All @@ -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);
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -602,17 +602,18 @@ public boolean canBeExported(int processId) {
* @return list of instances of Process or ProcessInterface
*/
public List<? extends Object> getSelectedProcessesOrProcessDTOs() {
return selectedProcessesOrProcessDTOs;
return selectedProcesses;
}

public void setSelectedProcessesOrProcessDTOs(List<? extends Object> selectedProcessesOrProcessInterfaces) {
this.selectedProcessesOrProcessDTOs = selectedProcessesOrProcessInterfaces;
public void setSelectedProcessesOrProcessDTOs(List<? extends Object> 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) {
Expand Down
Loading

0 comments on commit 726bd3f

Please sign in to comment.