This is an automated email from the ASF dual-hosted git repository.
ofuks pushed a commit to branch DLAB-1749
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/DLAB-1749 by this push:
new a42782f [DLAB-1749] Updated ordering
a42782f is described below
commit a42782f0b9959d72a7743c6f712d54f17b0f831a
Author: Oleh Fuks <[email protected]>
AuthorDate: Tue Jul 14 12:26:26 2020 +0300
[DLAB-1749] Updated ordering
---
.../service/impl/LibraryServiceImpl.java | 25 ++++++++--------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git
a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/LibraryServiceImpl.java
b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/LibraryServiceImpl.java
index 70b5b16..ea4aae3 100644
---
a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/LibraryServiceImpl.java
+++
b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/LibraryServiceImpl.java
@@ -56,12 +56,12 @@ import org.apache.commons.lang3.StringUtils;
import org.bson.Document;
import java.util.ArrayList;
-import java.util.Comparator;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
-import java.util.TreeMap;
import java.util.stream.Collectors;
import static com.epam.dlab.backendapi.domain.AuditActionEnum.INSTALL;
@@ -114,30 +114,23 @@ public class LibraryServiceImpl implements LibraryService
{
public List<LibInfoRecord> getLibInfo(String user, String project,
String exploratoryName) {
Document document = libraryDAO.findAllLibraries(user, project,
exploratoryName);
- Map<LibKey, List<LibraryStatus>> model = new
TreeMap<>(Comparator.comparing(LibKey::getName)
- .thenComparing(LibKey::getVersion)
- .thenComparing(LibKey::getGroup));
-
+ Map<LibKey, List<LibraryStatus>> model = new LinkedHashMap<>();
if (document.get(ExploratoryLibDAO.EXPLORATORY_LIBS) != null) {
List<Document> exploratoryLibs = (List<Document>)
document.get(ExploratoryLibDAO.EXPLORATORY_LIBS);
exploratoryLibs.forEach(e ->
populateModel(exploratoryName, e, model, "notebook"));
-
}
-
if (document.get(ExploratoryLibDAO.COMPUTATIONAL_LIBS) != null)
{
Document computationalLibs =
getLibsOfActiveComputationalResources(document);
populateComputational(computationalLibs, model,
"cluster");
}
- List<LibInfoRecord> libInfoRecords = new ArrayList<>();
-
- for (Map.Entry<LibKey, List<LibraryStatus>> entry : model.entrySet()) {
- libInfoRecords.add(new LibInfoRecord(entry.getKey(),
entry.getValue()));
-
- }
+ LinkedList<LibInfoRecord> libInfoRecords = new LinkedList<>();
+ for (Map.Entry<LibKey, List<LibraryStatus>> entry :
model.entrySet()) {
+ libInfoRecords.addFirst(new
LibInfoRecord(entry.getKey(), entry.getValue()));
+ }
- return libInfoRecords;
- }
+ return libInfoRecords;
+ }
@Audit(action = INSTALL, type = COMPUTATIONAL_LIBS)
@Override
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]