Skip to content

Commit 415b26b

Browse files
author
Dennis Labordus
committed
Optimize code to decrease memory usages.
Signed-off-by: Dennis Labordus <[email protected]>
1 parent 65a48b0 commit 415b26b

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

repository-basex/src/main/java/org/lfenergy/compas/scl/data/repository/CompasSclDataBaseXRepository.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public class CompasSclDataBaseXRepository implements CompasSclDataRepository {
4545

4646
private static final String DECLARE_SCL_NS_URI = "declare namespace scl=\"" + SCL_NS_URI + "\";\n";
4747
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.
4851
private static final String DECLARE_LATEST_VERSION_FUNC =
4952
"declare function local:latest-version($db as xs:string, $id as xs:string)\n" +
5053
" as document-node()? { \n" +
@@ -127,10 +130,7 @@ public List<Item> listVersionsByUUID(SclType type, UUID id) {
127130

128131
@Override
129132
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.
134134
var result = executeQuery(type, DECLARE_SCL_NS_URI +
135135
DECLARE_LATEST_VERSION_FUNC +
136136
format(DECLARE_DB_VARIABLE, type) +
@@ -161,9 +161,7 @@ public String findByUUID(SclType type, UUID id, Version version) {
161161
@Override
162162
public SclMetaInfo findMetaInfoByUUID(SclType type, UUID id) {
163163
// 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.
167165
var metaInfo = executeQuery(type, DECLARE_SCL_NS_URI +
168166
DECLARE_COMPAS_NAMESPACE +
169167
DECLARE_LATEST_VERSION_FUNC +

0 commit comments

Comments
 (0)