Changeset 3538


Ignore:
Timestamp:
Jun 29, 2007, 2:30:48 PM (14 years ago)
Author:
Johan Enell
Message:

Fixes #660

Added permission delete for File and read for Job

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3.2/src/plugins/core/net/sf/basedb/plugins/Base1PluginExecuter.java

    r3478 r3538  
    5353import net.sf.basedb.core.PositionBatcher;
    5454import net.sf.basedb.core.ProgressReporter;
    55 import net.sf.basedb.core.Reporter;
    5655import net.sf.basedb.core.RequestInformation;
    5756import net.sf.basedb.core.SpotBatcher;
     
    9594import java.util.Collection;
    9695import java.util.Collections;
     96import java.util.Comparator;
    9797import java.util.EnumSet;
    9898import java.util.HashMap;
     
    102102import java.util.Map;
    103103import java.util.Set;
     104import java.util.TreeMap;
    104105import java.util.regex.Matcher;
    105106import java.util.regex.Pattern;
     
    557558      permissions.add(new Permissions(Item.DIRECTORY, null, EnumSet.of(Permission.CREATE, Permission.WRITE)));
    558559      permissions.add(new Permissions(Item.EXPERIMENT, null, EnumSet.of(Permission.WRITE)));
    559       permissions.add(new Permissions(Item.FILE, EnumSet.of(Permission.USE), EnumSet.of(Permission.CREATE, Permission.WRITE)));
     560      permissions.add(new Permissions(Item.FILE, EnumSet.of(Permission.DELETE), EnumSet.of(Permission.CREATE, Permission.WRITE)));
     561      permissions.add(new Permissions(Item.JOB, EnumSet.of(Permission.READ), null));
    560562      permissions.add(new Permissions(Item.PLUGINCONFIGURATION, EnumSet.of(Permission.WRITE), null));
    561563      permissions.add(new Permissions(Item.RAWBIOASSAY, null, EnumSet.of(Permission.READ)));
     
    743745      Boolean mergeReporters = (Boolean) configuration.getValue(geneAveragesParameter.getName());
    744746     
    745       Map<String, String> parameters = new HashMap<String, String>();
     747      TreeMap<String, String> parameters = new TreeMap<String, String>(new Comparator<String>()
     748      {
     749        /**
     750         * To make the keys orderd by the same order they are added
     751         */
     752        public int compare(String o1, String o2)
     753        {
     754          return 1;
     755        }
     756      });
    746757      for (PluginParameter<?> pp : getJobParametersFromXML(String.valueOf(configuration.getValue(jobParametersParameter.getName()))))
    747758      {
    748         String name = pp.getName();
    749         Object value = job.getValue(name);
    750         parameters.put(name, value == null ? "" : value.toString());
     759        if (pp != null)
     760        {
     761          String name = pp.getName();
     762          Object value = job.getValue(name);
     763          parameters.put(name, value == null ? "" : value.toString());
     764        }
    751765      }
    752766     
     
    861875    try
    862876    {
    863       List<PluginParameter<?>> p = new ArrayList<PluginParameter<?>>();
    864877      String doctype = "<!DOCTYPE jobparameters SYSTEM \"base1-plugin-configuration-file.dtd\">";
    865878      Document doc = XMLUtil.getValidatedXml(doctype+xml, dtdFile);
     
    876889        }
    877890      });
     891     
     892      TreeMap<Integer, PluginParameter<?>> positionParameter = new TreeMap<Integer, PluginParameter<?>>();
    878893      while (it.hasNext())
    879894      {
    880895        Element e = it.next();
    881896        JobParameter jp = new JobParameter(e);
    882         p.add(jp.getPluginParameter());
    883       }
    884       return p;
     897        if (positionParameter.containsKey(jp.getPosition()))
     898        {
     899          throw new BaseException("Duplicate parameter at position "+jp.getPosition());
     900        }
     901        positionParameter.put(jp.getPosition(), jp.getPluginParameter());
     902      }
     903      return new ArrayList<PluginParameter<?>>(positionParameter.values());
    885904    }
    886905    catch (JDOMException e1)
Note: See TracChangeset for help on using the changeset viewer.