Skip to content

Commit

Permalink
Merge branch '5.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
hplahar committed Jan 27, 2021
2 parents feaa85a + e516932 commit b372cd9
Show file tree
Hide file tree
Showing 9 changed files with 166 additions and 116 deletions.
26 changes: 13 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>org.jbei</groupId>
<artifactId>ice</artifactId>
<packaging>war</packaging>
<version>5.8.3</version>
<version>5.9.0</version>
<name>ice</name>
<description>Inventory of Composable Elements (ICE) for Synthetic Biology</description>
<repositories>
Expand All @@ -18,33 +18,33 @@
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>2.30.1</version>
<version>2.32</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>2.30.1</version>
<version>2.32</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>2.30.1</version>
<version>2.32</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.6</version>
<version>42.2.16</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.199</version>
<version>1.4.200</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand All @@ -55,18 +55,18 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
<version>2.8.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.14.Final</version>
<version>5.4.22.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-orm</artifactId>
<version>5.11.5.Final</version>
<version>5.11.8.Final</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
Expand All @@ -86,7 +86,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>5.4.14.Final</version>
<version>5.4.22.Final</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Expand All @@ -101,7 +101,7 @@
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>5.1</version>
<version>5.2</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
Expand Down Expand Up @@ -150,7 +150,7 @@
<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-servlet</artifactId>
<version>1.4.18.Final</version>
<version>2.2.0.Final</version>
</dependency>
</dependencies>
<build>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jbei/ice/lib/config/SiteSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
public class SiteSettings implements IDataTransferModel {

private String version = "5.8.3";
private String version = "5.9.0";
private String assetName;
private boolean hasLogo;
private boolean hasLoginMessage;
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/org/jbei/ice/lib/dto/folder/FolderDetails.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package org.jbei.ice.lib.dto.folder;

import org.jbei.ice.lib.account.AccountTransfer;
import org.jbei.ice.lib.dto.entry.EntryType;
import org.jbei.ice.lib.dto.sample.SampleRequest;
import org.jbei.ice.lib.dto.web.RegistryPartner;
import org.jbei.ice.lib.folder.AbstractFolder;

import java.util.ArrayList;
import java.util.List;

/**
* Folder Transfer Object
*
Expand All @@ -23,14 +27,17 @@ public class FolderDetails extends AbstractFolder {
private FolderDetails parent;
private RegistryPartner remotePartner;
private SampleRequest sampleRequest;
private final List<EntryType> contentTypes; // types of entries contained in this folder

public FolderDetails() {
super();
this.contentTypes = new ArrayList<>();
}

public FolderDetails(long id, String name) {
super(id);
this.folderName = name;
this.contentTypes = new ArrayList<>();
}

public String getName() {
Expand Down Expand Up @@ -123,4 +130,8 @@ public SampleRequest getSampleRequest() {
public void setSampleRequest(SampleRequest sampleRequest) {
this.sampleRequest = sampleRequest;
}

public List<EntryType> getContentTypes() {
return this.contentTypes;
}
}
9 changes: 9 additions & 0 deletions src/main/java/org/jbei/ice/lib/folder/UserFolders.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.jbei.ice.lib.folder;

import org.jbei.ice.lib.dto.entry.EntryType;
import org.jbei.ice.lib.dto.folder.FolderAuthorization;
import org.jbei.ice.lib.dto.folder.FolderDetails;
import org.jbei.ice.lib.dto.folder.FolderType;
Expand Down Expand Up @@ -43,6 +44,14 @@ public FolderDetails get(long folderId) {

authorization.expectRead(this.userId, folder);
FolderDetails folderDetails = folder.toDataTransferObject();
List<String> types = dao.getContentTypes(folderId);
if (!types.isEmpty()) {
for (String type : types) {
EntryType entryType = EntryType.nameToType(type);
if (entryType != null)
folderDetails.getContentTypes().add(entryType);
}
}

Account owner = accountDAO.getByEmail(folder.getOwnerEmail());
if (owner != null) {
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/org/jbei/ice/storage/hibernate/dao/FolderDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -388,4 +388,25 @@ public long getEntryCountByFolderType(FolderType type, String filter) {
throw new DAOException(e);
}
}

/**
* Retrieves distinct list of types for the entries contained in the folder
*
* @param folderId unique identifier for folder whose content types are being retrieved
* @return list of content types. e.g. if a folder contains 345 Strains, and 23 plasmids, this will return
* [STRAIN, PLASMID]. Any empty folder will result in a return of an empty list
*/
public List<String> getContentTypes(long folderId) {
try {
CriteriaQuery<String> query = getBuilder().createQuery(String.class);
Root<Folder> from = query.from(Folder.class);
Join<Folder, Entry> entry = from.join("contents");
query.select(entry.get("recordType")).distinct(true);
query.where(getBuilder().equal(from.get("id"), folderId));
return currentSession().createQuery(query).list();
} catch (HibernateException e) {
Logger.error(e);
throw new DAOException(e);
}
}
}
4 changes: 2 additions & 2 deletions src/main/webapp/scripts/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ iceControllers.controller('ActionMenuController', function ($stateParams, $uibMo
}

var i = $scope.selectedFolders.indexOf(folder);
if (i == -1) {
if (i === -1) {
$scope.selectedFolders.push(folder);
} else {
$scope.selectedFolders.splice(i, 1);
Expand Down Expand Up @@ -61,7 +61,7 @@ iceControllers.controller('ActionMenuController', function ($stateParams, $uibMo
}

var entrySelection = {
all: Selection.getSelection().type == 'ALL',
all: Selection.getSelection().type === 'ALL',
folderId: folderSelected,
selectionType: selectionType,
entryType: Selection.getSelection().type,
Expand Down
Loading

0 comments on commit b372cd9

Please sign in to comment.