Search in sources :

Example 1 with Session

use of io.dropwizard.jersey.sessions.Session in project textdb by TextDB.

the class KeywordDictionaryResource method listUserDictionaries.

@GET
@Path("/list")
public List<KeywordDictionary> listUserDictionaries(@Session HttpSession session) {
    UInteger userID = UserResource.getUser(session).getUserID();
    Result<Record4<UInteger, String, byte[], String>> result = getUserDictionaryRecord(userID);
    if (result == null)
        return new ArrayList<>();
    List<KeywordDictionary> dictionaryList = result.stream().map(record -> new KeywordDictionary(record.get(KEYWORD_DICTIONARY.KID), record.get(KEYWORD_DICTIONARY.NAME), convertContentToList(record.get(KEYWORD_DICTIONARY.CONTENT)), record.get(KEYWORD_DICTIONARY.DESCRIPTION))).collect(Collectors.toList());
    return dictionaryList;
}
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) KEYWORD_DICTIONARY(edu.uci.ics.texera.dataflow.jooq.generated.Tables.KEYWORD_DICTIONARY) Result(org.jooq.Result) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) Record4(org.jooq.Record4) FormDataParam(org.glassfish.jersey.media.multipart.FormDataParam) MediaType(javax.ws.rs.core.MediaType) List(java.util.List) Stream(java.util.stream.Stream) DSL.defaultValue(org.jooq.impl.DSL.defaultValue) Pair(org.apache.commons.lang3.tuple.Pair) javax.ws.rs(javax.ws.rs) java.io(java.io) UInteger(org.jooq.types.UInteger) Session(io.dropwizard.jersey.sessions.Session) GenericWebResponse(edu.uci.ics.texera.web.response.GenericWebResponse) UInteger(org.jooq.types.UInteger) Record4(org.jooq.Record4)

Example 2 with Session

use of io.dropwizard.jersey.sessions.Session 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

SqlServer (edu.uci.ics.texera.dataflow.sqlServerInfo.SqlServer)2 TexeraWebException (edu.uci.ics.texera.web.TexeraWebException)2 GenericWebResponse (edu.uci.ics.texera.web.response.GenericWebResponse)2 Session (io.dropwizard.jersey.sessions.Session)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 HttpSession (javax.servlet.http.HttpSession)2 javax.ws.rs (javax.ws.rs)2 MediaType (javax.ws.rs.core.MediaType)2 Pair (org.apache.commons.lang3.tuple.Pair)2 FormDataContentDisposition (org.glassfish.jersey.media.multipart.FormDataContentDisposition)2 FormDataParam (org.glassfish.jersey.media.multipart.FormDataParam)2 Result (org.jooq.Result)2 DSL.defaultValue (org.jooq.impl.DSL.defaultValue)2 UInteger (org.jooq.types.UInteger)2 FILE (edu.uci.ics.texera.dataflow.jooq.generated.Tables.FILE)1 KEYWORD_DICTIONARY (edu.uci.ics.texera.dataflow.jooq.generated.Tables.KEYWORD_DICTIONARY)1 FileManager (edu.uci.ics.texera.dataflow.resource.file.FileManager)1 java.io (java.io)1