Skip to content

Commit

Permalink
Fix CurrentTaskForm
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-ronge committed Jan 25, 2024
1 parent 731b24f commit 5534298
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import org.kitodo.data.exceptions.DataException;
import org.kitodo.export.ExportDms;
import org.kitodo.export.TiffHeader;
import org.kitodo.production.dto.TaskDTO;
import org.kitodo.production.enums.GenerationMode;
import org.kitodo.production.enums.ObjectType;
import org.kitodo.production.filters.FilterMenu;
Expand All @@ -66,7 +65,7 @@ public class CurrentTaskForm extends BaseForm {
private static final Logger logger = LogManager.getLogger(CurrentTaskForm.class);
private Process myProcess = new Process();
private Task currentTask = new Task();
private List<TaskDTO> selectedTasks = new ArrayList<>();
private List<Task> selectedTasks = new ArrayList<>();
private final WebDav myDav = new WebDav();
private String scriptPath;
private transient BatchTaskHelper batchHelper;
Expand Down Expand Up @@ -417,7 +416,7 @@ public void setTaskById(int id) {
*
* @return List of selected Tasks
*/
public List<TaskDTO> getSelectedTasks() {
public List<Task> getSelectedTasks() {
return this.selectedTasks;
}

Expand All @@ -427,7 +426,7 @@ public List<TaskDTO> getSelectedTasks() {
* @param selectedTasks
* provided by data table
*/
public void setSelectedTasks(List<TaskDTO> selectedTasks) {
public void setSelectedTasks(List<Task> selectedTasks) {
this.selectedTasks = selectedTasks;
}

Expand Down Expand Up @@ -748,7 +747,7 @@ public String[] getTaskCustomColumnNames() {
* @param propertyName name of the property for the property value is retrieved
* @return property value if process has property with name 'propertyName', empty String otherwise
*/
public static String getTaskProcessPropertyValue(TaskDTO task, String propertyName) {
public static String getTaskProcessPropertyValue(Task task, String propertyName) {
return ProcessService.getPropertyValue(task.getProcess(), propertyName);
}

Expand All @@ -768,7 +767,7 @@ public static int getCorrespondingTemplateTaskId(Task task) {
* @param task TaskDTO object whose process is used
* @return process age of given tasks process
*/
public String getProcessDuration(TaskDTO task) {
public String getProcessDuration(Task task) {
return ProcessService.getProcessDuration(task.getProcess());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,10 +563,10 @@ public Map<String, String> getMetadataLanguages() {
*
* @return list of projects available for assignment to the user
*/
public List<ProjectDTO> getProjects() {
public List<Project> getProjects() {
try {
return ServiceManager.getProjectService().findAllAvailableForAssignToUser(this.userObject)
.stream().sorted(Comparator.comparing(ProjectDTO::getTitle)).collect(Collectors.toList());
.stream().sorted(Comparator.comparing(Project::getTitle)).collect(Collectors.toList());
} catch (DataException e) {
Helper.setErrorMessage(ERROR_LOADING_MANY, new Object[] {ObjectType.PROJECT.getTranslationPlural() },
logger, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2165,8 +2165,8 @@ private String prepareKey(String key) {
* @return property value if process has property with name 'propertyName',
* empty String otherwise
*/
public static String getPropertyValue(ProcessDTO process, String propertyName) {
for (PropertyDTO property : process.getProperties()) {
public static String getPropertyValue(Process process, String propertyName) {
for (Property property : process.getProperties()) {
if (property.getTitle().equals(propertyName)) {
return property.getValue();
}
Expand All @@ -2181,8 +2181,8 @@ public static String getPropertyValue(ProcessDTO process, String propertyName) {
* ProcessDTO object for which duration/age is calculated
* @return process age of given process
*/
public static String getProcessDuration(ProcessDTO process) {
String creationDateTimeString = process.getCreationDate();
public static String getProcessDuration(Process process) {
String creationDateTimeString = process.getCreationDate().toString();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime createLocalDate = LocalDateTime.parse(creationDateTimeString, formatter);
Duration duration = Duration.between(createLocalDate, LocalDateTime.now());
Expand Down

0 comments on commit 5534298

Please sign in to comment.