Changeset 3569
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/plugin/AbstractAnalysisPlugin.java
r3501 r3569 24 24 package net.sf.basedb.core.plugin; 25 25 26 import java.util.Arrays;27 26 import java.util.Collections; 28 import java.util.HashSet;29 27 import java.util.Set; 30 28 … … 56 54 57 55 /** 56 GuiContext = [Item.BIOASSAYSET, GuiContext.Type.ITEM] 57 @since 2.4 58 */ 59 protected static final GuiContext CONTEXT_BIOASSAYSET = 60 new GuiContext(Item.BIOASSAYSET, GuiContext.Type.ITEM); 61 62 /** 63 GuiContext = [Item.BIOASSAY, GuiContext.Type.LIST] 64 @since 2.4 65 */ 66 protected static final GuiContext CONTEXT_BIOASSAYS = 67 new GuiContext(Item.BIOASSAY, GuiContext.Type.LIST); 68 69 /** 58 70 The default gui contexts where it makes sense to use an analysis plugin. 59 71 Override for the {@link InteractivePlugin#getGuiContexts()} method to 60 specify other contexts. This set can't be modified. 72 specify other contexts. This set can't be modified. This set only 73 includes the {@link #CONTEXT_BIOASSAYSET}. 61 74 */ 62 75 protected static final Set<GuiContext> defaultGuiContexts = 63 Collections.unmodifiableSet(new HashSet<GuiContext>( 64 Arrays.asList( 65 new GuiContext(Item.BIOASSAYSET, GuiContext.Type.ITEM), 66 new GuiContext(Item.BIOASSAY, GuiContext.Type.LIST) 67 ) 68 )); 76 Collections.singleton(CONTEXT_BIOASSAYSET); 69 77 70 78 /** … … 126 134 } 127 135 /** 128 Check that the item is a bioassayset. 136 Check that the item is a bioassayset and that the logged in user has 137 permission to use the current experiment. 129 138 @return null if the item is a bioassayset, an error message otherwise 130 @throws PermissionDeniedException If the logged in user dosen t have131 permission to use the Experiment .139 @throws PermissionDeniedException If the logged in user dosen't have 140 permission to use the Experiment 132 141 */ 133 142 public String isInContext(GuiContext context, Object item) 134 143 { 135 144 String message = null; 136 if (defaultGuiContexts.contains(context)) 145 Experiment e = null; 146 if (context.equals(CONTEXT_BIOASSAYSET)) 137 147 { 138 148 if (item == null) … … 147 157 { 148 158 BioAssaySet bas = (BioAssaySet)item; 149 Experiment e = bas.getExperiment(); 150 e.checkPermission(Permission.USE); 151 } 152 } 159 e = bas.getExperiment(); 160 } 161 } 162 else 163 { 164 DbControl dc = sc.newDbControl(); 165 try 166 { 167 e = getCurrentExperiment(dc); 168 } 169 finally 170 { 171 if (dc != null) dc.close(); 172 } 173 } 174 if (e != null) e.checkPermission(Permission.USE); 153 175 return message; 154 176 } -
trunk/src/plugins/core/net/sf/basedb/plugins/FormulaFilter.java
r3501 r3569 56 56 import java.util.Arrays; 57 57 import java.util.Collection; 58 import java.util.Collections; 58 59 import java.util.EnumSet; 59 60 import java.util.HashSet; … … 92 93 93 94 private static final Set<Permissions> permissions = new HashSet<Permissions>(); 95 private static final Set<GuiContext> guiContexts = Collections.unmodifiableSet( 96 new HashSet<GuiContext>(Arrays.asList(CONTEXT_BIOASSAYSET, CONTEXT_BIOASSAYS)) 97 ); 94 98 95 99 private RequestInformation configureJob; … … 208 212 ------------------------------------------- 209 213 */ 214 @Override 215 public Set<GuiContext> getGuiContexts() 216 { 217 return guiContexts; 218 } 210 219 public RequestInformation getRequestInformation(GuiContext context, String command) 211 220 throws BaseException
Note: See TracChangeset
for help on using the changeset viewer.