|
22 | 22 | import java.io.IOException; |
23 | 23 | import java.util.ArrayList; |
24 | 24 | import java.util.HashMap; |
25 | | -import java.util.HashSet; |
26 | 25 | import java.util.List; |
27 | 26 | import java.util.Map; |
28 | 27 | import java.util.Optional; |
@@ -104,13 +103,25 @@ public void copyAttachments(AttachmentCopyEventContext context) throws IOExcepti |
104 | 103 | .toString())); |
105 | 104 | } |
106 | 105 |
|
107 | | - Set<String> customPropertiesInSDM = new HashSet<>(customPropertyDefinitions.values()); |
108 | | - String upID = context.getUpId(); |
109 | | - String folderName = upID + "__" + compositionName; |
110 | 106 | String repositoryId = SDMConstants.REPOSITORY_ID; |
111 | 107 | Boolean isSystemUser = context.getSystemUser(); |
112 | | - |
113 | 108 | SDMCredentials sdmCredentials = tokenHandler.getSDMCredentials(); |
| 109 | + |
| 110 | + // Fetch secondary types and valid secondary properties from SDM |
| 111 | + List<String> secondaryTypes = |
| 112 | + sdmService.getSecondaryTypes(repositoryId, sdmCredentials, isSystemUser); |
| 113 | + List<String> validSecondaryProperties = |
| 114 | + sdmService.getValidSecondaryProperties( |
| 115 | + secondaryTypes, sdmCredentials, repositoryId, isSystemUser); |
| 116 | + |
| 117 | + // Filter custom properties to only include those that are valid in SDM |
| 118 | + Set<String> customPropertiesInSDM = |
| 119 | + customPropertyDefinitions.values().stream() |
| 120 | + .filter(validSecondaryProperties::contains) |
| 121 | + .collect(Collectors.toSet()); |
| 122 | + |
| 123 | + String upID = context.getUpId(); |
| 124 | + String folderName = upID + "__" + compositionName; |
114 | 125 | // Check if folder exists before trying to create it |
115 | 126 | boolean folderExists = |
116 | 127 | sdmService.getFolderIdByPath(folderName, repositoryId, sdmCredentials, isSystemUser) |
|
0 commit comments