Reorganized code
This commit is contained in:
parent
3b9c0c8df8
commit
38c684bb6a
|
@ -4,8 +4,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
|
||||
## [v3.4.0-SNAPSHOT]
|
||||
|
||||
- To ensure persistence of file already stored in the workspace is now used the facility provided by storage-hub #27736
|
||||
|
||||
- The persistence of file already stored in the workspace can be ensured by using the copy provided by storage-hub #27736
|
||||
- The removal of a file persited is resolved using the public link #27952
|
||||
|
||||
## [v3.3.0]
|
||||
|
||||
|
|
|
@ -194,9 +194,17 @@ public class StorageHubManagement {
|
|||
encId = encId.replace(enchriptedPrefix, "");
|
||||
String decodeURL = new String(Base64.getUrlDecoder().decode(encId));
|
||||
String decodedId = StringEncrypter.getEncrypter().decrypt(decodeURL);
|
||||
logger.trace("From public link URL {} has been extraced the file id={}", url.toString(), decodedId);
|
||||
return decodedId;
|
||||
}
|
||||
|
||||
public FileContainer getFileContainer(URL shubPublicLink) throws Exception {
|
||||
String id = getFileId(shubPublicLink);
|
||||
OpenResolver openResolver = storageHubClient.open(id);
|
||||
FileContainer fileContainer = openResolver.asFile();
|
||||
return fileContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method can be used only if the caller has the right to access
|
||||
* the file already stored in the workspace
|
||||
|
@ -222,13 +230,6 @@ public class StorageHubManagement {
|
|||
logger.debug("File persistence has been ensured. The file is available at {}", finalURL);
|
||||
return finalURL;
|
||||
}
|
||||
|
||||
public FileContainer getFileContainer(URL shubPublicLink) throws Exception {
|
||||
String id = getFileId(shubPublicLink);
|
||||
OpenResolver openResolver = storageHubClient.open(id);
|
||||
FileContainer fileContainer = openResolver.asFile();
|
||||
return fileContainer;
|
||||
}
|
||||
|
||||
public URL persistFile(InputStream inputStream, String fileName, String mimeType)
|
||||
throws Exception {
|
||||
|
@ -242,7 +243,7 @@ public class StorageHubManagement {
|
|||
}
|
||||
|
||||
URL finalURL = persitedFile.getPublicLink();
|
||||
logger.debug("File persistence has been ensured. The file is available at {}", finalURL);
|
||||
logger.debug("File persistence has been ensured (id={}. The file is available at {}", persitedFile.getId(), finalURL);
|
||||
return finalURL;
|
||||
}
|
||||
|
||||
|
@ -278,7 +279,7 @@ public class StorageHubManagement {
|
|||
public void removePersistedFile(String filename, String mimeType) throws Exception {
|
||||
persitedFile = getPersistedFile(filename, mimeType);
|
||||
if(persitedFile !=null) {
|
||||
logger.info("Persited file with mimetype {} and name {} was found. Goign to remove it.", mimeType, filename);
|
||||
logger.info("Persited file with mimetype {} and name {} was found (id={}). Goign to remove it.", mimeType, filename, persitedFile.getId());
|
||||
persitedFile.delete();
|
||||
}
|
||||
}
|
||||
|
@ -291,7 +292,7 @@ public class StorageHubManagement {
|
|||
public void removePersistedFile(URL shubPublicLink) throws Exception {
|
||||
persitedFile = getFileContainer(shubPublicLink);
|
||||
if(persitedFile !=null) {
|
||||
logger.info("Persited file available at {} was found. Goign to remove it.", shubPublicLink);
|
||||
logger.info("Persited file available at {} was found (id={}). Goign to remove it.", shubPublicLink, persitedFile.getId());
|
||||
persitedFile.delete();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue