Added session in all methods
This commit is contained in:
parent
1199570e57
commit
3bfbe5ed9b
|
@ -88,18 +88,25 @@ public class CatalogueStorageHubManagement {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void internalAddRevisionID(String resourceID, String revisionID) throws Exception {
|
protected void internalAddRevisionID(String resourceID, String revisionID) throws Exception {
|
||||||
FileContainer fileContainer = storageHubManagement.getPersistedFile();
|
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||||
if(fileContainer != null) {
|
Secret secret = Constants.getCatalogueSecret();
|
||||||
Metadata metadata = fileContainer.get().getMetadata();
|
try {
|
||||||
Map<String,Object> map = metadata.getMap();
|
secretManager.startSession(secret);
|
||||||
map.put(CatalogueMetadata.CATALOGUE_RESOURCE_ID, resourceID);
|
FileContainer fileContainer = storageHubManagement.getPersistedFile();
|
||||||
map.put(CatalogueMetadata.CATALOGUE_RESOURCE_REVISION_ID, revisionID);
|
if(fileContainer != null) {
|
||||||
metadata.setMap(map);
|
Metadata metadata = fileContainer.get().getMetadata();
|
||||||
fileContainer.setMetadata(metadata);
|
Map<String,Object> map = metadata.getMap();
|
||||||
} else {
|
map.put(CatalogueMetadata.CATALOGUE_RESOURCE_ID, resourceID);
|
||||||
logger.warn(
|
map.put(CatalogueMetadata.CATALOGUE_RESOURCE_REVISION_ID, revisionID);
|
||||||
"Unable to set revision id {} to the file of resource with id {} because the file was NOT found on storage-hub. This could be related to an item not created via gCat. Skipping it.",
|
metadata.setMap(map);
|
||||||
revisionID, resourceID);
|
fileContainer.setMetadata(metadata);
|
||||||
|
} else {
|
||||||
|
logger.warn(
|
||||||
|
"Unable to set revision id {} to the file of resource with id {} because the file was NOT found on storage-hub. This could be related to an item not created via gCat. Skipping it.",
|
||||||
|
revisionID, resourceID);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
secretManager.endSession();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,8 +146,15 @@ public class CatalogueStorageHubManagement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileContainer getPersistedFile() {
|
public FileContainer getPersistedFile() throws Exception {
|
||||||
return storageHubManagement.getPersistedFile();
|
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||||
|
Secret secret = Constants.getCatalogueSecret();
|
||||||
|
try {
|
||||||
|
secretManager.startSession(secret);
|
||||||
|
return storageHubManagement.getPersistedFile();
|
||||||
|
} finally {
|
||||||
|
secretManager.endSession();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue