Skip to content
Snippets Groups Projects
Commit fa156e7c authored by srosse's avatar srosse
Browse files

OO-1069: optimize PUT of new file, speed up of 25% on large folders

parent b4fc112c
No related branches found
No related tags found
No related merge requests found
......@@ -89,6 +89,8 @@ public interface MetaInfo {
* @return The identity of the initial author.
*/
public Identity getAuthorIdentity();
public boolean hasAuthorIdentity();
/**
* Corresponds to DublinCore:description
......@@ -200,6 +202,9 @@ public interface MetaInfo {
public VFSLeaf getThumbnail(int maxWidth, int maxHeight);
/**
* Thumbnails are cleared and the metadata file is written on the disk
*/
public void clearThumbnails();
/**
......
......@@ -561,13 +561,18 @@ public class MetaInfoFileImpl extends DefaultHandler implements MetaInfo {
* @see org.olat.core.commons.modules.bc.meta.MetaInfo#getAuthorIdentity()
*/
public Identity getAuthorIdentity() {
if (this.authorIdentKey == null) {
if (authorIdentKey == null) {
return null;
} else {
return BaseSecurityManager.getInstance().loadIdentityByKey(this.authorIdentKey);
return BaseSecurityManager.getInstance().loadIdentityByKey(authorIdentKey);
}
}
@Override
public boolean hasAuthorIdentity() {
return (authorIdentKey != null);
}
/**
* @see org.olat.core.commons.modules.bc.meta.MetaInfo#getHTMLFormattedAuthor()
*/
......@@ -808,6 +813,9 @@ public class MetaInfoFileImpl extends DefaultHandler implements MetaInfo {
return new LocalFileImpl(thumbnailInfo.getThumbnailFile());
}
/**
* Thumbnails are cleared and the XML file is written on the disk
*/
@Override
public void clearThumbnails() {
cannotGenerateThumbnail = false;
......
......@@ -208,7 +208,6 @@ public class VFSResourceRoot implements WebResourceRoot {
}
try {
//FileUtils.copy(is, childLeaf.getOutputStream(false));
copyVFS(childLeaf, is);
} catch (QuotaExceededException e) {
throw e;
......@@ -228,10 +227,10 @@ public class VFSResourceRoot implements WebResourceRoot {
if(childLeaf instanceof MetaTagged && identity != null) {
MetaInfo infos = ((MetaTagged)childLeaf).getMetaInfo();
if(infos != null && infos.getAuthorIdentity() == null) {
if(infos != null && !infos.hasAuthorIdentity()) {
infos.setAuthor(identity);
infos.clearThumbnails();
infos.write();
//infos.write(); the clearThumbnails call write()
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment