Improving lib
This commit is contained in:
parent
525dfddd52
commit
3b832173e9
|
@ -142,17 +142,14 @@ public class StorageHubManagement {
|
|||
return destinationFolder;
|
||||
}
|
||||
|
||||
protected boolean isPersistedFile(FileContainer fileContainer, String filename) {
|
||||
protected boolean checkMetadata(FileContainer fileContainer) {
|
||||
// Checking if the file is already a persisted file of the workspace
|
||||
if(fileContainer.get().getName().startsWith(filename)) {
|
||||
if(metadataMatcher != null) {
|
||||
Metadata metadata = fileContainer.get().getMetadata();
|
||||
return metadataMatcher.check(metadata);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
if(metadataMatcher != null) {
|
||||
Metadata metadata = fileContainer.get().getMetadata();
|
||||
return metadataMatcher.check(metadata);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void logItem(ItemContainer<? extends Item> itemContainer) {
|
||||
|
@ -196,9 +193,12 @@ public class StorageHubManagement {
|
|||
List<ItemContainer<? extends Item>> itemContainers = listResolver.withMetadata().getContainers();
|
||||
for(ItemContainer<? extends Item> itemContainer : itemContainers) {
|
||||
if(itemContainer.getType()==ContainerType.FILE) {
|
||||
if(isPersistedFile((FileContainer) itemContainer, filename)) {
|
||||
if(checkMetadata((FileContainer) itemContainer)) {
|
||||
this.persitedFile = (FileContainer) itemContainer;
|
||||
return this.persitedFile;
|
||||
}else {
|
||||
logger.warn("The file with mimetype {} and name {} was found in the expected folder (i.e. id:{}, path:{}) but the check on metadata failed. The file is not the one expected.",
|
||||
mimeType, filename, destinationFolder.getId(), destinationFolder.get().getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue