Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add info logs to make transaction of working copy merge more traceable #8178

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ public String delResources(final ServiceContext context, final int metadataId) t
folderKey = getMetadataDir(context, metadataId);
final Folder folder = cmisUtils.getFolderCache(folderKey, true);

Log.info(Geonet.RESOURCES, String.format("Deleting the folder of '%s' and the files within the folder", folderKey));
ianwallen marked this conversation as resolved.
Show resolved Hide resolved
folder.deleteTree(true, UnfileObject.DELETE, true);
cmisUtils.invalidateFolderCache(folderKey);

Expand Down Expand Up @@ -508,7 +509,9 @@ public MetadataResourceContainer getResourceContainerDescription(final ServiceCo
@Override
public void copyResources(ServiceContext context, String sourceUuid, String targetUuid, MetadataResourceVisibility metadataResourceVisibility, boolean sourceApproved, boolean targetApproved) throws Exception {
final int sourceMetadataId = canEdit(context, sourceUuid, metadataResourceVisibility, sourceApproved);
final int targetMetadataId = canEdit(context, sourceUuid, metadataResourceVisibility, targetApproved);
final String sourceResourceTypeDir = getMetadataDir(context, sourceMetadataId) + cmisConfiguration.getFolderDelimiter() + metadataResourceVisibility.toString();
final String targetResourceTypeDir = getMetadataDir(context, targetMetadataId) + cmisConfiguration.getFolderDelimiter() + metadataResourceVisibility.toString();
try {
Folder sourceParentFolder = cmisUtils.getFolderCache(sourceResourceTypeDir, true);

Expand All @@ -522,6 +525,8 @@ public void copyResources(ServiceContext context, String sourceUuid, String targ
for (Map.Entry<String, Document> sourceEntry : sourceDocumentMap.entrySet()) {
Document sourceDocument = sourceEntry.getValue();


Log.info(Geonet.RESOURCES, String.format("Copying %s to %s" , sourceResourceTypeDir+cmisConfiguration.getFolderDelimiter()+sourceDocument.getName(), targetResourceTypeDir));
// Get cmis properties from the source document
Map<String, Object> sourceProperties = getProperties(sourceDocument);
putResource(context, targetUuid, sourceDocument.getName(), sourceDocument.getContentStream().getStream(), null, metadataResourceVisibility, targetApproved, sourceProperties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public AbstractMetadata replaceMetadataWithDraft(AbstractMetadata md) {
* @return
*/
public AbstractMetadata replaceMetadataWithDraft(AbstractMetadata md, AbstractMetadata draft) {
Log.info(Geonet.DATA_MANAGER, String.format("Replacing metadata approved record (%d) with draft record (%d)", md.getId(), draft.getId()));
Log.trace(Geonet.DATA_MANAGER, "Found approved record with id " + md.getId());
Log.trace(Geonet.DATA_MANAGER, "Found draft with id " + draft.getId());
// Reassign metadata validations
Expand Down Expand Up @@ -131,6 +132,7 @@ public AbstractMetadata replaceMetadataWithDraft(AbstractMetadata md, AbstractMe
}

// Reassign file uploads
Log.info(Geonet.DATA_MANAGER, String.format("Copying draft record '%d' resources to approved record '%d'", draft.getId(), md.getId()));
draftMetadataUtils.replaceFiles(draft, md);

metadataFileUploadRepository.deleteAll(MetadataFileUploadSpecs.hasMetadataId(md.getId()));
Expand Down