Changeset 384


Ignore:
Timestamp:
Aug 9, 2007, 4:47:05 PM (14 years ago)
Author:
dominic
Message:

new annotation type and cv importer class files and build file

Location:
trunk/uk/ac/ebi/AnnotationTypeCvImporter
Files:
2 added
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/uk/ac/ebi/AnnotationTypeCvImporter/src/uk/ac/ebi/nugo/plugins/AnnotationTypeCvImporter.java

    r378 r384  
    3535import net.sf.basedb.util.parser.Mapper;
    3636import net.sf.basedb.util.Values;
     37import uk.ac.ebi.nugo.plugins.util.ValueFormatter;
    3738
    3839
     
    511512          if (category != null)
    512513          {
    513             List<String> annotationTypeCategory= Values.getList(columnMappings.get("categoryColumnMapping").getValue(data),";");
     514            List<String> annotationTypeCategory=
     515              ValueFormatter.getList(columnMappings.get("categoryColumnMapping").getValue(data),";");
    514516           
    515517            for (int i=0, z=annotationTypeCategory.size(); i<z;i++)
     
    540542          if (enumeration)
    541543            annotationType.setValues
    542               (Values.getList(columnMappings.get("cvValueColumnMapping").getValue(data),";"));
     544              (ValueFormatter.getList(columnMappings.get("cvValueColumnMapping").getValue(data),";"));
    543545         
    544546          itemType= columnMappings.get("itemTypeColumnMapping").getValue(data);
     
    546548          {
    547549            Item[] items=Item.values();
    548             List<String> itemTypes=Values.getList(columnMappings.get("itemTypeColumnMapping").getValue(data),separator); 
     550            List<String> itemTypes=ValueFormatter.getList(columnMappings.get("itemTypeColumnMapping").getValue(data),separator); 
    549551            for (String itemType: itemTypes)
    550552            {
  • trunk/uk/ac/ebi/AnnotationTypeCvImporter/src/uk/ac/ebi/nugo/plugins/util/ValueFormatter.java

    r378 r384  
    88
    99import java.text.SimpleDateFormat;
    10 import java.util.ArrayList;
    1110import java.util.Arrays;
    12 import java.util.Collection;
    1311import java.util.Date;
    1412import java.util.List;
    1513import java.util.regex.PatternSyntaxException;
     14
     15import net.sf.basedb.core.BaseException;
    1616/**
    1717  A utility class containing static methods for formatting parameter values.
     
    2424public class ValueFormatter
    2525  {
    26  
     26
    2727  private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
    2828 
     
    7474  }
    7575
     76  /**
     77   * Convert a string value with a delimeter into a list
     78   * @param values, the values to convert
     79   * @param delimeter, the delimeter in the string
     80   * @return the list of string values
     81   */
     82  public static final List<String> getList(String values, String delimeter)
     83  {
     84    List<String> value = null;
     85    String[] result;
     86    if (values != null )
     87    {
     88      try
     89      {
     90        result =values.split(delimeter);
     91        value= Arrays.asList(result);
     92      }
     93      catch(PatternSyntaxException pse)
     94      {
     95        new BaseException(pse.getMessage());
     96      }
     97    }
     98    return  value;
     99  }
    76100   
    77101
Note: See TracChangeset for help on using the changeset viewer.