plugins/base2/net.sf.basedb.illumina/trunk/src/net/sf/basedb/illumina/filehandler/SnpCvsValidationFactory.java

Code
Comments
Other
Rev Date Author Line
1385 02 Sep 11 martin 1 package net.sf.basedb.illumina.filehandler;
1385 02 Sep 11 martin 2
1385 02 Sep 11 martin 3 import net.sf.basedb.core.ArrayDesign;
1385 02 Sep 11 martin 4 import net.sf.basedb.core.DataFileType;
1385 02 Sep 11 martin 5 import net.sf.basedb.core.DbControl;
1385 02 Sep 11 martin 6 import net.sf.basedb.illumina.Illumina;
1385 02 Sep 11 martin 7 import net.sf.basedb.util.extensions.ActionFactory;
1385 02 Sep 11 martin 8 import net.sf.basedb.util.extensions.InvokationContext;
1385 02 Sep 11 martin 9
1385 02 Sep 11 martin 10 public class SnpCvsValidationFactory 
1385 02 Sep 11 martin 11   implements ActionFactory<SnpCvsValidationAction>
1385 02 Sep 11 martin 12 {
1385 02 Sep 11 martin 13   public SnpCvsValidationFactory()
1385 02 Sep 11 martin 14   {}
1385 02 Sep 11 martin 15
1385 02 Sep 11 martin 16   @Override
1385 02 Sep 11 martin 17   public SnpCvsValidationAction[] getActions(InvokationContext<? super SnpCvsValidationAction> context) 
1385 02 Sep 11 martin 18   {
1385 02 Sep 11 martin 19     SnpCvsValidationAction[] actions = null;
1385 02 Sep 11 martin 20     Object item = context.getClientContext().getCurrentItem();
1385 02 Sep 11 martin 21     ArrayDesign ownerItem = null;
1385 02 Sep 11 martin 22     if (item instanceof ArrayDesign)
1385 02 Sep 11 martin 23     {
1385 02 Sep 11 martin 24       ownerItem = (ArrayDesign)item;
1385 02 Sep 11 martin 25       DbControl dc = context.getClientContext().getDbControl();
1385 02 Sep 11 martin 26       actions = new SnpCvsValidationAction[] { new SnpCvsValidationAction(dc, ownerItem) };
1385 02 Sep 11 martin 27     }    
1385 02 Sep 11 martin 28     return actions;
1385 02 Sep 11 martin 29   }
1385 02 Sep 11 martin 30
1385 02 Sep 11 martin 31   @Override
1385 02 Sep 11 martin 32   public boolean prepareContext(InvokationContext<? super SnpCvsValidationAction> context) 
1385 02 Sep 11 martin 33   {
1385 02 Sep 11 martin 34     Object item = context.getClientContext().getCurrentItem();
1385 02 Sep 11 martin 35     boolean isInContext = false;
1385 02 Sep 11 martin 36     if (item instanceof ArrayDesign)
1385 02 Sep 11 martin 37     {
1385 02 Sep 11 martin 38       ArrayDesign design = (ArrayDesign)item;
1385 02 Sep 11 martin 39       isInContext = Illumina.isIllumina(design);      
1385 02 Sep 11 martin 40     }
1385 02 Sep 11 martin 41     else if (item instanceof DataFileType)
1385 02 Sep 11 martin 42     {
1385 02 Sep 11 martin 43       DataFileType fileType = (DataFileType)item;
1386 06 Sep 11 nicklas 44       isInContext = Illumina.SNP_MANIFEST_FILE_ID.equals(fileType.getExternalId());
1385 02 Sep 11 martin 45     }    
1385 02 Sep 11 martin 46     return isInContext;
1385 02 Sep 11 martin 47   }
1385 02 Sep 11 martin 48
1385 02 Sep 11 martin 49 }