Search in sources :

Example 31 with Result

use of org.jooq.Result in project textdb by TextDB.

the class UserFileResource method listUserFiles.

@GET
@Path("/list")
public List<UserFile> listUserFiles(@Session HttpSession session) {
    UInteger userID = UserResource.getUser(session).getUserID();
    Result<Record5<UInteger, String, String, String, UInteger>> result = getUserFileRecord(userID);
    if (result == null)
        return new ArrayList<>();
    List<UserFile> fileList = result.stream().map(record -> new UserFile(record.get(FILE.FID), record.get(FILE.NAME), record.get(FILE.PATH), record.get(FILE.DESCRIPTION), record.get(FILE.SIZE))).collect(Collectors.toList());
    return fileList;
}
Also used : HttpSession(javax.servlet.http.HttpSession) TexeraWebException(edu.uci.ics.texera.web.TexeraWebException) SqlServer(edu.uci.ics.texera.dataflow.sqlServerInfo.SqlServer) FormDataContentDisposition(org.glassfish.jersey.media.multipart.FormDataContentDisposition) FILE(edu.uci.ics.texera.dataflow.jooq.generated.Tables.FILE) FileManager(edu.uci.ics.texera.dataflow.resource.file.FileManager) Result(org.jooq.Result) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) Record5(org.jooq.Record5) FormDataParam(org.glassfish.jersey.media.multipart.FormDataParam) MediaType(javax.ws.rs.core.MediaType) List(java.util.List) DSL.defaultValue(org.jooq.impl.DSL.defaultValue) Pair(org.apache.commons.lang3.tuple.Pair) javax.ws.rs(javax.ws.rs) Record1(org.jooq.Record1) UInteger(org.jooq.types.UInteger) Paths(java.nio.file.Paths) Session(io.dropwizard.jersey.sessions.Session) GenericWebResponse(edu.uci.ics.texera.web.response.GenericWebResponse) InputStream(java.io.InputStream) UInteger(org.jooq.types.UInteger) Record5(org.jooq.Record5)

Aggregations

Result (org.jooq.Result)31 Record (org.jooq.Record)24 ArrayList (java.util.ArrayList)23 List (java.util.List)22 Collectors (java.util.stream.Collectors)17 DSLContext (org.jooq.DSLContext)17 BigDecimal (java.math.BigDecimal)13 SQLException (java.sql.SQLException)13 Map (java.util.Map)13 Timestamp (java.sql.Timestamp)12 Optional (java.util.Optional)12 Stream (java.util.stream.Stream)12 Lists (com.google.common.collect.Lists)11 HashMap (java.util.HashMap)11 UUID (java.util.UUID)11 IOException (java.io.IOException)10 Iterator (java.util.Iterator)10 Singleton (javax.inject.Singleton)10 Almura (com.almuradev.almura.Almura)9 ServerNotificationManager (com.almuradev.almura.feature.notification.ServerNotificationManager)9