Alfresco REST Core API 通过 node-uuid 检索版本
Alfresco REST Core API retrive Version by node-uuid
我正在开发基于 REST API 的 Alfresco 客户端。
但我还没有找到允许使用其 node-uuid 检索版本的方法
不知道其父 UUID
[ base url: /alfresco/api/-default-/public/alfresco/versions/1 , api version: 1 ]
低于 Rest api 在不知道父 uuid 的情况下检索文件的版本历史记录。
http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/{{fileId}}/versions
这将提供 1.0 版的确切信息,同样您可以检索所有版本。
http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/695b8a62-b566-4d49-9a4f-8f509f8cae59/versions/1.0
{
"list": {
"pagination": {
"count": 2,
"hasMoreItems": false,
"totalItems": 2,
"skipCount": 0,
"maxItems": 100
},
"entries": [
{
"entry": {
"isFolder": false,
"isFile": true,
"modifiedAt": "2021-02-26T14:56:05.677+0000",
"modifiedByUser": {
"id": "admin",
"displayName": "Administrator"
},
"name": "CustomPage.PNG",
"id": "2.0",
"nodeType": "cm:content",
"content": {
"mimeType": "image/png",
"mimeTypeName": "PNG Image",
"sizeInBytes": 39779,
"encoding": "UTF-8"
}
}
},
{
"entry": {
"isFolder": false,
"isFile": true,
"modifiedAt": "2021-02-26T14:52:31.315+0000",
"modifiedByUser": {
"id": "admin",
"displayName": "Administrator"
},
"name": "CustomPage.PNG",
"id": "1.0",
"nodeType": "cm:content",
"content": {
"mimeType": "image/png",
"mimeTypeName": "PNG Image",
"sizeInBytes": 39779,
"encoding": "UTF-8"
}
}
}
]
}
}
下面的代码Return版本历史作为版本节点信息的分页列表。
@Override
public CollectionWithPagingInfo<Node> readAll(String nodeId, Parameters parameters)
{
NodeRef nodeRef = nodes.validateOrLookupNode(nodeId, null);
VersionHistory vh = versionService.getVersionHistory(nodeRef);
Map<String, UserInfo> mapUserInfo = new HashMap<>(10);
List<String> includeParam = parameters.getInclude();
List<Node> collection = null;
if (vh != null)
{
collection = new ArrayList<>(vh.getAllVersions().size());
for (Version v : vh.getAllVersions())
{
Node node = nodes.getFolderOrDocument(v.getFrozenStateNodeRef(), null, null, includeParam, mapUserInfo);
mapVersionInfo(v, node);
collection.add(node);
}
}
return listPage(collection, parameters.getPaging());
}
我正在开发基于 REST API 的 Alfresco 客户端。
但我还没有找到允许使用其 node-uuid 检索版本的方法 不知道其父 UUID
[ base url: /alfresco/api/-default-/public/alfresco/versions/1 , api version: 1 ]
低于 Rest api 在不知道父 uuid 的情况下检索文件的版本历史记录。
http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/{{fileId}}/versions
这将提供 1.0 版的确切信息,同样您可以检索所有版本。 http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/695b8a62-b566-4d49-9a4f-8f509f8cae59/versions/1.0
{
"list": {
"pagination": {
"count": 2,
"hasMoreItems": false,
"totalItems": 2,
"skipCount": 0,
"maxItems": 100
},
"entries": [
{
"entry": {
"isFolder": false,
"isFile": true,
"modifiedAt": "2021-02-26T14:56:05.677+0000",
"modifiedByUser": {
"id": "admin",
"displayName": "Administrator"
},
"name": "CustomPage.PNG",
"id": "2.0",
"nodeType": "cm:content",
"content": {
"mimeType": "image/png",
"mimeTypeName": "PNG Image",
"sizeInBytes": 39779,
"encoding": "UTF-8"
}
}
},
{
"entry": {
"isFolder": false,
"isFile": true,
"modifiedAt": "2021-02-26T14:52:31.315+0000",
"modifiedByUser": {
"id": "admin",
"displayName": "Administrator"
},
"name": "CustomPage.PNG",
"id": "1.0",
"nodeType": "cm:content",
"content": {
"mimeType": "image/png",
"mimeTypeName": "PNG Image",
"sizeInBytes": 39779,
"encoding": "UTF-8"
}
}
}
]
}
}
下面的代码Return版本历史作为版本节点信息的分页列表。
@Override
public CollectionWithPagingInfo<Node> readAll(String nodeId, Parameters parameters)
{
NodeRef nodeRef = nodes.validateOrLookupNode(nodeId, null);
VersionHistory vh = versionService.getVersionHistory(nodeRef);
Map<String, UserInfo> mapUserInfo = new HashMap<>(10);
List<String> includeParam = parameters.getInclude();
List<Node> collection = null;
if (vh != null)
{
collection = new ArrayList<>(vh.getAllVersions().size());
for (Version v : vh.getAllVersions())
{
Node node = nodes.getFolderOrDocument(v.getFrozenStateNodeRef(), null, null, includeParam, mapUserInfo);
mapVersionInfo(v, node);
collection.add(node);
}
}
return listPage(collection, parameters.getPaging());
}