Skip to content

Commit

Permalink
GeoNetwork 4.4.x minor versions library updates:
Browse files Browse the repository at this point in the history
- Spring Framework: 5.3.40
- Spring Security: 5.8.14
  • Loading branch information
josegar74 committed Oct 17, 2024
1 parent 24067c5 commit 312405e
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ private Path getPath(ServiceContext context, int metadataId, MetadataResourceVis
public String delResources(ServiceContext context, int metadataId) throws Exception {
Path metadataDir = Lib.resource.getMetadataDir(getDataDirectory(context), metadataId);
try {
Log.info(Geonet.RESOURCES, String.format("Deleting all files from metadataId '%d'", metadataId));
IO.deleteFileOrDirectory(metadataDir, true);
return String.format("Metadata '%s' directory removed.", metadataId);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ 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));
folder.deleteTree(true, UnfileObject.DELETE, true);
cmisUtils.invalidateFolderCache(folderKey);

Expand Down Expand Up @@ -509,9 +508,7 @@ 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 @@ -525,8 +522,6 @@ 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 @@ -243,7 +243,6 @@ public String delResources(final ServiceContext context, final int metadataId) t
ListContainerOptions opts = new ListContainerOptions();
opts.prefix(getMetadataDir(context, metadataId) + jCloudConfiguration.getFolderDelimiter()).recursive();

Log.info(Geonet.RESOURCES, String.format("Deleting all files from metadataId '%s'", metadataId));
// Page through the data
String marker = null;
do {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@
import com.amazonaws.services.s3.model.S3ObjectSummary;
import jeeves.server.context.ServiceContext;
import org.fao.geonet.api.exception.ResourceNotFoundException;
import org.fao.geonet.constants.Geonet;
import org.fao.geonet.domain.MetadataResource;
import org.fao.geonet.domain.MetadataResourceContainer;
import org.fao.geonet.domain.MetadataResourceVisibility;
import org.fao.geonet.kernel.setting.SettingManager;
import org.fao.geonet.resources.S3Credentials;
import org.fao.geonet.utils.Log;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.File;
Expand Down Expand Up @@ -188,8 +186,6 @@ public String delResources(final ServiceContext context, final int metadataId) t
try {
final ListObjectsV2Result objects = s3.getClient().listObjectsV2(
s3.getBucket(), getMetadataDir(metadataId));

Log.info(Geonet.RESOURCES, String.format("Deleting all files from metadataId '%s'", metadataId));
for (S3ObjectSummary object: objects.getObjectSummaries()) {
s3.getClient().deleteObject(s3.getBucket(), object.getKey());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ 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 @@ -132,7 +131,6 @@ 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
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1618,8 +1618,8 @@
<jts.version>1.19.0</jts.version>
<pg.version>42.7.3</pg.version>

<spring.version>5.3.33</spring.version>
<spring.security.version>5.8.11</spring.security.version>
<spring.version>5.3.40</spring.version>
<spring.security.version>5.8.14</spring.security.version>
<spring.jpa.version>2.7.18</spring.jpa.version>
<springboot.version>2.7.0</springboot.version>
<springdoc.version>1.8.0</springdoc.version>
Expand Down

0 comments on commit 312405e

Please sign in to comment.