ACS-2391: ACS-2391: StorageObjectProps - add version content specific endpoints (#881)

- fix blatant typo - thanks MP for detailed verification and feedback
- Note: e2e API sanity check will be added as part of ACS-2406
This commit is contained in:
montgolfiere
2022-01-11 10:24:20 +00:00
committed by GitHub
parent 49d7f5c2b1
commit cec820bc88

View File

@@ -86,15 +86,9 @@ public class NodeVersionsStorageInfoRelation implements RelationshipResourceActi
{ {
String contentPropQNameId = parameters.getRelationship2Id(); String contentPropQNameId = parameters.getRelationship2Id();
Version version = nodeVersions.findVersion(nodeId, versionId); NodeRef versionNodeRef = findVersionNodeRef(nodeId, versionId);
if (version != null) return storageInformation.getStorageInfo(versionNodeRef, contentPropQNameId, parameters);
{
NodeRef versionNodeRef = version.getFrozenStateNodeRef();
return storageInformation.getStorageInfo(versionNodeRef, contentPropQNameId, parameters);
}
throw new EntityNotFoundException(nodeId+"-"+versionId);
} }
@Experimental @Experimental
@@ -109,23 +103,17 @@ public class NodeVersionsStorageInfoRelation implements RelationshipResourceActi
{ {
String contentPropQNameId = parameters.getRelationship2Id(); String contentPropQNameId = parameters.getRelationship2Id();
Version version = nodeVersions.findVersion(nodeId, versionId); NodeRef versionNodeRef = findVersionNodeRef(nodeId, versionId);
if (version != null) final boolean result = storageInformation.requestArchiveContent(versionNodeRef, contentPropQNameId, archiveContentRequest);
if (result)
{ {
NodeRef versionNodeRef = version.getFrozenStateNodeRef(); withResponse.setStatus(HttpServletResponse.SC_OK);
final boolean result = storageInformation.requestArchiveContent(versionNodeRef, contentPropQNameId, archiveContentRequest); }
if (result) else
{ {
withResponse.setStatus(HttpServletResponse.SC_OK); withResponse.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED);
}
else
{
withResponse.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED);
}
} }
throw new EntityNotFoundException(nodeId+"-"+versionId);
} }
@Experimental @Experimental
@@ -140,22 +128,26 @@ public class NodeVersionsStorageInfoRelation implements RelationshipResourceActi
{ {
String contentPropQNameId = parameters.getRelationship2Id(); String contentPropQNameId = parameters.getRelationship2Id();
Version version = nodeVersions.findVersion(nodeId, versionId); NodeRef versionNodeRef = findVersionNodeRef(nodeId, versionId);
if (version != null) final boolean result = storageInformation.requestRestoreContentFromArchive(versionNodeRef, contentPropQNameId, restoreArchivedContentRequest);
if (result)
{ {
NodeRef versionNodeRef = version.getFrozenStateNodeRef(); withResponse.setStatus(HttpServletResponse.SC_ACCEPTED);
final boolean result = storageInformation.requestRestoreContentFromArchive(versionNodeRef, contentPropQNameId, restoreArchivedContentRequest);
if (result)
{
withResponse.setStatus(HttpServletResponse.SC_ACCEPTED);
}
else
{
withResponse.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED);
}
} }
else
{
withResponse.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED);
}
}
throw new EntityNotFoundException(nodeId+"-"+versionId); private NodeRef findVersionNodeRef(String nodeId, String versionId)
{
Version version = nodeVersions.findVersion(nodeId, versionId);
if (version == null)
{
throw new EntityNotFoundException(nodeId+"-"+versionId);
}
return version.getFrozenStateNodeRef();
} }
} }