Skip to content

Commit

Permalink
kitodo#3408 improvements from the review
Browse files Browse the repository at this point in the history
  • Loading branch information
markusweigelt committed Oct 6, 2021
1 parent 36715a2 commit 55391d6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,14 @@ private String getTitleFromMetaXML(Process process) {
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
return null;
return StringUtils.EMPTY;
}

private String getTitleFromAncestors() {
int processesSize = createProcessForm.getProcesses().size();

if (processesSize <= 1) {
return null;
return StringUtils.EMPTY;
}

List<TempProcess> ancestors = createProcessForm.getProcesses().subList(1, processesSize);
Expand All @@ -264,7 +264,7 @@ private String getTitleFromAncestors() {
return ((MetadataEntry) metadataOptional.get()).getValue();
}
}
return null;
return StringUtils.EMPTY;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public static String getValueOfMetadataID(String metadataID, List<ProcessDetail>
return ImportService.getProcessDetailValue(row);
}
}
return null;
return StringUtils.EMPTY;
}

private String evaluateAdditionalDetailsRows(String currentTitle, String currentAuthors, String token)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ public static void createProcessTitle(TempProcess tempProcess,
StructuralElementViewInterface docTypeView = rulesetManagementInterface
.getStructuralElementView(docType, acquisitionStage, priorityList);
String processTitle = docTypeView.getProcessTitle().orElse("");
ProcessService.generateProcessTitleAndGetAtstsl(processDetails,
ProcessService.generateProcessTitle(processDetails,
processTitle, tempProcess.getProcess());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;


public class ProcessService extends ProjectSearchService<Process, ProcessDTO, ProcessDAO> {
private final FileService fileService = ServiceManager.getFileService();
private static final Logger logger = LogManager.getLogger(ProcessService.class);
Expand Down Expand Up @@ -2290,14 +2291,12 @@ private HashSet<Process> getProcessesLinkedInLogicalDivision(
}

/**
* Generate and set the title to process and gets the atstsl.
*
* @return String atstsl
* Generate and set the title to process.
*/
public static String generateProcessTitleAndGetAtstsl(List<ProcessDetail> processDetails, String titleDefinition,
Process process) throws ProcessGenerationException {
return generateProcessTitleAndGetAtstsl(processDetails, titleDefinition, process,
TitleGenerator.getValueOfMetadataID(TitleGenerator.TITLE_DOC_MAIN, processDetails));
public static void generateProcessTitle(List<ProcessDetail> processDetails, String titleDefinition, Process process)
throws ProcessGenerationException {
generateProcessTitleAndGetAtstsl(processDetails, titleDefinition, process,
TitleGenerator.getValueOfMetadataID(TitleGenerator.TITLE_DOC_MAIN, processDetails));
}

/**
Expand All @@ -2311,7 +2310,7 @@ public static String generateProcessTitleAndGetAtstsl(List<ProcessDetail> proces
public static String generateProcessTitleAndGetAtstsl(List<ProcessDetail> processDetails, String titleDefinition,
Process process, String title) throws ProcessGenerationException {
TitleGenerator titleGenerator = new TitleGenerator(null, processDetails);
String newTitle = titleGenerator.generateTitle(titleDefinition, null, (Objects.nonNull(title) ? title : ""));
String newTitle = titleGenerator.generateTitle(titleDefinition, null, title);
process.setTitle(newTitle);
// atstsl is created in title generator and next used in tiff header generator
return titleGenerator.getAtstsl();
Expand Down Expand Up @@ -2434,7 +2433,7 @@ public static void deleteSymlinksFromUserHomes(Task task) {
}

/**
* Get the note list from metadata file by the xpath.
* Get the node list from metadata file by the xpath.
*
* @param process
* The process for which the metadata file is searched for
Expand Down

0 comments on commit 55391d6

Please sign in to comment.