Skip to content

BXC-5550 on-demand PDF generation service APIs#2159

Open
krwong wants to merge 20 commits into
mainfrom
bxc-5550
Open

BXC-5550 on-demand PDF generation service APIs#2159
krwong wants to merge 20 commits into
mainfrom
bxc-5550

Conversation

@krwong

@krwong krwong commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

https://unclibrary.atlassian.net/browse/BXC-5550

  • update javadoc and names to "aggregate pdf"
  • add extractTextType method to MachineGeneratedContentService to retrieve the textType
  • update getTextTypes method to use extractTextType
  • add AggregatePdfController
  • add Aggregate PDF action to ResultObjectActionMenu
  • add/update tests and test resources


if (!textTypeNode.isMissingNode()) {
String textType = textTypeNode.asText();
if (RESULT_HANDWRITTEN_PRINT.equalsIgnoreCase(textType)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 3 other possible values: N/A, PRINTED, and TYPED. N/A should probably not return a type, but all the others should make it through.


AggregatePdfAction.prototype.isValidTarget = function(target) {
return target.isSelected() && target.isEnabled() && $.inArray("editResourceType", target.metadata.permissions) != -1
&& "Folder" == target.getMetadata().type;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also be able to run this one Work objects

if (!isContentRoot && $.inArray('destroy', metadata.permissions) != -1) {
items["destroy"] = {name : 'Destroy', disabled : !resultObject.isDeleted};
}
if (metadata.type === 'Folder' && $.inArray('reindex', metadata.permissions) != -1) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be available to works as well

}

var aggregatePdfForm = aggregatePdfTemplate();
this.dialog = $("<div class='containingDialog'>" + aggregatePdfForm + "</div>");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe there is a confirmation dialogue option that we could use instead of creating a new form, you could check the "Reindex" or "Destroy" actions to see how those work


Map<String, Object> result = new HashMap<>();
var agent = AgentPrincipalsImpl.createFromThread();
result.put("action", "generate aggregate PDF");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
result.put("action", "generate aggregate PDF");
result.put("action", "generate aggregate PDFs");

assertTrue(cmd.contains("pdf4u"));
assertTrue(FilenameUtils.getBaseName(cmd.get(3)).startsWith(PARENT_UUID));
assertEquals(RESULT_HANDWRITTEN_CURSIVE, cmd.get(9));
assertEquals(List.of(RESULT_HANDWRITTEN_CURSIVE).toString(), cmd.get(9));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is expecting the parameter to have value [HANDWRITTEN_CURSIVE], but that seems pretty unusual for passing a list into a CLI, I would expect it to be a comma delimited list like HANDWRITTEN_CURSIVE,PRINTED

return target.isSelected() && target.isEnabled() && $.inArray("editResourceType", target.metadata.permissions) != -1
&& "Folder" == target.getMetadata().type;
return target.isSelected() && target.isEnabled()
&& $.inArray("reindex", target.metadata.permissions) !== -1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked in with Anna about who should have permission to run this workflow. I think we should switch back to editResourceType (here and in AggregatePdfProcessor). Reindex and Run Enhancements are only available to admins, but she suggested that canManager role be able to trigger this workflow.

}

return textTypeList;
return textTypeList.stream().map(Object::toString).collect(Collectors.joining(","));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest having the service return a List of paths still, and serializing it into a string where it needs to be a string for presenting it to the user. Returning a list of Paths is cleaner and more usable programmatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants