Skip to content

Copy attachment#245

Merged
yashmeet29 merged 23 commits intodevelopfrom
copyAttachment
Jul 21, 2025
Merged

Copy attachment#245
yashmeet29 merged 23 commits intodevelopfrom
copyAttachment

Conversation

@yashmeet29
Copy link
Copy Markdown
Collaborator

@yashmeet29 yashmeet29 commented Jul 16, 2025

Describe your changes

As an application developer, I want capability in plugin to copy attachments from one entity to another, so that I can easily generate new entities using existing entity as a template without copying individual attachments.

Any documentation

https://wiki.one.int.sap/wiki/display/sapecm/%28NEXUS%29+Copy+Attachments

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist before requesting a review

  • I follow Java Development Guidelines for SAP
  • I have tested the functionality on my cloud environment.
  • I have provided sufficient automated/ unit tests for the code.
  • I have increased or maintained the test coverage.
  • I have ran integration tests on my cloud environment.
  • I have validated blackduck portal for any vulnerability after my commit.

Upload Screenshots/lists of the scenarios tested

  • I have Uploaded Screenshots or added lists of the scenarios tested in description
    Create an entity upload 3 attachment, Create another entity, copy all the attachments from 1st entity to this entity.
    Duplicate error: Create an entity upload 3 attachment, Create another entity, upload one attachment which was present in 1st entity. copy all the three attachments from 1st entity => Nameconstarint error will be thrown and attachments created as part of copy is deleted.
    Not found error: Create an entity upload 3 attachment, Create another entity, copy all the three attachments from 1st entity by adding objectIds although 1 objectId is incorrect. => objectNot found error will be thrown and all the documents and folders created in SDM is deleted.
Screenshot 2025-07-17 at 12 36 59 PM Screenshot 2025-07-17 at 12 37 08 PM Screenshot 2025-07-17 at 1 14 41 PM Screenshot 2025-07-17 at 1 14 49 PM

pom.xml Outdated

<properties>
<revision>1.4.2-SNAPSHOT</revision>
<revision>1.0.0-RC1</revision>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

remove this

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done

rashmiangadi11
rashmiangadi11 previously approved these changes Jul 17, 2025
Copy link
Copy Markdown
Collaborator

@rishikunnath2747 rishikunnath2747 left a comment

Choose a reason for hiding this comment

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

SDMServiceGenericHandler is still required?

/**
* @return {@code true} if the user flow is used, {@code false} otherwise
*/
Boolean getSystemUser();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What is this used for?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is to support named user and technical user flow

@yashmeet29
Copy link
Copy Markdown
Collaborator Author

SDMServiceGenericHandler is still required?

Yes, if customers want to use oData call for copying attachments, they can call ServiceName.copyAttachment. So for that it is needed. I will update readMe as well in this PR

README.md Outdated
This plugin provides helper method to copy attachments from one entity to another. Copy attachments operation can also be triggered using OData API call.


Refer the below example of copyAttachment method usage.
Copy link
Copy Markdown
Collaborator

@dheerasameerk dheerasameerk Jul 21, 2025

Choose a reason for hiding this comment

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

You can describe a little more on the helper method usage. For example,

AttachmentService instance can be used to call copyAttachments method. This method expects an object of CopyAttachmentInput which requires new entity's Id (up__Id), the attachments facet name and the list of objectIds corresponding to attachments that are to be copied. Refer the below example for the usage of copyAttachment method.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done

README.md Outdated

## Support for copy attachments

This plugin provides helper method to copy attachments from one entity to another. Copy attachments operation can also be triggered using OData API call.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This plugin provides capability to copy attachments from one entity to another. This capability will copy attachments metadata on CAP as well as actual content on the SAP Document Management service repository. This feature can be used in following two ways.

README.md Outdated
new CopyAttachmentInput(up__ID, facet, objectIds);
attachmentService.copyAttachments(copyEventInput, isSystemUser);
```
Refer the below example of copyAttachment OData API usage.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You can describe a little more on the OData API method usage. For example,

Attachments service endpoint URL can be used with suffix /<Service_name>.copyAttachments . This request expects the following request body:

{
  "up__ID" : "<up__ID>",  // ID of the new entity
   "objectIds" : "abc","xyz" // objectIds corresponding to attachments that are to be copied
}

Refer the below example for the usage of copyAttachments OData API.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done

@dheerasameerk
Copy link
Copy Markdown
Collaborator

Readme looks good.

@yashmeet29 yashmeet29 merged commit cf407fc into develop Jul 21, 2025
8 checks passed
@yashmeet29 yashmeet29 deleted the copyAttachment branch July 21, 2025 09:36
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.

5 participants