Skip to content

Commit b372cd9

Browse files
committed
Merge branch '5.9.0'
2 parents feaa85a + e516932 commit b372cd9

File tree

9 files changed

+166
-116
lines changed

9 files changed

+166
-116
lines changed

pom.xml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>org.jbei</groupId>
55
<artifactId>ice</artifactId>
66
<packaging>war</packaging>
7-
<version>5.8.3</version>
7+
<version>5.9.0</version>
88
<name>ice</name>
99
<description>Inventory of Composable Elements (ICE) for Synthetic Biology</description>
1010
<repositories>
@@ -18,33 +18,33 @@
1818
<dependency>
1919
<groupId>org.glassfish.jersey.containers</groupId>
2020
<artifactId>jersey-container-servlet-core</artifactId>
21-
<version>2.30.1</version>
21+
<version>2.32</version>
2222
</dependency>
2323
<dependency>
2424
<groupId>org.glassfish.jersey.media</groupId>
2525
<artifactId>jersey-media-multipart</artifactId>
26-
<version>2.30.1</version>
26+
<version>2.32</version>
2727
</dependency>
2828
<dependency>
2929
<groupId>org.glassfish.jersey.inject</groupId>
3030
<artifactId>jersey-hk2</artifactId>
31-
<version>2.30.1</version>
31+
<version>2.32</version>
3232
</dependency>
3333
<dependency>
3434
<groupId>javax.servlet</groupId>
3535
<artifactId>javax.servlet-api</artifactId>
36-
<version>3.1.0</version>
36+
<version>4.0.1</version>
3737
<scope>provided</scope>
3838
</dependency>
3939
<dependency>
4040
<groupId>org.postgresql</groupId>
4141
<artifactId>postgresql</artifactId>
42-
<version>42.2.6</version>
42+
<version>42.2.16</version>
4343
</dependency>
4444
<dependency>
4545
<groupId>com.h2database</groupId>
4646
<artifactId>h2</artifactId>
47-
<version>1.4.199</version>
47+
<version>1.4.200</version>
4848
</dependency>
4949
<dependency>
5050
<groupId>junit</groupId>
@@ -55,18 +55,18 @@
5555
<dependency>
5656
<groupId>com.google.code.gson</groupId>
5757
<artifactId>gson</artifactId>
58-
<version>2.8.5</version>
58+
<version>2.8.6</version>
5959
<scope>compile</scope>
6060
</dependency>
6161
<dependency>
6262
<groupId>org.hibernate</groupId>
6363
<artifactId>hibernate-core</artifactId>
64-
<version>5.4.14.Final</version>
64+
<version>5.4.22.Final</version>
6565
</dependency>
6666
<dependency>
6767
<groupId>org.hibernate</groupId>
6868
<artifactId>hibernate-search-orm</artifactId>
69-
<version>5.11.5.Final</version>
69+
<version>5.11.8.Final</version>
7070
</dependency>
7171
<dependency>
7272
<groupId>javax.validation</groupId>
@@ -86,7 +86,7 @@
8686
<dependency>
8787
<groupId>org.hibernate</groupId>
8888
<artifactId>hibernate-c3p0</artifactId>
89-
<version>5.4.14.Final</version>
89+
<version>5.4.22.Final</version>
9090
</dependency>
9191
<dependency>
9292
<groupId>commons-io</groupId>
@@ -101,7 +101,7 @@
101101
<dependency>
102102
<groupId>com.opencsv</groupId>
103103
<artifactId>opencsv</artifactId>
104-
<version>5.1</version>
104+
<version>5.2</version>
105105
</dependency>
106106
<dependency>
107107
<groupId>ch.qos.logback</groupId>
@@ -150,7 +150,7 @@
150150
<dependency>
151151
<groupId>io.undertow</groupId>
152152
<artifactId>undertow-servlet</artifactId>
153-
<version>1.4.18.Final</version>
153+
<version>2.2.0.Final</version>
154154
</dependency>
155155
</dependencies>
156156
<build>

