Skip to content

Commit b7dd475

Browse files
committed
refactoring
1 parent 573ceb4 commit b7dd475

11 files changed

Lines changed: 633 additions & 317 deletions
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package com.sap.cds.sdm.model;
2+
3+
import com.sap.cds.reflect.CdsEntity;
4+
import java.util.List;
5+
import java.util.Map;
6+
7+
/** Helper class to hold attachment move context information. */
8+
public class AttachmentMoveContext {
9+
private final String objectId;
10+
private final MoveAttachmentsRequest request;
11+
private final List<String> validSecondaryProperties;
12+
private final Map<String, String> entityAnnotations;
13+
private final CdsEntity targetEntity;
14+
private final AttachmentProcessingResults processingResults;
15+
private final List<Map<String, String>> failedAttachments;
16+
17+
public AttachmentMoveContext(
18+
String objectId,
19+
MoveAttachmentsRequest request,
20+
List<String> validSecondaryProperties,
21+
Map<String, String> entityAnnotations,
22+
CdsEntity targetEntity,
23+
AttachmentProcessingResults processingResults,
24+
List<Map<String, String>> failedAttachments) {
25+
this.objectId = objectId;
26+
this.request = request;
27+
this.validSecondaryProperties = validSecondaryProperties;
28+
this.entityAnnotations = entityAnnotations;
29+
this.targetEntity = targetEntity;
30+
this.processingResults = processingResults;
31+
this.failedAttachments = failedAttachments;
32+
}
33+
34+
public String getObjectId() {
35+
return objectId;
36+
}
37+
38+
public MoveAttachmentsRequest getRequest() {
39+
return request;
40+
}
41+
42+
public List<String> getValidSecondaryProperties() {
43+
return validSecondaryProperties;
44+
}
45+
46+
public Map<String, String> getEntityAnnotations() {
47+
return entityAnnotations;
48+
}
49+
50+
public CdsEntity getTargetEntity() {
51+
return targetEntity;
52+
}
53+
54+
public AttachmentProcessingResults getProcessingResults() {
55+
return processingResults;
56+
}
57+
58+
public List<Map<String, String>> getFailedAttachments() {
59+
return failedAttachments;
60+
}
61+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.sap.cds.sdm.model;
2+
3+
import java.util.List;
4+
5+
/** Helper class to hold attachment processing results. */
6+
public class AttachmentProcessingResults {
7+
private final List<String> successfulObjectIds;
8+
private final List<List<String>> movedAttachmentsMetadata;
9+
private final List<CmisDocument> populatedDocuments;
10+
11+
public AttachmentProcessingResults(
12+
List<String> successfulObjectIds,
13+
List<List<String>> movedAttachmentsMetadata,
14+
List<CmisDocument> populatedDocuments) {
15+
this.successfulObjectIds = successfulObjectIds;
16+
this.movedAttachmentsMetadata = movedAttachmentsMetadata;
17+
this.populatedDocuments = populatedDocuments;
18+
}
19+
20+
public List<String> getSuccessfulObjectIds() {
21+
return successfulObjectIds;
22+
}
23+
24+
public List<List<String>> getMovedAttachmentsMetadata() {
25+
return movedAttachmentsMetadata;
26+
}
27+
28+
public List<CmisDocument> getPopulatedDocuments() {
29+
return populatedDocuments;
30+
}
31+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.sap.cds.sdm.model;
2+
3+
import java.util.List;
4+
import java.util.Map;
5+
6+
/** Result class for copyAttachmentsToSDM method. */
7+
public class CopyAttachmentsResult {
8+
private final List<Map<String, String>> attachmentsMetadata;
9+
private final List<CmisDocument> populatedDocuments;
10+
11+
public CopyAttachmentsResult(
12+
List<Map<String, String>> attachmentsMetadata, List<CmisDocument> populatedDocuments) {
13+
this.attachmentsMetadata = attachmentsMetadata;
14+
this.populatedDocuments = populatedDocuments;
15+
}
16+
17+
public List<Map<String, String>> getAttachmentsMetadata() {
18+
return attachmentsMetadata;
19+
}
20+
21+
public List<CmisDocument> getPopulatedDocuments() {
22+
return populatedDocuments;
23+
}
24+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
package com.sap.cds.sdm.model;
2+
3+
import com.sap.cds.sdm.service.handler.AttachmentMoveEventContext;
4+
import java.util.List;
5+
import java.util.Map;
6+
7+
/** Helper class to hold database failure context information. */
8+
public class DatabaseFailureContext {
9+
private final List<String> successfulObjectIds;
10+
private final String sourceFolderId;
11+
private final String targetFolderId;
12+
private final String repositoryId;
13+
private final SDMCredentials sdmCredentials;
14+
private final Boolean isSystemUser;
15+
private final AttachmentMoveEventContext context;
16+
private final List<Map<String, String>> failedAttachments;
17+
18+
public DatabaseFailureContext(
19+
List<String> successfulObjectIds,
20+
String sourceFolderId,
21+
String targetFolderId,
22+
String repositoryId,
23+
SDMCredentials sdmCredentials,
24+
Boolean isSystemUser,
25+
AttachmentMoveEventContext context,
26+
List<Map<String, String>> failedAttachments) {
27+
this.successfulObjectIds = successfulObjectIds;
28+
this.sourceFolderId = sourceFolderId;
29+
this.targetFolderId = targetFolderId;
30+
this.repositoryId = repositoryId;
31+
this.sdmCredentials = sdmCredentials;
32+
this.isSystemUser = isSystemUser;
33+
this.context = context;
34+
this.failedAttachments = failedAttachments;
35+
}
36+
37+
public List<String> getSuccessfulObjectIds() {
38+
return successfulObjectIds;
39+
}
40+
41+
public String getSourceFolderId() {
42+
return sourceFolderId;
43+
}
44+
45+
public String getTargetFolderId() {
46+
return targetFolderId;
47+
}
48+
49+
public String getRepositoryId() {
50+
return repositoryId;
51+
}
52+
53+
public SDMCredentials getSdmCredentials() {
54+
return sdmCredentials;
55+
}
56+
57+
public Boolean getIsSystemUser() {
58+
return isSystemUser;
59+
}
60+
61+
public AttachmentMoveEventContext getContext() {
62+
return context;
63+
}
64+
65+
public List<Map<String, String>> getFailedAttachments() {
66+
return failedAttachments;
67+
}
68+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package com.sap.cds.sdm.model;
2+
3+
import java.util.List;
4+
5+
/** Helper class to encapsulate draft entry creation parameters for move operations. */
6+
public class DraftEntryMoveData {
7+
private final List<List<String>> movedAttachmentsMetadata;
8+
private final List<CmisDocument> populatedDocuments;
9+
private final String parentEntity;
10+
private final String compositionName;
11+
private final String upID;
12+
private final String upIdKey;
13+
private final String repositoryId;
14+
private final String folderId;
15+
16+
public DraftEntryMoveData(
17+
List<List<String>> movedAttachmentsMetadata,
18+
List<CmisDocument> populatedDocuments,
19+
String parentEntity,
20+
String compositionName,
21+
String upID,
22+
String upIdKey,
23+
String repositoryId,
24+
String folderId) {
25+
this.movedAttachmentsMetadata = movedAttachmentsMetadata;
26+
this.populatedDocuments = populatedDocuments;
27+
this.parentEntity = parentEntity;
28+
this.compositionName = compositionName;
29+
this.upID = upID;
30+
this.upIdKey = upIdKey;
31+
this.repositoryId = repositoryId;
32+
this.folderId = folderId;
33+
}
34+
35+
public List<List<String>> getMovedAttachmentsMetadata() {
36+
return movedAttachmentsMetadata;
37+
}
38+
39+
public List<CmisDocument> getPopulatedDocuments() {
40+
return populatedDocuments;
41+
}
42+
43+
public String getParentEntity() {
44+
return parentEntity;
45+
}
46+
47+
public String getCompositionName() {
48+
return compositionName;
49+
}
50+
51+
public String getUpID() {
52+
return upID;
53+
}
54+
55+
public String getUpIdKey() {
56+
return upIdKey;
57+
}
58+
59+
public String getRepositoryId() {
60+
return repositoryId;
61+
}
62+
63+
public String getFolderId() {
64+
return folderId;
65+
}
66+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.sap.cds.sdm.model;
2+
3+
import java.util.List;
4+
import java.util.Map;
5+
6+
/**
7+
* Encapsulates the result of a batch move operation in SDM. Contains metadata for successfully
8+
* moved attachments and tracks failures.
9+
*/
10+
public class MoveAttachmentsResult {
11+
private final List<List<String>> movedAttachmentsMetadata;
12+
private final List<CmisDocument> populatedDocuments;
13+
private final List<Map<String, String>> failedAttachments;
14+
private final List<String> successfulObjectIds;
15+
16+
public MoveAttachmentsResult(
17+
List<List<String>> movedAttachmentsMetadata,
18+
List<CmisDocument> populatedDocuments,
19+
List<Map<String, String>> failedAttachments,
20+
List<String> successfulObjectIds) {
21+
this.movedAttachmentsMetadata = movedAttachmentsMetadata;
22+
this.populatedDocuments = populatedDocuments;
23+
this.failedAttachments = failedAttachments;
24+
this.successfulObjectIds = successfulObjectIds;
25+
}
26+
27+
public List<List<String>> getMovedAttachmentsMetadata() {
28+
return movedAttachmentsMetadata;
29+
}
30+
31+
public List<CmisDocument> getPopulatedDocuments() {
32+
return populatedDocuments;
33+
}
34+
35+
public List<Map<String, String>> getFailedAttachments() {
36+
return failedAttachments;
37+
}
38+
39+
public List<String> getSuccessfulObjectIds() {
40+
return successfulObjectIds;
41+
}
42+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.sap.cds.sdm.model;
2+
3+
import com.sap.cds.reflect.CdsEntity;
4+
import java.util.List;
5+
import java.util.Map;
6+
7+
/** Helper class to hold SDM validation data. */
8+
public class SDMValidationData {
9+
private final List<String> validSecondaryProperties;
10+
private final Map<String, String> entityAnnotations;
11+
private final CdsEntity targetEntity;
12+
13+
public SDMValidationData(
14+
List<String> validSecondaryProperties,
15+
Map<String, String> entityAnnotations,
16+
CdsEntity targetEntity) {
17+
this.validSecondaryProperties = validSecondaryProperties;
18+
this.entityAnnotations = entityAnnotations;
19+
this.targetEntity = targetEntity;
20+
}
21+
22+
public List<String> getValidSecondaryProperties() {
23+
return validSecondaryProperties;
24+
}
25+
26+
public Map<String, String> getEntityAnnotations() {
27+
return entityAnnotations;
28+
}
29+
30+
public CdsEntity getTargetEntity() {
31+
return targetEntity;
32+
}
33+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.sap.cds.sdm.model;
2+
3+
/** Helper class to hold target folder information. */
4+
public class TargetFolderInfo {
5+
private final String targetFolderId;
6+
private final Boolean targetFolderExists;
7+
8+
public TargetFolderInfo(String targetFolderId, Boolean targetFolderExists) {
9+
this.targetFolderId = targetFolderId;
10+
this.targetFolderExists = targetFolderExists;
11+
}
12+
13+
public String getTargetFolderId() {
14+
return targetFolderId;
15+
}
16+
17+
public Boolean getTargetFolderExists() {
18+
return targetFolderExists;
19+
}
20+
}

0 commit comments

Comments
 (0)