Skip to content

Commit f7c3d62

Browse files
committed
Update README.md
1 parent 0f1e626 commit f7c3d62

1 file changed

Lines changed: 30 additions & 23 deletions

File tree

README.md

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -517,31 +517,38 @@ request =
517517

518518
## Support for copy attachments
519519

520-
This plugin provides helper method to copy attachments from one entity to another. Copy attachments operation can also be triggered using OData API call.
520+
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.
521521

522+
1. **A helper method to copy attachments from one entity to another**
523+
524+
The `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.
525+
526+
Example usage:
527+
```java
528+
String up__ID = "123";
529+
List<String> objectIds = ["abc", "xyz"];
530+
String facet = "AdminService.Books.attachments" // Target facet. This can be usually obtained from context.getTarget().getQualifiedName()
531+
boolean isSystemUser = false;
532+
var copyEventInput =
533+
new CopyAttachmentInput(up__ID, facet, objectIds);
534+
attachmentService.copyAttachments(copyEventInput, isSystemUser);
535+
```
536+
2. **OData API to copy attachments from one entity to another**
537+
538+
You can also use an OData API call to trigger the copy operation.
522539

523-
Refer the below example of copyAttachment method usage.
524-
```java
525-
String up__ID = "123";
526-
List<String> objectIds = ["abc", "xyz"];
527-
String facet = "AdminService.Books.attachments" // Target facet. This can be usually obtained from context.getTarget().getQualifiedName()
528-
boolean isSystemUser = false;
529-
var copyEventInput =
530-
new CopyAttachmentInput(up__ID, facet, objectIds);
531-
attachmentService.copyAttachments(copyEventInput, isSystemUser);
532-
```
533-
Refer the below example of copyAttachment OData API usage.
534-
```
535-
HTTP Method: POST
536-
Request URL:
537-
<app_url>/odata/v4/<Service_Name>/<Entity_Name>(ID=<up__ID>,IsActiveEntity=false)/attachments/<Service_name>.copyAttachments
538-
539-
Request Body:
540-
{
541-
"up__ID" : "<up__ID>",
542-
"objectIds" : "abc","xyz"
543-
}
544-
```
540+
Example usage:
541+
```
542+
HTTP Method: POST
543+
Request URL:
544+
<app_url>/odata/v4/<Service_Name>/<Entity_Name>(ID=<up__ID>,IsActiveEntity=false)/attachments/<Service_name>.copyAttachments
545+
546+
Request Body:
547+
{
548+
"up__ID" : "<up__ID>",
549+
"objectIds" : "abc","xyz"
550+
}
551+
```
545552

546553
## Known Restrictions
547554

0 commit comments

Comments
 (0)