@@ -45,6 +45,9 @@ public class CompasSclDataBaseXRepository implements CompasSclDataRepository {
45
45
46
46
private static final String DECLARE_SCL_NS_URI = "declare namespace scl=\" " + SCL_NS_URI + "\" ;\n " ;
47
47
private static final String DECLARE_COMPAS_NAMESPACE = "declare namespace compas=\" " + COMPAS_EXTENSION_NS_URI + "\" ;\n " ;
48
+ // This find method always searches for the latest version.
49
+ // Retrieve all versions using db:list-details function.
50
+ // Sort the result descending, this way the last version is the first.
48
51
private static final String DECLARE_LATEST_VERSION_FUNC =
49
52
"declare function local:latest-version($db as xs:string, $id as xs:string)\n " +
50
53
" as document-node()? { \n " +
@@ -127,10 +130,7 @@ public List<Item> listVersionsByUUID(SclType type, UUID id) {
127
130
128
131
@ Override
129
132
public String findByUUID (SclType type , UUID id ) {
130
- // This find method always searches for the latest version.
131
- // Retrieve all versions using db:list-details function.
132
- // Sort the result descending, this way the last version is the first.
133
- // Use this path to retrieve the document with the doc function.
133
+ // This find method always searches for the latest version and returns this.
134
134
var result = executeQuery (type , DECLARE_SCL_NS_URI +
135
135
DECLARE_LATEST_VERSION_FUNC +
136
136
format (DECLARE_DB_VARIABLE , type ) +
@@ -161,9 +161,7 @@ public String findByUUID(SclType type, UUID id, Version version) {
161
161
@ Override
162
162
public SclMetaInfo findMetaInfoByUUID (SclType type , UUID id ) {
163
163
// This find method always searches for the latest version.
164
- // Retrieve all versions using db:list-details function.
165
- // Sort the result descending, this way the last version is the first.
166
- // Use this path to retrieve the document with the doc function.
164
+ // Extracts the needed information from the document and returns this.
167
165
var metaInfo = executeQuery (type , DECLARE_SCL_NS_URI +
168
166
DECLARE_COMPAS_NAMESPACE +
169
167
DECLARE_LATEST_VERSION_FUNC +
0 commit comments