src/main/java/org/jbei/ice/lib/config/SiteSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
public class SiteSettings implements IDataTransferModel {
1111

12-
private String version = "5.8.3";
12+
private String version = "5.9.0";
1313
private String assetName;
1414
private boolean hasLogo;
1515
private boolean hasLoginMessage;

src/main/java/org/jbei/ice/lib/dto/folder/FolderDetails.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
package org.jbei.ice.lib.dto.folder;
22

33
import org.jbei.ice.lib.account.AccountTransfer;
4+
import org.jbei.ice.lib.dto.entry.EntryType;
45
import org.jbei.ice.lib.dto.sample.SampleRequest;
56
import org.jbei.ice.lib.dto.web.RegistryPartner;
67
import org.jbei.ice.lib.folder.AbstractFolder;
78

9+
import java.util.ArrayList;
10+
import java.util.List;
11+
812
/**
913
* Folder Transfer Object
1014
*
@@ -23,14 +27,17 @@ public class FolderDetails extends AbstractFolder {
2327
private FolderDetails parent;
2428
private RegistryPartner remotePartner;
2529
private SampleRequest sampleRequest;
30+
private final List<EntryType> contentTypes; // types of entries contained in this folder
2631

2732
public FolderDetails() {
2833
super();
34+
this.contentTypes = new ArrayList<>();
2935
}
3036

3137
public FolderDetails(long id, String name) {
3238
super(id);
3339
this.folderName = name;
40+
this.contentTypes = new ArrayList<>();
3441
}
3542

3643
public String getName() {
@@ -123,4 +130,8 @@ public SampleRequest getSampleRequest() {
123130
public void setSampleRequest(SampleRequest sampleRequest) {
124131
this.sampleRequest = sampleRequest;
125132
}
133+
134+
public List<EntryType> getContentTypes() {
135+
return this.contentTypes;
136+
}
126137
}

src/main/java/org/jbei/ice/lib/folder/UserFolders.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.jbei.ice.lib.folder;
22

3+
import org.jbei.ice.lib.dto.entry.EntryType;
34
import org.jbei.ice.lib.dto.folder.FolderAuthorization;
45
import org.jbei.ice.lib.dto.folder.FolderDetails;
56
import org.jbei.ice.lib.dto.folder.FolderType;
@@ -43,6 +44,14 @@ public FolderDetails get(long folderId) {
4344

4445
authorization.expectRead(this.userId, folder);
4546
FolderDetails folderDetails = folder.toDataTransferObject();
47+
List<String> types = dao.getContentTypes(folderId);
48+
if (!types.isEmpty()) {
49+
for (String type : types) {
50+
EntryType entryType = EntryType.nameToType(type);
51+
if (entryType != null)
52+
folderDetails.getContentTypes().add(entryType);
53+
}
54+
}
4655

4756
Account owner = accountDAO.getByEmail(folder.getOwnerEmail());
4857
if (owner != null) {

src/main/java/org/jbei/ice/storage/hibernate/dao/FolderDAO.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,4 +388,25 @@ public long getEntryCountByFolderType(FolderType type, String filter) {
388388
throw new DAOException(e);
389389
}
390390
}
391+
392+
/**
393+
* Retrieves distinct list of types for the entries contained in the folder
394+
*
395+
* @param folderId unique identifier for folder whose content types are being retrieved
396+
* @return list of content types. e.g. if a folder contains 345 Strains, and 23 plasmids, this will return
397+
* [STRAIN, PLASMID]. Any empty folder will result in a return of an empty list
398+
*/
399+
public List<String> getContentTypes(long folderId) {
400+
try {
401+
CriteriaQuery<String> query = getBuilder().createQuery(String.class);
402+
Root<Folder> from = query.from(Folder.class);
403+
Join<Folder, Entry> entry = from.join("contents");
404+
query.select(entry.get("recordType")).distinct(true);
405+
query.where(getBuilder().equal(from.get("id"), folderId));
406+
return currentSession().createQuery(query).list();
407+
} catch (HibernateException e) {
408+
Logger.error(e);
409+
throw new DAOException(e);
410+
}
411+
}
391412
}

src/main/webapp/scripts/controllers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ iceControllers.controller('ActionMenuController', function ($stateParams, $uibMo
3131
}
3232

3333
var i = $scope.selectedFolders.indexOf(folder);
34-
if (i == -1) {
34+
if (i === -1) {
3535
$scope.selectedFolders.push(folder);
3636
} else {
3737
$scope.selectedFolders.splice(i, 1);
@@ -61,7 +61,7 @@ iceControllers.controller('ActionMenuController', function ($stateParams, $uibMo
6161
}
6262

6363
var entrySelection = {
64-
all: Selection.getSelection().type == 'ALL',
64+
all: Selection.getSelection().type === 'ALL',
6565
folderId: folderSelected,
6666
selectionType: selectionType,
6767
entryType: Selection.getSelection().type,

0 commit comments

Comments
 (0)