11package org .eupathdb .sitesearch .wsfplugin ;
22
3+ import java .util .ArrayList ;
4+ import java .util .List ;
5+ import java .util .Map ;
6+ import java .util .stream .Collectors ;
7+
8+ import javax .sql .DataSource ;
9+
10+ import org .apache .log4j .Logger ;
311import org .gusdb .fgputil .ArrayUtil ;
412import org .gusdb .fgputil .FormatUtil ;
13+ import org .gusdb .fgputil .db .runner .SQLRunner ;
14+ import org .gusdb .fgputil .db .runner .SQLRunnerException ;
15+ import org .gusdb .fgputil .runtime .GusHome ;
16+ import org .gusdb .fgputil .runtime .InstanceManager ;
17+ import org .gusdb .oauth2 .client .veupathdb .UserInfo ;
18+ import org .gusdb .wdk .model .Utilities ;
19+ import org .gusdb .wdk .model .WdkModel ;
520import org .gusdb .wdk .model .question .Question ;
621import org .gusdb .wdk .model .record .PrimaryKeyDefinition ;
722import org .gusdb .wdk .model .record .RecordClass ;
8- import org .gusdb .wdk .model .user .User ;
23+ import org .gusdb .wdk .model .user .UserFactory ;
924import org .gusdb .wsf .plugin .AbstractPlugin ;
1025import org .gusdb .wsf .plugin .PluginModelException ;
1126import org .gusdb .wsf .plugin .PluginRequest ;
1227import org .gusdb .wsf .plugin .PluginResponse ;
1328import org .gusdb .wsf .plugin .PluginUserException ;
14- import org .gusdb .fgputil .db .runner .SQLRunner ;
15- import org .gusdb .fgputil .db .runner .SQLRunnerException ;
16- import org .gusdb .wdk .model .user .UserFactory ;
17-
18- import org .gusdb .fgputil .runtime .GusHome ;
19- import org .gusdb .fgputil .runtime .InstanceManager ;
20- import org .gusdb .wdk .model .Utilities ;
21- import org .gusdb .wdk .model .WdkModel ;
22- import org .apache .log4j .Logger ;
23-
24- import javax .sql .DataSource ;
25- import java .util .ArrayList ;
26- import java .util .List ;
27- import java .util .Map ;
28- import java .util .stream .Collectors ;
2929
3030public class CommunityStudyIdsPlugin extends AbstractPlugin {
3131
@@ -62,7 +62,7 @@ protected int execute(PluginRequest request, PluginResponse response) throws Plu
6262 List <UserDatasetIds > communityDatasetIds = getCommunityDatasetIds (request , question , wdkModel );
6363 UserFactory userFactory = new UserFactory (wdkModel );
6464 List <Long > userIds = communityDatasetIds .stream ().map (udi -> udi .ownerId ).collect (Collectors .toList ());
65- Map <Long , User > userMap = userFactory .getUsersById (userIds );
65+ Map <Long , UserInfo > userMap = userFactory .getUsersById (userIds );
6666 for (UserDatasetIds udi : communityDatasetIds ) {
6767 String [] row = {udi .datasetId , userMap .get (udi .ownerId ).getDisplayName (), userMap .get (udi .ownerId ).getOrganization ()};
6868 response .addRow (row );
@@ -73,7 +73,7 @@ protected int execute(PluginRequest request, PluginResponse response) throws Plu
7373 /* we store in memory a map of ownerUserId to VDI dataset id, for each community dataset.
7474 We assume there are not too many to fit comfortably into memory. (100k at absolute most)
7575 */
76- List <UserDatasetIds > getCommunityDatasetIds (PluginRequest request , Question question , WdkModel wdkModel ) throws PluginModelException , PluginUserException {
76+ List <UserDatasetIds > getCommunityDatasetIds (PluginRequest request , Question question , WdkModel wdkModel ) throws PluginModelException {
7777
7878 if (! wdkModel .getProperties ().containsKey (VDI_CONTROL_SCHEMA_PROP_KEY ))
7979 throw new PluginModelException ("Can't find property'" + VDI_CONTROL_SCHEMA_PROP_KEY + "' in model.prop file" );
@@ -115,7 +115,7 @@ public void initialize(PluginRequest request) throws PluginModelException { }
115115 public void validateParameters (PluginRequest request ) throws PluginModelException , PluginUserException { }
116116
117117 static Question getQuestion (PluginRequest request ) throws PluginModelException {
118- String questionFullName = request .getContext ().get (Utilities .QUERY_CTX_QUESTION );
118+ String questionFullName = request .getContext ().get (Utilities .CONTEXT_KEY_QUESTION_FULL_NAME );
119119 WdkModel wdkModel = InstanceManager .getInstance (WdkModel .class , GusHome .getGusHome (), request .getProjectId ());
120120 return wdkModel .getQuestionByFullName (questionFullName ).orElseThrow (() -> new PluginModelException ("Could not find context question: " + questionFullName ));
121121 }
0 commit comments