This commit is contained in:
Lucio Lelii 2019-03-13 17:33:24 +00:00
parent 5271923cee
commit f44f3fc0ad
4 changed files with 7 additions and 18 deletions

View File

@ -12,7 +12,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.data.access</groupId>
<artifactId>storagehub</artifactId>
<version>1.0.3-SNAPSHOT</version>
<version>1.0.4-SNAPSHOT</version>
<name>storagehub</name>
<packaging>war</packaging>

View File

@ -94,6 +94,7 @@ public class AccountingHandler {
}
if (version!=null)
accountingNode.setProperty(VERSION_ACCOUNTING, version.getName());
}catch(UnsupportedRepositoryOperationException uropex) {
logger.warn("version cannot be retrieved", uropex);
}

View File

@ -235,23 +235,11 @@ public class ItemsCreator {
if (!node2Item.checkNodeType(destination, FolderItem.class))
throw new InvalidItemException("the destination item is not a folder");
LockManager lockManager = ses.getWorkspace().getLockManager();
lockManager.lock(destination.getPath(), false, true, 0,login);
log.info("session: {}",ses.toString());
Node newNode;
try {
newNode = createFileItemInternally(ses, destination, stream, name, description, login);
ses.save();
} finally {
log.info("session: {}",ses.toString());
try {
lockManager.unlock(destination.getPath());
}catch(LockException e) {
log.warn("error unlocking item id {} with path {}",destination.getIdentifier(), destination.getPath(), e);
}
}
Node newNode = createFileItemInternally(ses, destination, stream, name, description, login);
ses.save();
versionHandler.checkinContentNode(newNode, ses);
log.info("file with id {} correctly created",newNode.getIdentifier());
@ -288,7 +276,7 @@ public class ItemsCreator {
log.debug("item prepared, fulfilling content");
log.debug("content prepared");
Node newNode;
try {
newNode = ses.getNode(org.gcube.common.storagehub.model.Paths.append(org.gcube.common.storagehub.model.Paths.getPath(destinationNode.getPath()), name).toPath());
@ -303,7 +291,6 @@ public class ItemsCreator {
versionHandler.makeVersionableContent(newNode, ses);
accountingHandler.createFolderAddObj(name, item.getClass().getSimpleName(), item.getContent().getMimeType(), ses, newNode, false);
}
return newNode;
}

View File

@ -474,6 +474,7 @@ public class ItemsManager {
for (Version version: jcrVersions) {
boolean currentVersion = ((AbstractFileItem)currentItem).getContent().getStorageId().equals(version.getFrozenNode().getProperty(NodeProperty.STORAGE_ID.toString()).getString());
versions.add(new org.gcube.common.storagehub.model.service.Version(version.getIdentifier(), version.getName(), version.getCreated(), currentVersion));
}
}catch(RepositoryException re ){