Changeset 4992


Ignore:
Timestamp:
Oct 1, 2018, 12:46:53 PM (4 years ago)
Author:
Nicklas Nordborg
Message:

References #1054: Even more functionality in the Flagged alignment wizard

The Release exporter plug-in has been updated to require a verification from the user if the selected list contains one or more raw bioassays marked with DoNotUse.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/release/ReleaseExporterPlugin.java

    r4721 r4992  
    2323import net.sf.basedb.core.StringParameterType;
    2424import net.sf.basedb.core.Job.ExecutionTime;
     25import net.sf.basedb.core.Listable;
    2526import net.sf.basedb.core.plugin.AbstractPlugin;
    2627import net.sf.basedb.core.plugin.GuiContext;
     
    2829import net.sf.basedb.core.plugin.Request;
    2930import net.sf.basedb.core.plugin.Response;
     31import net.sf.basedb.core.query.Annotations;
    3032import net.sf.basedb.core.query.Expressions;
    3133import net.sf.basedb.core.query.Hql;
     
    4143import net.sf.basedb.opengrid.config.ConnectionInfo;
    4244import net.sf.basedb.reggie.Reggie;
     45import net.sf.basedb.reggie.dao.Annotationtype;
    4346import net.sf.basedb.reggie.dao.Fileserver;
    4447import net.sf.basedb.util.FileUtil;
     
    229232        }
    230233       
     234        if (ri.getParameter("acceptDoNotUse") != null && !Boolean.TRUE.equals(request.getParameterValue("acceptDoNotUse")))
     235        {
     236          response.setError("The DoNotUse parameter must be set TRUE", null);
     237          return;
     238        }
     239
    231240        DbControl dc = null;
    232241        ItemList list = (ItemList)request.getParameterValue("itemList");
     
    254263        storeValue(job, request, ri.getParameter("itemList"));
    255264        storeValue(job, request, ri.getParameter("releaseType"));
     265        storeValue(job, request, ri.getParameter("acceptDoNotUse"));
    256266       
    257267        if ("Remote".equals(releaseType))
     
    383393      ItemList currentList = null;
    384394      int currentListId = sc.getCurrentContext(Item.ITEMLIST).getId();
     395      long numDoNotUse = 0;
    385396      if (currentListId != 0)
    386397      {
     
    389400        {
    390401          currentList = ItemList.getById(dc, currentListId);
     402          ItemQuery<? extends Listable> query = currentList.getMembers();
     403          query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT);
     404          query.join(Annotations.innerJoin(Annotationtype.DO_NOT_USE.load(dc), "dnu"));;
     405          numDoNotUse = query.count(dc);
    391406        }
    392407        finally
     
    411426          Arrays.asList("Local", "Remote"))
    412427      ));
     428     
     429      if (numDoNotUse > 0)
     430      {
     431        parameters.add(new PluginParameter<Boolean>(
     432          "acceptDoNotUse", "[Warning] DoNotUse",
     433          "The selected list contains " + numDoNotUse + " items marked with <b>DoNotUse</b>.\n"+
     434          "To continue with the release this parameter must be set to <b>true</b>.",
     435          new BooleanParameterType(null, true)
     436        ));
     437      }
    413438     
    414439      configureExport = new RequestInformation
Note: See TracChangeset for help on using the changeset viewer.